SQL 2005 Distributed Transactions from WCF

Hello,
I've been redirected here from the Transaction Programming forum becuase I have e peculiar issue with SQL 2005 running INSERT stored procs from multiple WCF services all withing a TransactionScope.
The original post is http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2720665&SiteID=1&mode=1
The story goes, I have SRVC A with starts a TransactionScope which in turn calls SRVC B & C in sequence based on processing rules.
SRVC A is a Sequential Workflow which Starts and Completes the TransactionScope
SRVC B Creates a new Customer into the database
SRVC C Creates new Accounts for that Customer and Initialises the accounts with funds
The DB Tables underneath are Customer, Account and AccountLog
DDL
Code Block
CREATE TABLE [Member].[Customers](
[CustomerId] [int]
IDENTITY(1,1) NOT NULL,
[Name] [varchar](32) NOT NULL,
[CreatedUtc] [datetime] NOT NULL ,
CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
[CustomerId]
ASC
CREATE TABLE [Bank].[Accounts](
[AccountId] [int]
IDENTITY(1,1) NOT NULL,
[CustomerId] [int] NOT NULL,
[CurrentBalance] [money] NOT NULL,
[LastUpdateDate] [datetime] NULL,
[CreatedDate] [datetime] NOT NULL,
[timestamp] [timestamp] NOT NULL,
CONSTRAINT [PK_Bank_Account] PRIMARY KEY CLUSTERED
[AccountId]
ASC
) ON [PRIMARY]
GO
ALTER TABLE [Bank].[Accounts] WITH CHECK ADD CONSTRAINT [FK_Account_Customer] FOREIGN KEY([CustomerId])
REFERENCES [Member].[Customers] ([CustomerId])
CREATE TABLE [Bank].[AccountLog](
[AccountLogId] [int]
IDENTITY(1,1) NOT NULL,
[AccountId] [int] NOT NULL,
[Amount] [money] NOT NULL,
[UtcDate] [datetime] NOT NULL,
CONSTRAINT [PK_Bank_AccountLog] PRIMARY KEY CLUSTERED
[AccountLogId]
ASC
) ON [PRIMARY]
GO
ALTER TABLE [Bank].[AccountLog] WITH CHECK ADD CONSTRAINT [FK_AccountLog_Account] FOREIGN KEY([AccountId])
REFERENCES [Bank].[Accounts] ([AccountId])
NB. I've removed most fields not essential for this example.
So from SRVC A I invoke SRVC B and the Customer is created, however when I get to SRVC C and the accounts are to be created I get a lock.  Only when the Transaction aborts due to timeout, do I see in SQL Profiler that the call to the SP that created the Account is executed but eventually rolls back as it is part of the distributed transaction.
Now, If I set the Isolation level in the TransactionScope to ReadUncommitted (urgh) the problem remains.  When I set the IsolationLevel to Read Uncommitted in the SP that creates the account the problem remains but when I remove the FK constraint the problem disappers.  The other curious thing is that with the Customer -> Account FK removed and when SRVC C calls to insert funds into the AccountLog which also updates an aggregated total in the Account from within the same transaction scope and with Account -> AccountLog FK constraints in place there is no locking even with Isolation Serializable.
I'm quite at a loss as to what could be causing these issues.  If anyone has any suggestions I would greatly appreciate any help.
Thanks
Andy
 

Andy,
Is this still an issue?
Thanks!
Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it!

Similar Messages

  • Do I need Distributed Transaction Scope when I have Two Database in Single SQL Server Instance

    Dear Sirs.
    I have Two Database in SQL Server Express 2008 R2, I Move Row From Database 1 Table 1 to Database 2 Table 1
    Do I need Distributed Transaction or just regular Transaction.
    Thank you in Advance. 
    Irakli Lomidze

    Dear Sirs.
    I have Two Database in SQL Server Express 2008 R2, I Move Row From Database 1 Table 1 to Database 2 Table 1
    Do I need Distributed Transaction or just regular Transaction.
    Thank you in Advance. 
    Irakli Lomidze
    Whats you are doing does not qualify under distributed transaction. Please read about distributed transaction from below link
    http://technet.microsoft.com/en-us/library/ms188721%28v=sql.105%29.aspx
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • Get error from SQL AGENT: The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D024

    I am running SQL Agent that executes an SSIS process from sql server1. The SSIS process executes its SQL/tables/sp’s  against another sql server2.
    I get an error after adding data flow tasks with transaction supported within a sequence with transaction required. The error, “The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D024 "The transaction
    manager has disabled its support for remote/network transactions"
    Prior to adding this sequence everything was working from sql agent, and there were other sequences with oledb destinations.
    Everything works when running within SSIS Package.
    I see this article on similar issue,
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0bfa2569-8849-4884-8f68-8edf98a9b4fe/problem-to-execute-a-package-and-tasks-with-a-certain-transactionoption-property-i-need-help?forum=sqlintegrationservices
    “I had similar issue and solved by setting the following on both the machines. Allow Remote Clients, Allow Remote Administration,
    Allow Inbound Clients, Allow Outbound Clients, and TIP are enabled in Component Services/My Computer/Properties/MSDTC/Security Configuration.”
    I don’t want to remove transaction required for the “Remove Duplicates from Staging” sequence.
    Anyone seen this?
    Greg Hanson

    DTC was running on remote computer. The problem was it was no longer accepting transactions from remote servers. This was in SSIS so I had to turn to "Transaction Supported" for all Data Flow Transactions.
    Greg Hanson

  • Distributed transaction using linked server not working in SQL Server 2008 64 bit

    Hi. I have had an issue trying to get distributed transactions to work in SQL Server 2008 using a linked server. The error message I get is
    OLE DB provider "SQLNCLI10" for linked server "pod1" returned message "No transaction is active.".
    Msg 7391, Level 16, State 2, Line 3
    The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "pod1" was unable to begin a distributed transaction.
    My Environment:
    Windows Server 2008 Enterprise 64 bit, SQL Server 2008 Enterprise 64 bit
    Problem occurs with multiple different builds of SQL Server 2008 - I have been able to reproduce the problem with 10.0.1600.0, 10.0.1779.0 (CU 2), as well as 10.0.2531 (SP1)
    I am aware that other people have had this issue and have reviewed all existing posts. I have verified that the MSDTC is configured correctly on both machines. I have also used DTCTester to verify that DTC is working correctly on all machines in question.
    None of the mentioned resolutions has solved this problem for me.
    I am not seeing this problem occur on my 32 bit test machines - it is only occurring if at least one of the two machines is 64 bit.

    Hi All,
    I realise that this topic may be a little bit out-of-date but if someone gets here from some search engine trying to find a solution for DTC problems, this MAY be useful.
    So... I recently had the same issue, tried all the approaches described in KB and other articles, but it didn't help. Because my task to solve this was not of the highest priority I forgot about it for some time.
    Today I was troubleshooting some other issue and, by accident discovered source of that first problem:
    In the EventViewer I found Error entry logged by MSDTC saying:
    "The local MS DTC detected that the MS DTC on vm-server1 (other machine name that also runs DTC - my comment) has the same unique identity as the local MS DTC. This means that the two MS DTC will not be able to communicate
    with each other. This problem typically occurs if one of the systems were cloned using unsupported cloning tools. MS DTC requires that the systems be cloned using supported cloning tools such as SYSPREP. Running 'msdtc -uninstall' and then 'msdtc -install'
    from the command prompt will fix the problem. Note: Running 'msdtc -uninstall' will result in the system losing all MS DTC configuration information."
    So I followed suggestion and run:
    msdtc -uninstall
    msdtc -install
    This solved my problems with DTC. Hope it will help someone.
    Piotr

  • Is Distributed Transaction Coordinator services of the application role are required by SQL Server 2012 for clustering and support of SharePoint 2013.

    All I want to know is if Distributed Transaction Coordinator services of the application role are required by SQL Server 2012 for clustering and support of SharePoint 2013.
    I have been planning and deploying my companies first Windows Server 2012/SQL Server 2012 Always On cluster and Always On Availability Groups Multi-Subnet cluster and instances for SharePoint 2013, and I will be brutally honest, the documentation on either
    the MSDN and TechNet leave alot to be desired. Continually finding links in the documentation will take me from a Windows 2012 reference to a page talking about Windows Server 2008 or R2, The differences of which there are so many when it comes to configurations,
    settings, roles, services when working with SQL Server 2012. I have been confused, frustrated, screaming mad, with all the misdirection in this documentation.  The documentation takes me windows 2008 R2 which is different than 2012!
    Tired and trying to pick myself up off the floor!
    Greg
    Gman

    In general, DTC is not required for SQL 2012.  But, since you are asking specifically about SharePoint, it would be better to ask in a SharePoint forum.  They would be more likely to know those situations where FTC might be needed by SharePoint. 
    .:|:.:|:. tim

  • Works in sql not in apex: ORA-02049 distributed transaction waiting lock

    Hi,
    I get this error
    failed to parse SQL query:
    ORA-02049: timeout: distributed transaction waiting for lockwhen trying to run this query from it's page. But it works fine if I run it in the SQL console...
    failed to parse SQL query:
    ORA-select distinct n.notif_no,
           n.maint_work_centre,
           n.maint_work_centre_text,
           n.raised_by,
           n.notif_text,
           (select  (SAP_LONG_TEXT.NOTIFICATION_TEXT_1||SAP_LONG_TEXT.NOTIFICATION_TEXT_2||SAP_LONG_TEXT.NOTIFICATION_TEXT_3||SAP_LONG_TEXT.NOTIFICATION_TEXT_4||SAP_LONG_TEXT.NOTIFICATION_TEXT_5||SAP_LONG_TEXT.NOTIFICATION_TEXT_6||SAP_LONG_TEXT.NOTIFICATION_TEXT_7||SAP_LONG_TEXT.NOTIFICATION_TEXT_8||SAP_LONG_TEXT.NOTIFICATION_TEXT_9||SAP_LONG_TEXT.NOTIFICATION_TEXT_10||SAP_LONG_TEXT.NOTIFICATION_TEXT_11||SAP_LONG_TEXT.NOTIFICATION_TEXT_12||SAP_LONG_TEXT.NOTIFICATION_TEXT_13||SAP_LONG_TEXT.NOTIFICATION_TEXT_14||SAP_LONG_TEXT.NOTIFICATION_TEXT_15||SAP_LONG_TEXT.NOTIFICATION_TEXT_16||SAP_LONG_TEXT.NOTIFICATION_TEXT_17||SAP_LONG_TEXT.NOTIFICATION_TEXT_18||SAP_LONG_TEXT.NOTIFICATION_TEXT_19||SAP_LONG_TEXT.NOTIFICATION_TEXT_20||SAP_LONG_TEXT.NOTIFICATION_TEXT_21||SAP_LONG_TEXT.NOTIFICATION_TEXT_22||SAP_LONG_TEXT.NOTIFICATION_TEXT_23||SAP_LONG_TEXT.NOTIFICATION_TEXT_24||SAP_LONG_TEXT.NOTIFICATION_TEXT_25||SAP_LONG_TEXT.NOTIFICATION_TEXT_26||SAP_LONG_TEXT.NOTIFICATION_TEXT_27||SAP_LONG_TEXT.NOTIFICATION_TEXT_28||SAP_LONG_TEXT.NOTIFICATION_TEXT_29||SAP_LONG_TEXT.NOTIFICATION_TEXT_30||SAP_LONG_TEXT.NOTIFICATION_TEXT_31||SAP_LONG_TEXT.NOTIFICATION_TEXT_32||SAP_LONG_TEXT.NOTIFICATION_TEXT_33||SAP_LONG_TEXT.NOTIFICATION_TEXT_34||SAP_LONG_TEXT.NOTIFICATION_TEXT_35||SAP_LONG_TEXT.NOTIFICATION_TEXT_36||SAP_LONG_TEXT.NOTIFICATION_TEXT_37||SAP_LONG_TEXT.NOTIFICATION_TEXT_38||SAP_LONG_TEXT.NOTIFICATION_TEXT_39||SAP_LONG_TEXT.NOTIFICATION_TEXT_40||SAP_LONG_TEXT.NOTIFICATION_TEXT_41||SAP_LONG_TEXT.NOTIFICATION_TEXT_42||SAP_LONG_TEXT.NOTIFICATION_TEXT_43||SAP_LONG_TEXT.NOTIFICATION_TEXT_44||SAP_LONG_TEXT.NOTIFICATION_TEXT_45||SAP_LONG_TEXT.NOTIFICATION_TEXT_46||SAP_LONG_TEXT.NOTIFICATION_TEXT_47||SAP_LONG_TEXT.NOTIFICATION_TEXT_48||SAP_LONG_TEXT.NOTIFICATION_TEXT_49||SAP_LONG_TEXT.NOTIFICATION_TEXT_50) from sap_long_text@genadm where sap_long_text.notification = n.notif_no) "long",
           n.notif_date,
           n.funct_loc,
           n.order_no,
           n.notif_status,
           n.room,
           n.notif_type
    from   notifications@amt n, SAP_LONG_TEXT@genadm
    where  instr(':'||:P9_NOTIFTYPE||':',':'||n.NOTIF_TYPE||':')>0 and
           instr (':'||:P9_SITE||':',':'||n.site||':') > 0 and
           n.notif_date BETWEEN :P9_DATEFROM and :P9_DATETO and
           n.notif_status not like '%NOCO%'I've had this error before but I don't remember why/what happened. The page has been working fine, the error just randomly cropped up today.
    And a secondary question, is there a better way to write the query (it's a copy/paste from an older query). That select within the select is ugly...

    Hello,
    Take a look at the following thread -
    help ORA-02049
    Is it really necessary that you always query across the DBLink? Is using local materialized views not an option for you?
    John.
    http://jes.blogs.shellprompt.net
    http://apex-evangelists.com

  • CRS Editor - Retrieving Timestamp database field from SQL 2005

    Hello -
    For the life of me, I cannot retrieve a database timestamp field from SQL 2005.
    I have successfully used 'cast(Date as char(30)) as DateStr' to convert to string but the DBRead statement displays the original object only as java.lang.Timestamp.  Any posts regarding this topic usually require Java skill sets above my level (creating new java class for import,...).
    There has to be an easy way to do this without being a Java programmer, yes?
    Any help here would greatly be appreciated!
    Thanks
    Andy Backus
    941.587.7199

    Andy,
    I'm guessing you know that this isn't really a date/time value in MS SQL.  According to Microsoft: 
    The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.
    But to your question how to get the timestamp value out in a string...You'll want to use the convert function:
    select convert(varchar(10),myTimestampField) from myTable
    That will return the hex value in the column in a string format.  Also, when you retrieve the data, are you looking at the original table (which specifies the column is a timestamp), or did you create a dummy table with the columns named and formatted the way the data will be returned that UCCX can look at for the schema?  If it doesn't have the correct schema to look at, you'll have problems.
    Cliff
    please rate helpful posts

  • Linked Server : SQL 2012 to 2000 error - Microsoft Distributed Transaction Coordinator (MS DTC) has stopped this transaction.

    Hi all,
      If any one has worked around this error and can help ?
    Msg 8522, Level 16, State 3, Line 1
    Microsoft Distributed Transaction Coordinator (MS DTC) has stopped this transaction.
      I am trying to connect from sql 2012 to 2000 server. Established linked server using native client 10. I am able to see catalogs and database and table. Just when I am trying to query i am getting above error. 
    any help is really appreciated. 
    Thanks
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

    Hi Logicinisde,
    What the new error message do you get after using the workarounds in this
    blog? Please post it for analysis.
    Besides, as SQL Server 2012 has stopped connecting to SQL Server 2000 via linked servers, personally I recommend you upgrade SQL Server 2000 to a higher version to make your queries or ETLs efficient.
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Error connecting SQL Azure - Network access for Distributed Transaction Manager (MSDTC) has been disabled

    Sometimes I have an error connecting SQL Azure. The error occurs in an asp.net application and in a windows service running on VM in Azure. Error details:
    System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network
    access in the security configuration for MSDTC using the Component Services Administrative tool. ---> System.Runtime.InteropServices.COMException: The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT:
    0x8004D024)
       at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel,
    ITransactionShim& transactionShim)
       at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)
       --- End of inner exception stack trace ---
       at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException)
       at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)
       at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)
       at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)
       at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
       at System.Transactions.Transaction.Promote()
       at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction)
       at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
       at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
       at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction)
       at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&
    connection)
       at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.Open()
       at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
       at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
       at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
       --- End of inner exception stack trace ---
       at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
       at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection()
       at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
       at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClassb.<GetResults>b__9()
       at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
       at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
       at System.Data.Entity.Core.Objects.DataClasses.EntityReference`1.Load(MergeOption mergeOption)
       at System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
       at System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
       at System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__2(TProxy proxy, TItem item)

    Hello,
    I am not an expert in MSDTC but as we know,SQL Azure Database does not support
    distributed transactions. This means that SQL Azure doesn’t allow Microsoft Distributed Transaction Coordinator (MS DTC) to delegate distributed transaction handling.
    One common cause of MSDTC getting involved in Entity Framework applications is the fact that we close and reopen the same connection as needed (i.e. for each query that is executed).To avoid the stack from opening and closing the connection multiple times,
    you can simply open the connection explicitly and run the queries in the same connectio.
    The following thread is about a similar issue, please refer to:
    http://answers.flyppdevportal.com/categories/azure/sqlazure.aspx?ID=d705a8cf-cba4-494c-96f6-96a136bd29e3
    What's more, you can also try the workaround that involves setting the Enlist option of the SQL Azure connection to false. For the detail explanation, please refer to:Entity
    FrameWork and SQL Azure
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Problem: [Microsoft][ODBC SQL Server Driver][SQL Server]The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.

    Hi Gurus,
    I have this problem in my MS SQL Server 2012 that is running in SQL Server 2008 R2 Enterprise 64 bit.. Not sure why... Here is the full details of the error:
    Microsoft OLE DB Provider for ODBC Drivers 80040E14
    [Microsoft][ODBC SQL Server Driver][SQL Server]The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.
    /Libraries/DBA/DBA.asa, line 717
    Line 717 is this:
    rs.open destTableName,,,,adCmdTable
    Full details of the code:
        'Field object used to iterate through each field of the rs
        dim rs, fld
        'call dbInitRS(rs)
        set rs = server.createobject("adodb.recordset")
        'On Error Resume Next
        'Open rs
        set rs.activeConnection = myConnection
        rs.cursorType = adOpenKeyset
        rs.lockType = adLockOptimistic
        'rs.open destTableName
        rs.open destTableName,,,,adCmdTable
        'if err.number <> 0 then
        '    goto HandleError
        'end if
        rs.addNew
    Any ideas how to solve this problem?
    Thanks

    Still does not work. I have allow MSDSTC in my firewall list.
    Hi dudskie,
    Have you try to use DTCTester or DTCPing to verify MSDTC functionality over the network? Please refer to the following article:
    Troubleshooting Problems with MSDTC:
    http://msdn.microsoft.com/en-us/library/aa561924.aspx
    Use the DTCTester utility to verify transaction support between two computers if SQL Server is installed on one of the computers. The DTCTester utility uses ODBC to verify transaction support against a SQL Server database. For more information about
    DTCTester see How to Use DTCTester Tool.
    Use DTCPing to verify transaction support between two computers if SQL Server is not installed on either computer. The DTCPing tool must be run on both the client and server computer and is a good alternative to the DTCTester utility when SQL Server
    is not installed on either computer. For more information about DTCPing, see
    How to troubleshoot MS DTC firewall issues.
    If you have any feedback on our support, please click
    here.
    Hope this helps.
    Regards,
    Elvis Long
    TechNet Community Support

  • Fetch the data from the tables in the SQL 2005 server to sap R/3.

    Hi Experts,
    We need to fetch the data from the tables in the SQL 2005 server to sap R/3.
    Please explain which will be the best approach to fetch the same and how to do it. Sample program can greatly help.
    << Please do not offer points >>
    Regards,
    Shobana K
    Edited by: Rob Burbank on Sep 21, 2010 2:36 PM

    Hi,
    Try NATIVE SQL statements in your abap code otherwise you can try to establish jdbc connection from ABAP program.
    search in SDN for samples!
    Suresh

  • Connecting to SQL 2005 from Oracle error

    I have an Oracle Database and SQL Database on the same server and wants to use odbc to connect to the SQL 2005 database and query tables of my choice.
    I did configured the ODBC correctly and called the DSN TSH_ARCHIVE. I have tested it and it works great. But each time I run the following query I get error:
    SQL> select count(*) from BALANCES_HS@tse_archive;
    select count(*) from BALANCES_HS@tse_archive
    ERROR at line 1:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Any suggestion and help will be greatly appreciated.
    Edited by: azaza on Jan 28, 2010 6:32 AM

    Hi,
    Thanks for the files.
    There are some problems with the configuration.
    listener.ora -
    LISTENERTSE_ARCHIVE =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST = xxxxx.ita.doc.gov)(PORT=1521))
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    SID_LIST_LISTENER=
    (SID_LIST=
    (SID_DESC=
    (SID_NAME=TSE_ARCHIVE)
    (ORACLE_HOME=J:\app\product\11.1.0\db_2)
    (PROGRAM=hsodbc)
    (SID_DESC=
    (SID_NAME=tpisdb06)
    (ORACLE_HOME=J:\app\product\11.1.0\db_2)
    This should be -
    LISTENERTSE_ARCHIVE =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST = xxxxx.ita.doc.gov)(PORT=1521))
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    SID_LIST_LISTENERTSE_ARCHIVE =
    (SID_LIST=
    (SID_DESC=
    (SID_NAME=TSE_ARCHIVE)
    (ORACLE_HOME=J:\app\product\11.1.0\db_2)
    (PROGRAM=dg4odbc)
    (SID_DESC=
    (SID_NAME=tpisdb06)
    (ORACLE_HOME=J:\app\product\11.1.0\db_2)
    The SID_LIST_LISTENER needs to match the actual listener name and the program for 11g DG4ODBC is called dg4odbc and not hsodbc.
    tnsnames.ora -
    TSE_ARCHIVE =
    (DESCRIPTION=
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = TSE_ARCHIVE)(PORT=1521))
    (CONNECT_DATA =
    (SERVICE_NAME = TSE_ARCHIVE)
    (HS=OK)
    The HOST name - TSE_ARCHIVE does not match the HOST in the listener, so it should be -
    TSE_ARCHIVE =
    (DESCRIPTION=
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx.ita.doc.gov)(PORT=1521))
    (CONNECT_DATA =
    (SERVICE_NAME = TSE_ARCHIVE)
    (HS=OK)
    I've changed the actual name to xxxxx so replace that with the name in the original file.
    Change the files, stop and start the listener then try again.
    If you still have an ora-12154 error then send the output from the following SQL -
    select db_link, host from user_db_links; <=== as the user getting the error
    and
    select db_link, host from dba_db_links; <===== as a DBA user
    Regards,
    Mike

  • Database restore from SQL 2000 to SQL 2005 for SBO 2005B

    Hi Everyone,
    I am facing some problems in regards to the restore of SBO Database from SQL 2000 to SQL 2005.
    Let me explain you the problem.
    See I am using SAP B1 2005B with patch level 38 in my laptop with SQL 2000. I have made an company in this and done work in it as a production company and now I want to restore this company in the server which has SQL 2005. How to do it.
    I have taken a backup in my laptop from SAP B1 Server Suite Manager which has SQL 2000 and sucessfully backed up but when I am trying to restore in the server which has SQL 2005 I am getting the following error in SQL 2005 in server :-
    Restore failed for Server 'DXBAP001'.  (Microsoft.SqlServer.Smo)
    System.Data.SqlClient.SqlError: Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL\data\SBO_DCHAR.mdf" failed with the operating system error 3(The system cannot find the path specified.). (Microsoft.SqlServer.Smo)
    Please let me know the solution for it.
    Thanks in Advance.
    Regards,
    Kawish Junaid Mazhari

    Hi,
    In SQL 2005 create a database and name as the 200 one was (though any name would do).  when you create the database note the location of the .mdb and .ldf file.
    once this had created right click on your new database > tasks > restore database
    in the new window select from device and point it to your .bak file created from your 2000 system, ensure you put a tick in the restore box on the new line.
    in the options tab tick overwrite database, and, change the file locations in the restore as directory to the file locations of the new database.  the file names must be the same too.
    you can change the original file names after the restore.
    that should do the trick.
    thanks,
    mike

  • Upgrade Process from SQL 2005 to SQL 2012

    Hi All,
    I have gone thru multiple threads and would like to understand some steps in detail for me to upgrade SQL 2005 to SQL 2012.
    Below is my understanding and questions around it, I would be setting up a new environment with OS 2007/2008 with SQL 2012:
    Environment Readiness - Ensure new environment is ready with Win 2007/2008 with SQL 2012 Server
    Run Upgrade Advisor on the new environment and point to SQL 2005 instance
    Find the breaking/discontinued changes to be done before or After Upgrade
    <Question>: Over here I would like to know what should be our approach to make the required changes
    <Question>: Obviously I should not be making changes directly on the Production SQL 2005 server, then in that case should I take a backup/restore on the new SQL Server 2012 and then make the required changes to the database objects
    like (Table schema(changing column names/datatypes etc.), Stored Procedure, Functions & Views)
    <Question>: When I do a backup/restore I would also get the data along with it, so is this a recommended approach or should we only run/use the table schema creation scripts, fix the issues identified by UA and then do an Table to Table import,
    any thoughts on this ?
    <Question>: If I have to do a table to table Import then I should ensure there's a downtime during the Import or would I have any other better approach          
    So, basically my questions are around the approach of fixing the issues identified by UA and moving the database to SQL Server 2012 environment, I have around 300 databased to me upgraded.
    Please do let me know what should be a good/proven approach ? Pl. do let me know if you would need any more details from me.
    ---Umesh

    Thanks all for the replies.
    I am trying summarize what I have understood here:
    Document SQL Server 2005 environment details, Is there any tool which could give us all relevant details
    I would take the backup from the SQL Server 2005 Production environment and then restore the same in a test environment which again has SQL Server 2005 and Run Upgrade Advisor on that
    Probbaly run SQL Profiler as well to find out the deprecated changes to be done
    I should fix all the breaking, discontinued changes on the Test system identified by UA
    I should fix all the deprecated changes on the Test system identified by SQL Profiler
    Steps 3 & 4 should give me the changed scripts for all database objects (i.e. Table Schema, Stored Procedures, Functions & Views)
    <Question> Perform test, I understand this acitivity test can be captured by having SQL profiler running in the background on the SQL Server 2005 production environment where we can identify some days in a week or a month where maximum activity is
    expected to ensure we cover most the scenarios, let me know is this approach looks fine or is there a better approach
    Now, with regards to acutal upgrade I need to identify a time window where in less activity is done during which I could have a downtime for the actual SQL Server 2005 production environment
    Post downtine, I should do a BackUp for all databases from SQL Server 2005 production environment
    Test on environment readiness of SQL Server 2012 can be compared against the documentation done as part of the first Step
    <Question> Ideally I should a restore first in the new environment which has SQL Server 2012
    <Question> Then run the Scripted changes where we fixed all the breaking, discontinued & deprecated changes
    <Question> Does above sequence of Step 9 & 10 make sense or is there a better approach of doing it
    <Question> Post Upgrade and running of changed scripts, I should run the Upgrade Advisor again and see if everything looks fine
    <Question> Perform test again which we ran on SQL Server 2005 Test environment
    <Question> These steps should complete the Upgrade process.
    Please do let me know if the above sequence look ok to all of you and does it really work in a practical scenario, do let me know your feedback or any change in sequence/process or any other tools that can be used here.
    Thanks Again ...

  • Custom DTS package migration from BPC 4.2 ,SQL 2000 to BPC 7.0 M , SQL 2005

    Is there any changes required in the custom dts package when migration from BPC 4.2 , sql 2000 Environment to bpc 7.0 , SQL 2005/2008  Environment.
    or
    Please suggest process for migrating  custom dts package from BPC 4.2 ,SQL 2000 Envirnment to BPC 7.0 ,SQL 2005/2008 Environment

    When you say "custom dts package" that can mean many different things. What type of customization has been done?
    There are a few BPC-related features which changed from 4.2, which must be manually adjusted, if you're using those features.
    But SQL itself also changed dramatically in moving from SQL 2000 to 2005. So if your customer's packages are heavily customized around SQL 2000, this may require substantial re-work.
    The only migration process for custom DTS packages -- that I'm aware of -- is to use the SQL 2005 migration tool in SSIS, see how much it messed up, and then fix everything else that's still broken.
    But there also may be opportunities to improve the package overall. SQL 2005 has a lot of great new features in SSIS, over what was there in SQL 2000.
    I haven't started working with SQL 2008 yet, so I can't say what complexity there is in upgrading DTS packages from 2005 to 2008. From what I read in the BPC 7 release notes, it sounds like it's a very minor upgrade, compared to the jump from 2000 to 2005.

Maybe you are looking for