Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ADMINISTRATION
FOR SAP -
HANDS-ON LABS
Page 1/104
Table of Contents
Basics .................................................................................................................................................. 6
Page 2/104
Hands-On Lab 6.2 Redirected Restore........................................................................................... 69
Hands-On Lab 9.2 Creating InfoCubes that use Column-Organized Tables .................................. 86
Page 3/104
Information about the VMware Image
To run the hands-on labs a VMware image is provided on the classroom computers.
Important note: If the VMware image is not yet started on your machine, please let the instructor
know to assist you. If you start the VMware image, you might be prompted to select Move or Copy. It
is very important that you select Move. Otherwise, the network settings on the VMware image will
not be correct and SAP will not start.
On the Linux VMware an SAP system with the name (<SAPSID>) N4S is installed. It is running on a
DB2 LUW database with the database name (<DBSID>) N4S.
The following table lists OS users and passwords for the VMware image:
OS-User Password
root (Linux Administrator) passw0rd
db2n4s (DB2 Instance Owner) passw0rd
n4sadm (SAP System Owner) passw0rd
sapn4s (SAP Connect User) passw0rd
Page 4/104
The following table lists users and passwords to log on to the SAP system N4S (client 001):
SAP-USER Password
bwuser passw0rd
sap* passw0rd
Page 5/104
Preparing the Hands-On Labs
Basics
The objective of each hands-on lab is described in this document. Each lab is aligned with
the topics covered within the boot camp.
Each hands-on lab consists of multiple exercises and each exercise contains at least one
task or question.
The questions are followed by hints that help to solve the exercise.
Commands that you have to enter will be written using the Courier New type.
Logon to the operating system with user root and password passw0rd.
Open a GNOME Terminal window.
Switch to user n4sadm (su n4sadm) and enter startsap.
Wait until the startsap command is completed. Please note, that depending on the speed of
the host server it can take some minutes for the SAP system to fully start.
Page 6/104
Unit 1 Basics
Objective:
Learn to work with the DB2 command line processor (CLP) and SAP transaction DBA Cockpit
to access the DB2 database
Questions:
(1) Which DB2 version and Fix Pack is installed on the system?
(2) How many applications are connected against database N4S? Use both DB2 CLP and
DBA Cockpit to get this information. Are there differences in the output provided by DB2
CLP and SAP?
(3) What is the command syntax for the BACKUP command? And what is the meaning of
SQL code SQL1024?
Hints:
Log on to n4shost as user root and open a terminal window (click on the GNOME
Terminal icon on the Linux desktop). In the Terminal window, switch to user db2n4s
(with command: su db2n4s)
Page 7/104
IMAGE 1 - GNOME TERMINAL
Page 8/104
Open SAP transaction code DBA Cockpit (alternatively, use ST04, DB02) to access the
DBA Cockpit.
On the Linux Terminal window, enter the following commands (as user db2n4s):
o To show the DB2 version, release and Fix Pack level of your DB2 instance use the
command db2level.
o To list all the connection applications on the DB2 system, use this CLP command:
db2 list applications
To list all the applications including the internal DB2 engine connections (like the
db2stmm) on the DB2 system, use this CLP command:
db2 list applications show detail
o The CLP online help can be used to see the command syntax for a DB2 command as
well as the description of a SQL message:
db2 \? backup
db2 \? SQL1024
In the DBA Cockpit, select database N4S, then Performance Applications (see
Image 4).
Page 9/104
IMAGE 4 DBA COCKPIT: APPLICATION SNAPSHOT
Objective:
Understand and access the different DB2 objects on the N4S system: Instance, database,
database directory, SAP schema.
Run SQL commands to get information about the tables in the database
Questions:
(2) Where is the DB2 instance home and which user is the DB2 instance owner?
Page 10/104
(3) What is the database name and where is the database directory?
(8) How many tables are in the entire database? And how many tables belong to the SAP
ABAP stack?
(10) Can you run a SQL command from within SAP DBA Cockpit?
Hints:
Page 11/104
o List the contents of /db2/N4S
ls l /db2/N4S
o Query the SAP table SVERS to see the SAP kernel release of system N4S:
db2 "select * from sapn4s.svers"
o Query the DB2 system catalog to get the total number of tables in the database as
well as the number of tables that belong to the SAP schema:
db2 "select count(*) from syscat.tables where type='T'"
db2 "select count(*) from syscat.tables where tabschema =
'SAPN4S' and type='T'"
Logon to SAP transaction DBA Cockpit (as user BWUSER): In the DBA Cockpit, select
database N4S, then Space Tables and Index Top Space Consumers and find the
largest tables in the database.
Please note: Depending on the uptime of the database, the transaction might not return
any data if the SAP collector did not run already.
Page 12/104
In the DBA Cockpit, go to Diagnostics SQL Command Line to execute SQL queries
from inside the SAP system
Page 13/104
Hands-On Lab 1.3 Security
Objective:
Questions:
(1) Where is the password file for SAP ABAP system users? What is the content of the file?
(2) What are the instance level authorities, and which OS groups are assigned to them?
Which OS users have which authorities on DB2 instance level?
(4) Does the user sapn4s hold DBADM authority on the database N4S?
(5) Can you get some of the information from the DBA Cockpit?
Hints:
Work as user n4sadm for this exercise. In the Gnome Terminal, you can go to File
Open Tab to open a second tab. In this tab, change to user n4sadm using the command:
su n4sadm).
Page 14/104
IMAGE 8 TERMINAL: OPEN A NEW TAB
o The password file dscdb6.conf for the SAP ABAP engine is located in the global
directory of the SAP instance:
ls l /usr/sap/N4S/SYS/global/dscdb6.conf
o The password file contains entries for the two users n4sadm and sapn4s (plus a
timestamp):
cat /usr/sap/N4S/SYS/global/dscdb6.conf
o To map the DB2 authorities groups with the groups on the operating system, look at
both the /etc/group and /etc/password files:
cat /etc/group
cat /etc/passwd
o The authentication type of the database is set in the database configuration file:
db2 get db cfg for n4s | grep AUTHENTICATION
Page 15/104
o Query the AUTH_LIST_AUTHORITIES_FOR_AUTHID table function to see the
authorities of the sapn4s user.
You can run the SQL script /db2/db2n4s/scripts/admin/auth_list.clp to do so. The
script contains the following SQL:
SELECT varchar(AUTHORITY,25) User, D_USER, D_GROUP,
D_PUBLIC FROM TABLE
(SYSPROC.AUTH_LIST_AUTHORITIES_FOR_AUTHID ('SAPN4S', 'U')
) AS T ORDER BY AUTHORITY;
While you cannot check the OS security configuration settings from within the SAP
transaction, you can use the DBA Cockpit to see the configuration of the database
manager and the database:
Page 16/104
Hands-On Lab 1.4 Communication
Objective:
Understand the communication settings of the DB2 instance and how the SAP application
connects to DB2.
Questions:
(2) Is TCP/IP communication enabled on the DB2N4S instance? On which port is the
instance listening?
(3) How does the SAP application connect to the database via TCP/IP or IPC? Where is the
configuration file for the SAP application servers?
(4) Can you get some of the information also through the DBA Cockpit?
Hints:
Work in the Terminal window as user db2n4s. Use the following commands to get the
required information:
o The TCP/IP port for the communication with the instance is set in the instance
configuration:
db2 get dbm cfg | grep SVCENAME
Page 17/104
The service name sapdb2N4S is translated in the Linux system through the
/etc/services file:
cat /etc/services | grep sapdb2N4S
Switch to user n4sadm in the Terminal window for the next commands:
o To check if the SAP system is using the CLI driver or the traditional DB2 client you
could run
R3trans d
Open the trans.log file created by R3trans in your current directory and search for
the word driver.
o The configuration for the communication between SAP application servers and DB2
database via CLI driver is located in the global SAP directory:
cat /sapmnt/N4S/global/db6/db2cli.ini
You cannot check the OS communication configuration settings from within the SAP
DBA Cockpit transaction. However, you can use the DBA Cockpit to see the CLI (client)
configuration as well as the configuration of the database manager and the DB2
Registry:
Page 18/104
IMAGE 10 DBA COCKPIT: CLIENT CONFIGURATION
Page 19/104
IMAGE 12 DBA COCKPIT: REGISTRY SETTINGS
Page 20/104
Hands-On Lab 1.5 DB2 Process Model
Objective:
Understand the DB2 process model and list the different DB2 threads (EDUs)
Learn how different settings in the instance configuration can influence the number of DB2
agents
Questions:
(1) List all threads of the DB2 engine. How many DB2 TCP/IP communication managers do
you see? What is the PID of the db2sysc process?
(3) How many DB2 agents will be created initially and how many DB2 agents will be pooled?
(4) How many threads defined for reading and writing of pages from/to buffer pool? Can
you influence the number of these threads?
(5) In the N4S SAP system, how many work processes are defined? Do you see DB2 threads
corresponding to each SAP work process?
(6) Can you use an application to find the process ID of the SAP disp+work process for a
given DB2 connection?
Hints:
Work in the Terminal window as user db2n4s. Use the following commands to get the
required information:
o To list all threads (EDUs) of the DB2 engine, use the db2pd edus command.
Page 21/104
o The output of db2pd edus will also provide you with the PID of the db2sysc, the
number of DB2 TCP/IP communication managers (search for db2tcpcm) and the
db2agents
o Look for the db2pclnr (page cleaner) and db2pfchr (prefetcher) EDUs. The number
of cleaners and prefetchers are determined by database configuration parameters
NUM_IOCLEANERS and NUM_IOSERVERS.
Transaction code SM50 will provide you with a list of SAP work processes. If you are
already in another transaction (like DBA Cockpit), you have to enter /nsm50 in the SAP
GUI (or /osm50 to open a new session).
Page 22/104
IMAGE 14 DBA COCKPIT: LIST ALL CONNECTIONS
Page 23/104
Double-click on one of the application handles to access the application snapshot. Then
choose the tab Assigned Agents:
You can map the PID using ps ef | grep <PID> and the TID using db2pd
edus |grep <TID>
Page 24/104
Hands-On Lab 1.6 Configuration
Objective:
Learn how to get configuration settings of the DB2 database and instance
Understand how you can change parameters using the DBA Cockpit
Questions:
(1) What are the settings of the DB2 registry? Which parameter influences almost all
settings in the registry?
(2) Using DB2 CLP: What is the current (memory) value of the database configuration
parameter SORTHEAP?
(3) Using DBA Cockpit: What is the path for the DB2 diagnostic information (DIAGPATH)?
(4) Increase the size of the catalog cache of the database using the DBA Cockpit. Is this
change immediately propagated to the database? How about a change of the log buffer
size?
Hints:
Work in the Terminal window as user db2n4s. Use the following commands to get the
required information:
o To see the current value of the database configuration parameter SORTHEAP, issue
the following commands:
db2 connect
Page 25/104
db2 get db cfg for n4s show detail
db2 terminate
Alternatively, you can use db2pd to get the same information without the need to
connect to the database:
db2pd db n4s dbcfg
Page 26/104
Click on "Change
Page 27/104
Deferred and current
value are both 12800
o The size of the log buffer is determined by database parameter LOGBUFSZ. It is one
of the few parameters in the database configuration that cannot be changed online
(i.e. it requires a restart of the DB2 database to activate the change). After the
change in the DBA Cockpit you will notice the new value is listed as Deferred
Value.
Page 28/104
Hands-On Lab 1.7 Memory Model
Objective:
Understand the DB2 memory model and which commands to use to see the overall memory
usage of the DB2 instance.
See which parameters are influenced by the self-tuning memory manager (STMM)
Questions:
(1) How much memory is the DB2 instance allowed to use? What is the high-water mark
usage?
(2) Can you increase the memory usage limit for DB2 online?
(3) How much memory is currently used by the DB2 database N4S? Which memory pool is
the largest consumer of database memory?
(5) How many buffer pools does the N4S database have and what is the size?
Hints:
o Use command db2pd dbptnmem to get the required information about the
memory limit as well as the HWM of the DB2 partition.
Page 29/104
db2 terminate
Double-check with db2pd dbmcfg | grep INSTANCE
o The memory usage of the DB2 database can be seen in the output of db2pd
dbptnmem (search for DB-N4S).
o To see which memory sets are using the most memory inside database memory,
you can use the db2pd db n4s mempools command. Alternatively, you can
use db2top m
Use the DBA Cockpit for the next steps. Using Configuration Database will show
that STMM is enabled on the database.
Page 30/104
The defined buffer pools can be seen with Configuration Buffer Pools. The
database N4S has only one user buffer pool; the size is tuned by STMM (Size is set to
Automatic):
The different memory areas of DB2 can be listed in the DBA Cockpit via Performance
Memory:
Page 31/104
Unit 2 Storage Management
Objective:
Learn how to use DB2 CLP and DBA Cockpit to access information about the DB2 tablespaces
and containers.
Questions:
(1) Using CLP: Which SQL can you use list all tablespaces and see the extent size in the N4S
database? Is there an alternative command to access the information?
(2) Using CLP: Which containers are defined for tablespace N4S#FACTD?
(3) Using CLP: Which information is provided in the tablespace snapshot? Can you see the
MAXSIZE of tablespace SYSCATSPACE?
(4) Using DBA Cockpit can you see whether any tablespace in N4S is not using automatic
storage management?
(5) What is the largest tablespace in the database? What is the total size of the database?
(6) How many storage group paths are defined on database N4S?
(7) Can you increase the size of tablespace N4S#FACTD? Create a new tablespace
N4S#MYTS as a DMS tablespace can you increase the size for this tablespace?
Page 32/104
Hints:
Work in the Terminal window as user db2n4s. Use the following commands to get the
required information:
o You can query the MON_TBSP_UTILIZATION view to access information about the
tablespaces of the database. Use the SQL script /db2/db2n4s/scripts/admin/
tbsp_utilization.clp to do so.
The script contains the following SQL:
select substr(tbsp_name,1,16) as tbsp_name, tbsp_type,
substr(tbsp_page_size,1,6) as page_size,
substr(tbsp_extent_size,1,2) as extent_size,
tbsp_utilization_percent from
sysibmadm.mon_tbsp_utilization;
Alternatively, you can use the db2pd db n4s tablespaces command to
retrieve similar information
o To list all containers for a given tablespace you can query the
MON_GET_CONTAINER table function. Use the script /db2/db2n4s/scripts/admin/
mon_get_container.clp.
The script contains the following SQL:
select tbsp_name, container_name, fs_total_size,
fs_used_size from table(mon_get_container('N4S#FACTD',-
1));
o The snapshot for the tablespaces will list the tablespace parameters like MAXSIZE:
db2 get snapshot for tablespaces on n4s | more
and search for Maximum tablespace size
o Using Space Tablespaces we see that all tablespaces in N4S are using
automatic storage:
Page 33/104
IMAGE 25 DBA COCKPIT: TABLESPACES
o You can find the largest tablespace by sorting the output by KB Total
o Using Space Database you can see the size of the database (and also the
growth rates). Use the time frame Ad-hoc to bypass the data collection
framework and look at the current size:
o Using Space Automatic Storage we see that database N4S has one storage
group IBMSTOGROUP with four storage paths:
Page 34/104
IMAGE 27 DBA COCKPIT: STORAGE GROUPS
Click on Change
Page 35/104
IMAGE 29 DBA COCKPIT - CHANGE TABLESPACE PARAMETERS
o You can use the DBA Cockpit to create a new tablespace N4S#MYTS on the
database. If you choose managed by database you have to provide the name and
size of the tablespace containers. Once created, you can change the size of the
tablespace by adding containers or change the size of the existing one.
Page 36/104
o To add a tablespace, just click on the Add Tablespace button in the tablespace
overview in DBA Cockpit. A popup window similar to the following example will
appear:
Choose DMS
Move to the tab Containers and fill in the necessary information for the size and
location of the container. Then click on Add and hit enter in the next screen.
Page 37/104
The newly created tablespace will be now listed on the DMS/SMS Tablespaces tab:
When you click on Change for this tablespace you will notice that you have more
options, for example to add another container:
Page 38/104
IMAGE 35 DBA COCKPIT: DELETE A TABLESPACE
Page 39/104
Hands-On Lab 2.2 Manage Tablespaces and Storage
Objective:
Questions:
(1) How do you add a storage path to an existing storage group? Will the new path be used
immediately?
(2) Can you easily reduce the high-water mark of a DB2 tablespace?
Hints:
As user db2n4s make sure the new storage path exists on the database server by
running the following command:
ls /db2/N4S/sapdata5
Page 40/104
Click on Change to add a
new storage path
o Click on Change on the IBMSTOGROUP storage group. In the new window, click on
Add to add the new storage path /db2/N4S/sapdata5 and then click on Save:
o The storage group will now show five storage paths. You will see that the new
storage path is created but Not_in_use:
Page 41/104
IMAGE 38 DB02: AUTOMATIC STORAGE AFTER CHANGE
o A new storage path will only be used by DB2 once needed, i.e. because the other
storage paths are full and DB2 cannot grow containers any further. You can also
force DB2 to use a new storage path by rebalancing a tablespace.
Page 42/104
IMAGE 40 START REBALANCE OPERATION
o You can monitor the progress on DB2 CLP level by running a db2pd util rep
o Alternatively, you can run a tail on the db2diag.log as db2n4s user run
db2diag f. You will see messages like the following example:
Page 43/104
IMAGE 42 DB2DIAG.LOG - ADM6062I MESSAGE
o In the DBA Cockpit you will notice that the N4S#CLUI tablespace has now five
containers; also the storage path will now be listed as In Use:
Page 44/104
IMAGE 44 DBA COCKPIT: STORAGE GROUP WITH 5 PATHS
Page 45/104
Unit 3 Table and Index Maintenance
Objective:
Learn how to monitor and influence the automatic maintenance feature of DB2.
See how you can analyze single tables in the DBA Cockpit to get information about statistics,
table structure or compression state.
Use the DBA Cockpit to define a new maintenance policy for REORG.
Questions:
(1) Can you see the queue of the automatic table maintenance of the DB2 database?
(2) Does the N4S SAP database use the virtual table functionality?
(4) Does the database N4S have tables marked as VOLATILE? Do they have current
statistics?
(5) Is an automatic REORG policy implemented on database N4S? Can you see the policy on
CLP level?
Hints:
Page 46/104
o As of DB2 10 you can see the queue for the automatic maintenance feature of DB2.
Go to Space Automatic Maintenance Queue / RTS Requests to see if there are
any outstanding requests for RUNSTATS or REORG:
o To get information about a specific table, you can go to Space Single Table
Analysis. For example, table SAPN4S./BIC/AODSBENCH00 is row-organized, has
around 2 million rows (cardinality) and is compressed with a compression rate of
73%:
Page 47/104
IMAGE 46 DBA COCKPIT: SINGLE TABLE ANALYSIS
o Database N4S was installed using the virtual table functionality. You can see all
virtual tables with Space Virtual Tables
Page 48/104
IMAGE 47 DBA COCKPIT: VIRTUAL TABLES
o As every SAP DB2 database, N4S has a couple of tables that are marked as
volatile. These tables will not be considered by automatic RUNSTATS. The DBA
Cockpit will list these tables under Configuration Special Tables Regarding
RUNSTATS:
Page 49/104
IMAGE 48 DBA COCKPIT - VOLATILE TABLES
Page 50/104
IMAGE 49 DBA COCKPIT: CONFIGURE AUTOMATIC REORG
o On DB2 CLP level, you can double-check the reorg policy by running the following
command as user db2n4s:
db2 "call sysproc.automaint_get_policyfile('AUTO_REORG',
'policy.xml')"
This will create a XML file located in /db2/db2n4s/sqllib/tmp. The file created could
then be adapted to your specific needs and implemented as a new policy by using:
db2 "call sysproc.automaint_set_policyfile('AUTO_REORG',
'policy_new.xml')"
Page 51/104
Unit 4 Log File Management
Objective:
Questions:
(1) How many primary and secondary logs are defined for the N4S database?
(2) Looking at your configuration, would you be able to recover the table at a specific point
in time?
Hints:
You can use either the DB2 CLP or the DBA Cockpit to see the configuration of database
N4S.
o To check the settings for LOGPRIMARY and LOGSECOND on DB2 CLP use:
db2 get db cfg for n4s | grep Number | grep LOG
o To check the settings for the log archiving on database N4S, run:
db2 get db cfg for n4s | grep LOGARCHMETH
Database N4S is running in circular logging, as both parameters are set to OFF;
therefore only offline backups are possible and the database does not support a
point in time recovery
Page 52/104
Hands-On Lab 4.2 Enable Archival Logging
Objective:
Tasks:
(1) We will use database SAMPLE for this hands-on lab. Catalog the database on both the
DB2 database directory as well as in the SAP DBA Cockpit
Hints:
First, on DB2 CLP, check whether the SAMPLE database is already cataloged in the
database directory. The output of db2 list db directory should like this:
Page 53/104
IMAGE 50 OUTPUT OF DB2 LIST DB DIRECTORY
Activate the SAMPLE database and invoke the stored procedure db2sap:
db2 activate db sample
db2 connect to sample
db2 invoke db2sap
db2 terminate
Now, we have to add the database SAMPLE in the DBA Cockpit. Go to System
Landscape tab and click on Add:
Page 54/104
IMAGE 51 DBA COCKPIT: SYSTEM LANDSCAPE
Enter the necessary information in the Add System Entry window. Use SAMPLE as
the System name; then select Remote Database Connection, enter the database name
SAMPLE and click on the symbol to create a new connection:
Page 55/104
A new screen Add connection entry will appear.
In this screen, enter exactly this information:
Page 56/104
After saving the new DB connection, you will be back in the System Entry screen.
Select all Collector Options.
Page 57/104
IMAGE 55 DBA COCKPIT INTEGRATE A SYSTEM 4
Back in the System Landscape you should now see both connections:
To select the SAMPLE database click on the system name on the left upper corner
and select SAMPLE:
Page 58/104
Image 57 DBA Cockpit - Select SAMPLE
Page 59/104
IMAGE 59 DBA COCKPIT: CHANGE OF LOGARCHMETH1 (2/2)
Alternatively, you can change the configuration using the DB2 CLP:
db2 update db cfg for sample using logarchmeth1
disk:/db2/SAMPLE/archive
Exit the DBA Cockpit by clicking on the yellow arrow (or press Shift+F3)
Go back to the Terminal window and continue as user db2n4s on the DB2 command
line.
Page 60/104
o Try to connect now:
db2 connect to sample
this should fail with a message SQL1116N at this point saying that the database
is in BACKUP PENDING state.
o You need to take a full offline backup to get the database to a normal state. And
you have to do this through CLP:
First, create your backup directory (mkdir /db2/SAMPLE/backup).
Now start the offline backup with
db2 backup db sample to /db2/SAMPLE/backup
o Once the backup has finished successfully you can now activate the database again:
db2 activate db SAMPLE
o Running db2diag f will show that the log file archive operation was successful.
Page 61/104
Unit 6 Backup and Recovery
Objective:
Learn how to use the DB2 RECOVER command to restore and roll-forward a database.
Tasks:
(1) Use the DBA Cockpit (DB13) to schedule an online backup of the SAMPLE database and
check that the backup finishes successfully.
(4) Check the archive directory, notice that you have a directory created for your log chains.
(5) Run db2ckbkp on the latest backup image to confirm that it is usable for recovery.
(6) Use the RECOVER command to restore the database to the point of the second update
statement from step 2.
(7) Connect to the database SAMPLE and query the EMPLOYEE table.
(8) Check the archive directory again. Notice that a new log chain directory is created.
Page 62/104
Hints:
Make sure to use the SAMPLE database for this exercise. In the DBA Cockpit, go to the
DBA Planning Calendar ( Jobs DBA Planning Calendar). Make sure, that you have
selected database SAMPLE:
o In the Action Pad in the right corner, select Database Backup to Device and
double-click on the action. A new window Schedule a New Action will appear:
Page 63/104
IMAGE 61 DB13 - SCHEDULE ONLINE BACKUP
o Back in the calendar you can monitor the backup operation (alternatively, you can
go to the DB2 CLP and run db2pd util).
o Once the backup has finished, the Planning Calendar should look similar to this
screenshot:
Page 64/104
IMAGE 62 DB13 - SUCCESSFUL BACKUP
Now logon as user db2n4s and work on the DB2 command line. Connect to the SAMPLE
database
db2 connect to sample
Page 65/104
IMAGE 63 CLP: RUNNING PIT_RECOVERY.CLP SCRIPT
Probably the DBA Cockpit is still connected and needs to be forced off of the database
with the FORCE APPLICATION command:
Page 66/104
IMAGE 64 CLP: FORCE APPLICATION
Check the archive directory that you have configured in lab 4.2. You will notice that a
directory C0000000 was created automatically for log chain 0:
ls /db2/SAMPLE/archive/db2n4s/SAMPLE/NODE0000/LOGSTREAM0000
Run the db2ckbkp command on the latest backup image to confirm that it is usable for
recovery:
ls ltr /db2/SAMPLE/backup/
db2ckbkp /db2/SAMPLE/backup/<most recent backup filename>
Now start the RECOVER command. Make sure to roll forward to the point in time
returned after the second update statement from the pit_recovery.clp script (the
timestamp has the format yyyy-mm-dd-hh.mm.ss.nnnnnn).
db2 terminate
db2 deactivate db sample
db2 "recover db sample to <timestamp taken after second
update statement>"
Page 67/104
Once the RECOVER command has finished successfully, activate and connect to the
SAMPLE database:
db2 activate db sample
db2 connect to sample
When you query the EMPLOYEE table, you will notice that only the first two updates
were recovered (as intended by providing the point in time):
db2 select empno, firstnme from employee
Check the archive directory again. Notice that a new log chain directory was created:
ls /db2/SAMPLE/
archive/db2n4s/SAMPLE/NODE0000/LOGSTREAM0000
Page 68/104
Hands-On Lab 6.2 Redirected Restore
Objective:
Tasks/ Questions:
(1) Use the DBA Cockpit to create a new DMS tablespace MYTS in the SAMPLE database.
(2) Create a redirected restore script for the SAMPLE database. Which tools can you use to
create this script?
(3) Change the location of the container of MYTS tablespace in the redirected restore script.
Why is MYTS the only tablespace where you can change the container layout?
(4) Perform a redirected restore using the RESTORE and ROLLFORWARD commands.
Hints:
Use the DBA Cockpit to create a new DMS tablespace MYTS in the SAMPLE database (
Space Tablespaces. Select the tab DMS/SMS Tablespaces and click on Add:
Page 69/104
IMAGE 66 DBA COCKPIT ADD TABLESPACE TO SAMPLE
Enter the tablespace name MYTS and Space Management By Database and leave the
other options unchanged.
In the Containers tab, click on the Add Container button and enter the following
information for the tablespace container:
Name: /db2/SAMPLE/db2n4s/NODE0000/SAMPLE/MYTS/C0000000.LRG
Size: 4000 KB
Page 70/104
Click on Add and answer the question with Yes:
You will now see the new DMS tablespace for database SAMPLE:
Page 71/104
Now, log on as user db2n4s on a Linux Terminal. Deactivate the SAMPLE database and
force off any connections:
db2 deactivate db sample
db2 list applications for db sample
db2 "force application (<application handle>)"
Use the brdb6brt command (part of the SAP kernel) to execute an offline backup of
database SAMPLE. Together with the offline backup the command can create a
redirected restore script (by using the bm BOTH option):
brdb6brt -s SAMPLE -bm BOTH bpt /db2/SAMPLE/backup
o Open the SAMPLE_NODE0000.scr file using vi (or any other editor) and look at the
different options. Search for the line containing the information for tablespace
MYTS. Change the container path from
/db2/db2n4s/SAMPLE/db2n4s/NODE0000/SAMPLE/MYTS/C0000000.LRG to
/db2/db2n4s/SAMPLE/db2n4s/NODE0000/SAMPLE/NEWTS/C0000000.LRG
Page 72/104
o After saving the change, start the redirected restore:
db2 tvf SAMPLE_NODE0000.scr
o Once the RESTORE has finished, perform a ROLLFORWARD to end of logs and stop
the rollforward operation afterwards:
db2 rollforward db sample to end of logs and complete
o Run the db2pd command to verify the new location of tablespace MYTS:
db2pd d sample tab[lespaces]
Page 73/104
Unit 7 Performance Monitoring and Tuning
Objective:
Use the DBA Cockpit to monitor key performance indicators in DB2 SAP environments.
Questions:
(1) How good is the quality of the buffer pool similar values for index and data?
(2) Which I/O times are reported for asynchronous I/O operations?
(3) Are the package cache and catalog cache sized sufficiently?
(6) Does the database have enough log space available? How about logging I/O?
Hints:
Use the DBA Cockpit for this exercise ( Performance Database). Make sure to
choose the database N4S. Choose Ad-hoc as the Time Frame. Go through the
different tabs to check the KPIs of database N4S.
Page 74/104
IMAGE 71 DBA COCKPIT: DATABASE PERFORMANCE
Objective:
Understand how to use the EXPLAIN facility to see SQL access plans.
See how you can use the index advisor to get recommendations on additional indexes.
Tasks/ Questions:
(1) What is the most expensive statement in the SQL cache of the N4S database in terms of
overall runtime (Coord. Statement Exec. Time)?
(2) Which statement is the most expensive in average (Avg. Coord. Stmt. Exec. Time)? Is
this statement executed often?
Page 75/104
(3) Highlight a query that is not a DB2 system catalog query and explain the statement.
Hints:
Use the DBA Cockpit ( Performance SQL Cache) for this exercise.
o By default, the statements are sorted by the Coord. Statement Exec. Time (overall
execution time for the statement). By clicking on the column Avg. Coord. Stmt.
Exec. Time) you can find the most expensive statement per execution.
o Highlight a query that is not a DB2 system catalog query and use the Explain to
see the access plan.
Page 76/104
IMAGE 73 DBA COCKPIT: EXPLAIN
o The SAP explain of the access plan is now displayed in the window:
o Go back to the SQL cache screen (by hitting the green back button or F3). Mark and
copy the SQL statement text.
Page 77/104
IMAGE 75 SELECT STATEMENT FOR INDEX ADVISOR
o Now, go to Diagnostics Index Advisor. Paste the copied SQL text in text box.
Then, click on Recommend Indexes. The DB2 Index Advisor will then propose new
indexes:
Page 78/104
Unit 8 Problem Analysis
Objective:
Run the DB2 INSPECT command to verify the consistency of a single table.
Tasks/ Questions:
(1) Use db2look to find the page and extent sizes defined for the SAP tablespaces.
(2) Run db2top in interactive mode for the N4S database. Can you see the quality of the
IBMDEFAULTBP buffer pool? Do you see any utility in progress?
(3) Use the DB2 INSPECT command to verify the integrity of table REPOSRC.
(4) Run command db2support to collect diagnostic data for the system. Which file is
created by db2support? Can you open this file? What does it contain?
Hints:
o The command options for the db2look to get information about the database layout
and write the output to a file are:
db2look d n4s l o db2look.out
Page 79/104
o Start db2top. In db2top, use b (Bufferpools) to get information about the
bufferpools of the database, including the quality. Use u (Utilities) to see if, for
example, RUNSTATS is running.
o Use INSPECT against table REPOSRC. The output file is in binary format and needs to
be transformed by using the db2inspf command:
db2 connect to n4s
db2 inspect check table name reposrc schema sapn4s
results keep inspect.dmp
cddump
db2inspf inspect.dmp inspect.out
vi inspect.out
Page 80/104
Hands-On Lab 8.2 Lock-wait Scenario
Objective:
Task/ Question:
(1) Create a lock-wait situation on the database and use the DBA Cockpit to monitor it. Is
there another tool available to get similar information?
Hints:
Open a second SAPGUI window with transaction SA38 (/osa38). Run the report
ZH9_LOCKWAIT.
In the DBA Cockpit, go to Diagnostics Lock Waits and Deadlocks. You will see the
lock wait created by the ABAP report:
Page 81/104
IMAGE 77 DBA COCKPIT - LOCK WAIT EVENTS
Page 82/104
IMAGE 78 DB6UTIL
Page 83/104
Unit 9 BLU Acceleration
Objective:
Questions:
(1) Is the DB2 installation of system SAP N4S currently supporting BLU Acceleration?
(2) How do you configure the DB2 instance (setting of intra-parallelism and query degree)
and DB2 database (configuration of sort memory) according to DB2 SAP best practices?
Hints:
Page 84/104
Take the setting of sort memory out of the self-tuning memory management. Which values
to use is largely depending on the available memory of the VMware image. Ask the lab
instructor whether you can increase the overall memory (and number of CPUs) of the image.
A change requires a reboot of the VMware image.
The overall memory limit of the DB2 instance (DBM CFG parameter INSTANCE_MEMORY) is
depending on the overall memory available on the VMware image. The values for SORTHEAP
and SHEAPTHRES_SHR (for the sort memory of the database) is then depending on the size
of INSTANCE_MEMORY.
The following table provides two different calculations for VMware images with 6 RAM and
12 GB RAM:
Page 85/104
Once SAP is available again, we can continue with the hands-on labs.
Objective:
Use the SAP dictionary to look at the storage parameters of column-organized tables and compare
the information to an InfoCube with row-organized tables.
Use the db2support tool on command line to retrieve DDL statements for InfoCube tables.
Tasks:
Call transaction RSA1 (Data Warehousing Workbench) and open the folder BI
Benchmark.
Page 86/104
Activate the context menu (right-click) of Benchmark InfoCube 01 (/BIB/BENCH01)
and choose Copy
Page 87/104
In the pop-up window, enter BLUCUBE01 as the InfoCube name and BLU
Benchmark InfoCube 01 as the comment. Leave the other field entries as they are
and continue with the Create button.
Page 88/104
Back in the RSA1 main menu, select Extras DB Performance Clustering.
Page 89/104
Save and activate the InfoCube.
You can now display the layout of the BLU Benchmark cube inside RSA1. From the
menu, choose Extras Information (logs/status).
Page 90/104
IMAGE 87 TRANSACTION RSA1 INFO SELECTION
Page 91/104
IMAGE 88 TRANSACTION RSA1 STATUS INFORMATION
Page 92/104
IMAGE 89 TRANSACTION RSA1 ABAP DICTIONARY
Examine the storage parameters of the table via the Database Utility as shown
below: From the menu go to Utilities Database Object Database Utility.
Page 93/104
IMAGE 91 TRANSACTION RSA1 DATABASE UTILITY DISPLAY STORAGE PARAMETERS
In the Storage parameters screen you will notice, that column-organized tables are
created with the keywords ORGANIZE BY COLUMN. Distribution keys (partitioning
keys) are tolerated but not supported yet in DB2 10.5 BLU acceleration.
Page 94/104
IMAGE 92 TRANSACTION RSA1 DATABASE UTILITY DISPLAY STORAGE PARAMETERS
Go back to the Status Information screen and repeat the steps for the E fact table
/BIC/EBLUCUBE01 and for one of the dimension tables /BIC/DBLUCUBE01*.
On the E fact table, of the many secondary indexes for row-organized InfoCube E
fact tables, only the unique P index remains. In the database, it is implemented as a
unique constraint on the column-organized table.
To compare with an InfoCube on row-organized tables, you can go back to
transaction RSA1. Double-click on InfoCube Benchmark InfoCube 01
(/BIB/BENCH01) and repeat the steps to look at the database tables in the ABAP
dictionary.
You can also retrieve the DDL for the BW tables on DB2 command line. For this,
work as user db2n4s and run the following command:
o db2look -d n4s -a -e -t "/BIC/EBLUCUBE01" "/B49/FBENCH01"
-o db2look.out
the file db2look.out will contain the DDL statements for both tables
Query the DB2 system catalog to see which tables are column-organized (column
TABLEORG of SYSCAT.TABLES):
Page 95/104
o SELECT TABNAME FROM SYSCAT.TABLES WHERE TABLEORG = C
Objective:
Learn how to use SAP report DB6CONV to convert existing SAP BW tables to column-
organized.
Tasks:
Call transaction SA38, enter DB6CONV in the Program field and execute (F8) the
report:
Page 96/104
IMAGE 94 DB6CONV SELECT NEW CONVERSION
Now select all BW Objects and then click on Conversion Queue. This will generate
a list of tables that will be converted to BLU:
Page 97/104
IMAGE 96 DB6CONV SELECT BW OBJECTS FOR CONVERSION
Page 98/104
Back in the New Conversion screen click on Save (CTRL+S):
Back in the DB6CONV main screen, you will now see the new BW conversion queue
in status PLANNED:
Page 99/104
IMAGE 100 DB6CONV PLANNED BW CONVERSION
Mark the line with the planned queue and click on Start Conversion:
Start the conversion immediately, with one conversion job (can be changed online
later):
Page 100/104
IMAGE 102 DB6CONV START BW CONVERSION SCREEN
In the DB6CONV main screen you will now see the queue in status RUNNING. In
the lower half of the screen you will see the tables that are part of the queue.
By selecting one of the tables and clicking on Conversion Log you can retrieve the
conversion log for the table.
Page 101/104
IMAGE 104 DB6CONV BW CONVERSION LOG
Depending on the speed of the VMware image, the DB6CONV can run for a while.
Page 102/104
Copyrights, Trademarks & Disclaimer
Copyright IBM Corporation, 2015 All Rights Reserved.
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., registered in many jurisdictions worldwide. Other product and service
names might be trademarks of IBM or other companies. A current list of IBM trademarks is
available on the Web at Copyright and trademark information at
www.ibm.com/legal/copytrade.shtml.
SAP, mySAP, SAP NetWeaver, SAP NetWeaver BI, SAP NetWeaver BW, SAP BW, SAP R/3,
SAP SCM, SAP SEM and other SAP products and services mentioned herein are trademarks or
registered trademarks of SAP AG in Germany and in several other countries.
More about SAP trademarks at.
http://www.sap.com/company/legal/copyright/trademark.asp
Microsoft, Windows, Windows NT and the Windows logo are registered trademarks of Microsoft
Corporation in the United States and/ or other countries.
UNIX is a registered trademark in the United States and other countries licensed exclusively
through The Open Group.
LINUX is a registered trademark of Linus Torvalds.
Intel and Pentium are registered trademarks and MMX, Itanium, Pentium II Xeon and Pentium III
Xeon are trademarks of Intel Corporation in the United States and/ or other countries.
Java and all Java- based trademarks and logos are trademarks of Sun Microsystems, Inc. in the
United States and/ or other countries.
Other company, product and service names may be trademarks or service marks of others.
Any discussion of OEM products is based upon information which has been publicly available and
is subject to change. The specification of some of the features described in this presentation may
change before the General Availability date of these products.
Information concerning non-IBM products was obtained from a supplier of these products,
published announcement material, or other publicly available sources and does not constitute an
endorsement of such products by IBM. Sources for non-IBM list prices and performance numbers
are taken from publicly available information, including vendor announcements and vendor
worldwide homepages.
Page 103/104
IBM has not tested these products and cannot confirm the accuracy of performance, capability, or
any other claims related to non-IBM products. Questions on the capability of non-IBM products
should be addressed to the supplier of those products.
Page 104/104