Anda di halaman 1dari 22

SAP transport hang.

Transport Troubleshooting guide


It has been a while since I handled a transport issue and it came to my attention that I had to dig
my emails for the solution of common to advanced SAP transport problems. Below is my list of
tasks to check when troubleshooting SAP transport hang issues.

Disclaimer: Below are to be used by medium experienced basis engineer who knows basic TMS
concepts.

Problem Keyword: Transport hang troubleshooting and clear a transport list. Transport is stuck.


1.0 Basic transport troubleshooting. Verify that there are no errors in system log.
1.1 Execute transaction STMS
1.2 Select Import Overview
1.3 Select SID
1.4 From menu > Go To > System Log
1.5 Correct if no issues in log.

1.5.1.1 Known Issue 1 - WARNING: \\SERVER\sapmnt\SIDtrans\tmp\SID.LOB is already in use
(22720), I'm waiting 2 sec (20100322091720). My name: pid 10128 on
SERVER (SIDadm)
1.5.1.2 Solution 1 - Backup and delete the file '\\SERVER\sapmnt\SIDtrans\tmp\SID.LOB'. Add the
transport again and perform import.

1.5.2.1 Known issue 2 - Cannot find \\SERVER\sapmnt\SIDtrans\log\SLOGXX02.SID
1.5.2.2 Solution 2 - Make sure that file exists. If not, copy the most recent SLOG (example
SLOGXX01) and rename it to SLOGXX02.SID. Check again the system log if the issue persist.

1.5.3.1 Known issue 3 - Problems with job RDDIMPDP
1.5.3.2 Solution 3 - Execute SE38 > Run program RDDNEWPP > Choose Normal priority. This will
schedule new RDDIMPDP job that is responsible for pushing transport requests in your system.

Disclaimer: The next steps are steps to clear the transport list to make sure that transports push
successfully. This should be aligned with customer.

2.0 Clear the transport list and redo the transport
2.1 Execute transaction STMS
2.2 Import overview -> Goto -> Import monitor >
2.3 'Monitor' -> right click on transport -> delete entry
2.4 Redo the transport action. Proceed to next step if not solved.

3.0 Clear the transport tables
3.1 Make sure that there are no stuck transports in your transport tables.
3.2 Check and delete entries (using transaction SM30) any entries found in the following tables:

TPSTAT
TRJOB
TRBAT

3.3 To do this execute SM30
3.4 Enter 'TRBAT' in Table/View.
3.5 Click on Display
3.6 Verify that NO transport number or HEADER exists.

3.7 If the Import Monitor or table TPSTAT does not contain
3.8 entries any more, you can delete the entries of tables TMSTLOCKR andTMSTLOCKP.
3.9 Redo the transport action.

If this does not solve the problem. You have the option to stop all transport from OS level.

4.0 Kill tp.exe OS process
4.1 Login to SAP server
4.2 Kill any TP.exe processes at the OS level.
4.3 Try again to add and import your request
4.4 Redo the transport action

5.0 Save transport resources.
5.1 It is SAP's recommendation that imports be done asynchrounously rather than synchronously.
By doing this you will be conserving system Resources.
5.2 In doing the import > Execution tab > Select 'Asynchrounously' > Confirm import

Below is unlikely but could also apply.

6.0 Make sure that transport parameters are okay.
6.1 Add the following parameter to your transport profile.

'/system_pf=/usr/sap//SYS/profile/DEFAULT.PFL'

This parameter simply tells sapevt where to look for your DEFAULT.PFL. Check note 449270 for
further information on this. Ensure you have the other settings like:

rdisp/mshost =
rdisp/msserv = sapms
SAPSYSTEM = 00 (this is the system number)

Add system_pf paramter to transport tool via STMS. On the left have
system_pf and on the right /usr/sap//SYS/profile/DEFAULT.PFL

After this, restart the system so that the new parameter is taken into account by the system.
Posted by Keen Robante at 3/22/2010 04:08:00 AM


Support pack upgrade Notes
Be patient.

How to monitor:

1. OS level - monitor if Package update background job is running. Don't stop the process.

2. SPAM (Support package manager)
A.1 Red - In process(Click on QUEUE STATUS button): You should see that import process is
ongoing). Wait till it completes.
A.2 Red - STOP(due to error, DDIC activation, timeout, etc). Investigate. Make sure to restart
import again and confirm if error persists. Usually timeout are resolved by restart of import from
the point it stopped.

B. Yellow - needs confirmation or requirements not met. Action required to proceed.

C. Green - OK

3. AL11 > DIR_TRANS > TMP
- Sort the file according to last changed DATE. Notice the file name changes from a period. Also
notice the timing of change. If it updates, the update is ongoing.

My Checklist Support package in Live system:
1. Take full backup of your system,
2. Space is available on Database. Check recovery settings
3. Your SPAM/SAINT version is updated.
4. Your Kernel patch is updated.
5. Your Business Client is locked
6. Work Process and Memory is available.
7. Space available at OS level
8. Check all prerequisites means spam status patch levels etc.
9. Lock all users except the user with which you want to apply(DDIC or equalent).
10. Check the tp version if required apply latest(n-1 kernel).
11. Take ABAPer presence at the time of applying.
12. Deschedule all Batch jobs

Problem:
GUI and login problems. Example you get ABAP dumps Syntax error in program "SAPLSUNI".

I have faced some GUI problems problem when i was applying patches.

I couldn't log on to system so i was just monitoring the logs and given sufficient time for patches
to finish from OS level

Background:
If you install a support package there are various phases (which you might have seen).

A first step install/update the tables/views/structure, a second step imports the code changes
and a third step activates those changes.

As long as not all three steps are completed you might face syntax errors. If e. g. step one is in
process and a program refers to a table structure that is not consistent with the code (because
stage 2 and 3 are not done yet) it will dump. This is a normal and expected.

Important:
Support packages installation is (usually) done in downtime (not system shut down but downtime
in sense of no one logged on but you with SPAM), that means, you logon to client 000 with one
mode, start the patch application and leave the system alone until the patch process is finished. If
the patch application takes several hours then you might get syntax errors for those several hours
until it's finished.

BB note 003 - SAP Performance Issue - RFC Memory -
TSV_TNEW_PAGE_ALLOC_FAILED - ARFCSDATA and
ARFCSSTATE
Summary:

Memory problem in SAP system due to more than million entries in RFC tables and RFC
inconsistency.

Symptoms:

1. In ST22, ABAP dumps TSV_TNEW_PAGE_ALLOC_FAILED register everytime an RFC transaction is
processed. Thousands of dumps could occur.
2. In SM50 process monitor, errors are detected and locks triggered from ARFCSDATA table.
3. In SM58 tRFC monitor, RFC transactions fails due to memory problems.

Solution:

1.0 Check ARFCDATA table status.
1.1 Go to transaction SE16
1.2 Enter ARFCDATA and Execute
1.3 If entries is more than a million, it is expected that there could be problems with RFC
connection.
1.4 Do a consistency check as described in Step 2.*

2.0.0 SAPNote 779664. Performed deletion of inconsistent RFC entries between ARFCSDATA and
ARFCSSTATE table.
2.1.0 Execute transaction SE38.
2.1.1 Enter RSTRFCEG in program and press Execute. You will go to the Outbound RFC consistency
screen.
2.1.2 Check all Tables affected TRFCQOUT, ARFCSSTATE, QREFTID, ARFCDATA
2.1.3 Uncheck 'Check only' to perform execution
2.1.4 Press Execute

2.2.1 SAPNote 779664. Enter RSTRFCEH in program and press Execute. You will go to the INBOUND
RFC consistency screen.
2.2.2 Check all Tables affected TRFCQOUT, ARFCSSTATE, QREFTID, ARFCDATA
2.2.3 Uncheck 'Check only' to perform execution
2.2.4 Press Execute

NOTE: Check if the problem is resolved from Steps 2 to 5.

Step 2.* and 3.* resolved our issue.

3.0 Review SAP note 353579. Check your memory parameters and increase RFC related memory
parameters below. Restart SAP system to take effect.

- change ztta/max_memreq_MB
- ztta/roll_area from

4.0 In Database level. Perform Index rebuild for the following SAP RFC tables
ARFCSSTATE
ARFCSDATA
TRFCQOUT
TRFCQIN
TRFCQSTATE
TRFCQDATA
ARFCRSTATE

5.0 SAP note 561988. Check SAP server for memory leaks. Reboot the server if needed.

BB note 002 - Transport error in background - Cannot
determine mshost in dev_evt
Symptoms:

1. Dialog transports are okay but automated background transports sometimes fail.

2. Error below in stms > Import overview > SAP system > Go To > TP system log
Trace File of External Event Raiser (Level=2, Append=0)
EventID: SAP_TRIGGER_RDDIMPDP
*** ERROR ***: Cannot determine mshost

3. Error below in the AL11 > DIR_HOME > dev_evt file log
EventID: SAP_TRIGGER_RDDIMPDP
SAP message server host: [SAP Server]
SAP message server service (new): 39XX [XX=message number]
SAP message server service (old): sapms[SID]
Event sent to server [SAP Server]

Cause:
Problems with transport process and involved parameters and components

Solution:

1.0 Review SAP notes 642464 & 449270. Check if transport parameters are set correctly in
the default profile DEFAULT.PFL.

This can be found in \usr\sap\[SID]\SYS\profile\DEFAULT.PFL

Add following parameter in your DEFAULT.PFL

SAPSYSTEM = [nn](this is the system number)
rdisp/msserv = sapms[SID]

2.0 Add the correction parameter [SID]/system_pf to transport profile.

As suggested in SAP note 449270 please add following parameter in
transport profile(TP_DOMAIN_[SID].PFL)

- there should be entry for [SID]/system_pf

Maintain the transport profile parameter [SID]/system_pf. Your
transport profile will be TP_DOMAIN_[SID].PFL is located in
DIR_TRANS/bin. The system_pf parameter should be the path to the
DEFAULT.PFL for that SID. Example:

A11/system_pf=d:\usr\sap\A11\SYS\profile\DEFAULT.PFL
B12/system_pf=/usr/sap/trans/bin/DEFAULT.B12

Both are valid paths, assuming that the profiles are maintained.

Please make sure after you make an entry in the transport profile end
this with a enter and then save otherwise the entry will not be read
properly.

3.0 Verify services file

Check if sapmsSID port is open.

Go to C:\WINDOWS\system32\drivers\etc for Windows.

Check the services file for the sapms[SID] entry. This entry
should have the format:
sapms[SID] 3600/tcp > Note that last 2 digits is your SAP system number
If your entry looks like this:
sapms[SID]###3600/tcp
The '#' marks indicate the beginning of a comment, and all text after
this will be ignored. Remove them or duplicate the entry without the
comment marks.

4.0 Make sure that hosts file of all the systems are having specific
entries for all the systems in the landscape.

Go to C:\WINDOWS\system32\drivers\hosts

Verify if working by doing a network ping.

5.0 Restart the SAP instance after these changes and then try the import again. This should
resolve the issue.


BB note 001 - Performance issue - Yellow dispatcher - Dialog
is full - SAPLSENA program RSMONICDP table
Summary:

End-users are unable to logon to the BWP system.
All work processes are occupied by user ZZZBWP with program SAPLSENA (de/enqueue process).

This is due to application launching large amount of enq/deq for locks.

Investigation of application that utilize long RFC queue locks.
Profile parameters have been adapted to allow more users in parallel with RFC.

Symptoms:

1. Performance issue.

2. DIA Work Processes are all being used by SAPLSENA program.

3. This disallows other dialog logon and bad system performance.

4. System was available but unavailable for user login is most cases.

5. Process hang. SAP response time is slow due to all work process being used by one program.

Cause:

A. SAPLSENA program is run by user ZZZ* and occupies all dialog WP.
This program is a lock handler tool which does an enqueue/dequeue operations.

B. Application issue.

Solution:

1.0 Go to SM12 and look for old lock queues. Delete old lock queues and restart SAP system

2.0 Perform DBCC checktable for affected table in database level. In this case, we did DBCC check
for RSMONICDP table.
2.1 In your SQL query window execute below

DBCC CHECKTABLE ('Database.RSMONICDP')
GO

See link below for more info on errors and usage:

http://msdn.microsoft.com/en-us/library/ms174338.aspx

2.2 Troubleshoot if needed.

3.0 Do a clean restart of SAP and DB if problem persist or if you can no longer login to SAP.

When system is temporarily available. You can do other steps below:

4.0 Best practice to temporary lock the identified program user. This will disable the program to
run.

Implement parameter changes in step 5.0 and 6.0.

5.0 Review note 527481, 74141, and 986373. Below are particular parameters adjusted with
regards to SNOTE 74141.

rdisp/rfc_min_wait_dia_wp
rdisp/rfc_use_quotas

6.0 Review note 916706. Disable 'RFC standard Scheduling'
6.1 Login to SAP (this is the hard part for this case and we had to restart system to get random DIA
process free)
6.2 Go to transaction SE38
6.3 Enter program RSA1_TRFC_OPTION_SET.
6.4 Execute
6.5 Un-check 'RFC standard Scheduling'. Make sure that all options are unchecked.
6.6 Monitor the system
6.7 Unlock process user ZZZ* if required.

The procedure above solved the issue. Good luck.

usr/sap/SID is full in Windows
Solution: System clean up, usr/sap/SID is full

Background: SAP directory housekeeping is a common problem to basis engineers.
Below are some tips on how to handle problems with full or low space for usr/sap/SID.

Reason # 1.0: A huge file is unconsciously moved to usr/sap/SID directory.

Shit happens. Sometimes a person could accidentally move an ISO image or other unimportant file
to a wrong directory.
This is very stupid but these things happen.

Solution # 1.0 Delete or move non-sap file.

Step 1.1 Use Windows Search tool.
Step 1.2 Search usr/sap/SID directory by file special option with 10Mb size.

Example of files that are non-sap related:
Installers (*.ins)
ISO images (*.iso)
unnecessary zip files (*.zip)
unnecessary rar files (*.rar)

Step 1.3 Verify if files are no longer needed.
Step 1.4 Delete or move the identified miscellaneous files
Step 1.5 It's always best practice to move instead of delete. Also Don't delete files WITHOUT
second opinion of fellow system owners. Your choice.

Reason # 2: Standard SAP clean up jobs did not run.

Cleanup jobs must be regularly maintained for automatic SAP system cleanup.

Solution # 2: Verify if SAP standard reorg jobs below completed successfully.
a. SAP_REORG_JOBS
b. SAP_REORG_SPOOL
c. SAP_REORG_BATCHINPUT

See table below for more info on jobs:


In some urgent cases, you need to run programs associate with job manually. You can refer to my
post below on how to manually run the programs associate with jobs above in link below:

http://basisbibo.blogspot.com/2009/09/fundamental-sap-system-clean-up.html

Sometimes SAP standard jobs like any other job will fail to complete. Troubleshoot if needed.

It's always best to check last entry of job logs. Some reasons of job failure could be:
a. Executing user is locked. Check user in SU01 and unlock if needed.
b. No background process available during scheduled runtime. This is temporary. Run the job
again.
c. Disk I/O error. Check disk if full or physical errors are detected.
d. Variant does not exist. Create variant if needed.

Reason # 3.0: SAP_COLLECTOR_FOR_PERFMONITOR is not scheduled or having problems.

This job update the performance database MONI and reset stat file once the stat file reached its
max size. This should run regularly.

Solution #3.0 Verify job status. Troubleshoot if needed.

Step 3.1 Go to SM37, enter SAP_COLLECTOR_FOR_PERFMONITOR and find job occurence.
Step 3.2 If the job does not exit, schedule it as follow in transaction SM36:
Job name: SAP_COLLECTOR_FOR_PERFMONITOR,
main program: RSCOLL00
Frequency: Hourly
No variant.
(Note: sometimes the job does not have the name of SAP_COLLECTOR_FOR_PERFMONITOR, the
name depend on the job scheduler. You can check if it was scheduled in the system by the main
program RSCOLL00 in SM37)

Step 3.3 Make sure that the job completes.

Reason # 4.0 Developer traces files(e.g. dev_w0, dev_w1, dev_w*) are huge.

Dialog, Background and Spool work processes logs are recorded and consumes space in disk as
dev_w*.
Expect some work process to grow very large when major activity is ongoing like client copy or
delete.

Solution # 4.0 Verify and reset dev traces if needed

Step 4.1 In OS level go to usr/sap/SID/DVEBMGS**/work
Step 4.2 Do a search for dev_w*. Verify if one dev_w* is getting huge size (Around 1Gb to 5Gb)
Step 4.3 In SAP level verify activity through transaction SM50. dev_w(No.field in SM50). Check the
runtime if long running. 3600 = 1 hour.
Step 4.4 If confirmed to be long running, confirm with user if process can be reset. Don't reset
process unless confirmation is given.
Step 4.5 With a green signal, in SM50 Click on Process > Trace > Rest > Work process files
Step 4.6 Verify in OS level if the dev_w* file is reset to 0~ kb.

Reason # 5.0 Very big stat file.

Stat files are regularly cleaned by job SAP_COLLECTOR_FOR_PERFMONITOR.

In some development systems, stat files are not really needed.

Solution # 5.0 Delete stat file

Step 5.1 In SAP level, go to transaction ST03
Step 5.2 Switch to Expert mode view
Step 5.3 Go to Collector and Performance DB
Step 5.4 Go to Statistics and Record file
Step 5.5 Go to Delete file
Step 5.6 Select the SAP system affected (server_SID_Instance no).

Reason # 6. Your SAP baby is getting big. :D

This is the last resort for system administrators for maintenance.

Most plugins are installed.
All clean up jobs okay.
No confirmation to reset stat or developer traces (dev_w*)

Solution # 6: Extend file system. This can be done through.

Step 6.1 Disk replacement if you have poor disk management infrastructure. This will required SAP
downtime.
Step 6.2 Remote disk extension if you have Network File System.


SAP Basis Kernel Upgrade in Windows
Solution: Kernel upgrade change in SAP system

SAP note references:
19466 - Downloading SAP kernel patches

Below is generic practice:
Pre work - no SAP downtime required
Actual work - will require SAP system downtime due to kernel switch and some testing.
Post work - no downtime but SGEN background job will use simultaneous dialog process in load.
Preferred to do this with less user is system.

1.0 Pre Work

1.1 Download the new kernel files. See Note 19466 - Downloading SAP kernel patches
1.2 Create a copy of I:\usr\sap\SAPSID\SYS\exe\ folder. Name it I:\usr\sap\SAPSID\SYS\exe_new
1.3 Extract new kernel CAR/SAR files to I:\usr\sap\SAPSID\SYS\exe_new, overwrite if necessary.
Use SAPCAR -xvf

2.0 Actual work

2.1 Stop your SAP system
2.2 Stop your SAP services (e.g SAP,SAPOScol)

Perform kernel switch.

2.3 Go to your current SAP kernel folder I:\usr\sap\SAPSID\SYS\
2.4 Rename I:\usr\sap\SAPSID\SYS\exe to I:\usr\sap\SAPSID\SYS\exe_orig
2.5 Rename I:\usr\sap\SAPSID\SYS\exe_new to I:\usr\sap\SAPSID\SYS\exe

Clear your stat file.

2.6 Delete STAT file per SAP Note 1058988.

Test the new kernel. Make sure that no background jobs will run during testing. Set rdisp/btctime
to 0.

2.7 Edit I:\usr\sap\SAPSID\SYS\profile\SAPSID_DVEBMGS_HOSTNAME and change rdisp/btctime to 0
(take note of the original value)

2.8 Start your SAP services (e.g SAP,SAPOScol)

2.9 Perform verification after restart. Use transaction SICK, SM51, SM50, SMLG, SPAD, DB02, SM21,
ST22

2.10 If OK.Stop the SAP system again.

Perform revert of rdisp/btctime original value.

2.11 Edit I:\usr\sap\SAPSID\SYS\profile\SAPSID_DVEBMGS_HOSTNAME and change rdisp/btctime to
its original value
2.12 Start SAP system
Using Services Admin, start SAPOSCol
Using Services Admin, start SAP_Inst# and enable Automatic startup
Using SAP MMC, right click on SID then select Start"
2.13 Perform verification after restart. Use transaction SICK, SM51, SM50, SMLG, SPAD, DB02,
SM21, ST22.

3.0 Post Work

3.1 Perform load generator by executing SGEN > Regenerate Existing Loads > Distribute load if
possible > Immediate
3.2 Wait for Load Generator to complete.

Common errors:

I. Yellow dispatcher > Check disp+work.exe and sapstartsrv.exe if they are the same.
II. Yellow dispatcher > Install Microsoft DLL, as per SAP Note 684106. This is often not necessary

SAP programs for System Clean Up
Possible Solution: Job logs full, spool full, SNAP (ABAP dump) table full, system clean up
Related SAP Notes: 16083

There are a number of jobs that should be scheduled to run on a daily, weekly, or monthly basis.

These jobs delete obsolete files such as print logs, job logs, and ABAP dumps.

* RSBTCDEL : Deletes old batch jobs (sugg. older than 30 days)
* RSBTCDEL2: Allows you to create pre-defined jobs that deletes old batch jobs (sugg. older than
14 days)
* RSPO0041 : Deletes old print jobs (sugg. older than 7 days)
* RSBDCREO : Reorganizes batch sessions and logs (sugg. older than 7 days)
* RSSNAPDL : Deletes short dumps (sugg. default values)
* RSBPSTDE : Deletes old job statistics (sugg. older than 30 days)
* RSCOLL00 : Statistics collector for performance monitor (this actually is not a cleanup job, but it
should be scheduled hourly).

You can run the jobs manually first, and divide how often they should run for the particular
system, and then schedule them to run automatically.

To run the programs:
1. Use transaction SE38 in your SAP system
2. Enter the program required to run
3. Press 'Execute'. Note that each program has its own management menu.

Additionally, there are some cleanup jobs that should be executed manually on a regular basis
(usually once a month). These include:

* sqldba: Use the Show/Cleanup commands.
* tp: Use the check all and clearold all commands. Make sure to backup the transport directory
first.
* TemSe (temporary seuential data) database check: Transaction SP12. Execute the menu
command TemSe database->Consistency Check and delete inconsistent data.
SAP* Logon not possible Error in license Check
Symptom:
1. You perform a database refresh. Physical copy is successful and r3trans -d is okay.

2. You followed SAPnote 68048 and used SAP* as emergency user. Parameter
no_automatic_sapstar=0 is set.

3. You cannot install sap license from command saplicense -install. This is because license is
stored in a digital file and not 24 characters in version 7.00 or later. SAP license installation is
done in transaction SLICENSE with admin user preferrably SAP*. After SAP* user is okay, system
number of refreshed system is not correct. You get error below:

This system's system number is "000000000XXXXXXXXX", but there is a license key for system
number "000000000YYYYYYYYY" in the license key file.

Other terms: SAP* logon failure, database refresh,

Reason: There is an error in ABAP kernel 7.00 patch 250 and 251. This has been identified on April
24, 2010 by SAP note 1459897. 15 days ago. :)

Solution:
1. Update to kernel 252 or in urgent cases revert back to old working kernel.

2.0. Delete all existing/old/non working license in transaction SLICENSE. The system number is a
passive number generated from SAP OSS licensing. It will display the most active.

2.1. When all licenses are deleted, you will notice that system number will be:
INITIAL_SYSTEM_IDX instead of the "Source" system number (old).

2.1. Import the digital SAP license you got from Marketplace in transaction SLICENSE > New
License > Install.

Hope this helps.

References:
1459897 - ABAP 7.00: DDIC and SAP* cannot log on
806819 - sap* login not available [problems with client-copies]


How to configure and create SAP router service with SNC
via NTSCMGR
Steps to do when setting up SAP router via Secure Network Comm (SNC). A note for future
reference.

Hope this helps others too.

Part A.
The first thing you need to do, is to send a customer message to SAP
Support (component XX-SER-NET-OSS-NEW) and tell them to register the
hostname and IP of your new SAProuter.

Part B.
After youve received a confirmation from SAP that your SAProuter has
been registered, you are ready to configure your SAProuter.

If your SAProuter directory is N:\usr\sap\saprouter, these are the steps
to follow.

Note: You will be asked for a PIN code. Just pick your own 4 numbers, but
youll have to use the same PIN every time youre asked to enter one.

1. Set 2 environment variables: SECUDIR and SNC_LIB according to the
guide youve downloaded.
example for variable setting below:
SECUDIR = N:\usr\sap\saprouter\
SNC_LIB = N:\usr\sap\saprouter\NTIA64\sapcrypto.dll (choose NTIA64 if your system is Itanium)

2. Download the SAP Crypto Library and unpack it into
N:\usr\sap\saprouter

3. To generate a certificate request, run the command:
sapgenpse get_pse -v -r N:\usr\sap\saprouter\certreq -p
N:\usr\sap\saprouter\local.pse

4. Then you have to follow the guide and request the certificate from
http://service.sap.com/tcs -> Download Area -> SAProuter Certificate

5. Create a file N:\usr\sap\saprouter\srcert and copy the requested
certificate into this file. The run the command:
sapgenpse import_own_cert -c N:\usr\sap\saprouter\srcert -p
N:\usr\sap\saprouter\local.pse

6. To generate credentials for the user thats running the SAProuter
service, run command:
sapgenpse seclogin -p N:\usr\sap\saprouter\local.pse -O
(this will create the file cred_v2)

7. Check the configuration by running command:
sapgenpse get_my_name -v -n Issuer
Result should be: CN=SAProuter CA, OU=SAProuter,
O=SAP, C=DE)

8. Create SAProuter service on Windows with the command:
ntscmgr install SAProuter -b N:\usr\sap\saprouter\saprouter.exe -p
service -r -R N:\usr\sap\saprouter\saprouttab -W 60000 -K ^p:^

9. Edit the Windows Registry key as follows:
MyComputer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SAProute
r\ImagePath > Change both ^ to

Add the value of issuer from step 7..
end value should be -K "p:CN=SAProuter CA, OU=SAProuter,
O=SAP, C=DE

10. Start the SAProuter service with your SNC user from step 6.

11. Enter the required parameters in OSS1 -> Technical Settings

12. Test your SAP router


database inconsistency. Fix script for schema and principal
id
-----DO NOT FORGET TO CHANGE schema ID -----
begin transaction

set nocount on

declare @SchemaToFix varchar(25)
set @SchemaToFix = 'prd'

declare @max int
declare @i int
declare @cmd varchar(500)
declare @ObjName varchar(500)
declare @ObjNameFull varchar(500)
declare @LastUserID int
declare @LastUser varchar(100)
declare @LastSchemaID int
declare @LastSchema varchar(100)
declare @CurrentUserID int
declare @CurrentSchemaID int

declare @MaxUserID int
declare @MaxSchemaID int

print convert(varchar(20),getdate(),109) + ' Starting ..'

if not exists (select * from sys.schemas where name = @SchemaToFix)
begin
print convert(varchar(20),getdate(),109) + ' Schema not found. Exiting.'
rollback transaction
return
end

if exists (select count(*) from sys.schemas
where principal_id = user_id(@SchemaToFix)
having count(*) > 1
) begin
print convert(varchar(20),getdate(),109) + ' User owns more than one schema. Exiting.'
print convert(varchar(20),getdate(),109) + ' See OSS note 1086375 for details.'
rollback transaction
return
end

if exists (select * from sys.schemas
where principal_id = user_id(@SchemaToFix)
and principal_id = schema_id
) begin
print convert(varchar(20),getdate(),109) + ' UserID and SchemaID are the same.'
print convert(varchar(20),getdate(),109) + ' Nothing to do. Exiting.'
rollback transaction
return
end

select @CurrentUserID = principal_id from sys.schemas where name = @SchemaToFix
select @CurrentSchemaID = schema_id from sys.schemas where name = @SchemaToFix

print convert(varchar(20),getdate(),109) + ' Current state: UserID = ' + convert(varchar(3),
@CurrentUserID) + ' SchemaID = ' + convert(varchar(3), @CurrentSchemaID)

select @MaxUserID = max(uid) from sys.sysusers with (nolock) where uid < 16000
select @MaxSchemaID = max(schema_id) from sys.schemas with (nolock) where schema_id < 16000

if @MaxUserID > @MaxSchemaID
set @max = 5 + @MaxUserID
else
set @max = 5 + @MaxSchemaID

dbcc dropcleanbuffers
dbcc freeproccache

if exists (select top 1 name from sysusers where name like 'SchemaRepairU%') begin
declare TempUserCursor cursor for select name from sysusers where name like 'SchemaRepairU%'
open TempUserCursor
fetch next from TempUserCursor into @LastUser
while @@fetch_status = 0 begin
set @cmd = 'drop user ' + @LastUser
execute (@cmd)
fetch next from TempUserCursor into @LastUser
end
close TempUserCursor
deallocate TempUserCursor
end

if exists (select top 1 name from sys.schemas where name like 'SchemaRepairS%') begin
declare TempSchemaCursor cursor for select name from sys.schemas where name like
'SchemaRepairS%'
open TempSchemaCursor
fetch next from TempSchemaCursor into @LastSchema
while @@fetch_status = 0 begin
if not exists (select top 1 name from sysobjects where uid = schema_id(@LastSchema)) begin
set @cmd = 'drop schema ' + @LastSchema
execute (@cmd)
end
fetch next from TempSchemaCursor into @LastSchema
end
close TempSchemaCursor
deallocate TempSchemaCursor
end
print convert(varchar(20),getdate(),109) + ' Cleanup finished'

set @i = 1

set @LastUser = 'SchemaRepairU' + convert(varchar(3),@i)
set @cmd = 'create user ' + @LastUser + ' without login'
execute (@cmd)
set @i = @i + 1

select @LastUserID = uid from sysusers where name = @LastUser

while @LastUserID < @max - 1 begin
set @LastUser = 'SchemaRepairU' + convert(varchar(3),@i)
set @cmd = 'create user ' + @LastUser + ' without login'
execute (@cmd)
select @LastUserID = uid from sysusers where name = @LastUser
set @i = @i + 1
end
print convert(varchar(20),getdate(),109) + ' User created. LastUser is : ' + @LastUser
set @i = 1

set @LastSchema = 'SchemaRepairS' + convert(varchar(3),@i)
set @cmd = 'create schema ' + @LastSchema + ' '
execute (@cmd)
set @i = @i + 1

select @LastSchemaID = schema_id from sys.schemas where name = @LastSchema

while @LastSchemaID < @max - 1 begin
set @LastSchema = 'SchemaRepairS' + convert(varchar(3),@i)
set @cmd = 'create schema ' + @LastSchema + ' '
execute (@cmd)
select @LastSchemaID = schema_id from sys.schemas where name = @LastSchema
set @i = @i + 1
end

print convert(varchar(20),getdate(),109) + ' Schemas created. LastSchema is : ' + @LastSchema
print convert(varchar(20),getdate(),109) + ' Start moving objects .... '
--###########################################################################
declare TempObjectCursor cursor local for
select name from sysobjects where
((xtype='U' and name <> 'dtproperties')
or (xtype='V' and name not in ('syssegments','sysconstraints'))
or (xtype='P' and name not like 'dt_%')
or (xtype='D' and name not like 'DF__dtpropert%')
or (xtype in ('FN','TF','IF'))
) and uid = schema_id(@SchemaToFix)


open TempObjectCursor
fetch next from TempObjectCursor into @ObjName
while @@fetch_status=0
begin
set @ObjNameFull = '[' + @SchemaToFix + '].[' + @ObjName + ']'
set @cmd = N'ALTER SCHEMA ' + @LastSchema + ' TRANSFER ' + @ObjNameFull
exec( @cmd )
fetch next from TempObjectCursor into @ObjName
end

close TempObjectCursor
deallocate TempObjectCursor
--###########################################################################
print convert(varchar(20),getdate(),109) + ' All objects moved to schema ' + @LastSchema

set @cmd = 'alter authorization on schema::' + @LastSchema + ' to ' + @LastUser
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' Authorization on schema ' + @LastSchema

set @cmd = 'alter authorization on schema::' + @SchemaToFix + ' to ' + @LastUser
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' Authorization on schema ' + @SchemaToFix

set @cmd = 'drop schema ' + @SchemaToFix
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' Schema dropped ' + @SchemaToFix

set @cmd = 'drop user ' + @SchemaToFix
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' User dropped ' + @SchemaToFix

set @cmd = 'create user SchemaRepairU without login'
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' User gap filled'

set @cmd = 'create schema SchemaRepairS'
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' Schema gap filled'

set @cmd = 'create user ' + @SchemaToFix + ' for login ' + @SchemaToFix
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' New schema user created'

set @cmd = 'create schema ' + @SchemaToFix
execute (@cmd)
print convert(varchar(20),getdate(),109) + ' New schema created'
print convert(varchar(20),getdate(),109) + ' Start moving objects back ..... '
--###########################################################################
declare TempObjectCursor cursor local for
select name
from sysobjects
where
( (xtype='U' and name <> 'dtproperties')
or (xtype='V' and name not in ('syssegments','sysconstraints'))
or (xtype='P' and name not like 'dt_%')
or (xtype='D' and name not like 'DF__dtpropert%')
or (xtype in ('FN','TF','IF'))
) and uid = schema_id(@LastSchema)

open TempObjectCursor
fetch next from TempObjectCursor into @ObjName
while @@fetch_status=0
begin
set @ObjNameFull = '[' + @LastSchema + '].[' + @ObjName + ']'
set @cmd = N'ALTER SCHEMA ' + @SchemaToFix + ' TRANSFER ' + @ObjNameFull
exec( @cmd )
fetch next from TempObjectCursor into @ObjName
end

close TempObjectCursor
deallocate TempObjectCursor
--###########################################################################
print convert(varchar(20),getdate(),109) + ' All objects moved into new schema'

set @cmd = 'alter authorization on schema::' + @SchemaToFix + ' to ' + @SchemaToFix
execute (@cmd)
set @cmd = 'alter user ' + @SchemaToFix + ' with default_schema = ' + @SchemaToFix
execute (@cmd)
exec sp_addrolemember 'db_owner', @SchemaToFix
print convert(varchar(20),getdate(),109) + ' Authorization set on new schema/user'

declare TempSchemaCursor cursor for select name from sys.schemas where name like
'SchemaRepairS%'
open TempSchemaCursor
fetch next from TempSchemaCursor into @LastSchema
while @@fetch_status = 0 begin
set @cmd = 'drop schema ' + @LastSchema
execute (@cmd)
fetch next from TempSchemaCursor into @LastSchema
end
close TempSchemaCursor
deallocate TempSchemaCursor
print convert(varchar(20),getdate(),109) + ' Final schema cleanup finished'

declare TempUserCursor cursor for select name from sysusers where name like 'SchemaRepairU%'
open TempUserCursor
fetch next from TempUserCursor into @LastUser
while @@fetch_status = 0 begin
set @cmd = 'drop user ' + @LastUser
execute (@cmd)
fetch next from TempUserCursor into @LastUser
end
close TempUserCursor
deallocate TempUserCursor
print convert(varchar(20),getdate(),109) + ' Final user cleanup finished'

commit transaction

exec sp_change_users_login 'update_one',@SchemaToFix,@SchemaToFix
print convert(varchar(20),getdate(),109) + ' New user accociated to the login.'

select @CurrentUserID = principal_id from sys.schemas where name = @SchemaToFix
select @CurrentSchemaID = schema_id from sys.schemas where name = @SchemaToFix

print convert(varchar(20),getdate(),109) + ' Current state: UserID = ' + convert(varchar(3),
@CurrentUserID) + ' SchemaID = ' + convert(varchar(3), @CurrentSchemaID)

print convert(varchar(20),getdate(),109) + ' Script finished.'

Schema conversion for SAP database copy [custom direct]
-----------begin change of schema----
use EH5
go
if object_id('sp_change_sapuser') is not null drop procedure sp_change_sapuser go create
procedure sp_change_sapuser @oldid sysname, @newid sysname as begin

declare @oldid_uid smallint
declare @newid_uid smallint
declare @object sysname
declare @object_full nvarchar(999)

--set @oldid_uid = user_id(@oldid)
select @oldid_uid =schema_id from EH5.sys.schemas where name=@oldid set @newid_uid =
user_id(@newid)

if @oldid_uid is not null and @newid_uid is not null begin declare object_cursor cursor local for
select name
from sysobjects
where
( (xtype='U' and name <> 'dtproperties')
or (xtype='V' and name not in ('syssegments','sysconstraints'))
or (xtype='P' and name not like 'dt_%')
or (xtype='D' and name not like 'DF__dtpropert%')
or (xtype in ('FN','TF','IF'))
) and @oldid_uid = uid

open object_cursor
fetch next from object_cursor into @object while @@fetch_status=0 begin
set @object_full = user_name(@oldid_uid) + '.' + @object
exec sp_changeobjectowner @object_full, @newid
fetch next from object_cursor into @object end end else if @oldid_uid is null
begin
print '*** old database user does not exist ***'
end
if @newid_uid is null
begin
print '*** new database user does not exist ***'
end
end
go

exec sp_change_sapuser 'mp1', 'eh5'
go


my SQL server mirroring script and guide
Note: Script below is only for guide.
Credits to Joan Peralta for the initial guide.

Step 1 - backup Database

BACKUP DATABASE EBP TO DISK = 'T:\ebp_backup\ebp_326' WITH NOFORMAT, NOINIT, SKIP,
NOREWIND, NOUNLOAD, STATS = 10

Step 2 - backup log

BACKUP LOG EBP TO DISK = 'T:\ebp_backup\ebplog_326' WITH NOFORMAT, NOINIT, SKIP,
NOREWIND, NOUNLOAD, STATS = 10

Step 3 - Copy the physical files to known local standby disk (with enough space to carry backups)
such as i:\usr\sap

Step 4 - restore database to Standby system. (Make sure no recovery option is selected)

RESTORE DATABASE EBP from disk = 'i:\usr\sap\ebp_backup\ebp_326' with norecovery, replace,
move 'EBPDATA1' to 'R:\EBP\DATA1\EBPdata1.mdf',
move 'EBPDATA2' to 'R:\EBP\DATA2\EBPdata2.ndf',
move 'EBPDATA3' to 'R:\EBP\DATA3\EBPdata3.ndf',
move 'EBPDATA4' to 'R:\EBP\DATA4\EBPdata4.ndf',
move 'EBPLOG1' to 'R:\EBP\log1\EBPlog1.ldf'
go

Step 5 - Restore log to standby system

RESTORE LOG EBP FROM DISK = N'i:\usr\sap\ebp_backup\ebplog_326' WITH NORECOVERY,
NOUNLOAD, STATS = 10

Step 6 - Using source Database EBP > Right Click to Properties
>Go to Mirroring
>Configure security
>Select principal node
> Next
>Select mirror node
>Next
>Finish

Step 7 - Start Mirroring

SAP disp+work stop. DNS issue for servers with multiple
SID
For reference in case you have DNS server issue with SAP servers having multiple named instance. This is
good learning when working with multiple named SAP host.
The parameter below bypasses the need of SAP to reference DNS server and identify itself as the
named host name.

Error/Symptoms:
1 No change performed.
2 Very slow SAP processing due to semi dialog standstill.
3 Multiple SAP instances go into dialog standstill.
4 All SAP process ends after 30 minutes.
5 DIA work process stay in Run status and end of dev_w0 log is below
6 dev_w0 log involves gateway routing to localhost and not named instance
Gateway issues detected when doing a trace on work process.
M Tue Jul 1 03:30:04 2014
M *** ERROR => GwConnectSapWp: GwConnect to localhost / sapgw17 failed (rc=NIECONN_PENDING)
[gwxx.c 1842]
M ***LOG S0T=> GwConnectSapWp, GwConnect (-0012) [gwxx.c 1848]


7 After 30 minutes the session is ended.
Workaround:
rdisp/reverse_name_lookup=0 disable reverse name lookup of user-terminals
gw/resolve_phys_addr=0 disable reverse name lookup for gwrd

Permanent Solution:
DNS flush. Find named instance conflict or stuck entries in DNS server.

Please take note that this is a workaround. We still need to correct DNS conflict within the SAP network.