[SAP 4.6C]BASIS ADMINISTRATION TIPS
作者: bbobb(http://bbobb.itpub.net)发表于: 2004.08.27 16:35
分类: SAP
出处: http://bbobb.itpub.net/post/69/576
---------------------------------------------------------------
本文是日常维护中非常有用的一些小技巧。
- 在OS级通过命令获得SAP的一些信息。
- 不登陆SAP系统,用批处理来检查SAP系统是否在运行
- 在DB中查看SAP系统的版本
- 锁某个特定的CLIENT
等等
- 不登陆SAP SYSTEM,在命令行下检查系统是否正常运行。
这是个极其有用的技巧。能帮助你判断系统运行的状态。在这个脚本中最重要的一个命令是SAPINFO.EXE,在SAPFRONTEND CD中能找到这个命令。如果你找不
到可以个我EMAIL。SAPINFO使用语法是:
sapinfo ashost=hostname sysnr=nn
我的PC是WIN2K,SAPGUI 6.2, SAP 安装在主机名为:horse, bull, cock的三台机器上
STEP1: 在C:WINNTsystem32driversetc,编辑hosts文件,建立SAP 系统APP所在机器的IP与HOSTNAME地对应。如
127.0.0.1 localhost
109.104.81.3 horse
109.104.81.5 bull
109.104.81.11 cock
STEP 2: 将sapinfo.exe拷到winntsystem32下,并在这个目录下建立checksap.bat批处理文件;如下
@echo off
rem
rem script: CheckRFC.BAT
rem It uses SAPINFO from the RFC-SDK(SAPGUI) to check an RFC destination
rem It needs two parameters: 1. Hostname 2.Instance Number
rem A ping is sent to the host. If successful an Rfc check is carried out.
if "%2"=="" goto Noparameter
echo Pinging %1 ...
ping %1 -n 2 | find /i "reply" > nul && goto CheckRFC
echo System does not exist on the network! & goto Bye
:CheckRFC
sapinfo ashost=%1 sysnr=%2 & if errorlevel 1 goto System_Down
echo ----------------------------------------------------------
echo System is up. RFC checks OK!
echo ----------------------------------------------------------
goto Bye
:System_Down
echo ----------------------------------
echo System is down!
echo ----------------------------------
goto Bye
:NoParameter
echo ----------------------------------
echo You did not specify at least on parameter!
echo Synatx: checkrfc "hostname" "instance number"
echo Example: checkrfc mydev 00
echo ------------------------------------
:Bye
2. lock a client to prevent logons
Do you need to do maintenance on a system and want to make sure nobody logs on to it while you are
working it?
You can lock a system at the OS level by running : tp locksys <SID> pf=tpprofile
Example: To lock your DEV system enter this command: tp locksys DEV pf=saptranshostsapmnttransbintp_domain_dev.pfl
Userss will get this message if thery attempt to log on: "Upgrade still running.Logon not possible"
Notice that the message is not exactly accurate. TP locksys is mainly used during release upgrade
so the message is kink of generic. But, it works!
To unlock the system, run: tp unlocksys <SID> pf=tpprofile
Only SAP* and DDIC can log on to any of the clients in the system that has been locked.
3. SAP table with Version and Instance name
USAP R/3 stores its version, instance name and OS platform in tables!
This is excellent as you can then query the <SID> database to get the
R/3 version, Instance Name and OS platform as follows:
select * from SVERS
select * from TSLE4
You do not even have to log on to the application to get this info.The
above query gives it to you in less than 1 second
4. Locking/Unlocking accounts
User accounts can be locked/unlocked via SU01(User Maintenance)
But, what goes on behind the scenes?What does the system do to actually set this?
The table USR02 gets updated. The field UFLAG determines if the user account is
locked or unlocked. The value "64" indicates that the user account is locked,
The value "0" indicates that the user account is unlocked.
Knowing this, you can then issue an update statement at the database level that
locks all users in mass
Do not lock yourself out,though!Use exceptions for super user accounts in your
update statement
5.Getting technical info at the OS level
It is very easy to obtain the patche level of some core R/3 executables such as:
disk+work, tp and r3trans
Many people woule like to know how to do this,Here show you how to do it for R/3 systems
running on Windows a:
STEP1: Go to the command prompt
STEP2: Change to the "run" directory of your SAP instance(cd usrsap<SID>sysexerun).
STEP3: Run the following three commands
dsp+work -V |find "patch number"
tp -V |find "patch number"
r3trans -V|find "patch number"
If you want to see all the release infomation, then do not filter for the patch number.



