Saturday, 12 October 2013

Wily Starting and Stopping

/usr/sap/<SID>/wily/bin

./EMCtrl.sh (start|stop|help)

status     - status of the Enterprise Manager
start      - start Enterprise Manager
stop       - stop Enterprise Manager
help       - lists these commands

Tuesday, 24 September 2013

Providing DB2 Support Info to SAP

See SAP note 83819 - DB6: Collecting support data

As <SID>adm or db2<SID>:

db2support <work_dir> -d <dbsid> -c -s -f

The end result is a db2support.zip file or around 12MB in the <work_dir>

Windows Server Uptime

To find the uptime of a Windows server without uptime.exe:

Open a command prompt

Type "net statistics server"

The line that starts "Statistics since …" shows the date and time the server was last restarted.

(The command can be shortened to "net stats srv".)

On Windows 2008:

SystemInfo | find "Boot Time"

Returns:
System Boot Time: 02/03/2014, 00:06:12

(Windows Task Manager also shows uptime in Windows 2008)

Tuesday, 17 September 2013

DB2 Notes

Log In To DB2 As a Specific User

db2 CONNECT TO <database> USER <user ID> USING <password>

To bring a database out of backup pending mode

Ensure DB is offline
Run the following command:
db2dart <dbname> /CHST /WHAT DBBP OFF
Info from here:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/core/r0003477.htm


Create or Copy a Table

  1. CREATE TABLE <schema>.<new table name> LIKE <schema>.<existing table name>
  2. INSERT INTO <schema>.<new table name> SELECT * FROM <schema>.<existing table name>



Delete or Drop a Table

DROP TABLE <schema>.<table name>


Rename a Table

RENAME TABLE <schema>.<new table name> TO <new table name>



To see DB2 version

Run the following command at OS level:
db2level

Backups

To take an ad-hoc online backup

db2 "backup db <DBSID> online to /staging/area, /staging/area, /staging/area, /staging/area"

(The number of '/staging/area's governs the size of the dumped file.)

To take an ad-hoc offline backup

db2 "backup db <DBSID> to /staging/area, /staging/area, /staging/area, /staging/area"

(The DB2 default is to take offline backups. The number of '/staging/area's governs the size of the dumped file.)'


View DB2 backup history

To view the backup history in a decent, readable format:
db2 "select substr(comment,1,20) "TYPE", substr(start_time,7,2)||'/'||substr(start_time,5,2)||'/'||substr(start_time,1,4)||' '||substr(start_time,9,2)||':'||substr(start_time,11,2) "START", substr(end_time,7,2)||'/'||substr(end_time,5,2)||'/'||substr(end_time,1,4)||' '||substr(end_time,9,2)||':'||substr(end_time,11,2) "END", SQLCODE "ERROR" from sysibmadm.DB_history Where ENTRY_STATUS='A' and comment like 'DB2 BACKUP%'  group by substr(comment,1,20), start_time, end_time, SQLCODE order by end_time desc"

To view all of the backup histories:
db2 list history BACKUP all for <SID> 
To view all of the history since a certain date:
db2 list history BACKUP since 20130301 for <SID> 
To view the archive log history since a certain date:
db2 list history archive log since 20130301 for <SID>


Provide DB2 diagnostic info to SAP

Refer to following SAP note 83819 - DB6: collect support data

db2support <work_dir> -d <dbsid> -f

This produces a file called db2support.zip in the 'work_dir'



Find Schema Names in a DB2 Database

db2 select schemaname from syscat.schemata



List Tables in a DB2 Database

db2 list tables for schema sapsr3db
or
db2 select tabname from syscat.tables where tabschema = ''




Check the validity/consistency of a DB2 archive log file

db2cklog check

(more info here)


Find database size

 db2 "call get_dbsize_info(?,?,?,-1)"

  Value of output parameters
  --------------------------
  Parameter Name  : SNAPSHOTTIMESTAMP
  Parameter Value : 2015-04-30-08.55.09.658199

  Parameter Name  : DATABASESIZE
  Parameter Value : 1630123229184

  Parameter Name  : DATABASECAPACITY (total amount of disk space allocated)
  Parameter Value : 4276539830272

  Return Status = 0



To run a script file of DB2 commands

db2 -tvs <filename>.clp


Find DB2 startup time

db2 get snapshot for dbm | grep -i manager

            Database Manager Snapshot
Database manager status                        = Active
Start Database Manager timestamp               = 02/20/2015 18:13:27.587803
Remote connections to db manager               = 111
Remote connections executing in db manager     = 1
Local connections executing in db manager      = 0


Restart db2vend process cleanly

db2pd -db <db sid> -fvp lam1 term

(Note: use 'lam1' for 'log archive method 1')


Find more info on an error code

db2diag -rc <number including minus sign>


Find out if a database has more than one partition

db2pd -  -alldbpartitionnums


DB2 error ADM6017E


FUNCTION: DB2 UDB, buffer pool services, sqlbClnrAsyncWriteCompletion, probe:0
MESSAGE : ADM6017E  The table space "PSAPTEMPX" (ID "30") is full. Detected on
          container "/db2/SID/saptemp1/NODE0000/tempX/PSAPTEMPX.container000"
          (ID "0").  The underlying file system is full or the maximum allowed
          space usage for the file system has been reached. It is also possible
          that there are user limits in place with respect to maximum file size
          and these limits have been reached.

Refer to SAP note:
334608 - DB6: SMS tablespace ##(PSAPTEMP##) is FULL

Create an additional temporary tablespace with the same page size.

db2 list tablespaces show detail

Tablespace ID                        = 30
Name                                 = PSAPTEMPX
Type                                 = System managed space
Contents                             = Temporary data
State                                = 0x0000
   Detailed explanation:
     Normal
Total pages                          = 1
Useable pages                        = 1
Used pages                           = 1
Free pages                           = Not applicable
High water mark (pages)              = Not applicable
Page size (bytes)                    = 4096
Extent size (pages)                  = 8


db2 list tablespace containers for 30

            Tablespace Containers for Tablespace 30

Container ID                         = 0
Name                                 = C:\db2\SID\sapdatat
Type                                 = Path

Now create a new temporary tablespace on another disk with more freespace.
db2 "create temporary tablespace PSAPTEMPY PAGESIZE 4096 managed by system using ('D:\db2\SID\sapdatat')"

After the new temporary tablespace has been successfully created, you can delete tablespace PSAPTEMPX:

db2 "drop tablespace PSAPTEMPX"

Thursday, 15 August 2013

Default Passwords

Wily Introscope

Help: https://service.sap.com/~sapdownload/011000358700001995842008E/SAPISDOC02_0.pdf

Default URL: http://<server name>:6001

Username Password
Admin Admin89
Guest guest12


Default SAP Passwords

Details Client Username Password
RFC to SAP 000 OSS_RFC cpic
Comms user All SAPCPIC ADMIN
STMS user All TMSADM PASSWORD
STMS user All TMSADM $1Pawd2&
Earlywatch 066 EARLYWATCH SUPPORT
Admin user All SAP* PASS

Default Apache Tomcat Password

Login: http://localhost:8080/
Username Password
admin admin
(Note: Username is lower case)

Default SAP MaxDB Passwords

UsernamePassword
CONTROLcontrol
SUPERDBAadmin

Friday, 14 June 2013

Unix Commands And Info

Switch to 'root' User in SUDO

Type:
sudo su -

Prompt should change to reflect the fact you're now logged in as root.

If the following text appears, you don't have root access:



Email a File from Unix

To email a binary/data file from Unix use:
uuencode <filename> <name-to-call-attachment> | mail -s "Subject" <email address>

If uuencode isn't available the contents of a text file can be emailed from Unix:
mail -s "Subject" user@example.com(Note: The contents of the file appears in the body of the email message, not as an attachment)


Search for Files by Contents

To find a file based on its contents in Unix:
find . -name "*.txt" -exec grep -il "hello" {} \;

To scan all files in the current folder for particular text and return the filename:
grep -il "hello"
('i' = ignore case, 'l' = return file names of matches)



Find files and Delete Them

The following command finds files named 'trash' and then deletes them:
find . -name "trash" -exec rm {}\;



Find a file By Date

To find a file based on its date (in this case more than 365 days) and move it:
find . -mtime +365d -exec mv {} /new/destination/folder \;



Copy Hidden Files in Unix


The following command copies any hidden files (files starting with full stop, dot, '.') followed by any letter or number:

cp /path/to/source/.[a-zA-Z0-9]* /path/to/target/




Sort Directory Listing

(Tested on AIX)

To sort a directory listing in Unix:
ls -l | sort +4 -rn

Sorts the list by column 4 (file size) in reverse order (smallest files listed last).


See Who Is or Was on a Server

Type: last | more


Create Softlink (Symbolic link)

ln -s <destination folder> <alias>

The '-s' switch is required to link across filesystems.
More info here:
http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds3%2Fln.htm

Thursday, 13 June 2013

Register Content Server/SAP MaxDB In LMDB/SMSY

How To Register a Content Server/SAP MaxDB in LMDB/SMSY

(Info taken from SAP note 1794004)

Assume Solution Manager Diagnostic agent and Host Agent are installed on server. Host Agent needs to be at least patch 143.

Find Location of Database Tools Path

On Windows, open a command prompt and change directory to C:\Program Files\SAP\hostctrl\exe

Run the following command:
saphostctrl.exe -host <Content Server host> -user sapadm - -dbname <DB SID> -dbtype ada -function GetDatabaseProperties -dbuser <db user ID> -dbpass <db user password>

Enter password for sapadm user.

Locate line saying Database/DatabaseToolsPath=<Path>




Set Connection Details

Run the following command:
saphostctrl.exe -host <DB hostname> -user sapadm - -function ExecuteOperation -name SetupMaxDBCredentials SID=<DB SID> DatabaseToolsPath=<Path> USERNAME=<DB user ID> PASSWORD=<DB user password>

Enter password for sapadm user


If the line "FATAL: Close xuser entry failed:" appears in the reponse carry out the steps below:

  • Enter the following line to register a user:
  • xuser -u <DB user>,<Password> -d <DB SID> -n <DB hostname>
  • Enter the following line to ensure the user details have been saved:
  • xuser list
  • Re-run the previous saphostctrl command to set the connection details.



Test The Connection 

Enter the following command:
saphostctrl.exe -host <DB hostname> -user sapadm - -dbname <DB SID> -dbtype ada -function GetDatabaseStatus

Enter password for sapadm user



LMDB and SMSY

After restarting the host agent service the details of the Content Server or SAP MaxDB will be pushed to the LMDB of the configured SMD Agent.

The database's details will be visible in LMDB/SMSY after a few minutes.

Friday, 24 May 2013

Suspend Or Release All SAP Background Jobs

To Suspend All Currently Released SAP Background Jobs

Run SE38
Enter program name BTCTRNS1
Click Execute

This program has no selection screen. It just returns the screen below:

In SM37 the jobs go into status "Release/Suspended":


To Release All Currently Suspended SAP Background Jobs

Run SE38
Enter program name BTCTRNS2
Click Execute

This program has no selection screen. It just returns the screen below:

Friday, 17 May 2013

Adobe Document Services (ADS) Notes

To produce an example document from within SAP GUI to test the connection to Adobe Document Services (ADS):

Run SE38
Enter program name FP_TEST_00

Choose form FP_TEST_00
Click Execute
Enter a 'real' printer such as LP01 (as opposed to LOCL)
Click Print Preview

Document will appear embedded in SAP GUI



To Display Info About the Adobe Document Services (ADS) Service

Run SA38
Enter FP_FEATURE_TEST


Adding Extra Fonts to ADS

Create folder fonts under:
/usr/sap/<SID>/SYS/global/AdobeDocumentServices/FontManagerService
Create folder customer under fonts
Ensure that the <sid>adm user has read and write permission for the directory
Restart following services in NWA: ADS (com.adobe/AdobeDocumentServices), font manager and XML template

More info here.


Tuesday, 2 April 2013

PAL - Printing Assistant for Landscapes

Centrally administer SAP printers for a whole landscape with transaction PAL.

Requires RFCs to target systems

SAP doc on setting up PAL

(PAL is to SAP printing what CUA is to SAP users!)