0000098678-sqlserver connection issue

3
7/21/2019 0000098678-SqlServer Connection Issue http://slidepdf.com/reader/full/0000098678-sqlserver-connection-issue 1/3 SAP Note Header Data Symptom Connection problems occur between SAP and SQL Server. There is a connection timeout, or connection error. Other Terms Timeout netlib tcp/ip named pipes shared memory netlib Reason and Prerequisites This is a description of the connection mechanisms using SAP with SQL Server 7.0 and later. This note could also be useful in troubleshooting various connection problems. Solution CONNECTION PARAMETERS: ====================== SAP executables (kernel and standalone), need three variables to connect to SQL Server: 1. SERVER - name of SQL Server (default or named instance). 2. DBNAME - name of database containing SAP data. 3. SCHEMA - namespace context (can be used starting with release 4.6c). Must be set when using multiple SAP systems within the same physical database (MCOD- or schema installation). For non- MCOD-installations, this variable must either not be set or set to dbo. This is enough information to make a connection using "Windows Authentication". The connections are made using the NT user ID that owns the session. For SAP it's usually <DOMAIN>\SAPService<SID>. SAP releases older than 4.5b also need USER and PASSWD because SQL Server authentication is used. These parameters are specified in the following ways: l For the SAP system kernel, the SAP profiles are used: ¡ SERVER is set by using SAPDBHOST in the DEFAULT.PFL profile. SAPDBHOST must always be set to the name of the windows server name which runs the SQL Server. Sometimes the windows server name is not the same as the SQL Server name (named instance, or renamed server). In this case profile parameter dbs/mss/server = <server_name>\<SID> should be added to specify the actual SQL Server name. ¡ DBNAME usually inherits the setting of the SAPSYSTEMNAME profile parameter. It can also be set in the instance profile using dbs/mss/dbname. ¡ SCHEMA is set using dbs/mss/schema in the default profile. This variable must be set if the system is an MCOD system. This allows multiple SAP system to share the same database. If there is one MCOD system, all SAP systems in the same database must be MCOD systems. For MCOD-installations SCHEMA is always equal to the <SID> in lowercase letters. For non-MCOD- installations SCHEMA is either not set or set to dbo. l For standalone programs environment variables are used. ¡ SERVER is set using environment variable MSSQL_SERVER ¡ DBNAME is set using MSSQL_DBNAME ¡ SCHEMA is set using MSSQL_SCHEMA. In addition the environment variable "dbms_type" must be set to the value "mss". Example (for an 98678 - SQL Server Connection Issues Version 18 Validity:  06.01.2009 - active Language English (Master) Released On 09.01.2009 08:20:13 Release Status Released for Customer Component BC-DB-MSS Microsoft SQL Server Priority Recommendations / Additional Info Category Help for error analysis

Upload: pkumar1012275

Post on 05-Mar-2016

25 views

Category:

Documents


0 download

DESCRIPTION

SQL Connection issue

TRANSCRIPT

Page 1: 0000098678-SqlServer Connection Issue

7/21/2019 0000098678-SqlServer Connection Issue

http://slidepdf.com/reader/full/0000098678-sqlserver-connection-issue 1/3

SAP Note 

Header Data

Symptom 

Connection problems occur between SAP and SQL Server.There is a connection timeout, or connection error.

Other Terms 

Timeout netlib tcp/ip named pipes shared memory netlib

Reason and Prerequisites 

This is a description of the connection mechanisms using SAP with SQL Server 7.0 and later.This note could also be useful in troubleshooting various connectionproblems.

Solution 

CONNECTION PARAMETERS:======================SAP executables (kernel and standalone), need three variables to connect to SQL Server:

1. SERVER - name of SQL Server (default or named instance).

2. DBNAME - name of database containing SAP data.

3. SCHEMA - namespace context (can be used starting with release 4.6c). Must be set when usingmultiple SAP systems within the same physical database (MCOD- or schema installation). For non-MCOD-installations, this variable must either not be set or set to dbo.

This is enough information to make a connection using "Windows Authentication". The connections aremade using the NT user ID that owns the session. For SAP it's usually <DOMAIN>\SAPService<SID>. SAPreleases older than 4.5b also need USER and PASSWD because SQL Server authentication is used.

These parameters are specified in the following ways:

l For the SAP system kernel, the SAP profiles are used:

¡ SERVER is set by using SAPDBHOST in the DEFAULT.PFL profile. SAPDBHOST must always be setto the name of the windows server name which runs the SQL Server. Sometimes the windowsserver name is not the same as the SQL Server name (named instance, or renamed server). Inthis case profile parameter

dbs/mss/server = <server_name>\<SID> should be added to specify the actual SQL Server name.

¡ DBNAME usually inherits the setting of the SAPSYSTEMNAME profile parameter. It can also beset in the instance profile using dbs/mss/dbname.

¡ SCHEMA is set using dbs/mss/schema in the default profile. This variable must be set if thesystem is an MCOD system. This allows multiple SAP system to share the same database. Ifthere is one MCOD system, all SAP systems in the same database must be MCOD systems. ForMCOD-installations SCHEMA is always equal to the <SID> in lowercase letters. For non-MCOD-installations SCHEMA is either not set or set to dbo.

l For standalone programs environment variables are used.

¡ SERVER is set using environment variable MSSQL_SERVER

¡ DBNAME is set using MSSQL_DBNAME

¡ SCHEMA is set using MSSQL_SCHEMA.

In addition the environment variable "dbms_type" must be set to the value "mss". Example (for an

98678 - SQL Server Connection Issues 

Version  18 Validity: 06.01.2009 - active Language  English (Master)

Released On  09.01.2009 08:20:13

Release Status Released for Customer

Component  BC-DB-MSS Microsoft SQL Server

Priority  Recommendations / Additional InfoCategory  Help for error analysis

Page 2: 0000098678-SqlServer Connection Issue

7/21/2019 0000098678-SqlServer Connection Issue

http://slidepdf.com/reader/full/0000098678-sqlserver-connection-issue 2/3

MCOD system on a named instance):

set MSSQL_SERVER=myserver\MSD set MSSQL_DBNAME=MSDset MSSQL_SCHEMA=msdset dbms_type=mss

If dbs/mss/schema is not set, then MSSQL_SCHEMA must not be set.

Since 4.6D the dbs/mss/<parameter> is the preferred format for MSS profile parameters.See note 28667 for a more detailed discussion of the MSS profileparameters.

In 4.6D and later some small changes were made:

1. The SAP kernel ignores all environment variables, but a message is printed in the developertraces (dev_w??) if the corresponding variable is set to a different value.Older releases use the environment variables and those values override the profiles.

2. dbs/mss/<parameter> should now be used exclusively. If older formats (dbs/oledb/..,rsdb/mssql/...) are used, they still work.In 6.20 a "deprecation" message is printed in the dev traces.

POSSIBLE CONNECTION PROBLEMS:=============================It is very important to be aware of which network layer libraries are used to connect to SQLServer. In some cases the system is trying to connect using a protocol whose libraries are disabledor not working for some other reason. You can view and change the network library choices in theClient Configuration Utility for SQL Server 2000, or the SQL Server Configuration Manager for SQL

Server 2005 and later.Generally either Named Pipes or Shared Memory protocols should be used for connecting to a SQLServer on the same host, but TCP/IP to connect across a network.

In particular, the use of named pipes across a physical network can hurt performance quite a bit.

To determine the network library being used for the SAP connections, execute the following query:

select hostname,net_library,COUNT(*) from master..sysprocesses group by hostname,net_library 

This will list the application servers, the type of network library being used and how manyconnections are made by each type. The value for net_library can be LPC (Local Procedure Call),TCP/IP or Named Pipes.

SAP Kernel 4.6D will simply use the network protocol determined by the settings in the ClientConfiguration Utility, or the SQL Server Configuration Manager (Client Configuration).

SAP Kernel 6.40 or later will attempt to force the proper protocol by automatically adding aprotocol prefix to the SQL Server name. The protocol prefixes are added like this: 

l For a local connection

¡ For releases 6.40 or 7.00 connecting to SQL Server 2005 or earlier: np:<server_name> 

¡ For releases 7.00 connecting to SQL Server 2008 or later or 7.10 orlater: lpc:<server_name> 

l For a connection across a network: tcp:<server_name> 

If the dbs/mss/server profile parameter is modified and one of the prefixes lpc:, np: or tcp: is

added in front of the server name, then the server name will not be modified before connecting (i.e.the requested protocol is used).If simply a ':' character is added in front of the server name:

dbs/mss/server = :<server_name> 

Then the system will use <server_name> directly. No protocol prefix will be used and the protocolspecified in the Client Configuration will be used.

The developer tracefiles in the work directory of the system (dev_w0 for example) will show theserver name being used (with added prefix).

The protocol prefixes can be tested directly using any of the SQL Server tools such as the SQLServer Management Studio or command line tools such as osql or sqlcmd. Examples: 

sqlcmd -S np:(local)sqlcmd -S tcp:PRDSRV

TROUBLESHOOTING STANDALONE CONNECTION PROBLEMS:===============================================If a standalone program such as R3trans.exe or tp.exe is having problems connecting, you can obtainfurther trace information by using a special environment variable called MSSQL_DBSLPROFILE.

Login as the <sid>adm Windows user and try for example:SET MSSQL_DBSLPROFILE=1 

r3trans -dSET MSSQL_DBSLPROFILE=

Page 3: 0000098678-SqlServer Connection Issue

7/21/2019 0000098678-SqlServer Connection Issue

http://slidepdf.com/reader/full/0000098678-sqlserver-connection-issue 3/3

 

Now a file has been created named dbsl_w0 (or in some cases dbsl_p<n> where <n> is the process id)in your current directory. Examine this file to see if there is further information or hints as towhere the problems is. Send this file to SAP Support if necessary. 

TROUBLESHOOTING SAP CONNECTION PROBLEMS:========================================You can also obtain dbsl_w?? trace files from the kernel by doing thefollowing:

1. Adddbs/mss/dbsl_profile=1 

in the instance profile <SID>_DVEBMGS??_<host>, not DEFAULT.PFL.

2. Start SAP, wait a few minutes and then stop SAP.

3. Examine new dbsl_w?? files in \usr\sap\<SID>\DVEBMGS??\work or send them to SAP Support.

4. IMPORTANT: Remove dbs/mss/dbsl_profile from the profile when the problem has been resolved.Otherwise you will soon run out of diskspace.

Other Attributes

Validity

This document is not restricted to a software component or software component version

References

This document refers to:

SAP Notes 

This document is referenced by:

SAP Notes (8) 

EDIT

 FILE

 SUCH

1794178 Network issues suspected on SQL Server systems 

1593183 TCP/IP networking parameters for SQL Server  

551915 R/3 won't start after database restore or database copy 

492966  APO 3.0 liveCache administration/monitoring (LC10) 

455238 MSSQL_* environment variables, profile parameters 

208632 TCP/IP network protocol for MSSQL 

28667 Microsoft SQL Server Specific Profile Parameters 

551915 R/3 won't start after database restore or database copy 

1914385 SQL Server Alias use results in a connection, but w/errors 

1794178 Network issues suspected on SQL Server systems 1593183 TCP/IP networking parameters for SQL Server  

455238 MSSQL_* environment variables, profile parameters 

208632 TCP/IP network protocol for MSSQL 

28667 Microsoft SQL Server Specific Profile Parameters 

492966  APO 3.0 liveCache administration/monitoring (LC10) 

Transaction codes