Sie sind auf Seite 1von 230

SAP NetWeaver ’04

Database Administration Guide

®
SAP on IBM DB2
Universal Database
for UNIX and
Windows

Document Version 1.02 – July 10, 2006


SAP AG
Neurottstraße 16
69190 Walldorf
Germany
T +49/18 05/34 34 24
F +49/18 05/34 34 20
www.sap.com

© Copyright 2004 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and
form or for any purpose without the express permission of SAP AG. other SAP products and services mentioned herein as well as their
The information contained herein may be changed without prior respective logos are trademarks or registered trademarks of SAP AG
notice. in Germany and in several other countries all over the world. All other
product and service names mentioned are the trademarks of their
Some software products marketed by SAP AG and its distributors respective companies. Data contained in this document serves
contain proprietary software components of other software vendors. informational purposes only. National product specifications may
vary.
Microsoft, Windows, Outlook, and PowerPoint are registered
trademarks of Microsoft Corporation. These materials are subject to change without notice. These materials
are provided by SAP AG and its affiliated companies ("SAP Group")
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, for informational purposes only, without representation or warranty of
MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, any kind, and SAP Group shall not be liable for errors or
xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, omissions with respect to the materials. The only warranties for SAP
Tivoli, and Informix are trademarks or registered trademarks of IBM Group products and services are those that are set forth in the express
Corporation in the United States and/or other countries. warranty statements accompanying such products and services, if any.
Nothing herein should be construed as constituting an additional
Oracle is a registered trademark of Oracle Corporation. warranty.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the SAP Library document classification: PUBLIC
Open Group.
Disclaimer
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, Some components of this product are based on Java™. Any code
VideoFrame, and MultiWin are trademarks or registered trademarks of change in these components may cause unpredictable and severe
Citrix Systems, Inc. malfunctions and is therefore expressively prohibited, as is any
decompilation of these components.
HTML, XML, XHTML and W3C are trademarks or registered
trademarks of W3C®, World Wide Web Consortium, Massachusetts Any Java™ Source Code delivered with this product is only to be used
Institute of Technology. by SAP’s Support Services and may not be modified or altered in any
way.
Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used Documentation in the SAP Service Marketplace
under license for technology invented and implemented by Netscape. You can find this documentation at the following Internet address:
service.sap.com/instguides

MaxDB is a trademark of MySQL AB, Sweden.


Terms for Included Open e. The Customer may distribute original or modified STLport
sources, provided that:
Source Software • The conditions indicated in the above permission notice
This SAP software contains also the third party open source software are met;
products listed below. Please note that for these third party products • The following copyright notices are retained when
the following special terms and conditions shall apply. present, and conditions provided in accompanying
permission notices are met:

SAP License Agreement for STLport Copyright 1994 Hewlett-Packard Company


SAP License Agreement for STLport Copyright 1996,97 Silicon Graphics Computer
between Systems, Inc.
Copyright 1997 Moscow Center for SPARC
SAP Aktiengesellschaft Technology.
Systems, Applications, Products in Data Processing Copyright 1999,2000 Boris Fomitchev
Neurottstrasse 16 Copyright 2001 SAP AG
69190 Walldorf
Germany Permission to use, copy, modify, distribute and sell this

( hereinafter: SAP ) software and its documentation for any purpose is


hereby granted without fee, provided that the above

and copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in

you supporting documentation. Hewlett-Packard Company

( hereinafter: Customer ) makes no representations about the suitability of this


software for any purpose. It is provided "as is" without
express or implied warranty.

1. Subject Matter of the Agreement


a. SAP grants Customer a non-exclusive, non-transferable, Permission to use, copy, modify, distribute and sell this

royalty-free license to use the STLport.org C++ library software and its documentation for any purpose is

(STLport) and its documentation without fee. hereby granted without fee, provided that the above

b. By downloading, using, or copying STLport or any portion copyright notice appear in all copies and that both that

thereof Customer agrees to abide by the intellectual property copyright notice and this permission notice appear in

laws, and to all of the terms and conditions of this supporting documentation. Silicon Graphics makes no

Agreement. representations about the suitability of this software for

c. The Customer may distribute binaries compiled with any purpose. It is provided "as is" without express or

STLport (whether original or modified) without any implied warranty.

royalties or restrictions.
d. Customer shall maintain the following copyright and Permission to use, copy, modify, distribute and sell this

permission notices on STLport sources and its software and its documentation for any purpose is

documentation unchanged: hereby granted without fee, provided that the above

Copyright 2001 SAP AG copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in
supporting documentation. Moscow Center for SPARC
Technology makes no representations about the 3. Exclusion of warranty
suitability of this software for any purpose. It is As the STLport is transferred to the Customer on a loan basis and
provided "as is" without express or implied warranty. free of charge, SAP cannot guarantee that the STLport is error-
free, without material defects or suitable for a specific application
Boris Fomitchev makes no representations about the under third-party rights. Technical data, sales brochures,
suitability of this software for any purpose. This advertising text and quality descriptions produced by SAP do not
material is provided "as is", with absolutely no indicate any assurance of particular attributes.
warranty expressed or implied. Any use is at your own 4. Limited Liability
risk. Permission to use or copy this software for any a. Irrespective of the legal reasons, SAP shall only be liable for
purpose is hereby granted without fee, provided the damage, including unauthorized operation, if this (i) can be
above notices are retained on all copies. Permission to compensated under the Product Liability Act or (ii) if caused
modify the code and to distribute modified code is due to gross negligence or intent by SAP or (iii) if based on
granted, provided the above notices are retained, and a the failure of a guaranteed attribute.
notice that the code was modified is included with the b. If SAP is liable for gross negligence or intent caused by
above copyright notice. employees who are neither agents or managerial employees
of SAP, the total liability for such damage and a maximum
Permission to use, copy, modify, distribute and sell this limit on the scope of any such damage shall depend on the
software and its documentation for any purpose is extent to which its occurrence ought to have anticipated by
hereby granted without fee, provided that the above SAP when concluding the contract, due to the circumstances
copyright notice appear in all copies and that both that known to it at that point in time representing a typical
copyright notice and this permission notice appear in transfer of the software.
supporting documentation. SAP makes no c. In the case of Art. 4.2 above, SAP shall not be liable for
representations about the suitability of this software for indirect damage, consequential damage caused by a defect or
any purpose. It is provided with a limited warranty and lost profit.
liability as set forth in the License Agreement d. SAP and the Customer agree that the typical foreseeable
distributed with this copy. SAP offers this liability and extent of damage shall under no circumstances exceed EUR
warranty obligations only towards its customers and 5,000.
only referring to its modifications. e. The Customer shall take adequate measures for the
protection of data and programs, in particular by making
2. Support and Maintenance backup copies at the minimum intervals recommended by
SAP does not provide software maintenance for the STLport. SAP. SAP shall not be liable for the loss of data and its
Software maintenance of the STLport therefore shall be not recovery, notwithstanding the other limitations of the present
included. Art. 4 if this loss could have been avoided by observing this
All other services shall be charged according to the rates for obligation.
services quoted in the SAP List of Prices and Conditions and f. The exclusion or the limitation of claims in accordance with
shall be subject to a separate contract. the present Art. 4 includes claims against employees or
agents of SAP.
Typographic Conventions Icons
Type Style Description
Icon Meaning
Example Text Words or characters quoted
Caution
from the screen. These include
field names, screen titles,
pushbuttons labels, menu Example
names, menu paths, and menu
options. Note
Cross-references to other
documentation Recommendation

Example text Emphasized words or phrases Syntax


in body text, graphic titles, and
table titles
EXAMPLE TEXT Technical names of system
objects. These include report Additional icons are used in SAP
names, program names, Library documentation to help you
transaction codes, table identify different types of information at
names, and key concepts of a a glance. For more information, see
programming language when Help on Help → General Information
they are surrounded by body Classes and Information Classes for
text, for example, SELECT and Business Information Warehouse on
INCLUDE. the first page of any version of SAP
Library.
Example text Output on the screen. This
includes file and directory
names and their paths,
messages, names of variables
and parameters, source text,
and names of installation,
upgrade and database tools.
Example text Exact user entry. These are
words or characters that you
enter in the system exactly as
they appear in the
documentation.
<Example Variable user entry. Angle
text> brackets indicate that you
replace these words and
characters with appropriate
entries to make entries in the
system.
EXAMPLE TEXT Keys on the keyboard, for
example, F2 or ENTER.
Contents

SAP Database Administration Guide: IBM DB2 Universal


Database for UNIX and Windows...................................................10
1 Introduction .......................................................................................10
1.1 About this Documentation .................................................................. 10
1.1.1 Who Should Use this Documentation .........................................................................10
1.1.2 How this Documentation is Structured........................................................................11
1.2 Naming Conventions ........................................................................... 12
1.3 End of Support of SAP DB2 Admin Tools .......................................... 13
1.4 Admin Tools: Enhancements and Changes....................................... 13
1.4.1 New Features..............................................................................................................16
1.4.2 Differences Between 4.6D and 6.NN Admin Tools.....................................................19
1.5 DB2 UDB for UNIX and Windows Version 7: Enhancements ........... 20
1.6 DB2 UDB for UNIX and Windows Version 8: Enhancements ........... 22
1.7 DB2 UDB for UNIX and Windows Version 8: Enhancements ........... 24
1.8 DB2 UDB for UNIX and Windows Version 8.2.2: Enhancements ..... 25
2 Basic Concepts .................................................................................26
2.1 Introduction .......................................................................................... 26
2.1.1 The SAP DB2 Admin Tools ........................................................................................26
2.1.2 User Interfaces............................................................................................................27
2.2 SAP Log File Management .................................................................. 28
2.2.1 Recovery - The Need for Log Files.............................................................................28
2.2.2 Recovering Log Files ..................................................................................................30
2.2.3 Log File Life Cycle (Archive and Restore) ..................................................................31
2.2.4 Log File Deletion .........................................................................................................34
2.2.5 Protocols .....................................................................................................................36
2.2.6 Raw Device Log Files .................................................................................................36
2.2.7 Log File States ............................................................................................................37
2.2.8 Special Cases - Non-Standard Behavior of Database Systems ................................38
2.3 SAP Security Concept ......................................................................... 39
2.4 Multi-Partitioned Systems ................................................................... 40
3 Installation and Setup.......................................................................41
3.1 Introduction .......................................................................................... 41
3.2 SAP System Environment ................................................................... 43
3.2.1 SAP System Users and Groups .................................................................................43
3.2.2 User Environment .......................................................................................................45
3.2.3 Access Authorizations for Admin Tool-Related Directories ........................................46
3.3 Installing the Admin Tools Manually .................................................. 47
3.3.1 Prerequisites for the Admin Tools Installation ............................................................48
3.3.2 General Information ....................................................................................................50
3.3.3 Upgrading the Admin Tools ........................................................................................50
3.3.4 Installing the Latest Admin Tools................................................................................51
3.3.5 Checking the Admin Tools Environment ....................................................................52
3.3.6 Actions Performed by the sddb6ins Program .............................................................53

6 July 2006
3.3.7 Special Configurations ................................................................................................57
3.3.8 Enabling the Database for Rollforward Recovery.......................................................57
3.3.8.1 Enabling Rollforward Recovery for a Single-Partitioned Database ......................58
3.3.8.2 Enabling Rollforward Recovery for a Multi-Partitioned Database.........................59
3.3.9 Deinstalling the Admin Tools ......................................................................................60
3.4 Installation and Setup of the DB2 Control Center Extensions ......... 60
3.4.1 Installation of the DB2 Control Center ........................................................................61
3.4.2 Installing the DB2 Control Center Extensions ............................................................61
3.4.3 Setting Up the DB2 Control Center.............................................................................62
3.4.4 Using the DB2 Control Center Extensions .................................................................69
4 Configuration.....................................................................................70
4.1 Changing the Admin Tools Configuration ......................................... 70
4.1.1 Parameters Affecting Log File Management Storage.................................................70
4.1.2 Configuring the Admin Tools Using Environment Files ..............................................73
4.2 Configuring the System for Archiving Log Files ............................... 78
4.2.1 Archiving Directly to TSM ...........................................................................................80
4.2.2 Archiving Directly to Disk ............................................................................................81
4.2.3 Archiving to an Alternative Storage Management Product.........................................82
4.2.4 Indirect Archiving to Tape ...........................................................................................82
4.2.5 Indirect Archiving to TSM............................................................................................88
4.2.6 Indirect Archiving Using a Customer Script ................................................................89
4.3 Configuring TSM (Tivoli Storage Management)................................. 90
4.3.1 Configuring TSM Files dsm.opt and dsm.sys .............................................................91
4.3.2 Configuring TSM Environment Variables....................................................................92
4.3.3 Configuration Considerations .....................................................................................94
4.4 DB2 Configuration Parameters ........................................................... 95
4.5 Disk Space Considerations for Running the Admin Tools ............... 96
5 Regular Administration ....................................................................98
5.1 DB2 Log File Management .................................................................. 98
5.1.1 Archiving Log Files from Disk to Backend ..................................................................98
5.1.2 Deleting Log Files .....................................................................................................101
5.2 Storage Management ......................................................................... 103
5.2.1 Checking the Space Available in a File System .......................................................104
5.2.2 Checking the Space Available in a Tablespace .......................................................104
5.2.3 Checking the Size of Tables and Indexes ................................................................106
5.3 Performance Monitoring.................................................................... 107
5.3.1 Monitoring Database Performance ...........................................................................107
5.3.2 Monitoring Dynamic SQL Statements.......................................................................109
5.3.3 Updating Statistics for Database Tables and Checking for Reorganization.............109
5.3.4 Job Monitoring ..........................................................................................................110
5.4 Database Backup ............................................................................... 110
5.4.1 Backup Considerations.............................................................................................111
5.4.2 Performing the Backup .............................................................................................111
5.4.3 Integrity of Backups ..................................................................................................113
5.4.4 Frequency of Backups and Time Required ..............................................................113
5.4.5 Advanced Backup Techniques .................................................................................114
6 Advanced Tasks..............................................................................115
6.1 The db6util Tool.................................................................................. 115
6.2 Setting and Updating Passwords ..................................................... 116
6.3 Using the Journal in the DB2 Control Center Extensions .............. 116

July 2006 7
6.4 Advanced Log File Management Tasks ........................................... 117
6.4.1 Deleting Special Log Files ........................................................................................118
6.4.2 Deleting Tapes from the Admin DB ..........................................................................120
6.5 Reorganization of Tables and Tablespaces ..................................... 120
6.6 Redirected Restore ............................................................................ 122
6.6.1 Usage of Tool brdb6brt .............................................................................................123
6.7 Command Line Tasks Using db6clp................................................. 128
6.8 Monitoring Database Alerts............................................................... 130
6.9 Monitoring Lock Waits and Deadlocks............................................. 130
6.10 Managing Backups and Logs Archived on TSM............................ 131
6.11 The db2inidb Tool ............................................................................ 132
6.11.1 db2inidb Option: as mirror ......................................................................................133
6.11.2 db2inidb Option: as snapshot .................................................................................136
6.11.3 db2inidb Option: as standby for Backups ...............................................................138
6.11.4 db2inidb Option: as standby for Hot-Standby Database ........................................139
6.12 Dual Logging .................................................................................... 145
6.13 Adjusting the Content of the Admin DB ......................................... 145
7 Emergency Tasks............................................................................147
7.1 SAP Database Recovery.................................................................... 147
7.2 Log File Restore of the SAP Database ............................................. 148
7.3 Recovery of the Admin DB ................................................................ 153
7.3.1 General Information ..................................................................................................153
7.3.2 Recovery Process.....................................................................................................154
Appendix A: Tool Command Line Parameters................................157
brarchive - Log File Archive Tool............................................................ 157
brdb6brt - Redirected Restore Tool ........................................................ 160
brrestore - Log File Retrieval Tool .......................................................... 164
db2uext2 - DB2 User Exit......................................................................... 167
db6adutl - SAP TSM Management Tool.................................................. 168
db6util - Tool to Assist Database Administration.................................. 169
dmdb6bkp - Database Backup Tool........................................................ 170
dmdb6srp - Update Statistics Tool ......................................................... 172
dmdb6rts - Table Reorganization Tool ................................................... 173
sddb6ins - Admin Tools Installation Program ....................................... 174
sddb6mir - Admin DB Creation and Mirror Tool Utility ......................... 176
Appendix B: Troubleshooting...........................................................177
DB2 Traces ............................................................................................... 177
DB2 Trace Facility db2trc...................................................................................................177
DB2 CLI Trace ...................................................................................................................178
Admin Tools Traces ................................................................................. 179
Downloading Admin Tool Patches from SAP Service Marketplace ..................................180
Troubleshooting Admin Tools and Programs ....................................... 182
General Troubleshooting Comments.................................................................................182
Initial Troubleshooting Steps..............................................................................................183
Installation (sddb6ins) Troubleshooting .............................................................................183
User Exit Troubleshooting..................................................................................................184

8 July 2006
brarchive/brrestore Troubleshooting..................................................................................189
DB2 Control Center Extensions Troubleshooting..............................................................204
Collecting Diagnostic Information for SAP Support ...........................................................205
Appendix C: Implementation Details................................................206
Admin DB Structure ................................................................................. 206
brarchive and brrestore backend Library Architecture.......................................................210
DB2 Control Center Extensions Architecture........................................ 211
Appendix D: Example of File init<DBSID>.db6 ...............................212
File init<DBSID>.db6 on UNIX ................................................................. 212
File init<DBSID>.db6 on Windows .......................................................... 215
Appendix E: Example of Customer Script db6sctsm.smp.............221
Appendix F: References ....................................................................223
DB2 UDB for UNIX and Windows V7 - Additional Documentation ....... 223
DB2 UDB for UNIX and Windows V8 - Additional Documentation ....... 225
Glossary and Index ............................................................................227

July 2006 9
1 Introduction

1.1 About this Documentation


This documentation supplies information specific to the SAP environment and describes daily
administration tasks using both product tools and the SAP-specific administration tools. The
documentation is written based on DB2 UDB Version 7 as the underlying database release.
The concepts described in this documentation are also expected to apply to other DB2 for
UNIX and Windows database versions.
The information in this documentation has been collected from a variety of sources such as
previous administration documentations, SAP Notes and customer experience and gives the
administrator a single point of reference. The information is presented in a task-oriented way,
separating information frequently needed from that which the administrator only requires, for
example, in an emergency. It also includes a new troubleshooting section giving advice about
solving problems before contacting SAP, or what information to send to SAP if no solution
can be found.

The information provided in this documentation applies to all SAP kernel


releases starting from 3.1I and higher as well as IBM DB2 Universal Database
for UNIX and Windows Version 7 and higher.
If you would like to give feedback on this documentation, use the following email
address: feedback.db6@sap.com

1.1.1 Who Should Use this Documentation


This documentation is intended primarily for database administrators and SAP system
administrators who need to install and maintain an SAP system running on DB2 UDB for
UNIX and Windows. It is structured to be of use to both people new to database
administration and experienced SAP administrators alike, including those with experience
with other database products.
It will also be of use to a range of customer support functions when planning, installing, and
maintaining systems, or assisting in these tasks.

10 July 2006
1.1.2 How this Documentation is Structured
This documentation is divided into the following sections:

Chapters
...

1. Introduction
Provides general information about the guide, its targeted audience, interfaces, naming
conventions and new features.
2. Basic Concepts
Describes administration and Admin Tools and the related concepts, including DB2
UDB-specific information about installing and configuring servers and clients for the
SAP system.
3. Installation and Setup
Explains how to install Admin Tool patches and deal with upgrades. It also covers
manual (re)installation of the tools if required.
4. Configuration
Describes the available options and steps required to configure the Admin Tools.
5. Regular Administration
Lists and describes tasks that system administrators need to perform on a regular
basis such as storage administration, backup and log file management.
6. Advanced Tasks
Covers one-time or rarely needed tasks not related to configuration. Some tasks may
be prerequisites for other day-to-day tasks, which must be performed before log files
can be stored to tape.
Also includes monitoring and performance considerations.
7. Emergency Tasks
Tasks that administrators may need to perform after a database failure.

Appendices
A. Tool Command Line Parameters
Contains detailed command line syntax for each command.
B. Troubleshooting
Describes what to do when tools do not work as expected.
C. Implementation Details
Contains internal tool information, especially for support personnel.
D. Example of the File init<DBSID>.db6
E. Example of Customer Script db6sctsm.smp
F. References
G Glossary and Index

July 2006 11
1.2 Naming Conventions
Terminology

For information about terminology used in this documentation, see Glossary and
Index [Page 227].

Product Names
In this documentation the following naming conventions apply:
SAP Web Application Server / SAP system
SAP Web Application Server is referred to as SAP Web AS or SAP system. Additionally the
term SAP system also refers to other applications of mySAP.com.
IBM DB2 Universal Database for UNIX and Windows
IBM DB2 Universal Database for UNIX and Windows is referred to as DB2 UDB for UNIX and
Windows or DB2.
IBM DB2 Universal Database Enterprise Server Edition for UNIX and Windows
IBM DB2 Universal Database Enterprise Server Edition for UNIX and Windows is referred to
as DB2 UDB ESE for UNIX and Windows
single-partitioned system / EE system
The term single-partitioned system replaces the term EE system.
multi-partitioned system / EEE system
The term multi-partitioned system replaces the term EEE system.
6.NN Admin Tools / 6.10 Admin Tools
The term 6.NN Admin Tools replaces the term 6.10 Admin Tools, as these Admin Tools can
be used for any SAP system release starting from 6.10 and higher.
Tivoli Storage Management (TSM) / ADSM
The IBM storage product ADSM has been renamed to TSM (Tivoli Storage Manager) in the
most recent versions. The names are often used interchangeably, but in this documentation
the product is referred to as TSM. The term ADSM is normally only used in this guide to
indicate program parameters or configuration parameter names.

Tivoli (IBM) no longer supports the product ADSM. Customers still using ADSM
are strongly advised to upgrade to TSM Client Version 4.1 or higher.
Serious problems have occurred when using the Admin Tools with TSM Version
3.7. This version is also out of service now, so an upgrade is also strongly
advised.
Windows
The term Windows refers to Windows 95, Windows 98, Windows NT, or Windows 2000.
Servers can only be installed on Windows NT or Windows 2000. Clients can be installed on
any Windows platform.

12 July 2006
1.3 End of Support of SAP DB2 Admin Tools
With version 8.2, DB2 UDB for UNIX and Windows has introduced its own log file
management that replaces the SAP log file management tools (referred to as Admin Tools
throughout this document). Therefore, the SAP log file management tools are no longer
supported by:
• Version 9 and higher of IBM DB2 for Linux, UNIX, and Windows
• SAP Java only systems
• SAP systems based on SAP kernel releases 7.00 or higher
• New operating system platforms, for example, Linux AMD64/EM64T, Linux on Power,
Windows AMD64/EM64T or Solaris on AMD64.
• TheDB2 HADR feature.

If you are using DB2 UDB for UNIX and Windows version 8.2 or higher, we
recommend that you use DB2’s integrated log file management. The DB2 log
file management is supported for all SAP releases. For more information, see
the following documentation:
• IBM DB2 Universal Database for UNIX and Windows: New Log File
Management that is available on SAP Service Marketplace at
service.sap.com/instuidesNW2004s → Operations → Database-
Specific Guides
• DB2 documentation IBM DB2 Universal Database - Data Recovery and
High Availability Guide and Reference
• SAP Note 913481

1.4 Admin Tools: Enhancements and Changes


The following sections summarize recent changes to the Admin Tools.

Within these sections, we refer to the Admin Tools release and not the SAP
system release, which do not need to be the same.
For example, the 4.6D Admin Tools should be used on all SAP 3.1I to 4.6D
systems where DB2 UDB for UNIX and Windows Version 7 or higher is
installed. The 6.10 Admin Tools or higher should be used with all SAP system
releases above and including 6.10.

July 2006 13
The following changes are informational or not patch-specific:
• Installation Program sddb6ins
The command line syntax of sddb6ins has been simplified by extracting information
from the environment. The sddb6ins program now also contains the remaining Admin
Tools, which it installs. sddb6ins therefore no longer requires a separate
DBATOOLS.SAR file, and the shared library path environment variable must no longer
be set before starting it.
The Admin Tools installation program sddb6ins now checks many aspects of the
environment to locate the majority of problems experienced by customers. In the past a
difficulty with the Admin Tools has been the runtime environment. Admin Tools files
and directories may have been unintentionally removed or were given the wrong
ownership or authorizations; environment variables may have been set to non-existent
directories, and so on.
For more information, see Installing the Admin Tools Manually [Page 47].
• Admin Tools in an MCOD Environment
The Admin Tools have been modified to support this SAP feature. They are only
installed with the first SAP system, that is, only once per database. As log files are
shared by all the SAP systems using the same single database, user db2<dbsid> and
all <sapsid>adm users can perform log file management tasks.
It is necessary to differentiate between the SAP system ID <SAPSID> and the SAP
system database name <DBSID>, as these are no longer necessarily the same.
Additionally, user IDs and directory names may be affected. If <SAPSID> and
<DBSID> have the same value, as is often the case for the first SAP system installed
on a database, the old terminology still applies as described in the table below.
However, there is a limitation in SAP 4.6x releases, that the initial SAP system must
have the same ID as the SAP database. Further SAP systems have different IDs. The
database connect user for the first SAP system in a 4.6D system environment is still
sapr3.
If an MCOD system is removed, you must make sure that the db2<dbsid> user
environment still points to another valid MCOD system using the same database.
The following terminology conversions must be used:
SAP System and Database Name Descriptions
ID Old ID New ID
SAP system ID <SID>, <SAPSID>, <sapsid>
<sid>
SAP database <SID>, <DBSID>, <dbsid>
name <sid>

User ID Descriptions
User Old ID New ID
Database db2<sid> db2<dbsid>
instance owner
SAP database <sid>adm <sapsid>adm
administrator

14 July 2006
Database sapr3 sap<sapsid>
connect user

sapr3 is still used


for the first SAP
system in a 4.6D
system environment.

Directory Names Descriptions


Directory Old Name New Name
SAP system related <SID> <SAPSID>
directories
db2<dbsid> home <SID> <DBSID>
directory and
subdirectories

The following are examples of how the descriptions of directory names have
changed on UNIX systems compared to earlier versions of this documentation
on. If <SAPSID> and <DBSID> are the same, the real directory name after
substitution remains unchanged:
Old New
/usr/sap/<SID>/sys/exe/run /usr/sap/<SAPSID>/sys/exe/run
/db/<SID>/log_dir /db/<DBSID>/log_dir

If the original SAP system is removed, certain Admin Tools are no longer fully
functional. This restriction only applies to 4.6D SAP systems.
From SAP system Release 6.10 and higher, it is only necessary to verify that
the db2<dbsid> user is set up correctly. Use sddb6ins –checkonly to
verify this. This user may require changes to his environment.
For more information about released platforms and availability, see SAP Service
Marketplace at service.sap.com/mcod.
• 64-bit Support
The Admin Tools have been modified to work with 64-bit platforms.
Some changes were specifically implemented for the 4.6D and 6.NN Admin Tools and
delivered as patches. For more detailed information, see New Features [Page 16].
For information about the main differences between the 4.6D and 6.NN Admin Tools, see
Differences Between 4.6D and 6.NN Admin Tools [Page 19].

July 2006 15
1.4.1 New Features
This section provides information about new features that have been specifically implemented
for the 4.6D and 6.NN Admin Tools.

6.NN stands as a placeholder for all Admin Tools releases starting from 6.10
and higher.

New Features of 4.6D Patch 20 and 6.NN Patch 9


• brarchive/brrestore customer script interface
You can now write your own individual backend interface. For more information, see
Archiving Log Files from Disk to Backend [Page 98].
• Option brarchive –GAL/-DMP
You use this option to adjust the Admin DB to a file system. For more information, see
Adjusting the Content of the Admin DB [Page 145].
• Option sddb6ins –r
You use this option to recreate the Admin DB from a SAR file. For more information,
see Recovery of the Admin DB [Page 153].
• Support of two TSM management classes
The User Exit and brarchive can now archive log files to two TSM management
classes. For more information, see Archiving Directly to TSM [Page 80].
• Restore of log files excluding the Admin DB
The User Exit restores log files from log_archive or log_retrieve without any
information about those log files in the Admin DB. You activate this feature by setting
configuration variable DB2DB6_UEXIT_RETRIEVE_WO_DB in file init<DBSID>.db6.
• Admin Tools and DB2 Version 8
The Admin Tools are now supported for DB2 UDB for UNIX and Windows Version 8.

For more detailed information about 4.6D patch 22 and 6.NN patch 11, see SAP
Note 533979.

New Features of 4.6D Patch 22 and 6.NN Patch 11


• Option brarchive –dt
You use this option to delete tapes using the command line. For more information, see
Deleting Log Files [Page 101].
• Option brarchive –do
You use this option to delete obsolete log files using the command line. For more
information, see Advanced Log File Management Tasks [Page 117].

16 July 2006
• Support of TSM LANFREE
The Admin Tools have been modified to support the TSM LANFREE feature. You
activate this feature by setting configuration variable DB2DB6_TSM_MULTITHREADED
in file init<DBSID>.db6. For more information, see Configuring TSM (Tivoli Storage
Management) [Page 90].

For more detailed information about 4.6D patch 22 and 6.NN patch 11, see SAP
Note 597356.

New Features of 4.6D Patch 23 and 6.NN Patch 12


• Indirect archiving without accessing the Admin DB
If you are using indirect archiving, the User Exit is now able to archive without
accessing the Admin DB. The necessary tasks to update the Admin DB content are
moved from the User Exit to brarchive. You activate or deactivate this feature of the
User Exit by setting configuration variable DB2DB6_UEXIT_ARCHIVE_WO_DB to ON or
OFF.
Program sddb6ins automatically sets variable DB2DB6_UEXIT_ARCHIVE_WO_DB to
ON if during the installation of the Admin Tools the new version of transaction DB12 is
recognized by the Admin Tools.
• Archiving directly to disk
If you are using direct archiving, the User Exit is now able to archive log files directly
to disk. For more information, see Configuring the System for Archiving Log Files [Page
78].

For more detailed information about 4.6D patch 23 and 6.NN patch 12, see SAP
Note 597416.

New Features of 4.6D Patch 25 and 6.NN Patch 14


• Indirect archiving without accessing the Admin DB is now the default for all
releases.
Before mirroring, the sddb6mir tool also adds missing log files. This updates the
information in the old version of transaction DB12. Archiving without the Admin DB
causes fewer problems. For this reason, this is now the default for all SAP system
releases. To turn archiving without the Admin DB off, set
DB2DB6_UEXIT_ARCHIVE_WO_DB to OFF in the init file.

New Features of 4.6D Patch 27 and 6.NN Patch 16


• For 4.6D patch 27 and 6.NN patch 16, you must use TSM Version 4 or higher.
• TSM is now supported for Linux IA64 and Windows IA64.

HP-UX IA64 is not yet supported since the TSM API and client is not yet
available.
• To deinstall the Admin Tools, you can use sddb6ins –d.

July 2006 17
New Features of Other Administrative Tools
• Backup restore tool brdb6brt patch 12
If an incremental or delta backup was detected, option INCREMENTAL AUTOMATIC
was added.
• Backup restore tool brdb6brt patch 11
AutoStorage support was added.
• Backup restore tool brdb6brt patch 9
Option –nn ALL was added. With this option, you can create backups or the redirected
restore script for all database partitions with one call.
• Backup restore tool brdb6brt patch 5
{ New comments starting with SET IGNORE ROLLFORWARD
The script created by brdb6brt patch 2 or higher contains new comments
starting with SET IGNORE ROLLFORWARD. You might have to use this feature if
the log files contain information about container change operations and
the operations cannot be applied during the roll-forward recovery. This may
occur in a redirected restore scenario because the container layout is then
different to the one when the backup was made.
You activate this feature by removing the two dashes (−−) at the beginning of
the corresponding comment line.
{ Support of striped containers
Striped containers are created if you are using DB2 Version 7 and instance
registry variable DB2_STRIPED_CONTAINERS is set to ON. For DB2 Version 8,
this variable is set to ON by default.
{ Backup information in brdb6brt
brdb6brt automatically contains the information from the latest full backup. It
retrieves the information from the backup history file.
{ Option –bm RETRIEVE RELOCATE
You use this option to create scripts that can be used for database relocation.
These scripts can be used as a template in db2relocatedb with command
relocate DB or in db2inidb with command RELOCATE USING.

Option –replace <replace definition>


You use this option to modify the generated scripts for redirected restore and
relocation. For example, you can replace the database name <DBSID>.

For more detailed information about the current patch of brdb6brt, see SAP
Note 867914

18 July 2006
• DB2 Control Center Extensions patch 4:
{ You can now use the DB2 Control Center Extensions for the 4.6D and 6.NN
Admin Tools.
{ The DB2 Control Center Extensions have been modified to support the customer
script option of brarchive.
{ The DB2 Control Center Extensions are supported for DB2 UDB for UNIX and
Windows Version 8.

For more detailed information about patch 3 of the DB2 Control Center
Extensions, see SAP Note 703988.

1.4.2 Differences Between 4.6D and 6.NN Admin Tools


Since the implementation of the 6.NN Admin Tools, the main differences to the 4.6D Admin
Tools are:
• ADM<DBSID> database mirroring no longer required
In the past, the Admin DB ADM<DBSID> was mirrored to the SAP database to reduce
the risk of data loss. This has proven to be unnecessary. Thus, the program sdd6mir,
which was used to perform this action, is no longer required. When SAP system log
files are stored directly by the User Exit to TSM, the Admin DB is not required and so
no backup (mirror) of this database is needed. If log files are stored using brarchive,
a backup copy of the Admin DB is stored to the same medium as the log file(s) at the
end of each brarchive run. For more information about how to recover the Admin
DB, see Recovery of the Admin DB [Page 153].
This implies that the 6.NN Admin Tools delivery does not contain program sddb6mir
any more.
• New location for Admin Tools executables
To reduce the dependencies between the almost release-independent Admin Tools
and the release-dependent SAP products, the Admin Tools, their configuration,
protocol and trace files have been moved. This means that, for example, unlike Admin
Tool versions up to 4.6D, the 6.10 Admin Tools no longer need to be re-installed after
an SAP system upgrade.
For more information, see Installing the Admin Tools Manually [Page 47].

July 2006 19
The following table shows the location of the Admin Tools files and variables for 4.6D
and 6.NN:

4.6D 6.NN
Executables UNIX: UNIX:
and libraries: /usr/sap/<SAPSID>SYS/ <INSTHOME>/admintools/
exe/run bin
brarchive/
brrestore, Windows: Windows:
db6adutl, <drive>:\usr\sp\<SAPSID>\SYS\ <INSTHOME>\admintools\
libdb6* exe\run bin
Protocol files UNIX: UNIX:
/db2/<DBSID>/saparch <INSTHOME>/admintools/
/db2/<DBSID>/saprest protocols
Windows: Windows:
<drive>:\db2\db2<dbsid>\ <INSTHOME>\admintools\
saparch protocols
<drive>:\db2\db2<dbsid>\
saprest
Trace files UNIX: UNIX:
/tmp/TraceFiles <INSTHOME>/admintools/
TraceFiles
Windows:
<DB2DB6_TEMP_DIR>\ Windows:
TraceFiles <INSTHOME>\admintools\
TraceFiles
TSM UNIX: UNIX:
environment in.dbenv_<host>.csh/sh <INSTHOME>/admintools/
variables bin/dbaenv_<host>.csh/
Windows: sh
user environment
Windows:
user environment

1.5 DB2 UDB for UNIX and Windows Version 7:


Enhancements
The following are the major new features in Version 7.1 and Version 7.2, which are relevant
to the Admin Tools:

Version 7.1
• Closing the Active Log File after Backup
After an online backup is complete, DB2 forces the currently active log file to be closed
and as a result it will be archived. This ensures that an online backup has a complete
set of archived log files available for recovery.
For more information, see the IBM documentation DB2 Administration Guide:
Implementation

20 July 2006
• On Demand Log Archive Support
You can now force the currently active log file closed, which is then automatically
archived by DB2 if the User Exit is enabled. Database administrators are thus provided
with more granular control over their backup and restore strategy. For more
information, see the IBM documentation DB2 Administration Guide: Implementation.
• Log Limit Increased to 32 GB
The maximum size of (the sum of) all log files has been increased from 4 GB to 32 GB.
This enables applications to perform extremely large amounts of work within a single
transaction. For more information, see the IBM documentation DB2 Administration
Guide: Implementation.
• Renaming a Tablespace
When creating a tablespace, you specify its name. In previous versions, you were not
allowed to change that name again during the lifetime of the tablespace object. Now,
an administrator can rename a tablespace with the RENAME TABLESPACE statement.
For more information, see the IBM documentation DB2 Administration Guide:
Implementation.

Version 7.2
• Block Transactions When Log Directory is Full
DB2 Version 7.2 provides a new registry variable DB2_BLOCK_ON_LOG_DISK_FULL,
which is used to prevent disk full errors from being generated when DB2 cannot create
a new log file in the active log directory. DB2 attempts to create the log file every five
minutes and writes a message to file db2diag.log after each attempt. This file
indicates if your application is hanging.
For more information about the DB2 instance variable
DB2_BLOCK_ON_LOG_DISK_FULL, see the DB2 Release Notes.
• Suspended I/O
Supports continuous system availability, while allowing online split mirror handling of
the database. By momentarily suspending I/O to disk, DB2 will ensure that the split
mirror copy maintains its integrity. A new tool db2inidb has been created that
operates on split mirror copies.

If you want to use the db2inidb tool, we strongly recommend that you read
The db2inidb Tool [Page 132] before you start using it.
• Dual Logging
DB2 now has the capability to mirror the active log files to protect databases from
accidental deletion of an active log and data corruption caused by a hardware failure. A
new registry variable DB2_NEWLOGPATH2 instructs the database to write an identical
copy of the log files to a different path on a physically separate disk.

July 2006 21
• Parallel Recovery
DB2 now uses multiple agents to perform both crash recovery and database roll-
forward recovery. This may improve performance on SMP machines.
• Incremental and Delta Backups
There are two backup types supported:
{ Incremental backup:
Only contains pages that have been modified since the last full database or
tablespace backup.
{ Delta backup:
Only contains data that has changed since the last tablespace backup (full,
incremental, or delta backup).

1.6 DB2 UDB for UNIX and Windows Version 8:


Enhancements
All new features of DB2 UDB for UNIX and Windows Version 8 are described in the IBM
documentation IBM DB2 Universal Database Version 8 - What’s New.
This section briefly summarizes new features that affect log file management and database
administration in an SAP environment.

Logging Enhancements
• Dual Logging
Restrictions of this feature, which was introduced in DB2 Version 7.2, have been
removed. This feature is now supported on Windows as well. You can choose the
mirror log directory by setting database configuration parameter mirrorlogpath.
• Infinite Logging
It allows an active unit of work to span the primary logs and archive logs, effectively
allowing a transaction to use an infinite number of log files. Without infinite active log
enabled, the log records for a unit of work must fit in the primary log space. Infinite
active log is enabled by setting logsecond to -1. Infinite active logging can be used to
support environments with large jobs that require more log space than you would
normally allocate to the primary logs.

Be aware that if you activate this feature, rollbacks may take a long time if the
log files containing the rollback information need to be retrieved by the User
Exit. We strongly recommend that you use this feature only if you are using
direct archiving.
If you use indirect archiving, it is possible that the User Exit cannot retrieve
required log files for a rollback, because they have already been archived and
deleted from log_archive by brarchive. In addition, you should set the new
database configuration parameters MAX_LOG and NUM_LOG_SPAN to avoid that
transactions run indefinitely.

22 July 2006
• Block Transactions when Log Directory is Full
The block on log disk full function, which was introduced in DB2 Version 7, is now set
using database configuration parameter blk_log_dsk_ful.
• Increased Log Space
The maximum amount of log space, which can be defined, has increased from 32 GB
to 256 GB.

Backup and Recovery Enhancements


• XBSA Support
Backup can now interface with solutions from storage vendors that have implemented
the XBSA industry standard interface.
• Point in Time Rollforward Recovery to Local Time
When using point in time (PIT) rollforward recovery, you can now specify the time as
local time. This makes it easier to roll forward to a specific point in time and eliminates
potential errors due to the translation of local to GMT time.
• Database Maintenance Mode: QUIESCE
Using the new QUIESCE command, you can force all users off an instance or a
database and put it into a quiesced mode for database maintenance activities. The
quiesce mode of the database is ideal to create an offline backup without the need to
stop the SAP application servers.

Availability Enhancements
• Online Table Reorganization
Online table reorganization allows applications to access the table during the
reorganization. In addition, online table reorganization can be paused and resumed
later by anyone with the appropriate authorization by using the schema and table
name. Online table reorganization is allowed only on tables with type-2 indexes and
without extended indexes.
• Online Index Reorganization
A table and its existing indexes can be read and updated during an index
reorganization using the new REORG INDEXES command.
• Online Configuration Parameters
Over 50 configuration parameters can now be set online. Changes to these online
configuration parameters take immediate effect without the need to stop and start the
instance, or deactivate and activate the database. You no longer have to disconnect
users when you fine tune your system, which gives you more flexibility to decide when
to change the configuration.
• DMS Container Operations
If you use database-managed tablespaces, DB2 Version 8 will allow you to drop a
container from a tablespace, reduce the size of existing containers, and add new
containers to a tablespace in a way that a rebalance does not occur.

Usability Enhancements
DB2 Control Center and 64-bit Instances
The DB2 Control Center can now be used to administer 32-bit and 64-bit instances.

July 2006 23
1.7 DB2 UDB for UNIX and Windows Version
8.2: Enhancements
• Integrated log file management
With Version 8.2, DB2 has introduced its own integrated log file management. For
more information, see the document IBM DB2 Universal Database for UNIX and
Windows: New Log File Management that is available on SAP Service Marketplace at
service.sap.com/instuidesNW2004s → Operations → Database-Specific
Guides
• Automatic RUNSTATS:
With automatic statictics collection, you let DB2 determine, which statistics are required
by your workload and which statistics need to be updated. With AutoRunstats
enabled, DB2 will automatically run the RUNSTATS tool in the background to make sure
that the correct statistics are collected and maintained.
AutoRunstats replaces the former internal mechanism of SAP CCMS and is now
available for all SAP system releases. For more information, see SAP Note 860724
Configuration of CCMS Planning Calendar for AutoRunstats.
• Inclusion of transaction logs in backup images
When creating an online backup image, you can include the log files that are required
to restore and recover a database in the backup image. The advantages are as follows:
{ You only need the backup image to ensure the consistency of an online backup.
{ You do not have to decide any more which log files are required.
This feature is supported by dmdb6bkp. For more information, see dmdb6bkp –
Database Backup Tool [page 170].
• Self tuning backup and restore operations
DB2 automatically chooses the number of buffers, the buffer size, and the parallelism
settings for both backup and restore operations.
• New command for simplified database recovery
The new command for database recovery combines the functions of the RESTORE
DATABASE and ROLLFORWARD DATABASE commands. Using this command, you
specify the point in time to which you want the database to be recovered. You do not
need to indicate which database backup image must be restored or which log files are
required to reach the specified point in time. You can also use this new command for
multi-partitioned databases.
• Throttling database tools
Running DB2 database tools can have a significant impact on the database
performance. Using this feature, you can decrease the priority of a specific database
tool to a desired value.
This feature is supported by tool dmdb6bkp. For more information, see dmdb6bkp –
Database Backup Tool [page 170].

24 July 2006
1.8 DB2 UDB for UNIX and Windows Version
8.2.2: Enhancements

• Automatic resizing of DMS tablespaces (AutoResize)


DMS tablespaces consist of file containers or raw device containers and their sizes are
set when the containers are assigned to the tablespace. The tablespace is considered
full when all of the space within the containers has been used. However, you can add
or extend containers using the SQL statement ALTER TABLESPACE that allows more
space to be given to the tablespace. DMS tablespaces also have a feature called
“auto-resize”. As space is consumed in a DMS table space that can be automatically
resized.
• Automatic storage management (AutoStorage)
Databases that are enabled for automatic storage have a set of one or more storage
paths associated with them. DB2 uses one or more storage paths as location where it
creates AutoStorage tablespace containers.

You can only enable DB2’s automatic storage management during database
creation. You cannot disable automatic storage management afterwards.

July 2006 25
2 Basic Concepts

2.1 Introduction
This chapter describes the concepts relating to the Admin Tools, and the terminology used
throughout this documentation. Much of this terminology is described in Glossary and Index
[Page 227].

This documentation includes new and updated information that was not
available in previous versions.

2.1.1 The SAP DB2 Admin Tools


The SAP DB2 Admin Tools are a collection of tools specific to the SAP environment, which
supplement standard DB2 tools. They can be divided into the following categories:
• Log file management tools
• Database backup and restore support tools
• Performance related tools
In addition to the tools themselves, a graphical interface, the DB2 Control Center
Extensions, has been created that simplifies access to several of the Admin Tools. These
are extra menu options and windows that are available in the DB2 Control Center after the
extensions are installed.

26 July 2006
SAP System
<SAPSID>

SAP database
<DBSID> SAP processes

M
+ o
Ex nit
ec or
cute

ut
+ Exe r
o

e
Monit

Proto
c
Admin Tools + Qu o l
ery
cute
Exe
DB2 Control Center
+ SAP Extensions Admin database
Configure ADM<DBSID>
+ Query

The following graphic shows the relationship between the Admin Tools and the DB2 Control
Center Extensions plus the SAP system and database.

2.1.2 User Interfaces


System administrators can perform the DBA tasks using the following interfaces:
• DB2 Command Line Processor (CLP)
DB2 tool used to execute database utilities, SQL statements and get online help. It
offers a variety of command options, and can be started in interactive input mode,
command mode and batch mode. For more information, see the DB2 Command
Reference.
• DB2 Control Center (DB2CC)
DB2 tool offering a graphical user interface that simplifies administrative tasks such as
configuring the database, backup and recovery, scheduling jobs, and managing media.
To start the DB2 Control Center, use the db2cc command on the command line, or
use Start panels on Windows platforms. The DB2 Control Center can be extended with
the SAP Admin Tools Control Center extensions to support SAP-specific tasks related
to log file management. You can also access tools such as DB2 Visual Explain and
DB2 Performance Monitor from the DB2 Control Center.
For introductory information, choose Help → Getting Started.

July 2006 27
• Operating System Command Line
This can be used to perform the majority of tasks described in this documentation.
Generally this is the fastest and most flexible method, but may require user knowledge
of complex command syntax. The system administrator can also use this interface to
automate tasks, for example, by writing scripts or batch files.
• SAP Transactions
These provide an additional graphical interface for starting specific tasks. The number
of available tasks is limited, but they are often neither platform nor database-specific
and can therefore be used in a mixed environment.

2.2 SAP Log File Management


This section explains why log file management is an essential part of system administration,
and how the Admin Tools assist in this task. It covers the following topics:
• Recovery − The Need for Log Files [Page 28]
• Recovering Log Files [Page 30]
• Log File Life Cycle (Archive and Restore) [Page 31]
• Log File Deletion [Page 34]
• Protocols [Page 36]
• Raw Device Log Files [Page 36]
• Log File States [Page 37]
• Special Cases – Non-Standard Behavior of Database Systems [Page 38]

2.2.1 Recovery - The Need for Log Files


Once a database is up and running, one of the most essential tasks for a database
administrator is the management of database backups and log files to ensure that databases
can be recovered after a serious failure. The DB2 Database Manager generates log files to
keep track of changes made to the database. These log files are required for the following
purposes:
• Explicit and implicit rollback
When a database transaction is rolled back all changes are undone.
{ Explicit rollback
An application indicates that changes that it started to make to the database are
invalid.
{ Implicit rollback
A program making changes to the database does not commit changes before
exiting, either through incorrect programming or a crash.
In both cases the database needs log file information to return the database to the
state it was in before the changes were made.

28 July 2006
• Database recovery
The DB2 Database Manager may be forced to restart without applications being able to
close all open transactions. The log files containing the information about changes
made by these transactions are required to perform database recovery when the
database manager is started again. This involves rolling back (undoing) all open
transactions for all applications.
• Database restore
A database can be recreated by restoring a previous backup. A backup represents the
state of a database at the time the backup was performed, but does not contain
information about transactions completed after this time. Therefore, after a backup
image is used to restore a database, log file data generated after the backup was taken
must be added to the database again, to bring the database completely up-to-date.
This process is known as rollforward recovery. The command to add the log file
information is as follows:
DB2 ROLLFORWARD.
{ Restoring from an offline backup image
Such a database is immediately usable after the ROLLFORWARD STOP
subcommand. Alternatively, log files can be first applied to bring the database
up to date (to end of logs).
{ Restoring from an online backup image
In the case of an online backup, the log files generated while the backup
operation was running are also required, as transactions may have modified the
database contents during the time of the backup. Without this additional data
the restored database cannot be activated. The database must be rolled forward
to at least the point in time when the backup operation completed to ensure
that the data is consistent throughout the database.
Rollback and database recovery do not normally require user intervention. The DB2
Database Manager retains all log files as long as they contain information from open
transactions. User intervention is only required if the directory where the database manager
stores log files is damaged or lost. This directory is known both as the LOGPATH and log
directory. In case of loss or damage, you can recover at least those files that have been
successfully archived with the tools described below.

If the log directory is changed and then the subdirectory or any required log files
in that subdirectory are removed, DB2 will look for log files in the default log
directory (SQLOGDIR) when the database is activated. If the log files are not
found, the database will enter a backup pending state.
In connection with rollforward operations, DB2 version 7 supports a log overflow directory.
The rollforward operation first checks for logs in the location specified by the LOGPATH
database configuration parameter. If you have moved any logs from the location specified by
the log path parameter, use the ROLLFORWARD overflow directory parameter to specify the
path to the logs that you moved. This is especially important in connection with recovery
when logging to raw devices.

July 2006 29
2.2.2 Recovering Log Files
The tools db2uext2 (the User Exit), brarchive and brrestore were developed as the log
file management component of the Admin Tools. Their main purposes are:
• To archive log files.
• To assist database administrators performing database rollforward operations after a
database restore.
The Admin Tools are automatically installed as part of an SAP system installation with
R3SETUP. If you install your SAP system with SAPinst, the Admin Tools are no longer
automatically installed. You can manually (re)install, upgrade or patch the Admin Tools using
the sddb6ins program. For more information, see Installing the Admin Tools Manually [Page
47].
Rollforward recovery is not enabled by default. Unless otherwise configured, the DB2
Database Manager reuses a fixed number of log files in a circular fashion, for example,
0,1,2,3,0,1,2,3,0 and so on. This behavior can be modified so that the database manager
uses log files in an ascending order, for example, 0,1,2,3,4,…,9999999. By default, the
database manager also does not start any application (User Exit) to independently archive
full log files for later recovery.
Database administrators are strongly recommended to set the following database parameters
in the SAP environment to ON:
• LOGRETAIN
Rollforward recovery is enabled by turning on this parameter. That is, circular logging
is turned off and each new log file has a higher number.

Each time the LOGRETAIN parameter is turned off and on again, the database
manager resets log file numbers and starts from zero again. This can result in
several log files having the same log file number on a given node. The log files
management tools only directly support recovery of the most recent version of
log files. Recovery of older versions must be done manually.
• USEREXIT
The User Exit mechanism is enabled by turning on this parameter. The User Exit is
automatically started by the DB2 engine each time a log file becomes full.
A backup is required after setting the LOGRETAIN parameter (or both), after which the
database can be started again.

To perform online backups, the database must be operated in rollforward


recovery mode. To restore the database from an online backup, all log files in
use during the online backup operation must be available to complete the
restore operation.
Once these parameters have been turned on and a backup has been performed, the Admin
Tools can be used to archive log files. The User Exit (db2uext2) is then automatically
started by the database each time a log file is filled. Depending on how it is configured, the
User Exit either archives log files directly to a storage management product, or it copies the
log files to the directory referred to as archive directory (as defined by the
DB2DB6_ARCHIVE_PATH environment variable). Groups of files in the archive directory can
then be archived to tape, TSM or with an individual script using brarchive later.

30 July 2006
The database can be recovered later using the DB2 commands RESTORE and
ROLLFORWARD. Dependent on the configuration, the User Exit either retrieves log files directly
from the chosen repository, or from the archive directory and/or retrieve directories. The latter
is the directory (defined by the DB2DB6_RETRIEVE_PATH environment variable) to which log
files are restored using brrestore. To complete a rollforward operation (other than stop),
brrestore and ROLLFORWARD operations may need to be performed repeatedly until all
required log files have been retrieved and rolled into the database.

If the database is not rolled forward to the end of all logs when restarted, the
Database Manager will create new log files starting with the number
immediately following the last log file that was rolled into the database. This can
result in several log files having the same log file number on a given node. The
log file management tools only directly support recovery of the most recent
version of log files. Recovery of older versions must be done manually.

Running the User Exit, brarchive and brrestore


The User Exit does not need to be started by a user – it is automatically called by DB2 if
configured correctly. Both brarchive and brrestore can be called from within the DB2
Control Center or can be started from the command line. brarchive can also be scheduled
to be (regularly) started using the DBA Planning Calendar (SAP transaction DB13), or
otherwise automated using scripts or batch files.

2.2.3 Log File Life Cycle (Archive and Restore)


The following section covers the standard scenarios known as indirect and direct archiving.
There is a third scenario, which is a variation of direct archiving, where the SAP User Exit is
configured to call a vendor User Exit. The log file cycle is similar to direct archiving with the
log files being copied elsewhere but the target and exact behavior depend on the vendor
User Exit.
The graphic describes the possible life cycle of a log file when using the log file management
tools.

July 2006 31
Indirect …/log_archive/<DBSID>
S0000003.LOG
(A)
LOGPATH DB Parameter S0000004.LOG (B)
…/log_dir . User Exit offline retained
brarchive
S0000005.LOG (D) TSM, TAPE or SCRIPT
S0000006.LOG S0000002.LOG
S0000007.LOG archived retained
brrestore
online active User Exit restored retained
online retained S0000000.LOG (C)
(D)
S0000001.LOG
DB2DB6_RETRIEVE_PATH
…/log_retrieve/<DBSID>

Direct
LOGPATH DB Parameter . TSM, DISK or VENDOR
…/log_dir . S0000000.LOG
(A)
S0000005.LOG S0000001.LOG
S0000006.LOG User Exit S0000002.LOG
S0000007.LOG (D) S0000003.LOG
online active S0000004.LOG
online retained archived retained

Archive
Restore

When the USEREXIT database configuration parameter is set, the database engine
automatically starts the User Exit program to archive each log file as soon as it is full or it is
closed. The location the file is moved to depends on the configuration of the User Exit. By
default, log files are archived indirectly by first copying the file to the archive directory. The
User Exit can be reconfigured to archive directly using TSM, archive to disk or via an
alternative User Exit.

The Admin Tools can only administer the latest version of a log file with a given
number per node, that is, you cannot administer two log files with the number 25
on node 0.

Indirect Archiving and Restore (Default)


Single log files are copied into the archive directory by the User Exit (A). brarchive is then
used to archive groups of offline log files into an archive repository (also known as backend
repository) (B). File archiving using the archive directory is referred to as indirect archiving.
brrestore retrieves archived log files from the repository if they are no longer in the archive
directory, and places them in the retrieve directory (C) where the User Exit can access them.
When requested by a ROLLFORWARD operation in connection with a database restore action,
the User Exit retrieves log files from the archive or the retrieve directory (D).

32 July 2006
Only indirect archiving supports archiving to tape without a vendor storage
management product. However, before you decide to use this solution you
should take the following disadvantages into consideration:
• Log files are not immediately archived to long-term storage. Therefore, log
files copied by the User Exit but not yet archived with brarchive can be lost
if the disk containing the archive directory fails.
• The complexity of the solution, including additional storage directories and an
extra Admin DB slightly increases the risk of failure.

Direct Archiving and Restore


Direct archiving is the recommended method for log file archiving, as it is the simplest and
therefore most reliable method. Log files are archived immediately and directly to long-term
storage. However, either TSM or another storage management product with its own User Exit
is required. You can use these products not only to archive log files but also to archive
backups.
The User Exit can be configured to archive directly to TSM, archive to disk or to call a
vendor User Exit for an alternative storage product. The latter provides support for any
products which provide a User Exit, whilst ensuring that SAP tables containing log file
information are also updated. A later ROLLFORWARD operation, after restoring the database,
results in the files being automatically restored from the same source. Log files are not
renamed during direct archiving or restore.

We recommend that database administrators use direct archiving as it


performs well and requires minimal maintenance. ROLLFORWARD operations
after a database restore normally require no user interaction when using direct
archiving.
For more information about how to configure the User Exit and the Admin Tools in general,
see Changing the Admin Tools Configuration [Page 70].

Log File Naming Convention


The log file names in the graphic above are simplified for readability depending on the way
they are archived:
• Direct archiving
Files are stored to the backend without their names being modified except if you are
using direct archiving to disk. In this case, the node number NODEXXXX is appended to
avoid problems in a multi-partitioned environment.
• Indirect archiving
When the User Exit copies log files from the log directory to the archive directory, the
files are renamed by appending the file-closure timestamp (14 digits) and the node
number (NODExxxx). In ROLLFORWARD mode, when the User Exit moves files from the
archive or retrieve directory back to the log directory, the original name is restored.
Otherwise, the files will not be recognized by DB2.

July 2006 33
For example, during archiving, the copy of the file S0000001.LOG put in the archive
directory might be renamed to S0000001.LOG.20001130140536.NODE0000.
A file restored by brrestore (in the LOG RETRIEVE directory) still has the extended
file name.
The name is first truncated back to its original form in the copy returned to the log
directory by the User Exit when it is called to retrieve files for a ROLLFORWARD
operation.
DB2 log file names are of the format Snnnnnnn.LOG, where nnnnnnn is a seven digit
number ranging from 0000000 to 9999999. When a database is first created, log files
starting from S0000000.LOG are created. DB2 restarts the log file numbering sequence at
S0000000.LOG under the following conditions:
• When the database configuration file is changed to enable archive logging
• When the database configuration file is changed to disable archive logging
• When the log file sequence wraps, that is after log S9999999.LOG is used
The states a log file passes through, which appear in the above graphic, for example, online
active, are described in Log File States [Page 37].

Admin Tool Log File Management Model – Indirect Archiving Only


Whenever a log file is archived, the Admin Tools also associate it with a database backup
timestamp (that is, the date and time of the most recent SAP system database backup
operation – whichever was performed most recently). The Admin Tools are then able to tell
the database administrator which log files are needed to roll forward a database after a
specific backup image has been restored. For more information, see Log File Restore of the
SAP Database [Page 148].
In combination with the log file close timestamp (another log file attribute), the backup
timestamp allows the Admin Tools to keep track of the restorable backup or log file
combinations. The Admin Tools GUI (DB2 Control Center Extensions) also supports this.

Normally, only the Admin Tools should be used to manage log files. The files
should not be moved or deleted manually as this will lead to data
inconsistencies. The only exception to this is when log files that are no longer
supported by the tools (see Invalid in the section Log File States [Page 37]), are
restored. Those files must have the timestamp and node extension removed
from their names when they are moved back to the log directory.

2.2.4 Log File Deletion


Log Files on Disk
Log files in the DB2 log directory should not be deleted. The database manager
automatically deletes or reuses these files after they have been successfully archived by the
User Exit. Depending on the archiving method you choose, the following happens:
• If you chose direct archiving, no log file copies are made on disk and no deletion is
needed.

34 July 2006
• If you chose indirect archiving, log files copied to the archive directory by the User Exit
and later successfully archived using brarchive will only be deleted from the archive
directory if this is explicitly requested. The same applies to log files restored to the
retrieve directory by brrestore.
In the latter cases deletion is requested by:
• Indicating deletion as part of a brarchive/brrestore operation (options -sd and –
ssd).
• Explicitly deleting log files in a later call to an Admin Tool (options -ds and –dr). Log
files no longer required on the backend should also be deleted using these tools.

Be aware that the available disk space will eventually be exhausted if the User
Exit is unable to successfully archive log files over a long period of time. The
same will happen if log files archived using brarchive and restored using
brrestore are not deleted using the same tools.
Tapes can be reused, but other backend storage should be cleaned up regularly
using the Admin Tools. Storage management products often supply their own
tools for doing this or can be configured to automatically remove old files.
However, it is essential that you use the Admin Tools to delete files when using
indirect archiving, as the Admin DB is then also updated.

Log Files in Long-Term Storage


• Tape
If you use a tape as a long-term storage, the Admin DB should always reflect the
content of the tapes (in the Admin DB, there is an entry for each log file that is stored
on tape). If you reuse a tape that already contains log files, all entries in the Admin DB
will automatically be removed before the tape is overwritten with new log files.
Therefore the Admin DB does not grow. If you lose a tape or if a tape becomes
unreadable, you should delete the tape from the Admin DB to reflect this lost or
unreadable tape in the Admin DB. For more information, see Deleting Tapes from the
Admin DB [Page 120].
• TSM
If TSM is configured correctly and if you use an archive copy group for storing log files,
the log files will automatically be deleted from TSM. If you use indirect archiving, the
Admin DB does not recognize the automatic deletion and runs out of sync. To
synchronize the Admin DB, you should use brrestore –delete. For more
information, see Deleting Log Files [Page 101].
If you use a backup copy group, you need to delete the log files manually. If you use
indirect archiving, use brrestore –delete. For more information, see Deleting Log
Files [Page 101]. If you use direct archiving, you may use db6adutl to delete the log
files.
• Customer script
If you use a customer script, you should use brrestore –delete to delete log files.
For more information, see Deleting Log Files [Page 101].

July 2006 35
2.2.5 Protocols
The User Exit (db2uext2), brarchive and brrestore generate protocol information to
record the actions that have been performed. Protocol information is also written into the
Admin DB by the log file management tools. This information can be used by the DB2 Control
Center Extensions. The Admin DB protocols and the protocol files of brarchive and
brrestore are eventually deleted by brarchive. The frequency can be configured by
setting configuration parameter delete_protocols using the DB2 Control Center
Extensions.

Protocol files should only be deleted by the database system administrator.


The protocol files have the following form and are written to the following directories:
Tool Protocol File(s) Location
User Exit db2uext2.log.NODExxxx Directory defined by the
db2uext2.err.NODExxxx DIAGPATH configuration
(Files are appended) parameter
(db2 get dbm cfg …)
brarchive brarchive.<timestamp>.lfa • For 4.6 D Admin Tools:
<INSTHOME>/saparch
(One file per run)
• For 6.NN Admin Tools:
<INSTHOME>/admintools/
protocols
brrestore brrestore.<timestamp>.lfr • For 4.6D Admin Tools
<INSTHOME>/saprest
(One file per run)
• For 6.NN Admin Tools:
<INSTHOME>/admintools/
protocols
These tools can also write more detailed traces, normally only for use by support and
development. For more information, see Appendix B: Troubleshooting [Page 177].

2.2.6 Raw Device Log Files


To achieve maximum performance, we recommend that you use raw devices for storing log
data. This has the effect of bypassing a possible file system management overhead and
allows DB2 to manage the log data with optimum efficiency. However, it is generally easier to
work with log files in file systems, as these can be maintained and manipulated using
standard operating system tools.
The Admin Tools fully support raw logging. The differences between file system-based
logging and raw device logging are hidden by the User Exit. The User Exit extracts raw data
into individual files that then behave identically to non-raw log files.
If you decide to use raw device logging, the following is necessary to enable roll-forward
during database recovery. If logging information cannot be obtained from the log extents
available on the raw device, DB2 expects the logs to be in the log overflow directory. To
allow the User Exit to put missing logs in the log overflow directory, the ROLLFORWARD utility
must specify the overflow log path parameter.

36 July 2006
2.2.7 Log File States

This section is mainly written for system administrators and support personnel
only for use if problems involving the Admin DB occur.
Within an SAP environment, in order for the tools to know what operations have been
performed on a log file, the log file is defined to pass though the following states during its life
cycle. This state information is stored in the Admin DB, so it is only relevant to systems using
the (default) indirect archiving method. This information is consequently not stored on
systems performing direct archiving.
• Online active
The log file is currently being used to log transactions. The location of the log file is
defined in the LOGPATH database configuration parameter. This can be either a file
system path or a raw device.
• Online retained
The log file is no longer being written to by the database, but may contain information
about transactions that the database engine has not yet written from the buffer pool to
disk. The log file is located in the log directory, and will also be in the archive directory
after the User Exit has run.
• Offline retained
The log file is no longer being used and does not contain transactions with unwritten
data pages. The log file is in the archive directory.

The original log file will also remain in LOGPATH until the database is stopped or
the DB2 Database Manager reuses the file. However, the tools have no
influence on this and so assume that the file is no longer there.
• Archived retained
The log file has been archived using brarchive. The location of the archived log file
is a storage management product, for example, TSM (Tivoli Storage Manager) or tape.
If not explicitly deleted, the original log file is also still in the archive directory and no
restore is possible (or necessary) as long as this original log file has not been deleted
using brrestore.
• Restored retained
The log file has been restored using brrestore. The location of the restored log file is
the retrieve directory. If not explicitly deleted by using the -delete option in a
subsequent operation, the archived log file is also still available on the backend.
• INVALID
The Admin Tools can only administer the latest version of a log file with a given number
per node. If the database generates a second log file with a number already used, the
User Exit marks previous versions as INVALID. This can occur after a database
restore if the ROLLFORWARD operation does not use all log files, or by turning the
LOGRETAIN database configuration parameter off and on again. Older log files that
have been archived can still be manually retrieved from the backend using system or
storage product tools, but the Admin Tools only support the retrieval of the newest
version.

July 2006 37
• Gone
This state is only used internally to indicate that a log file could not be found in the
location where it was expected, for example, if a customer uses MOVE, RENAME or
DELETE. This state can also occur when storage products, such as TSM, automatically
delete files after a certain period of time. A delete operation will delete such entries.

2.2.8 Special Cases - Non-Standard Behavior of


Database Systems
Certain systems are set up in a slightly non-standard way, for example:
• As split-mirror
• As homogeneous system copy
In both cases the Admin Tools are either restricted or must be configured differently.

Split-Mirror for Backup Purposes


DB2 has introduced a new concept known as split-mirror using the db2inidb tool. With this
tool, you can rapidly create a mirror copy of a production system database without the need
to shut down the system. This copy can then be used to perform an offline backup without
affecting the performance of the original system, which continues processing as usual.

For this feature, we strongly recommend customers to only use direct archiving.
This requires either TSM or a vendor product that provides its own User Exit.
For more information, see The db2inidb Tool [Page 132].

Homogenous System Copy


You can create new SAP systems from existing system backups. In this case, the Admin
Tools must be newly installed on the new system as the system name has changed.

Do not attempt to copy Admin DB information from the source system to the
new target system.
Although DB2 does not force a backup in this situation, as LOGRETAIN is normally already
active, it is essential that you take a new backup before you use the Admin Tools on the new
SAP system.
Sometimes a system copy is used to overwrite another system or a previous system copy
where the Admin Tools were already installed. In this case, the old Admin DB should be
dropped before the Admin Tools are reinstalled. Additionally, the backup history file must be
pruned to remove all previous backup information before a new backup is taken and before
the Admin Tools are used.

38 July 2006
2.3 SAP Security Concept
General Information
In an SAP environment, DB2 runs with authentication set to the value
server_encrypt. This means that the user ID and password provided to connect to
databases or attach to database instances are verified by DB2 using operating system
services from within the database server.
The user IDs and passwords for SAP system users are maintained and stored in the file:
• UNIX: /usr/sap/<SAPSID>/SYS/global/dscdb6.conf
• Windows: \\%DSCDB6HOME%\sapmnt\<SAPSID>\SYS\global\dscdb6.conf

In an exclusively Windows environment, environment variable DSCDB6HOME


contains the name of the database server. In a system environment where the
database server operates under an operating system other than Windows,
DSCDB6HOME should contain the name of the server where file dscdb6.conf
can be accessed with the path listed above.
File dscdb6.conf must be accessible from all application and database servers using NFS
(UNIX) or Windows shares. Passwords are stored in encrypted form. This file is protected
from unauthorized access using file system access authorizations.
For all the dscdb6.conf accesses described in this documentation, environment variable
DB2DB6EKEY is used to encrypt or decrypt the requested password.

The value of DB2DB6EKEY must be identical on all application servers, the


central instance, and on the SAP system database servers (all systems with the
same <SAPSID>).
DB2DB6EKEY is requested and set during SAP system installations. The default
value is <DBSID><db_server_hostname>, but will need modifying for all but
the central database server.
The administrator can change this value at any time, but this requires that the
value be updated on all other related systems, and the passwords in the file
dscdb6.conf be changed (see below).
UNIX:
The DB2DB6EKEY variable is set in the SAP profiles dbenv_<hostname>.csh and
.dbenv_<hostname>.sh, which are read when <sapsid>adm or db2<dbsid> logs on.
Windows:
The DB2DB6EKEY variable is set in the system environment.

July 2006 39
Managing Passwords for Database Standard Users
DB2 uses operating system users to maintain system security. The Admin Tools need access
to the user passwords to access the database. These are stored in encrypted form in a
special file and must be updated using the dscdb6up tool.

Do not change user passwords only using operating system methods. Tools that
read password file dscdb6.conf will no longer be able to connect to the
database until tool dscdb6up has been used.
For information about how to set and update passwords for SAP system users, see Setting
and Updating Passwords [Page 116].

2.4 Multi-Partitioned Systems


The Admin Tools are also enabled to work with multi-partitioned systems. A multi-partitioned
database can be configured to consist of more than one database node. In this case, in the
SAP implementation, certain directories found in the single-partitioned environment are
extended to become node-specific in a multi-partitioned environment and other directories are
moved.

On UNIX, the home directory of the db2<dbsid> user changes from


/db2/<DBSID> (single-partitioned system) to /db2/db2<dbsid> (multi-
partitioned system).
Also tools such as brarchive and brrestore should be used with the additional
parameter –node. For more information about the syntax of brarchive and brrestore,
see brarchive - Log File Archive Tool [Page 157] and brrestore - Log File Retrieval Tool [Page
163].

40 July 2006
3 Installation and Setup

3.1 Introduction
This chapter is intended for administrators who want to check their environment, or need to
(re)install or upgrade the Admin Tools manually.
The installation of the Admin Tools depends on the SAP installation tool. You can install the
SAP system using:
• R3SETUP
The Admin Tools are automatically installed as part of the SAP system installation.
R3SETUP creates the directories, user, groups and user environment that are required
to successfully install the Admin Tools using the sddb6ins program.
• SAPinst
The Admin Tools are not automatically installed during the SAP system installation
with SAPinst. However, you can install the Admin Tools after installing the SAP system.
SAPinst creates the users and groups that are required to successfully install the
Admin Tools using the sddb6ins program. Version 6.10 of sddb6ins and higher
creates the directories and adds variables to the user environment that are required to
run the Admin Tools.

The 6.NN Admin Tools must be used on SAP systems with release 6.10 or
higher. They do not perform correctly on SAP systems with release 4.6D or
lower, and the 4.6D Admin Tools do not perform correctly on SAP systems with
release 6.10 or higher.

Installation Overview
The following list provides an overview of the steps that you have to perform to install the
Admin Tools and enable the SAP system database for recovery:
...

1. Check the SAP system environment [Page 43] to make sure that the SAP system was
installed correctly.
2. Check the prerequisites for the installation of the Admin Tools [Page 48].
3. Install or upgrade to the latest Admin Tools. For more information, see one of the
following sections:
{ Upgrading the Admin Tools [Page 50] if you want to upgrade the Admin Tools to
the latest version.
{ Installing the Latest Admin Tools [Page 51]if you want to install the latest
version of the Admin Tools or apply the latest patch.
4. Check the Admin Tools environment [Page 52] after installation.
5. Install the DB2 Control Center on the SAP database server or one or more
workstations. For more information, see Installation of the DB2 Control Center [Page
61].

July 2006 41
You may have already performed this step as part of the database installation.
Otherwise, this can be delayed until step 7 if roll-forward recovery enabling (step 6) will
be performed on the command line.
6. Enable the database for roll-forward recovery [Page 57].
7. Catalog the databases to be administered. For more information, see Setting Up the
DB2 Control Center [Page 62].
8. Check that the DB2 Control Center Extensions are working correctly. For more
information, see Using the DB2 Control Center Extensions [Page 69].

See also:
• For information about installing IBM DB2 Universal Database for UNIX and Windows
with the SAP system, see the following documentation:
{ For SAP Web AS Release 6.10, 6.20 and 6.30:
SAP Web Application Server Installation on UNIX: IBM DB2 Universal Database
for UNIX and Windows
SAP Web Application Server Installation on Windows 2000: IBM DB2 Universal
Database for UNIX and Windows
To find this documentation, see SAP Service Marketplace at
service.sap.com/instguides → SAP Components →SAP Web
Application Server.
{ For SAP Web AS 6.40 SR1:
SAP Web Application Server ABAP 6.40 SR1on UNIX: IBM DB2 Universal
Database for UNIX and Windows
SAP Web Application Server ABAP 6.40 SR1on Windows 2000: IBM DB2
Universal Database for UNIX and Windows
To find this documentation, see SAP Service Marketplace at
service.sap.com/instguidesNW04 → Installation.
{ For SAP Basis Release 4.6D:
SAP Basis Installation on UNIX: IBM DB2 Universal Database for UNIX and
Windows
SAP Basis Installation on Windows: IBM DB2 Universal Database for UNIX and
Windows
To find this documentation, see SAP Service Marketplace at
service.sap.com/instguides → SAP Components →SAP Basis.
{ For SAP R/3 Release 4.6x and lower:
To find the corresponding documentation, see SAP Service Marketplace at
service.sap.com/instguides → SAP Components → SAP R/3.
• For additional information about installing the Admin Tools, see the following SAP
Notes:
{ SAP Note 410252
DB6: Installing the latest 4.6D DB2 Admin Tools
{ SAP Note 455506
DB6: Installing the latest 6.NN DB2 Admin Tools
To find the SAP Notes, see SAP Service Marketplace at service.sap.com/notes.

42 July 2006
3.2 SAP System Environment
The following sections explain the SAP system environment that is a prerequisite for the
successful installation of the Admin Tools.

3.2.1 SAP System Users and Groups


The following tables list the users and groups that are automatically created by the installation
tool during the SAP system installation.

SAP System Users

User Description
db2<dbsid> Database administrator
This operating system user is the DB2 instance
owner and the SAP database administrator.
<sapsid>adm SAP system administrator
This operating system user is authorized to start and
stop the SAP system and the DB2 Database
Manager (instance). <sapsid>adm has the DB2
authorizations DBADM and SYSCTRL. DB2-specific
monitoring functions invoked by SAP application
server functions require SYSCTRL authorization. This
user belongs to the operating system group
db<dbsid>ctl.
sapr3 Database user
These operating system users own all SAP database
First installed SAP system with
objects (tables, indexes and views). All database
Release 4.6D or lower
connection and instance access operations for an
SAP application server are performed using these
users.

sap<sapsid> These users belong to the operating system group


SAPSYS and are only created on SAP systems on
SAP systems based on SAP which the SAP system database has been installed
Web AS kernel Release 6.10 (not on remote application servers). These users
or higher and additional MCOD have the following database authorizations:
4.6D SAP systems CREATETAB, BINDADD, CONNECT, and
IMPLICIT_SCHEMA
Windows only: SAP service account user
This operating system user is a virtual user. In
sapse<sapsid>
general, on Windows the SAP system is started with
this user account, but there is no need to log on to the
SAP system with it.
This user account must have the local user
authorizations to Log on as a service and has
to be a member of the local administrator group. The
name of this user must be sapse<sapsid>.

July 2006 43
SAP System Groups

Groups Description
db<dbsid>adm Database system administration group
Each member of this group has SYSADM authorization
for the DB2 Database Manager instance. This is the
highest level of authorization within the database
manager and controls all database objects.
db<dbsid>ctl Database system control group
Each member of this group has SYSCTRL
authorization for the DB2 Database Manager
instance. SYSCTRL has authorizations allowing
operations affecting system resources, but not
allowing direct access to data.
db<dbsid>mnt Database maintenance group
A user of this group can perform maintenance
operations on all databases associated with an
instance. It does not allow direct access to data. This
authority includes privileges to update database
configuration files, to back up a database or a
tablespace, to restore an existing database and to
monitor a database.
Windows only: Domain-level SAP system administration group
This group is used for grouping the SAP system
SAP_<SAPSID>_GlobalAdmin
administrators. The sole function of a global group is
to gather users together at domain level so that they
can be placed in the appropriate local groups. The
members of this group are the domain users
<sapsid>adm and sapse<sapsid>.
The group SAP_<SAPSID>_GlobalAdmin is only
used when the SAP System belongs to a Windows
domain. The group SAP_<SAPSID>_GlobalAdmin
is not required for a local installation.
Windows only: Local group on an application server
SAP_<SAPSID>_LocalAdmin Only local groups are created and maintained on an
application server. A local group can only be given
authorizations to the system where it is located. If the
system is part of the domain, the local group can
contain users and global groups from the domain.

44 July 2006
3.2.2 User Environment

In the following table, the Set In column shows the location where the variables
are set and where they need to be changed.

General Environment Variables

Environment Value Set In


Variable
DB2INSTANCE DB2<DBSID> UNIX:
~/.dbenv_<hostname>
.csh
and
~/.dbenv_<hostname>
.sh
Windows:
User environment
DB2DBDFT <DBSID> Same as relevant location
for variable DB2INSTANCE
as described in this table

DB2DB6EKEY <SAPSID><database server Same as relevant location


name> (default value) for variable DB2INSTANCE
as described in this table
INSTHOME UNIX: UNIX:
Home directory of user ~/.dbenv_<hostname>
db2<dbsid> .csh
Windows: and
Default value for a single-
~/.dbenv_<hostname>
partitioned system: .sh
<drive>:\DB2<DBSID>
Default value for a multi- Windows:
partitioned system: User environment
\\%DSCDB6HOME%\db2<dbsid>
SAPSYSTEMNAME <SAPSID> UNIX:
~/.sapenv_<hostname>
.csh
and
~/.sapenv_<hostname>
.sh
Windows:
User environment

July 2006 45
dbs_db6_schema Database schema: Same as relevant location
for variable
Valid for all SAP sap<sapsid> or sapr3
SAPSYSTEMNAME as
systems with SAP depending on the SAP system
Web AS 6.10 or described in this table
release you have installed.
higher and MCOD
4.6D SAP systems

Additional Environment Variables for Windows

Environment Variable Value


DSCDB6HOME Database server name
SAPMNT <drive>:\usr\sap\<SAPSID>
SAPEXE <drive>:\usr\sap\<SAPSID>\SYS\exe\run

3.2.3 Access Authorizations for Admin Tool-Related


Directories
Access Authorizations for Directories and Files under UNIX

DB2 Directory or File Access Owner Group


Privilege
in Octal
Form
Home directory of user 755 db2<dbsid> db<dbsid>adm
db2<dbsid> (/db2/<DBSID> or
/db2/db2<dbsid>)
/db2/<DBSID>/log_dir 750 db2<dbsid> db<dbsid>adm
/db2/<DBSID>/log_retrieve 750 db2<dbsid> db<dbsid>adm
/db2/<DBSID>/log_archive 750 db2<dbsid> db<dbsid>adm
/db2/<DBSID>/db2dump 750 db2<dbsid> db<dbsid>adm
/usr/sap/<SAPSID>/SYS/exe 755 <sapsid>adm sapsys
/usr/sap/<SAPSID>/SYS/ 750 <sapsid>adm db<dbsid>adm
global

/usr/sap/<SAPSID>/SYS/exe/ 4750 root db<dbsid>ctl


run/dscdb6up
/usr/sap/<SAPSID>/SYS/ <sapsid>adm db<dbsid>adm
global/dscdb6.conf 640

All authorizations can be checked using the –checkonly option of the


sddb6ins program.

46 July 2006
Access Authorizations for Directories and Files under Windows

Directory Access Owner For User or Group


Privileg
e
<drive>:\db2<dbsid> Full Administrator SAP_<SAPSID>_LocalAdmin,
Control System
<drive>:\db2 Full Administrator Everyone
Control
<drive>:\db2\<dbsid>\ Full Administrator db2<dbsid>, System
log_dir Control
<drive>:\db2\<dbsid>\ Full Administrator SAP_<SAPSID>_LocalAdmin,
log_retrieve Control System
<drive>:\db2\<dbsid\ Full Administrator SAP_<SAPSID>_LocalAdmin,
log_archive Control System
<drive>:\db2\<dbsid>\ Full Administrator SAP_<SAPSID>_LocalAdmin,
db2dump Control System

3.3 Installing the Admin Tools Manually

The 4.6D Admin Tools must be used on all SAP systems with release 3.1I −
4.6D where DB2 UDB for UNIX and Windows Version 7 or higher is installed.
The Admin Tools are installed on the database server using program sddb6ins. During
normal installation of an SAP system with R3SETUP, sddb6ins is called automatically.
The administrator only needs to execute sddb6ins manually in the following cases:
• If an SAP system was installed with SAPinst
• If you want to use the 4.6D Admin Tools and your SAP system is between Release 3.1I
and 4.6C
• After completion of an SAP system upgrade and if you have not yet installed the latest
Admin Tools
• When applying a downward compatible kernel and if you have not yet installed the
latest Admin Tools
• When manually installing the Admin Tools or applying an Admin Tools patch
• When checking the installation of the Admin Tools

July 2006 47
3.3.1 Prerequisites for the Admin Tools Installation
Before you can install the Admin Tools, you must make sure that certain prerequisites are
met. Some are general, some apply to a certain patch level of the sddb6ins program or
depend on your operating system.

General Prerequisites
• Sufficient space
Make sure that you have sufficient space (approx. 4 MB) in the directory containing the
Admin Tools executables. sddb6ins installs the executables in the following directory:
{ For 6.NN Admin Tools:
UNIX: $INSTHOME/admintools/bin
Windows: %INSTHOME%\admintools\bin
{ For 4.6D Admin Tools
UNIX: /usr/sap/<SAPSID>/SYS/exe/run
Windows: <drive>:\usr\sap\<SAPSID>\SYS\exe\run
If you are using indirect archiving (that is parameter -NODADMDB is not used during
installation), the Admin DB requires additional space. The directory to which the
database manager configuration parameter DFTDBPATH is pointing must be large
enough to hold the Admin DB and its log files (approx. 4 MB).
• Availability of the database instance
The SAP database instance DB2<DBSID> must be running when installation program
sddb6ins is executed.
• Correct user environment
Program sddb6ins must be executed in the correct user environment.
Windows:
To start sddb6ins.exe, log on to the database server as user <sapsid>adm.

When working with Microsoft Cluster, sddb6ins.exe must be executed on all


cluster nodes. For this, set the environment variable DB2INSTANCE to
db2<dbsid> (instead of db2l<dbsid>) in the local command window. The
database resource has to run on the actual cluster node.
UNIX:
To run sddb6ins, you require root authorization with the <sapsid>adm user
environment. Log on as <sapsid>adm and then change to user root using su.

Do not use su - to change to user root because the db2<dbsid> user


environment is then lost.

48 July 2006
UNIX only: For SAP Systems lower than 4.6x
If you want to install the 4.6D Admin Tools for the first time on SAP systems lower than 4.6x,
you have to perform the following additional steps as the group concept changed with
Release 4.6A:
...

1. Create two new groups called db<dbsid>ctl and db<dbsid>adm if they do not
already exist.
2. Change the primary group of user db<dbsid> to db<dbsid>adm and keep group
sysadm as the secondary group.
3. Add group db<dbsid>ctl as the secondary group to user <sapsid>adm.
4. Update the database manager configuration.
To do so, log on to the database server as user db2<dbsid> and enter the following
commands:
db2 update dbm cfg using SYSADM_GROUP db<dbsid>adm
db2 update dbm cfg using SYSCTRL_GROUP db<dbsid>ctl
5. Perform an instance update to correct the file authorizations of executables, for
example, db2start:
a. Log on to the database server as user db2<dbsid> and stop the DB2 instance.
Enter the following command:
db2stop force
b. As user root, switch to the instance directory and update the DB2 instance.
Enter the following commands:
cd <DB2 installation directory>/instance
./db2iupdt db2<dbsid>
c. Log on again as user db2<dbsid> and restart the DB2 instance. Enter the
following command:
db2start
6. Download the dscdb6up program from SAP Service Marketplace at
service.sap.com/patches.
7. To extract dscdb6up using CAR, enter the following command:
CAR -xvf dscdb6up.CAR
8. Copy the dscdb6up program to directory /usr/sap/<SAPSID>/SYS/exe/run.
9. Use chmod and chown to set the authorizations as follows:
File Permission Owner Group
<SAPMNT>/SYS/exe/run/dscdb6up 4750 root db<dbsid>ctl
<SAPMNT>/SYS/global 750 <sapsid> db<dbsid>adm
adm
<SAPMNT>/SYS/global/dscd6.conf 640 <sapsid> db<dbsid>adm
adm
<SAPMNT> acts as a place holder for /usr/sap/<SAPSID>.

July 2006 49
3.3.2 General Information
Return Codes of sddb6ins
The sddb6ins program writes information about the steps it performs to standard output.
The return code of the sddb6ins program depends on the success of the installation. The
following table describes the possible return codes:
Return Code Description
0 No error detected
1 Severe errors detected, the installation is not complete.
For more information, see Appendix B: Troubleshooting
[Page 177].
2 Warning. Errors have occurred during the installation
but the installation is complete. Check the output
messages.

The values listed in the table above differ from other Admin Tools.

Abbreviation of sddb6ins Options


The following options of the sddb6ins program are not listed in detail in the sections
Upgrading the Admin Tools [Page 50], Installing the Latest Admin Tools [Page 51] and
Checking the Admin Tool Environment [Page 52]. Instead, {common option} acts as a
placeholder for the following three options:
• [-s <SAPSID>]
• [-db2dbnamepwd <pwd>] [-db2dbnamedomain <domain>]
• [-sidadmpwd <pwd>] [-sidadmdomain <domain>]
• [-NOADMDB]
• [-DEB [<level>]]
For a detailed description of these options, see Appendix A: Tool Command Line Parameters
[Page 157].

3.3.3 Upgrading the Admin Tools


Use
You use the -u option of the sddb6ins program to upgrade the Admin Tools. The following
conditions apply:
• If you have performed an upgrade to an SAP system with Release 4.6D or lower but
you are still using a version of the Admin Tools from before 4.6D, an upgrade to the
latest 4.6D Admin Tools is strongly recommended.

50 July 2006
• If you upgrade to an SAP system Release 6.10 or higher, an upgrade to the 6.NN
Admin Tools is required.

If you are using an SAP system with Release 4.6D or lower and you want to use
the 6.NN Admin Tools, Admin Tools upgrades are not supported.

Procedure
To upgrade the Admin Tools, enter the following command:
sddb6ins -u <start release> [<target release>] {common options}
<start release> is a placeholder for the release of the previously installed Admin Tools.

For example, to upgrade the Admin Tools from 4.6D to 6.10 using the 6.10
sddb6ins executable:
UNIX: sddb6ins –u 46D
Windows: sddb6ins –u 46D –db2dbnamepwd <password of user
db2<dbsid>>
If the -NOADMDB option is used, the Admin DB will not be installed. In this case log file
archiving is only performed directly by the User Exit program db2uext2 (for more
information, see Archiving Directly to TSM [Page 80]). Otherwise, the Admin DB will be
installed (if not already present) and brarchive and brrestore are then also available.
See also:
Actions Performed by the sddb6ins Program [Page 53]

3.3.4 Installing the Latest Admin Tools


Use
You use the -i option in the following cases:
• You have to install the latest Admin Tools manually after an SAP system installation of
Release 6.10 or higher.
• You want to apply an Admin Tools patch for the currently installed Admin Tools.
However, you must make sure that you are using a patch that is valid for the same
release of the currently installed Admin Tools.

Procedure
To manually install the latest Admin Tools or to apply an Admin Tools patch, enter the
following command:
sddb6ins -i [<target release>] {common options}

July 2006 51
For example, to install the current version of the Admin Tools, enter the
following command:
UNIX: sddb6ins –i
Windows: sddb6ins –i –db2dbnamepwd <password of user
db2<dbsid>>
If the -NOADMDB option is used, the Admin DB will not be installed. In this case log file
archiving is only performed directly by the User Exit program db2uext2 (for more
information, see Archiving Directly to TSM [Page 80]). Otherwise, the Admin DB will be
installed (if not already present) and brarchive and brrestore are then also available.

On Windows, make sure that environment variable INSTHOME is set correctly:


• In a multi-host environment, INSTHOME must point to a Windows share
(default directory \\<instance-owning host>\db2<dbsid>).
• In a single-host environment, INSTHOME must point to an existing directory,
for example, d:\db2\db2<dbsid>.
The directory name must not contain any spaces.

The -a option of sddb6ins, which was used to install the latest Admin Tools
after the installation of a downward-compatible kernel (DCK), no longer exists.
Use the -i option instead.
See also:
Actions Performed by the sddb6ins Program [Page 51]

3.3.5 Checking the Admin Tools Environment


Use
You use option –checkonly to verify the Admin Tools installation. The verification routine
checks if:
• The environments for user db2<dbsid> and <sapsid>adm are set correctly.
• The necessary files and directories exist and have the correct authorizations.
• The DB2 instance variable DB2ENVLIST is set correctly.
• The database configuration parameters LOGRETAIN and USEREXIT are set to ON for
the SAP database <DBSID>.
• UNIX only: Users and groups are set up correctly.
• Windows only: The required shares exist.

52 July 2006
Procedure
To check the environment of the Admin Tools, enter the following command:
sddb6ins –checkonly [<target release>] {common options}

For example, to check the Admin Tools, enter the following command:
UNIX: sddb6ins –checkonly
Windows: sddb6ins –checkonly –db2dbnamepwd <password of
user db2<dbsid>>
With the sddb6ins version 6.10 or higher, this verification is also performed automatically at
the end of an installation (–i) or upgrade (-u) operation. The output contains useful
information about the environment in which the Admin Tools operate. The verification tool
writes the following message types:
Message Description
Type
[I] Provides information about the current configuration.
[E] Severe configuration errors have occurred during the
installation.
[W] Warnings if possible inconsistencies have been detected

3.3.6 Actions Performed by the sddb6ins Program


The following section describes the actions performed by the sddb6ins program during the
installation (option -i) or upgrade (option -u) of the Admin Tools:

Actions Performed During Installation (-i)


The sddb6ins program performs the following actions:
• 6.NN Admin Tools only:
The following table lists the directories that are created by sddb6ins:
Directory Description
• UNIX: Admin Tools directory, also
$INSTHOME/admintools contains the environment file
init<DBSID>.db6.
• Windows:
%INSTHOME%\admintools
• UNIX: Contains the Admin Tools
$INSTHOME/admintools/bin executables and libraries.
• Windows:
%INSTHOME%\admintools\bin

July 2006 53
• UNIX: Contains the trace files
$INSTHOME/admintools/TraceFiles created by all Admin Tools.
• Windows:
%INSTHOME%\admintools\TraceFiles
• UNIX: Contains brarchive and
$INSTHOME/admintools/protocols brrestore protocol files.
• Windows: User Exit protocol files are in
%INSTHOME%\admintools\protocols the DIAGPATH directory.
• 6.NN Admin Tools on Windows only:
In a multi-partitioned system, sddb6ins creates the following shares on the node
where hostname matches the contents of the variable DSCDB6HOME:
{ log_archive<DBSID>
{ log_retrieve<DBSID>
• Extracts the executables stored in sddb6ins to the following directory:
{ For 6.NN Admin Tools:
<INSTHOME>/admintools/bin
{ For 4.6D Admin Tools:
/usr/sap/<SAPSID>/SYS/exe/run
• Copies the User Exit program db2uext2 to the DB2 directory:
{ UNIX: $INSTHOME/sqllib/adm
{ Windows: <DB2_install_dir>\sqllib\bin
• Copies the stored procedure sddb6jds, which is required for the DB2 Control Center
Extensions, to the DB2 directory.
{ UNIX: $INSTHOME/sqllib/function
{ Windows: <DB2_install_dir>\sqllib\function
• 6.NN Admin Tools only:
Removes executables installed with previous versions, which are no longer required.
The Admin Tools up to 4.6D were stored in the same directory as the standard SAP
system executables and were therefore deleted during an SAP system upgrade.
• Creates or updates the environment file init<DBSID>.db6 in the following directory:
{ For 6.NN Admin Tools: <INSTHOME>/admintools directory (see table above)
{ For 4.6D Admin Tools: /usr/sap/<SAPSID>/SYS/global
For an example of the environment file, see Appendix D: Example of File
init<DBSID>.db6 [Page 212].

54 July 2006
• By default, sddb6ins creates the Admin DB ADM<DBSID> if it does not already exist
and performs the following actions:
{ Customizes a multi-partitioned system.
{ Grants the access authorizations to the Admin DB ADM<DBSID>.
{ If required, it creates the tables in the Admin DB and fills the configuration table
with default values if this table is empty.
{ 4.6D Admin Tools only:
Creates mirror tables in the <DBSID> database.

If you use the –NOADMDB option, the Admin Tool creation will be suppressed.
The Admin DB will not be created then and the above steps will not be
performed. If you want to use indirect archiving, do not use the –NOADMDB
option.
• 4.6D Admin Tools only:
Creates a user defined function (UDF) entry in the <DBSID> database.
• 6.NN Admin Tools only:
Adds Admin Tools-specific environment variables, for example for TSM, to the
environment of db2<dbsid> and <sapsid>adm.
• Sets the DB2 instance variable DB2ENVLIST, so that the stored procedure works
properly.
• UNIX only:
Sets the access authorizations on the Admin Tools directories and files as follows:

6.NN Admin Tools

Directory or File Access Owner Group


Privilege in
Octal Form
$INSTHOME/admintools 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/admintools/bin 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/admintools/protocols 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/admintools/TraceFiles 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/admintools/init<DBSID>. 0644 db2<dbsid> db<dbsid>adm
db6
$INSTHOME/admintools/bin/brarchive 6755 db2<dbsid> db<dbsid>adm
$INSTHOME/admintools/bin/brrestore 6755 root db<dbsid>adm
$INSTHOME/admintools/bin/libdb6tp. 0755 db2<dbsid> db<dbsid>adm
[o|so|sl]
$INSTHOME/admintools/bin/libdb6ds. 0755 db2<dbsid> db<dbsid>adm
[o|so|sl]
$INSTHOME/admintools/bin/libdb6sc. 0755 db2<dbsid> db<dbsid>adm
[o|so|sl]

July 2006 55
$INSTHOME/admintools/bin/libdb6sct 0755 db2<dbsid> db<dbsid>adm
sm.smp
$INSTHOME/admintools/bin/db6adutl 6755 root db<dbsid>adm
$INSTHOME/sqllib/adm/db2uext2 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/sqllib/function/sddb6jds 0755 db2<dbsid> db<dbsid>adm

4.6D Admin Tools

Directory or File Access Owner Group


Privileg
e in
Octal
Form
$INSTHOME/saparch 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/saprest
/tmp/TraceFiles 0755 db2<dbsid> db<dbsid>adm
/usr/sap/<SAPSID>/SYS/global/ 0640 db2<dbsid> db<dbsid>adm
init<DBSID>.db6
<SAPEXE>/brarchive 6755 db2<dbsid> db<dbsid>adm
<SAPEXE>/brrestore 6755 root db<dbsid>adm
<SAPEXE>/libdb6tp.[o|so|sl] 0755 db2<dbsid> db<dbsid>adm
<SAPEXE>/libdb6ds.[o|so|sl] 0755 db2<dbsid> db<dbsid>adm
<SAPEXE>/libdb6sc.[o|so|sl] 0755 db2<dbsid> db<dbsid>adm
<SAPEXE>/db6sctsm.smp 0755 db2<dbsid> db<dbsid>adm
<SAPEXE>/db6adutl 6755 root db<dbsid>adm
$INSTHOME/sqllib/adm/db2uext2 0755 db2<dbsid> db<dbsid>adm
$INSTHOME/sqllib/function/sddb6jds 0755 db2<dbsid> db<dbsid>adm
<SAPEXE> is a placeholder for /usr/sap/<SAPSID>/SYS/exe/run.
• Inserts the Admin Tools release into the Admin DB.
• 6.10 Admin Tools only:
Checks the installation of the Admin Tools using, for example, the –checkonly option,
which is described in Appendix A: Tool Command Line Parameters [Page 157] and
Appendix B: Troubleshooting [Page 177].

56 July 2006
Actions Performed During Upgrade (-u)
The actions performed during upgrade are similar to the actions performed during installation.
However, some actions depend on the <start release> parameter.
The sddb6ins program performs the following additional actions:
• If starting with 3.1I Admin Tools:
The 3.1I init<DBSID>.sap configuration file content is moved to the Admin DB.
• 4.0B − 4.6A Admin Tools
The log archive location must be changed. Any log files in the old location are moved
and the Admin Database is updated.
• 3.1I − 4.6C Admin Tools
The executables and libraries are exchanged.

3.3.7 Special Configurations


This section provides information about special configurations that apply in the case of
multiple SAP systems on one database (MCOD) or if you are using a multi-partitioned
database system:
• MCOD
{ For SAP systems with Release 4.6D:
The Admin Tools are only enabled for the main SAP system that is the firstly
installed SAP system. The Admin Tools do not support any additionally installed
SAP system .
{ For SAP systems with Release 6.10 or higher:
Call the sddb6ins program for all <sapsid>adm users to enable the Admin
Tools environment for all SAP systems that are installed on one database.
• Multi-partitioned database systems
If you are using a multi-partitioned database system, which is the default for an SAP
BW installation, and more than one database node is used, you must call sddb6ins
on each host where a database node of the database <DBSID> exists.
• Multi-partitioned database systems on UNIX only:
If you want to use indirect archiving, you have to split the database installation over
several nodes (computers). The archive and retrieve directories must be mounted on
all nodes using NFS. You must export the archive and retrieve directories on one node
and mount these directories on all other nodes using NFS. You need to use the same
path on all nodes for the archive and retrieve directory.

3.3.8 Enabling the Database for Rollforward Recovery


As outlined in Basic Concepts [Page 23], SAP and IBM recommend that the database system
be operated in roll-forward recovery mode (LOGRETAIN) with the USEREXIT database
parameter turned on. In this mode, the active log files, in which all database changes are

July 2006 57
recorded, are archived by the User Exit program db2uext2 when they are no longer needed
for processing transactions. Log file numbering increases with each new log file (up to
9999999).
Roll-forward recovery is not enabled by default. You enable roll-forward recovery and the
User Exit mechanism by setting the database configuration parameters LOGRETAIN and
USEREXIT to ON. An offline backup of the database must be performed after setting these
parameters. The procedures differ depending whether you are using a single-partitioned or
multi-partitioned system.

Unlike with an offline backup, if you want to perform online backups, the
database must be in roll-forward recovery mode, that is LOGRETAIN must be set
to ON.

There are ways of forcing the database out of BACKUP PENDING mode after
setting these parameters without performing a backup first. Do not do this, as
the Admin Tools will not operate correctly until a backup has been performed.
System copies created by restoring a database backup will also not force a new
backup if the LOGRETAIN parameter was already ON for the original database.
A new backup must be performed before the User Exit is called.
See also:
Enabling Rollforward Recovery for a Single-Partitioned Database [Page 58]
Enabling Rollforward Recovery for a Multi-Partitioned Database [Page 59]

3.3.8.1 Enabling Rollforward Recovery for a Single-Partitioned


Database
Updating Database Parameters
You can perform these actions either using the command line or the DB2 Control Center.

DB2 Command Line on the Database Server


...

1. Log on to the database server as user db2<dbsid>.


2. Windows only: Start the DB2 Command Window.
3. To update the database configuration parameters, enter the following commands:
db2 update db cfg for <DBSID> using USEREXIT ON
db2 update db cfg for <DBSID> using LOGRETAIN ON
4. Restart the database instance.
...

58 July 2006
DB2 Control Center

Make sure that you have installed and set up the DB2 Control Center before
performing these steps. For more information, see Installation of the DB2
Control Center [Page 61] and Setting Up the DB2 Control Center [Page 62].
1. Start the DB2 Control Center.
2. From the context menu of the <DBSID> database icon, choose Configure.
3. Choose Logs of the notebook.
4. Choose Retain log files for roll-forward recovery from the list.
5. In the value area, select the Yes radio button.
6. To confirm, choose OK to confirm.
7. Restart the database instance.
...

Backing Up the Database


After having updated the database configuration parameters, back up your database. For
more information, see Performing the Backup [Page 111].

3.3.8.2 Enabling Rollforward Recovery for a Multi-Partitioned


Database
Updating Database Parameters
You can perform these actions either using the command line or the DB2 Control Center.

DB2 Command Line on the Database Server


...

1. Log on to the database server as user db2<dbsid>.


2. To update the database configuration parameters, enter the following commands:
db2_all "db2 update db cfg for <DBSID> using LOGRETAIN ON"
db2_all "db2 update db cfg for <DBSID> using USEREXIT ON"
3. Restart the database instance.
..

DB2 Control Center

Make sure that you have installed and set up the DB2 Control Center before
performing these steps. For more information, see Installation of the DB2
Control Center [Page 61] and Setting Up the DB2 Control Center [Page 62].
1. Start the DB2 Control Center.
2. From the context menu of the <DBSID> database icon, choose Open → Database
Partitions….
3. In the table Database Partitions, Select all nodes.
4. From the menu that appears, select Configure….

July 2006 59
5. Choose Logs of the notebook.
6. Select Retain log files for roll-forward recovery from the list.
7. In the value area, choose the Yes radio button.
8. To confirm, choose OK.
9. Restart the database instance.
...

Backing Up the Database


After having updated the database configuration parameters, back up your database. For
more information, see Performing the Backup [Page 111].

3.3.9 Deinstalling the Admin Tools


Use
You can deinstall the Admin Tools with option –d of sddb6ins. This can be useful if you:
• Want to use other log file management tools
• Migrate to DB2 Version 8.2, which includes its own log file management
• Want to start the Admin Tools installation from scratch
This option performs the following actions:
• It removes the Admin Tool executables.
• It removes environment file init<DBSID>.db6.
• It drops the Admin DB.
• For the 4.6D Admin Tools: It drops the mirror tables from the <DBSID> database.

Procedure
To deinstall the Admin Tools, enter the following command:
sddb6ins –d

3.4 Installation and Setup of the DB2 Control


Center Extensions
The Admin Tools have a user interface that is integrated into the DB2 Control Center as a set
of extensions. As it is Java-based, it is available on all platforms which support Java. It can be
run remotely, such as on a PC. To be able to use this interface, you must install the DB2
Control Center first.

60 July 2006
3.4.1 Installation of the DB2 Control Center
The DB2 Control Center is part of the DB2 Client Software called the DB2 Administration
Client, and also part of the DB2 server installation.
To install it, follow the standard DB2 installation process and make sure that you select the
option Control Center for installation. On a UNIX based operating system, you can start the
DB2 Control Center by executing command db2cc. On Windows, there is also a menu entry
in the DB2 group in the Start menu.

The DB2 Control Center of DB2 Version 7 or lower does not support 64-bit
instances in general. In order to work with 64-bit systems, the DRDA protocol
must be used. This is available with all single- and multi-partitioned systems. On
all other systems, install DB2 Connect in addition.

3.4.2 Installing the DB2 Control Center Extensions


The DB2 Control Center Extensions can only be installed after the DB2 Control Center has
been installed.

If you use the direct archiving mode to archive the log files, the DB2 Control
Center Extensions are not required,.

On Windows:
...

1. Log on to the machine where you want to install the Admin Tools as a user with local
administration authorizations.
2. Insert the SAP kernel CD.
3. On the CD, change to the directory NT\I386\DBTOOLS.
4. Extract file DB6CCEXT.SAR to a temporary directory by using tool SAPCAR.
5. Change to the temporary directory.
6. Invoke setup.exe and follow the instructions.

For the DB2 Control Center Extensions to perform correctly, the DB2 variable
DB2INSTANCE must have the same value in the system environment and the
environment of the user who starts the DB2 Control Center.

July 2006 61
On UNIX:
...

1. Log on to the machine where you want to install the DB2 Control Center Extension as
user root.
2. Insert the SAP kernel CD.
3. Mount the CD.
4. On the CD, change to the directory UNIX/<Unix platform>/DBTOOLS.
5. Extract file DB6CCEXT.SAR to a temporary directory by using SAPCAR.
6. Change to the temporary directory.
7. Invoke the shell script install and follow the instructions

3.4.3 Setting Up the DB2 Control Center


The DB2 Control Center Extensions are available for SAP databases and instances. If the
DB2 Control Center is not running on the same machine as the SAP database, it is necessary
to catalog the remote computer, the SAP database and its instance. These tasks have to be
performed by an user with administrative authorizations.

Cataloging Databases on 32-Bit DB2 Instances

If communication error messages appear while performing actions in this


section, the DB2 Administration instance (db2das) may not be running on the
computer being cataloged or communication may not be set up correctly. Refer
to the DB2 documentation for setting up and starting the DB2 Administration
instance and the DB2 Messages Reference.

Cataloging a Remote Computer:


...

1. In the navigation frame of the DB2 Control Center, choose Systems from the context
menu.
2. Choose Add from the menu.
The Add System dialog box appears.

62 July 2006
3. To retrieve a list of DB2 systems located in the network, choose Refresh.
4. If available, choose the system on which the SAP database server is located. If the
system is not listed, enter the name of the server in the System Name field. Fill out or
modify the remaining fields.
5. To add this and further systems, choose Apply. Otherwise, confirm with OK.

July 2006 63
Cataloging a Database Manager Instance:
1. In the navigation frame of the DB2 Control Center, expand the node with the name of
the system where the DB2 server is located.
2. From the context menu of the Instances subnode, choose Add.
The Add Instance dialog box appears.

3. To retrieve a list of instances on the chosen system, choose Refresh.


4. If available, select the instance from the list in the Remote Instance field. If the instance
is not listed, enter the name of the instance in the Remote Instance field and fill out the
remaining fields. The service name should have the value sapdb2<DBSID> and is
defined in the file /etc/services on the database server.
5. To add this and further instances, choose Apply. Otherwise, confirm with OK.

64 July 2006
Cataloging the Databases <DBSID> and ADM<DBSID>:
...

1. In the navigation frame of the DB2 Control Center, expand the <system name> node,
then the instances node, and the <instance name> node.
2. From the context menu of the Databases node, choose Add.
The Add Database dialog box appears.

3. To retrieve the list of databases created on the instance, choose Refresh.


4. If available, choose the SAP database <DBSID> in the Database Name field. If the
database is not listed, enter the name of the database in the Database Name field. The
other fields are optional.
5. Confirm the entry by choosing Apply.
6. In the same way, select the Admin DB ADM<DBSID> in the Database Name field, or
enter the name by overwriting the previous entry.
7. Confirm the entries with OK.

Cataloging Databases on 64-Bit DB2 Instances


With DB2 Version 8, cataloging databases on 64-bit DB2 instances is the same process as
on 32-bit DB2 instances. The DB2 Control Center of DB2 Version 8 provides the same
functionality for both instance types as long as your database is DB2 Version 8.

If you want to access a DB2 Version 7 64-bit instance using DB2 Control Center
Version 8, you must configure the DRDA communication protocol to enable
communication. Be aware, however, that in this case only limited functionality is
available.
With DB2 Version 7, the DB2 Control Center does not provide all functions on 64-bit DB2
instances. To use the DB2 Control Center for DB2 Version 7 for the administration of 64-bit
DB2 instances, you must use the communication protocol DRDA.

Cataloging Databases to Use Communication Protocol DRDA


To be able to use communication protocol DRDA, the SAP database <DBSID> and Admin DB
ADM<DBSID> must be cataloged in a special procedure. On Windows, you can use the Client
Configuration Assistant or the command line processor. On UNIX, you can only catalog the
databases using the command line.

July 2006 65
Using the DB2 Version 7 Client Configuration Assistant
...

1. Log on as a user with administrative authorizations. If the computer is a member of a


domain, the user must have domain administrator authorizations.
2. Start the Client Configuration Environment by choosing Start → Programs → IBM DB2
→ Client Configuration Assistant.
The Client Configuration Assistant dialog box appears.
3. Choose Add.
The Add Database Wizard - 1. Source screen appears.
4. Choose Manually configure a connection to a database.
5. To continue, choose Next.
The Add Database Wizard - 2. Protocol screen appears.
6. Select TCP/IP.
7. To be able to connect to the server, select The database physically resides on a host or
AS/400 system.

If this option does not appear, you have not installed DRDA support on the client.
8. Select Connect directly to the server.
9. To continue, choose Next.
The Add Database Wizard - 3. TCP/IP screen appears.
10. In the Host Name field, enter the host name where the SAP database is running.
11. In the Port Number field, enter the port number of the database instance.

You can find the port number in the following file on the database host. The
location depends on the host operating system:
• Windows: <WindowsSystemDirectory>\system32\drivers\etc\services
• UNIX: /etc/services
Look for the entry sapdb2<DBSID>.
12. To continue, choose Next.
The Add Database Wizard - 4. Database screen appears.
13. Enter the name of the SAP database and choose Next twice.
The Add Database Wizard - 6. Node Option screen appears.
14. In the System Name field, enter the name of the database host.
15. In the Instance Name field, enter the DB2 instance name.
16. Choose the corresponding operating system.

66 July 2006
17. Choose Finish.
The Confirmation dialog box appears. To test the connection, choose Test Connection,
enter the user ID and password, and choose OK.
18. To repeat the procedure for the Admin DB ADM<DBSID>, choose Add and repeat steps
13 to 17.

Using the DB2 Version 8 Configuration Client Assistant


1. Log on as a user with administrator authorizations. If the computer is a member of a
domain, the user must have domain administrator authorizations.
2. Start the client configuration environment by choosing Start → Programs → IBM DB2
→ Set-up Tools → Configuration Assistant.
The Client Configuration Assistant dialog box appears.
3. Choose Selected → Add Database Using Wizard…
The Add Database Wizard – 1. Source screen appears.
4. Select Manually configure a connection to a database.
5. To continue, choose Next.
The Add Database Wizard – 2. Protocol screen appears.
6. Select TCP/IP.
7. To be able to connect to the server, select The database physically resides on a host or
AS/400 system.

If this option does not appear, you have not installed DRDA support on the client.
8. Select Connect directly to the server.
9. To continue, choose Next.
The Add Database Wizard – 3. TCP/IP screen appears.
10. In the Host name field, enter the host name where the SAP database is running.
11. In the Port number field, enter the port number of the database instance.

You can find the port number on the database host in the following file:
• UNIX:
/etc/services

• Windows:
<Windows_system_directory>\system32\drivers\etc\services

Look for the entry sapdb2<DBSID>.


12. To continue, choose Next.
The Add Database Wizard – 4. Database screen appears.
13. Enter the name of the SAP database and choose Next.
The Add Database Wizard – 5. Data Source screen appears.
14. Deselect Register this database for ODBC and choose Next.
The Add Database Wizard – 6. Node Option screen appears.

July 2006 67
15. Choose the corresponding operating system.
16. In the Remote instance name field, enter the DB2 instance name and choose Next.
The Add Database Wizard – 7. System Options screen appears.
17. To continue, choose Next.
The Add Database Wizard – 8. Security Options screen appears.
18. Select User authentication value in server’s DBM configuration.
19. To continue, choose Next.
The Add Database Wizard – 8 DCS Options screen appears.
20. Select Configure DCS options.
21. Select Disconnect if client generates an interrupt (INTERRUPT_ENABLED).
22. Choose Finish.
The Test Connection dialog box appears.
23. Select CLI and enter the user ID and password.
24. Choose Test Connection.
25. To check for a successful test connection, choose the Results tab. In case of a
success, the following message is displayed:
CLI connection tested successfully
26. To add the Admin DB ADM<DBSID>, repeat steps 1 to 22.

Using the Command Line


...

1. Log on as a user with SYSADM authorization, for example, db2<dbsid>.


2. Enter the following commands in the sequence given (use db2<dbsid> as
<nodeName>):
db2 catalog tcpip node <nodeName> remote <dbHostName> server
<portNumber>

You can find the port number on the database host in the following file:
UNIX: /etc/services
Windows: %SystemRoot%\system32\drivers\etc\services
Look for the entry sapdb2<DBSID>.
db2 catalog db <DBSID> at node <nodeName> authentication dcs
db2 catalog dcs db <DBSID> parms ',,INTERRUPT_ENABLED,,,,,'
db2 catalog db ADM<DBSID> at node <nodeName> authentication dcs
db2 catalog dcs db ADM<DBSID> parms ',,INTERRUPT_ENABLED,,,,,'

68 July 2006
3.4.4 Using the DB2 Control Center Extensions
After cataloging the databases, the DB2 Control Center Extensions can now be used. You
can access the DB2 Control Center Extensions using new context menu entries, which have
been added to the standard DB2 Control Center menus at the instance and database levels.
The <DBSID> database context menu contains three entries: SAP Options Management,
SAP Log File Management and SAP Tape Management.
For more information about how to use the option SAP Option Management, see Parameters
Affecting Log File Management Storage [Page 70].
For more information about how to use the option SAP Log File Management, see Advanced
Log File Maintenance Tasks [Page 117].

July 2006 69
4 Configuration

4.1 Changing the Admin Tools Configuration


The following sections describes how you can change the configuration of the Admin Tools.
There are two locations where parameters may need to be changed:
• In the DB2 Control Center Extensions (only necessary for indirect archiving).
For more information, see Parameters Affecting Log File Management Storage [Page
70].
• In the environment file init<DBSID>.db6
For more information, see Configuring the Admin Tools Using Environment Files [Page
73].

4.1.1 Parameters Affecting Log File Management


Storage
If you have decided to use the default behavior of archiving log files indirectly via disk, the
Admin DB will have been created. The Admin DB keeps track of the location and states of all
log files. Furthermore, it contains several configuration parameters for the log file
management tools.
To view or to change the parameters, proceed as follows:
...

1. In the navigation frame of the DB2 Control Center, choose the database <DBSID>
using the context menu.

If you are using the DB2 Control Center Extensions with a patch level lower than
3, you choose the database instance db2<dbsid> (containing the <DBSID>
database) using context menu.

70 July 2006
2. Choose SAP Option Management.
The Options dialog box appears. The following is an example from an AIX system.

When you select a parameter, its description is displayed in the field at the bottom of
the dialog box.
3. To change the value of a selected parameter, double-click on the Value field.
4. Enter the new values.
The following parameters can be set in the Options dialog box:
Parameter Description
backup_dev_type Default storage management product, if not given on the
command line. Initially set to tape, but can be set to adsm
for TSM.
Do not set this value to tsm.
cpio_flags Flags used to modify the cpio command when archiving
files to tape. These may need modifying if a non-standard
block size is used. For more information, see Indirect
Archiving to Tape [Page 82] section Modifying the Tape
Block Size.
cpio_in_flags Flags used to modify the cpio command when restoring
files from tape. These may need modifying if a non-standard
block size is used. For more information, see Indirect
Archiving to Tape [Page 82] section Modifying the Tape
Block Size.

July 2006 71
rewind Command used to rewind a tape. The $ is replaced by the
tape device name. This value should not normally be
changed.
rewind_offline Command used to rewind a tape and then place it offline
(some devices eject the tape). The $ is replaced by the tape
device name. This value should not normally be changed.
tape_pos_cmd Command used to a spool a tape forwards. The first $ is
replaced by the tape device name. The second $ is replaced
by a number indicating the number of files to spool forward
by. This value should not be changed.
tape_size Indicates the default size of tapes. It is only used to suggest
how much data might fit on a tape, but may be ignored. M
indicates megabytes. This value is used to set the default
value for all user-defined tape devices.
tape_address Non-rewind address of the default tape device. Using this
address ensures that the tape is not rewound at the end of
each tape operation. For more information about non-rewind
addresses, see brrestore - Log File Retrieval Tool [Page
163].
tape_address_rew Standard address of the default tape device. Using this
address results in the tape being rewound at the end of each
tape operation.
expir_period Number of weeks that must pass before a used tape can be
re-used without the need to explicitly reinitialize it. The
default is value 6.
tape_use_count Number of times a tape can be re-initialized before warning
messages appear requesting that the tape be replaced. The
default value is 100. Do not use operating system tools to
modify tapes or this information will be lost resulting in tapes
being used too often, risking loss of data.
dd_flags Flags used to modify the dd command when archiving files
to tape. These may need modifying if a non-standard block
size is used.
dd_in_flags Flags used to modify the dd command when restoring files
from tape. These may need modifying if a non-standard
block size is used.
delete_protocols Number of days to retain tool protocol entries in the Admin
DB, before they are deleted. The default value is 30.
adsm_mc Name of the default TSM management class.
5. To cancel changes, choose Escape. To confirm the changes, choose Enter.
A dialog box appears asking for confirmation of the changes.
6. To confirm the changes, choose Yes.

72 July 2006
4.1.2 Configuring the Admin Tools Using Environment
Files
The environment files init<DBSID>.db6 and init<SAPSID>.db6 are the primary source
for configuring the Admin Tools. The redirected restore tool brdb6brt and the CCMS tools
(for example, dmdb6rdi, dmdb6rts, dmdb6srp, dmdb6snp and db6clp) can be configured
in the init<SAPSID>.db6 file. The Admin Tools (for example, db2uext2, brarchive,
brrestore, db6adutl, sddb6mir) can be configured in the init<DBSID>.db6 file.

Location of the Environment Files


• The init<DBSID>.db6 file is located in the following directory:
{ For SAP system releases lower and including 4.6D
ƒ UNIX: /usr/sap/<SAPSID>/SYS/global
ƒ Windows: <drive>:\usr\sap\<SAPSID>\SYS\global
{ For SAP Web AS 6.10 or higher
ƒ UNIX: <INSTHOME>/admintools
ƒ Windows: <INSTHOME>\admintools

Be aware that for SAP system releases lower and including 4.6D, <SAPSID>
equals <DBSID> and the global directory is used as the location for the
environment files. Thus, all the variables are contained in the same file that is
located in the global directory.
• The init<SAPSID>.db6 file is located in the following directory:
{ UNIX: /usr/sap/<SAPSID>/SYS/global
{ Windows: <drive>:\usr\sap\<SAPSID>\SYS\global

Format of File Content


The following is a brief description of the format of the file content:
• A # introduces comments; the rest of the line is ignored.
• Empty lines are ignored.
• To set a variable, you have to specify a line like <variable name> = <value>, for
example, DB2DB6_TEMP_DIR = c:\temp.

Activation of Variables
All recognized variables are listed in the file and are inactive as long as they appear after the
comment sign (#). You activate a variable by removing the comment sign (#) and by adapting
the value of the variable according to your requirements.

We strongly recommend that you use only these files for configuring the Admin
Tools-specific environment variables.

July 2006 73
Admin Tools Configuration Variables
The following table lists the configuration variables of the Admin Tools, which are listed in file
init<DBSID>.db6 or init<SAPSID>.db6 respectively, and their values.

Variable Value
INSTHOME UNIX:
(4.6D Admin Tools only) Points to the db2<dbsid> home directory.
Windows:
Points to <CD-drive>:\db2\db<dbsid>.
DB2DB6_ARCHIVE_PATH Points to the archive directory.
UNIX: /db2/<DBSID>/log_archive (default value)
Windows:
Default value for a single-partitioned database:
<drive>:\db2<DBSID>\log_archive
Default value for a multi-partitioned database:
\\<instance_owning_machine>\log_archive<DBSID>
DB2DB6_RETRIEVE_PATH Points to the retrieve directory.
UNIX: /db2/<DBSID>/log_retrieve (default value)
Windows:
Default value for a single-partitioned database:
<drive>:\db2\<DBSID>\log_retrieve
Default value for a multi-partitioned system:
\\<instance_owning_machine>\log_retrieve<DBSID
>
DB2DB6_TEMP_DIR UNIX: /tmp (default value)
Windows: Value of %TEMP% (default value)
DB2DB6_STANDBY_DIR This variable is not set by default.
If this variable is used, the User Exit creates an additional
copy of the log file in the standby directory during the archiving
operation. If you want to set up a hot-standby system, you can
use this variable For more information, see The db2inidb Tool
[Page 132].
DB2DB6_STANDBY_DIR_NOERR By default, this variable is not set or set to OFF.
If the variable is set to ON, operations that fail in the standby
directory do not cause the executable, which accesses the
standby directory, to abort with an error.
DB2DB6_STANDBY_DIR_ADMDBSAR By default, this variable is not set or set to OFF.
If the variable is set to ON, brarchive creates an additional
copy of the Admin DB backup SAR file in standby directory
DB2DB6_STANDBY_DIR.

74 July 2006
DB2DB6_UEXIT_DIRECT • For indirect archiving:
This variable is not set or set to OFF.
• For TSM:
To activate archiving to TSM, set variable as follows:
DB2DB6_UEXIT_DIRECT=TSM:<mgmt
class1>[+<mgmt class 2>]
• For direct archiving to an alternative storage product, set
the variable as follows:
DB2DB6_UEXIT_DIRECT=VENDOR.
In addition, to activate direct archiving to an alternative
storage product, you must configure variable
DB2DB6_VENDOR_UEXIT.
• For archiving directly to disk, set the variable as follows:
DB2DB6_UEXIT_DIRECT=DISK.
For more information, see Configuring the System for Archiving
Log Files [Page 78].
DB2DB6_VENDOR_UEXIT By default, this variable is not set.
If you have configured DB2DB6_UEXIT_DIRECT=VENDOR,
you need to set the variable as follows:
DB2DB6_VENDOR_UEXIT=<path to vendor User
Exit>.
For more information, see Archiving to an Alternative Storage
Management Product [Page 82].
DB2DB6_UEXIT_ARCHIVE_WO_DB By default, this variable is not set or set to ON.
If this variable is set to ON, the User Exit does not update the
Admin DB during indirect archiving operations. brarchive
updates the Admin DB only during the next archiving
operation. For SAP system releases lower and including 4.6D
where program sddb6mir is used, sddb6mir updates the
Admin DB as well.
DB2DB6_UEXIT_RETRIEVE_WO_DB By default, this variable is not set or set to OFF.
If this variable is set to ON, the User Exit tries to retrieve log
files from log_archive or log_retrieve even if the Admin
DB does not exist or is not up-to-date.
DB2DB6_CORE By default, this variable is not set or set to OFF.
If this variable is set to ON, the Admin Tools executables write
a core file in UNIX instead of trying to handle exceptions
internally. We strongly recommend that you do not set this
variable to ON unless you are asked to do so by SAP support.
DB2DB6_NO_EJECT By default, this variable is not set or set to OFF which
generally avoids ejection of the tape To eject the tape, which
is the default behaviour, set this variable to ON.
DB2DB6_TSM_TIMEOUT Disconnects DB2 from TSM after a specified time in seconds
of no response . By default, this variable is not set. To switch
off this function, set this parameter to zero.

July 2006 75
DB2DB6_LIBDB6SC_SCRIPT By default, this variable is not set.
If you want to archive log files using a customer script with
brarchive, the value of the variable must be set to the fully
qualified path of the customer script.
For more information, see Indirect Archiving Using a Customer
Script [Page 89].
DB2DB6_TSM_MULTITHREADED By default, this variable is not set or set to OFF.
If you want to use the TSM LANFREE feature, you must set
this variable to ON.
For more information, see Configuring TSM (Tivoli Storage
Management) [Page 90].
DB2DB6_TSM_SLIB By default, this variable is not set or set to OFF.
You only have to set this variable if the currently shown
shared library version changes in newer versions of TSM. We
strongly recommend that you do not set this variable to ON
unless you are asked to do so by SAP Support.
DB2DB6_ADMDB_REORG_FREQUENCY By default, this variable is not set. The default value of seven
days applies.
By setting this variable, you can specify how often the Admin
DB is reorganized :
• –1 = never
• 7 = default value
DB2DB6_TRC_<TOOL> By default, this variable is not set or set to OFF.
If you set this variable to ON, the tracing for <TOOL> is
activated.
DB2DB6_TRC_<TOOL>_LEVEL Values between 1 and 9 are allowed and specify the level of
detail:
• 1 = less detailed
• 3 = default
• 9 = maximum
DB2DB6_TRC_<TOOL>_PATH Specifies the path where the trace files of format
<TOOL>.<timestamp>.trc are created.
DB2DB6_TRC_<TOOL>_FILE Overrides DB2DB6_TRC_<TOOL>_PATH.
If this variable is used, the same trace is used for all runs of
<TOOL>, which is set to the fully qualified path of the trace file.

76 July 2006
Configuration Variables of Other Tools
The following table lists the configuration variables of the redirected restore tool brdb6brt
and the CCMS tools, which are contained in file init<SAPSID>.db6, and their values.
Variable Default Description
Value
DB2DB6_DMDB6BKP_RETRIES 10 Backup retries in
case of offline
backups.
DB2DB6_DMDB6BkP_TAPE_PATTERN \\ Pattern which
distinguishes tapes
(Windows only)
from normal
directories
DB2DB6_DMDB6BKP_BLOCK_SIZE 1024 Sets backup block
size for tapes
(used by tool
dmdb6bkp)
DB2DB6_DBDM6SRP_UPDATE_THRESHOLD 15 Updates threshold
in percent to flag
tables for
RUNSTATS.
DB2DB6_DMDB6SRP_TABLESIZE_THRESHOLD 1000 Specifies minimum
table size in rows
to flag tables for
RUNSTATS.
DB2DB6_DMDB6BKP_UTIL_IMPACT_PRIORITY 0 Specifies impact
priority for backup.
0 means no
throttling.
DB2DB6_DMDB6BKP_COMPRESS OFF Sets compression
flag for backup
DB2DB6_DMDB6BKP_INCLUDE_LOGS OFF Includes required
transaction log files
in an online backup
to recover the
database to any
consistent point in
time.

July 2006 77
DB2DB6_DB2DB6_BLOCK_SIZE 1024 Specifies backup
block size for tapes
(used by tool
db2db6)
DB2DB6_DB6SRPRTS_PCT_LONG_LOB 10 Percentage of rows
that are read for
table size
calculation for long
and lob columns.
DB2DB6_DMDB6RDI_REFRESH_LOG_INFO 14 Number of days to
refresh CCMS
archiving log
information

See also:
Appendix D: Example of File init<DBSID>.db6 [Page 212].

4.2 Configuring the System for Archiving Log


Files
As outlined in Basic Concepts [Page 23], log files can be archived directly or indirectly.

Direct Archiving
The User Exit archives log files either directly to disk (DB2DB6_ARCHIVE_PATH), to TSM or
to another vendor storage management product, that is log files are immediately copied from
the system to a safe backend and do no longer reside on the local system. The User Exit
program can be configured to support one of these options.
Archiving log files directly to a storage vendor product means that the User Exit program uses
the indicated storage management product to manage DB2 log files. In case of TSM the User
Exit utilizes the TSM APIs to archive and retrieve log files. All other storage products (for
example, Legato Networker from Legato System, Inc.) deliver their own implementation of the
User Exit program.

78 July 2006
Direct archiving offers the following advantages:
• System configuration is less complex as no Admin DB or DB2 Control Center
Extensions are required.
• Backups can also be archived with the storage management product.
• Tape access and management using storage management systems are easy to handle
and no tape space is wasted.
• No extra space for an archive directory is needed when archiving to TSM or any other
storage management product. You only need extra space if you archive directly to
disk.

We recommend that database administrators use direct archiving as it


performs well and requires minimal maintenance. ROLLFORWARD operations
after a database restore normally require no user interaction when using direct
archiving.
However, when using direct archiving you have to take into considerations that some
constraints apply. During a roll-forward recovery of the database the storage management
system must be available. If it is not available, problems will arise. You can avoid this
situation by setting variable DB2DB6_STANDBY_DIR to keep local copies of log files until they
are no longer required on the local system. Furthermore, an overflow of the log_directory
can occur due to network outage or unavailability of the storage management system.

You can avoid an overflow of the log directory by increasing the space of the log
directory using the space you saved by not needing an archive directory. In
addition, setting DB2 registry variable DB2_BLOCK_ON_LOG_DISK_FULL=ON
(DB2 Version 7.2) or the corresponding database configuration variable
parameter BLK_LOG_DSK_FULL=YES (DB2 Version 8) also reduces the risk of
database failure. You also may consider to use infinite logging.

Indirect Archiving
This is the default configuration. The User Exit automatically copies log files to the directory
specified in the DB2DB6_ARCHIVE_PATH variable. Then brarchive is used to archive the
copied files. In this case, you can archive log files to TSM, tape or using a customer script.
Indirect archiving offers the following advantages:
• Log files are stored on the local system until deleted by brarchive.
In case your storage management system is unavailable, you are still able to restore
and rollforward the database as long as all log files and backups are still available on
the local system.
• Simple tape support is provided by the Admin Tools.
• Option brrestore –delete allows deletion of log files that were created before a
specific timestamp. With direct archiving this function is not available.
• The time of the archiving operation can freely be chosen. Thus, network traffic can be
avoided during the day by archiving during the night.

July 2006 79
However, when using indirect archiving, you have to take into consideration that there are a
few disadvantages. For example, log files located in the archive directory are unsafe until
stored to a safe backend by brarchive. The complexity of the solution, including additional
storage directories and an extra Admin DB, slightly increases the risk of failure. Especially the
existence of the Admin DB can cause problems in split-mirror scenarios and when performing
a homogeneous system copy.
See also:
For detailed information about direct and indirect archiving, see the following sections:
• Archiving Directly to TSM [Page 80]
• Archiving Directly to Disk [Page 81]
• Archiving to an Alternative Storage Management Product [Page 82]
• Indirect Archiving to Tape [Page 82]
• Indirect Archiving to TSM [Page 88]
• Indirect Archiving Using a Customer Script [Page 89]

4.2.1 Archiving Directly to TSM


In order to use the Tivoli Storage Manager to manage DB2 log files and/or DB2 backups, the
TSM client software must be installed on the DB2 database server and a TSM server must be
available. For more information about how to set up the TSM client, see Configuring TSM
(Tivoli Storage Management) [Page 90].
To indicate direct archiving to TSM, set the DB2DB6_UEXIT_DIRECT variable in the
environment file init<DBSID>.db6 (make sure that it is not commented out).
The following syntax is used to set variable DB2DB6_UEXIT_DIRECT:
DB2DB6_UEXIT_DIRECT = TSM:[<Mgmt Class>]

To use the TSM management class MLOG1:


DB2DB6_UEXIT_DIRECT = TSM:MLOG1
If you do not want to create and use a specific TSM management class, specify
either of the following:
• DB2DB6_UEXIT_DIRECT = TSM
• DB2DB6_UEXIT_DIRECT = TSM:DEFAULT
After you have switched on direct archiving by setting variable DB2DB6_UEXIT_DIRECT, the
Admin DB ADM<DBSID> is no longer used and can be dropped.

80 July 2006
The following naming conventions on the TSM server apply:
TSM Variable Meaning
/<DBSID> TSM file space name
DB2 TSM file space type
/NODEyyyy High level file identifier, where yyyy is the node number
/Szzzzzzz.LOG Low level file name, where zzzzzzz is the log file number

For the database BIN on node NODE0000, archiving log file S0000599.LOG
would result in the following values:
• File space name: /BIN
• File space type: DB2
• Object name file space: /BIN
• Object high-level name: /NODE0000
• Object low-level name: /S0000599.LOG
For storing the log files, the archive copy group is used by default. If no archive copy group is
defined, a backup copy group is used. We recommend that you define an archive copy group.

Archiving to Two TSM Management Classes


For duplicated archiving of log files to TSM, you have to create two management classes in
TSM. To do so, you specify both management classes, for example, MC1 and MC2, in the
User Exit variable DB2DB6_UEXIT_DIRECT.

DB2DB6_UEXIT_DIRECT = TSM:MC1+MC2

Archiving Using TSM Option LANFREE


To make sure that the Admin Tools work in a TSM LANFREE environment, you have to
activate variable DB2DB6_TSM_MULTITHREADED in file init<DBSID>.db6.

4.2.2 Archiving Directly to Disk


Since Admin Tools patch 23 (6.NN Admin Tools) or patch 12 (4.6D Admin Tools), the User
exit can directly archive or retrieve log files to or from disk. To define the archive directory,
you have to configure environment variable DB2DB6_ARCHIVE_PATH.
Set the DB2DB6_UEXIT_DIRECT and DB2DB6_ARCHIVE_PATH variables in the environment
file init<DBSID>.db6 using the following syntax:
DB2DB6_UEXIT_DIRECT = DISK
DB2DB6_ARCHIVE_PATH = <log file archive path>
During the archiving operation the User Exit appends the partition number to the log file to
avoid that log files from other DB2 partitions will be overwritten. During the retrieve operation

July 2006 81
the log file is transferred back to the log directory and the partition number is removed
automatically.
The log files in the archive directory need to be manually archived to disk using tools of your
choice.

Be aware that you cannot use brarchive or brrestore to archive or restore


these log files.

4.2.3 Archiving to an Alternative Storage Management


Product
In order to choose an alternative storage manager product to manage DB2 log files or DB2
backups, the specific client software must be installed and configured on the DB2 database
server. The Admin Tools User Exit must also be installed.

Make sure that the vendor User Exit program is renamed and does not
overwrite the User Exit program delivered by SAP.
Set the DB2DB6_UEXIT_DIRECT and DB2DB6_VENDOR_UEXIT variables in the environment
file init<DBSID>.db6 using the following syntax:
DB2DB6_UEXIT_DIRECT = VENDOR
DB2DB6_VENDOR_UEXIT = <vendor user exit program name>
If the vendor User Exit program is not in the path of the DB2 instance owner db2<dbsid>,
specify the program with the fully qualified path.
For setup and error handling relating to the vendor User Exit program, refer to the vendor’s
documentation.

4.2.4 Indirect Archiving to Tape


You can only archive log files to tape in indirect archiving mode. For this purpose, the Admin
Tools include a tape management facility. All tapes and tape devices used for log file
archiving must be registered here. Each tape and tape device is assigned to a tape device
class.
The basic steps in tape management include:
• Defining device classes.
• Defining devices.
• Initializing (naming) tapes.

82 July 2006
Initially, a default device class is defined. This device class initially contains one defined
device:
Windows: /dev/mt0
AIX: /dev/rmt0
Solaris: /dev/rmt/0
Linux: /dev/st0
HP-UX: /dev/rmt/0m

We recommend that you update or replace default entries according to your


requirements. To define device classes, devices and tapes, read the following
sections.
If you have more than one tape device, replace the 0 with 1, 2 and so on to address them.
For example, the second tape on Solaris is /dev/rmt/1.

Working with Tape Device Classes


...

1. In the navigation frame of the DB2 Control Center, expand the <system name> node
until the database names are visible.
2. From the context menu of the SAP database <DBSID> icon, choose SAP Tape
Management.
3. If required, log on as user db2<dbsid>.
The Tape Management dialog box appears.

4. Choose Tapes.
5. To display a list of all known device classes, expand the <System name> node in the
tree.

July 2006 83
6. You can choose from the following actions:
{ To add a new device class, choose Add Device Class from the context menu of
the <system name> node.
{ To change an existing device class definition, choose Edit from the context
menu of the <device class> node.
{ To remove a device class definition, choose Delete from the context menu of the
<device class> node.

All devices and tapes of that class will also be removed by the delete action.
For the first two actions, the Add/Change Device Class dialog box appears.

7. Enter or change the fields as required. The fields are described in detail in the table
following this procedure.
8. Choose Add or Change depending whether you want to add a new device class or
change existing data.
The fields in the Add/Change Device Class dialog box describe a tape device class. Most
fields have a corresponding configuration parameter as described in the table under
Parameters Affecting Log File Management Storage [Page 70].

84 July 2006
Field Description
Name Name of the device class. Required but can be freely chosen.
Capacity Overrides the tape_size configuration parameter.
Type Describes the device type you can choose from the menu.
Description Optional field that describes the device class.
Rewind Overrides the rewind configuration parameter.
Rewind Offline Overrides the rewind_offline configuration parameter.
Eject Identical to Rewind offline. Set this field to the same value.
Positioning Overrides the tape_pos_cmd configuration parameter.

Working with Tape Devices


...

1. In the navigation frame of the DB2 Control Center, choose SAP Tape Management
from the context menu of the SAP database <DBSID>.
2. If required, log on as user db2<dbsid>.
3. Expand the <system name> node, and the <device class> node to which the device
definition will be added.
4. Expand the Devices node.
A list of known device classes is displayed.
5. You can choose from the following actions:
{ To add a new tape, choose Add Device… from the context menu of the <device
class> node.
{ To change an existing Device definition, choose Edit from the context menu of
the <device> node.
{ To retrieve the label of a tape currently located in a tape drive, choose Retrieve
Tape Label from the context menu of the <device> node.
{ To remove a device definition, choose Delete from the context menu of the
<device> node.
For the first two actions the Add/Change Device dialog box appears.

July 2006 85
6. Enter or change the fields as required. Description is optional.
7. Choose Add or Change depending on whether you want to add a new tape or change
existing data.

Modifying the Tape Block Size


To improve performance, it is sometimes necessary to modify the block size used to read and
write tapes. The flags supplied to cpio and dd will need modifying if a non-standard block
size is used. For cpio, the option ‘B‘ must be replaced with ‘C‘ followed by the block size
divided by 512. For dd, the bs value must be changed to the block size in bytes.

Due to a limitation in the Admin DB design, such changes apply to all tape
classes and tape devices.

Initializing Tapes
Tapes must be initialized before files can be archived to them. This involves writing a header
file to each tape, containing information such as volume name, SAP system ID and tape
usage count. Only a single archive operation involving one or more log files is permitted on
an initialized tape. Tapes must normally then be re-initialized before new log files can be
archived to them. As described in Changing the Admin Tools Configuration [Page 70], tapes
can be re-used if the log files go out of date as defined by the expir_period configuration
parameter.

Initializing Tapes Using the DB2 Control Center


...

1. In the navigation frame of the DB2 Control Center, choose SAP Tape Management
from the context menu of the SAP database <DBSID>.
2. If required, log on as user db2<dbsid>.
3. Expand the <system name> node, and the <device class> node to which the tape to be
initialized belongs.
The Tape Management dialog box appears.

86 July 2006
4. From the context menu of the Tapes node, choose Initialize Tape….
The Initialize Tape dialog box appears
5. Enter the name of the new tape.
6. Choose the device where the tape is located.

If the tape has never been initialized before or was used to archive files less
than expir_period weeks ago, the initialization is not permitted unless the
Force initialization box is selected. You can change the value of the
expir_period parameter in the SAP Option Management dialog box.
To initialize a tape the first time, the Force initialization option must be selected.
7. To initialize the tape, choose Init.

All tape actions and their results can be seen by choosing Journal tab.

To initialize an already registered tape again, choose Re-initialize ….from the


context menu of the tape icon.
To remove a tape, choose Delete from the context menu of the tape icon.

Initializing Tapes with brarchive


brarchive is the command that the DB2 Control Center uses to initialize tapes. Calling
brarchive on the command line gives the administrator access to all command line options
and may therefore be more flexible than the DB2 Control Center interface.

The following command initializes a tape with the name D4XA01 without
checking whether the tape has already been used or initialized. Messages are
only written to a protocol file. To initialize the tape, enter the following command:
brarchive -i force -v D4XA01 –t/dev/rmt/0
The complete syntax is explained in Appendix A: Tool Command Line
Parameters [Page 157].

July 2006 87
4.2.5 Indirect Archiving to TSM
For indirect archiving to TSM, no special tasks must be performed other than configuring TSM
itself. You can find more general information about TSM configuration in Configuring TSM
(Tivoli Storage Management) [Page 90].
The following naming conventions apply on the TSM server:
TSM Variable Description
/<DBSID> TSM file space name
DB2 TSM file space type
/NODEyyyy High level file identifier, where yyyy
is the node number
/Szzzzzzz.LOG.YYYYMMDDHHMMSS.NODEyyyy Low level file name, where
• zzzzzzz is the log file number
• YYYYMMDDHHMMSS is the file that
was closed by DB2
• yyyy is the node number

For the database BIN on node NODE0000, archiving the log file S0000599.LOG
would result in the following values:
• File space name: /BIN
• File space type: DB2
• High-level name: /NODE0000
• Low-level name:
/S0000599.LOG.20010606103645.NODE0000
For storing the log files the archive copy group is used by default if no archive copy group is
defined. Then a backup copy group is used.

We recommend that you define an archive copy group.

Archiving Using the TSM Option LANFREE


If you want to use this option, you have to activate variable DB2DB6_TSM_MULTITHREADED
in file init<DBSID>.db6 to enable the Admin Tools to work in a TSM-LANFREE
environment.

88 July 2006
4.2.6 Indirect Archiving Using a Customer Script
brarchive und brrestore currently only support archiving to two backends: TSM and
tape. By using your own script, you enable the Admin Tools to archive log files to any
backend, which means any other storage product or storage device, according to your
requirements.
The script needs to be able to archive, retrieve or delete log files.

What Does the Script Need to Support?


If you want to use your own script to archive log files to any other back-end than TSM or tape,
you have to make sure the script accepts the parameters and return codes provided by
brarchive and brrestore.
The following table lists the parameters that the script needs to support:
Parameter Description
action You can set the parameter to perform the following actions:
• ARCHIVE
• RETRIEVE
• DELETE
directory • If you are archiving log files, directory points to the directory
where the log files to be archived are located.
• If you are retrieving log files, directory points to the directory
where the log files should be retrieved to.
• If you are deleting log files, directory points to the directory
where the log files were originally archived from.
file Defines the log file that is to be used. The log file has the following
format: Snnnnnnn.LOG<TS>.NODExxxx

The sequence of the parameters in the script must be the same as in the table.
...

The following table lists the return codes the script must issue for every action performed so
that brarchive and brrestore can determine a success or failure:
Return Code Description
LFMVND_STATUS_OK=0 Indicates success of the action performed.
LFMVND_RC_ERROR=64 Indicates failure of the action performed.
LFMVND_COMMAND_NOT_SUPPORTED=71 Indicates that the action specified in the
script is not supported.

You must make sure that you specify the correct return codes for every action
performed − as described in the table.
For example, if the script returns LFM_STATUS_OK (although the action has
failed) brarchive and brrestore assume that the action was completed
successfully, which is not the case. Thus, the content of the Admin DB becomes
inconsistent and you risk to lose log files.

July 2006 89
Writing Your Own Script
You use the sample script db6sctsm.smp, which is part of the Admin Tools delivery, to write
your own script. The shell script is designed for UNIX. If your system is running on Windows,
you have to write a batch file or an executable. In the sample script the TSM client dsmc is
used to archive, retrieve or delete log files.

We strongly recommend that you copy the sample script to avoid overwriting
during the next Admin Tool installation. After having copied the script, you can
enter your archive, retrieve or delete commands.

Activating the Script


You activate the script by setting parameter DB2DB6_LIBDB6SC_SCRIPT=<path to
customer script> in file init<DBSID>.db6.
For more information about how to set parameters in file init<DBSID>db6, see Configuring
the Admin Tools Using Environment Files [Page 73].

4.3 Configuring TSM (Tivoli Storage


Management)
Use
When issuing DB2 BACKUP or RESTORE commands, you can specify Tivoli Storage Manager
(TSM product, to manage the database or tablespace backup). You can also use TSM to
manage archived DB2 log files.

We recommend that you use at least TSM Version 4.1.

Procedure
Before the DB2 Database Manager db2<dbsid> can use TSM, you have to perform the
following steps:
...

1. Install the TSM client and API on the DB2 server.


2. Configure the TSM files dsm.opt (UNIX and Windows) and dsm.sys (UNIX only) as
described in Configuring TSM Files dsm.opt and dsm.sys [Page 91].
3. Configure the TSM environment variables DSM_DIR, DSMI_DIR, DSM_CONFIG,
DSMI_CONFIG, DSM_LOG and DSMI_LOG as described in Configuring TSM
Environment Variables [Page 92].
4. To generate the password, run the TSM client dsmc once.
5. To make the environment variable visible to DB2, restart DB2 with db2start.
For more detailed information about steps 2 and 3, see SAP Note 82029 ADSM/TSM
Installation in DB2 Environment.

90 July 2006
4.3.1 Configuring TSM Files dsm.opt and dsm.sys
On UNIX systems, the TSM files dsm.opt and dsm.sys must be configured. On Windows
systems, the TSM file dsm.opt must be configured. The files must contain the following
parameters:

UNIX
File dsm.opt

Parameter Value
SERVERNAME <TSM server name>

File dsm.sys

Parameter Value
SERVERNAME <TSM server name>
COMMETHOD TCP/IP
TCPPORT 1500
TCPSERVERADDRESS <TSM server IP address or host name and
domain name>
PASSWORDACCESS Generate
PASSWORDDIR /etc/adsm

The entry of SERVERNAME in the dsm.opt file must fit the value SERVERNAME
in the dsm.sys file.

For parameter PASSWORDDIR:


The users root and db2<dbsid> must be able to access directory
/etc/adsm. Make sure that this directory has the appropriate authorizations.

Windows
File dsm.opt

Parameter Value
COMMMETHOD TCP/IP
TCPPORT 1500
NODENAME <TSM client>
TCPSERVERADDRESS <TSM server IP address or host name and
domain name>
PASSWORDACCESS Generate

July 2006 91
4.3.2 Configuring TSM Environment Variables
TSM environment variables DSM_DIR, DSMI_DIR, DSM_CONFIG, DSMI_CONFIG, DSM_LOG
and DSMI_LOG are needed to tell TSM where TSM resides and on which TSM server the
database backup and the log files should be stored.
The following list provides additional information about these variables that you have to take
into consideration depending on the Admin Tools version you are using:
• 4.6D Admin Tools
{ UNIX
During the installation of the SAP system with R3SETUP the files
.dbenv_<hostname>.csh and .dbenv_<hostname>.sh are created in the
home directory of db2<dbsid> and <sapsid>adm. These files contain some
default values for the TSM variables, which are not valid in most cases and
which must be corrected.
{ Windows
The above mentioned variables are not set during installation and must be
added manually to the user environment of db2<dbsid> and <sapsid>adm.
• 6.NN Admin Tools or higher
{ UNIX
The sddb6ins program, which installs the Admin Tools, adds an entry to the
profile, .cshrc and .login scripts in the home directories of db2<dbsid>
and <sapsid>adm, which call the dbaenv_<hostname>.csh and
dbaenv_<hostname>.sh script.
The shell script dbaenv_<hostname>.csh and dbaenv_<hostname>. sh
add the TSM API-specific environment variables DSMI_DIR, DSMI_CONFIG and
DSMI_LOG, as well as the TSM client-specific environment variables DSM_DIR,
DSM_CONFIG and DSM_LOG. The values, which are set there, work on all
standard TSM installations and generally do need not to be corrected.
{ Windows
If the TSM software is installed on the database server before the sddb6ins
program is called, sddb6ins detects this and sets the TSM API-specific
environment variables DSMI_DIR, DSMI_CONFIG and DSMI_LOG to appropriate
values in the user environment of users db2<dbsid> and <sapsid>adm.
If you install the TSM software afterwards, you can rerun sddb6ins with the –i
option and sddb6ins will add these variables.

92 July 2006
Environment Variables for TSM:
The following table provides an overview of all environment variables you should check:
Variable Value Set In
DSMI_DIR Location of TSM API library with the Windows:
following default:
User environment of
Windows: db2<dbsid> and <sapsid>adm
<drive>:\progra~1\Tivoli\ UNIX:
tsm\api
For 6.NN Admin Tools:
UNIX:
• $INSTHOME/admintools/bin/dbaen
For 6.NN Admin Tools: v_<hostname>.csh
• dbaenv_<hostname>.csh • dbaenv_<hostname>.sh
• dbaenv_<hostname>.sh For 4.6D Admin Tools:
For 4.6D Admin Tools: • ~/.dbenv_<hostname>.csh
• ~/.dbenv_<hostname>.csh • ~/.dbenv_<hostname>.sh
• ~/.dbenv_<hostname>.sh
DSMI_LOG Log directory for TSM API with Same as for variable DSMI_DIR
the following default: as described in this table.
Windows:
<drive>:\progra~1\Tivoli
\tsm\api
UNIX:
$INSTHOME/errors
DSMI_CONFIG Location of dsm.opt file with Same as relevant location
the following default: for variable DSMI_DIR as
described in this table
Windows:
<drive>:\progra~1\Tivoli
\tsm\baclient\dsm.opt
UNIX:
$INSTHOME/sqllib/adsm
/dsm.opt
UNIX only: Location of TSM client with the UNIX only:
following default:
DSM_DIR For 6.NN Admin Tools:
For 6.NN Admin Tools:
• $INSTHOME/admintools/bin/dbaen
• dbaenv_<hostname>.csh v_<hostname>.csh
• dbaenv_<hostname>.sh • $INSTHOME/admintools/bin
For 4.6D Admin Tools: For 4.6D Admin Tools:
• ~/.dbenv_<hostname>.csh • ~/.dbenv_<hostname>.csh
• ~/.dbenv_<hostname>.sh • ~/.dbenv_<hostname>.sh

July 2006 93
UNIX only: Log directory for TSM client. UNIX only:
DSM_LOG The default is $INSTHOME/errors Same as for variable DSM_DIR
as described in this table
UNIX only: Location of dsm.opt file for TSM UNIX only:
DSM_CONFIG client. The default is:
Same as for variable DSM_DIR
$INSTHOME/sqllib/adsm/ as described in this table
dsm.opt

4.3.3 Configuration Considerations


With TSM, you can use the same or different management classes for archiving backups and
log files. The preferable solution, however, is that you use a management class for backups
different from the one you use for log files. If you use the same management class, backups
and log files might be archived to the same tape. In this case, the following disadvantages
have to be taken into consideration:
• If you lose a tape, you not only lose a backup but also the log files. If you only lose a
backup, you can use an older backup and still perform a rollforward recovery. With log
files missing, this is not possible.
• The performance during rollforward recovery is limited because log files are widely
spread on the tape if stored on the same tape as backups.
• Sometimes you might be forced to keep offline backups longer than log files. If log files
are deleted from tape by TSM, you cannot reuse the whole tape because backups still
reside on that tape and space reclamation drastically affects the system performance.

We recommend that for archiving log files you use a disk storage pool. With
this pool, you can achieve a better system and rollforward performance if
caching on the disk storage pool is switched on.
For backups, however, we recommend that you do not use such a disk storage
pool. If the DB2 backup image does not fit into this disk storage pool, TSM will
fail. An extremely large disk storage pool would be necessary to avoid this
problem.

94 July 2006
4.4 DB2 Configuration Parameters
DB2 variables are configured by the SAP installation to ensure that DB2 and the Admin Tools
work. This section lists parameters, which influence the Admin Tools directly, with a brief
description. If it is necessary to change them, refer to the DB2 documentation.

<DBSID> Database Configuration

Database Configuration Description


Parameter
LOGRETAIN Must be set to ON that roll-forward recovery is possible.
USEREXIT Must be set to ON that the User Exit db2uext2 is called.
LOGPATH Directory where DB2 writes log files to.
LOGFILSIZ Defines the size of each log file. Default value in an SAP
environment is 64 MB.

Database Manager Configuration

Database Manager Description


Configuration Parameter
DIAGPATH Location where DB2 writes the db2diag.log. The User
Exit program db2uext2 writes the files
db2uext2.NODEyyyy.log and
db2uext2.NODEyyyy.err to this directory.

DB2 Instance Registry Variables

Instance Registry Variable Description


DB2ENVLIST Default value:
• Windows:
INSTHOME SAPSYSTEMNAME dbs_db6_schema
• AIX:
LIBPATH INSTHOME SAPSYSTEMNAME
dbs_db6_schema
• Linux:
LD_LIBRARY_PATH INSTHOME SAPSYSTEMNAME
dbs_db6_schema
• Solaris:
LD_LIBRARY_PATH INSTHOME SAPSYSTEMNAME
dbs_db6_schema
• HP-UX:
SHLIB_PATH INSTHOME SAPSYSTEMNAME
dbs_db6_schema
Setting these variables ensures that the User Exit
program db2uext2 and the stored procedure sddb6jds
get the appropriate environment. The sddb6ins
installation program sets this value appropriately.

July 2006 95
4.5 Disk Space Considerations for Running the
Admin Tools
The following section provides additional information about the directories that are needed if
you want to install the Admin Tools. The given information refers to disk space considerations
for:
• Log files
• Protocols
• Trace files
• Admin DB

Log Files
• Direct archiving
Make sure that the log directory provides sufficient space to avoid problems if your
storage management system might be temporarily unavailable.
• Indirect archiving
The free space in the directory where DB2DB6_ARCHIVE_PATH is pointing to, needs to
be dimensioned, depending on the log file size and the period of time between two
brarchive calls and the amount of log files that accumulate between two brarchive
calls.
The free space in the directory where DB2DB6_TEMP_DIR is pointing to needs to be
dimensioned, so that two exports of the Admin DB fit into it. Otherwise, brarchive
fails to store the Admin DB.

Protocols
• User Exit protocols
The User Exit writes its protocol files db2uext2.NODExxxx.log and
dbuext2.NODExxxx.err to the directory where the database manager configuration
parameter DIAGPATH points to.
• brarchive/brrestore protocols
These log files are initially generated in the directory where DB2DB6_TEMP_DIR points
to. They are moved to the protocols directory at the end of the
brarchive/brrestore run.
The directories differ for the Admin Tools version as follows:
{ For 6.NN Admin Tools:
<INSTHOME>/admintools/protocols
{ For 4.6D Admin Tools:
brarchive: <INSTHOME>/saparch
brrestore: <INSTHOME>/saprest
These directories need to be dimensioned to hold the small protocol files.

96 July 2006
Trace Files
Trace files are only generated if the user has explicitly enabled trace file generation in the
init<DBSID>.db6 file. The trace files are only required to determine defects or by the SAP
support to fix problems.
The trace file directory can be configured in the init<DBSID>.db6 file for each executable
separately. The default directories are:
• For 6.NN Admin Tools:
<INSTHOME>/admintools/TraceFiles
• For 4.6D Admin Tools:
<DB2DB6_TEMP_DIR>/TraceFiles

Admin DB (Indirect Archiving)


The Admin DB is relatively small and its size increases slowly. All methods to keep the Admin
DB small are described in Regular Administration [Page 98].

July 2006 97
5 Regular Administration

5.1 DB2 Log File Management


The concepts and terminology used in this chapter are described in Basic Concepts [Page
23]. For more detailed information about how to configure the log file management tools, see
Configuration [Page 70].
If you are archiving directly, all archive processes will run automatically. You may need to
delete old log files from the storage product occasionally.
For indirect archiving (the default), the main daily action is archiving log files to tape or TSM
after they have been processed by the User Exit. If files are not deleted from the disk during
these archive operations, the files remaining on the disk will also need deleting regularly. The
other less regular log file management action is deleting log files from the storage product.

5.1.1 Archiving Log Files from Disk to Backend


The log files are copied to a temporary disk location by the User Exit, as specified by the
environment variable DB2DB6_ARCHIVE_PATH.
Log file management information is stored in the Admin DB ADM<DBSID>. The log files
written to the DB2DB6_ARCHIVE_PATH location can by archived using the brarchive tool,
either to tape, TSM or any other backend using a customer script. You can start brarchive
on the command line or using the DB2 Control Center Extensions, or using the DBA Planning
Calendar (transaction DB13).

Archiving with DB2 Control Center


...

1. In the navigation frame of the DB2 Control Center, choose your system and log on as a
user with administrator authorizations.
2. On the subnode Database, from the context menu of the database <DBSID>, choose
SAP Log File Management.
3. If required, log on as user <sapsid>adm or db2<dbsid>.
The Log File Management dialog box appears.
4. Choose Archive.
5. In the Archive Log Files of Node field, choose the node from which log files should be
archived.
6. In the Log Files to be Archived field, choose the log file up to which you want to
archive. All older log files up to the one you have selected will be selected for archiving.

If you do not want the log files to be deleted from the archive directory after
archiving, select Keep Log Files in File System. Select TSM, Tape or Script:
{ TSM:
In the TSM Management Class field, select a TSM management class.

98 July 2006
The possible entries for the management class are maintained using the SAP
Option Management dialog box. The corresponding keyword is adsm_mc.
Under Value, a list of management classes is specified, separated by commas.
For more information, see Changing the Admin Tools Configuration [Page 70].
{ Tape:
i. Select Name of First Tape.
The list of devices next to this box is then recalculated to only contain the
matching devices for that tape.
ii. Select a device. Alternatively, you can start by choosing a device name
and afterwards choose an appropriate tape.

If you want to save to two tapes simultaneously, follow the same procedure for
the Name of the Second Tape and its device. If these fields do not contain any
entries, log files are saved to a single tape.
Once you have selected an entry in one of the four boxes, the entries in the
remaining boxes are limited to those entries that match the selection.
iii. To display the full list of possible entries, start the selection process
again by choosing Reset Selection.
If the tape is not initialized or the device you want to use is not displayed
(not defined), go to the SAP Tape Management by choosing Tape. For
more information, see Indirect Archiving to Tape [Page 82].

After archiving log files to a tape, the same tape cannot be used to archive
additional log files in a later operation until the number of weeks specified in the
expir_period configuration parameter has elapsed or the tape is initialized
again. For more information, see Parameters Affecting Log File Management
Storage [Page 70].
7. To start the archive process, choose Archive.
A dialog box appears indicating that the archiving process was just started. After the
archiving has finished, another dialog box appears indicating if it was successful.

You can see all archiving actions and their results in the Journal page.

Archiving with Command Line Tool brarchive


brarchive is the command that the DB2 Control Center uses to archive log files. Calling
brarchive from the command line gives the administrator access to all command line
options and may therefore be more flexible than the DB2 Control Center interface. The
following syntax describes the most common usage of brarchive.

Tapes must be initialized before brarchive can use them. For more
information, see Indirect Archiving to Tape [Page 82].

July 2006 99
Archiving Log Files to Single Tape

Command brarchive -sd -d tape -v D4XA01 –t /dev/rmt/0 -out -


syntax n 25
Description Archives 25 log files to the tape D4XA01, and deletes them from the
file system if processing completes successfully. Messages are written
to the standard output and a protocol file.

Archiving Log Files to Two Tapes (Double Store)

Command brarchive -ssd -d tape -v D4XA01 D4XA02 –t


syntax /dev/rmt/0 /dev/rmt/1 -out -n 10
Description Archives the same ten log files to both the tapes D4XA01 and
D4XA02, and deletes them from the file system if processing
completes successfully. Messages are written to the standard output
file and a protocol file.

Archiving Log Files to TSM Without Delete

Command brarchive -s -d tsm –out


syntax
Description Archives all available log files to the default management class in
TSM, without deleting them from the file system. Messages are written
to the standard output file and a protocol file. You might not want to
delete log files immediately to allow them to be processed using other
tools. These must be deleted later using the –ds option.

Archiving Log Files to Two TSM Management Classes

Command brarchive –ssd –d tsm MC1+MC2 –out


syntax
Description As of 4.6D Admin Tool patch 20 or 6.NN Admin Tool patch 9, you can
archive log files to two different management classes. You have to
create two management classes, for example, MC1 and MC2, in TSM
before you call brarchive.

For more information about the barchive syntax, see brarchive - Log File Archive Tool
[Page 157].

100 July 2006


Setting Parameter Default Values in the Admin DB
To avoid the necessity to specify all command line options, you can set some values in the
SAP Option Management using the DB2 Control Center Extensions. For more information,
see Parameters Affecting Log File Management Storage [Page 70].
Setting the values for the following configuration variables will help you to minimize the
required command line options:
• backup_dev_type
Specify the value that you normally specify using the –d command line option.
• adsm_mc
Specify the TSM management class(es) that you want to use by default.

Archiving Using Customer Script


To activate the script support, you have to set variable
DB2DB6_LIBDB6SC_SCRIPT=<path_to_customer_script> in file init<DBSID>.db6.
However, before you call brarchive and brrestore using the command line, you must
make sure that option –d script is specified in the script as described in the following
example.

• If you want to archive all log files, you enter the following command:
brarchive –s –d script –out
• If you want to retrieve up to ten log files, you enter the following command:
brrestore –a –d script –n 10 –out
• If you want to delete log files for a specified backup timestamp, you enter the
following command:
brrestore –delete 20020107120000 –d script –out
For more information, see Appendix E: Example of Customer Script db6sctsm.smp [Page
221].

5.1.2 Deleting Log Files


Log files may need to be deleted regularly depending on how often backups are taken, the
number of log files generated each day, and the size of available storage. Log files are stored
in the following locations:
• Log directory
• Archive directory
• Tape
• Storage Products
• Any other backend using a customer script

July 2006 101


Deleting Log Files from the Log Directory

Normally there is no need to delete files from this directory. Do not delete files
that are still needed by the database.
Log files will be deleted from the log directory if you:
• Drop a database.
This action deletes all log files in the current log path directory. You may need to back
up these log files beforehand, for future recovery purposes.
• Recover the database to a point in time.
When recovering the database to a point in time, log files chronologically past the point
in time are re-used and therefore lost. For example, if a roll-forward operation only
needs log data up to the middle of log file 35 and you restart the database, the
remainder of log file 35 and the whole of log files 36 and onwards will be re-used.
If you need to restore again past the point in time used earlier, you cannot do so since
the log files were re-used. Retrieve the original set of log files manually to a different
location and copy them back for the restore action. You can identify the original log files
easily by their timestamp if they have the following format:
Snnnnnnn.LOG.<timestamp>.NODExxxx.
To actively delete log files, use the PRUNE LOG FILE command. This DB2 command
deletes all log files in the log directory created prior to a nominated log file. It will only do so
from the active log path. If any log files have been moved to another path, they will not be
considered by this command.

PRUNE LOGFILE PRIOR to S0000100.LOG


This command will delete all log files in the active log path up to and including
S0000099.LOG.

Deleting Log Files from the Archive Directory


Log files are placed here by the User Exit in indirect mode (default). If brarchive is then
used with the –sd or –ssd archive actions, the log files are removed again when the files
have been successfully stored. If only –s and –ss are used, the delete stored action (-ds)
must be run separately to delete these files from the disk.

Deleting Log Files from Tape


It is neither possible nor necessary to explicitly delete log files from tapes. As soon as a tape
is re-initialized or re-used, the files previously stored on the tape are removed from the Admin
DB.

Deleting Unknown TSM files with brrestore


The log file management tool brrestore now allows removal of files from TSM that are not
known to the Admin DB. This is done by specifying a file pattern, either to match log files
(*.LOG and *.LOG.*), or Admin DB safety files (*.SAR).
The syntax is as follows:
brrestore –delete <timestamp> [file pattern]

102 July 2006


Deleting Log Files from Storage Products
You can delete log files from either:
• TSM
Only use the Admin Tools to work with files stored indirectly to TSM. To delete old log
files created with recent tools, enter the following command:
brrestore –delete.
For more information about the syntax of brrestore, see brrestore - Log File
Retrieval Tool [Page 163].
Files stored directly to TSM or archived indirectly with older tools (for example, for SAP
system Release 3.1I and 4.0A) can be deleted using the db6adutl tool or the TSM
utility dsmc. In this case, refer to Archiving Directly to TSM [Page 80] for a description
of where the files are stored.
• Other storage management products
Files directly archived using an additional User Exit must be managed with tools made
available by that product. For more information, see the corresponding product
documentation.

Deleting Log Files Archived with a Customer Script


You delete log files, which were archived using a customer script, by entering the following
command:
brrestore –d script –delete.
The section DELETE must be implemented in the script.
For more information about the syntax of brrestore, see brrestore – Log File Retrieval Tool
[Page 163].

5.2 Storage Management


Approaching the limit of available storage can degrade overall performance. Running out of
storage may cause the database or system to fail. Therefore, one essential task for system
administrators is storage management, which consists of tasks such as:
• Checking the free space in file systems.
• Checking the space available in tablespaces.
• Checking the size of tables and indexes.
• Managing (for example, adding or resizing,) these storage elements to deal with
changing requirements.

July 2006 103


The tasks described in the following sections can be performed either using the DB2 Control
Center or the DBA Cockpit.

The information provided for the DBA Cockpit is valid for SAP Web AS 6.10 or
higher.
For SAP system Release 4.6x, you must make sure that you have installed the
DBA Cockpit as described in SAP Note 300828.

5.2.1 Checking the Space Available in a File System


To check the available free space of the log directory and the archive directory, proceed as
follows:

From the SAP Performance Monitor


You can access the information by calling transaction DB6COCKPIT and choosing
Configuration → File Systems in the navigation frame of the DBA Cockpit. The information
displayed on this screen helps you to determine how much free space is available in your file
systems.
For more information, see the SAP Online Documentation in the SAP Library.

From the Operating System:


Use the command df on UNIX systems and the program Explorer on Windows systems.

5.2.2 Checking the Space Available in a Tablespace


To check the amount of space available in a DMS tablespace, proceed as follows:

From the SAP Performance Monitor


You can access information about space for tablespaces by calling transaction DB02 and
choosing Space → Tablespaces in the navigation frame of the DBA Cockpit.
For more information, see the SAP Online Documentation in the SAP Library.

From the DB2 Control Center


...

1. Open the database tree.


2. Double-click onTablespaces.
In the contents pane a list of all tablespaces is displayed.
3. Scroll to columns Allocated size, Size used and Percentage used to see details related
to the amount of space available in a tablespace. Space is measured in pages where
one page is 4 KB.

104 July 2006


Adding More Space to a Tablespace
The capacity for a DMS tablespace is the total size of all containers allocated to this
tablespace. When a DMS tablespace reaches the threshold capacity (depending on the
usage of the tablespace, 90% is a possible threshold), you should add more space to it.

If you are using the new features of DB2 Version 8.2.2, that is, DMS AutoResize
or AutoStorage, you do not have to manually add space to containers.

From the SAP Performance Monitor (SAP Web AS 6.20 or higher)


You can add more space to tablespaces by calling transaction DB02 and choosing Space →
Tablespaces in the navigation frame of the DBA Cockpit and choosing Add.

From DB2 CLP


Using the following SQL commands you can:
• Add a new container to a DMS tablespace.
The DB2 database manager will automatically rebalance the tables in the DMS
tablespace across all available containers. During rebalancing, data in the tablespace
remains accessible. To add a new container, enter the following SQL command:
alter tablespace <tablespace name> add ( file '<container name>'
<number of pages> )
• Increase the size of one or more containers in the DMS tablespace.
{ Extend one or more existing tablespace container by a specific size. To do so,
enter the following SQL command:
alter tablespace <tablespace name> extend (all containers
<number additional pages> )
{ Resize one or more existing tablespace containers to a new size. Container
sizes can only be increased. To do so, enter the following SQL command:
alter tablespace <tablespace name> resize (all containers
<new container size in pages> )
The database manager will automatically rebalance the tables in the DMS tablespace
across all available containers if necessary. During rebalancing, data in the tablespace
remains accessible.
• DB2 Version 8
Increase the size of a DMS tablespace by adding a new stripe set. To do so, enter the
following SQL command:
alter tablespace <tablespace name> begin new stripe set (file
‘<container name>’ <number of pages>)
This does not cause rebalancing. The space that you have added will be available
immediately.
For more detailed information about the command syntax, see the IBM documentation DB2
Universal Database SQL Reference.

July 2006 105


We recommend that you avoid rebalancing because it has an significant impact
on the database performance. In addition, the added space is not available until
rebalancing has finished.
Always resize all containers of the last stripe set, because no rebalancing
occurs there. If this is not possible any more, for example, because the file
system is full, begin a new stripe set with an appropriate number of containers.
If you are using the new features of DB2 Version 8.2.2, that is, DMS AutoResize
or AutoStorage, database containers do not have to be resized because this is
automatically done by DB2.

Reducing the Size of a Tablespace


• DB2 Version 7
You can reduce the size of tablespaces by reorganizing all the tables in the tablespace,
backing up the tablespace and restoring it using a new physical layout.
• DB2 Version 8
{ From the SAP Performance Monitor (SAP Web AS 6.20 or higher)
You can reduce the space of a tablespace by calling transaction DB02 and
choosing Space → Tablespaces in the navigation frame of the DBA Cockpit
and choosing Change.
{ From DB2 CLP
You can reduce the size of a tablespace using the following SQL command:
alter tablespace <tablespace name> resize (all containers
<new container size in pages>)

5.2.3 Checking the Size of Tables and Indexes


You can access information about space for tables and indexes by calling transaction DB02
and choosing Space → Tables and Indexes in the navigation frame of the DBA Cockpit.
When you call this transaction for the first time, the following check on the system catalog
tables is performed:
• Are there tables that do not yet have an entry in the CCMS control table
DB6TREORG? (This table is always filled by CCMS programs after REORGCHK.)
• Are there tables that have entries in the CCMS control table DB6TREORG and that are
not up-to-date with the system catalog?
If any tables are found, a dialog box appears listing these tables that require reorganization.

Be aware that running a REORGCHK on the listed tables may take a long time
and affect the database performance.
To adjust the tables, choose REORGCHK. Otherwise, choose Continue.
For more information, see the SAP Online Documentation in the SAP Library.

106 July 2006


5.3 Performance Monitoring
Performance monitoring consists of the following tasks:
• Monitoring database performance
• Monitoring SQL statements
• Updating statistics for database tables and checking for reorganization
• Monitoring jobs
You can access all monitoring and database administration tasks using the DBA Cockpit.
The DBA Cockpit is a navigation frame that holds a tree structure, which is divided at the top
level into the main task areas of database administration, for example, performance
monitoring.

The information provided for the DBA Cockpit is valid for SAP Web AS 6.10 or
higher.
For SAP system releases lower than and including 4.6x, you must make sure
that you have installed the DBA Cockpit as described in SAP Note 300828.

5.3.1 Monitoring Database Performance


DB2 monitors are used to collect detailed resource usage information. The monitor switches
can be turned on and off at the instance level (DBM configuration) or at the application level
(using the UPDATE MONITOR SWITCHES command).

We recommend that you keep the monitor switches turned on. SAP provides a
graphical performance monitor for DB2 to analyze the database activity basis of
the DB2 monitor switches.

Checking Buffer Pool Quality


Buffer pools are database objects used to cache database data pages in memory. If an
object’s data page is placed in a buffer pool, physical I/O access to disks is avoided. Buffer
pools can be assigned to cache only data of a particular tablespace. This is assigned within
the tablespace definition. Every DB2 database must have a buffer pool. For each new
database created, DB2 defines the IBMDEFAULTBP buffer pool. This is the default buffer pool
for the database.

The information provided in this paragraph is only valid for SAP system
Release 4.6C and higher.
You can access information about the buffer pool quality by calling transaction ST04 and
choosing Performance → Database → Buffer Pools in the navigation frame of the DBA
Cockpit.
Buffer pool related information is displayed. The values of Overall Buffer Quality, Data Hit
Ratio and Index Hit Ratio should be more the 95 percent. Otherwise, contact SAP remote
services Early Watch to improve the values.

July 2006 107


For more information, see the SAP Online Documentation in the SAP Library.

Checking Locks and Deadlocks


DB2 captures information for locks held by applications against a database and records each
deadlock event (by means of deadlock event monitors).

The information provided in this paragraph is only valid for SAP system
Release 4.6C and higher.
You can access information about lock escalation, deadlocks and lock timeouts by calling
transaction ST04 and choosing Performance → Database → Buffer Pools in the navigation
frame of the DBA Cockpit.
The value of Lock Escalations, Deadlocks Detected and Lock Timeouts should be almost
zero. Otherwise, contact SAP remote services Early Watch to improve the values.
For more information, see the SAP Online Documentation in the SAP Library.

Checking Sort Overflows


The DB2 Snapshot Monitor provides cumulative information about the number of heaps used,
overflows and the performance of sorts. These snapshots are used in the SAP performance
monitor to display sort overflows.

The information provided in this paragraph is only valid for SAP system
Release 4.6C and higher.
You can access information about sort overflows by calling transaction ST04 and choosing
Performance → Database → Sorts in the navigation frame of the DBA Cockpit.
The value of Sort Overflows divided by Total Sorts should result in less than 0,01. Otherwise,
contact SAP remote services Early Watch to improve the values.
For more information, see the SAP Online Documentation in the SAP Library.

Checking Cache Quality


You can access information about catalog cache and package cache by calling transaction
ST04 and choosing Performance → Database → Cache in the navigation frame of the DBA
Cockpit.
The values of Catalog Cache Quality and Package Cache Quality should be more the 95
percent. Otherwise, contact SAP remote services Early Watch to improve the values.
For more information, see the SAP Online Documentation in the SAP Library.

108 July 2006


5.3.2 Monitoring Dynamic SQL Statements
Use
The DB2 statement cache stores packages and statistics for frequently used SQL
statements. By examining the contents of this cache, you can identify the dynamic SQL
statements that are most frequently executed and the queries that consume the most
resource. Using this information, you can examine the most commonly executed and most
expensive SQL operations, to determine if SQL tuning could result in better database
performance.

Procedure
You can access information about the dynamic SQL cache by calling transaction ST04 and
choosing Performance → SQL Cache in the navigation frame of the DBA Cockpit. You can
retrieve the latest cached SQL statement by choosing Refresh.
If you retrieve data for the first time, a Selection Criteria dialog box appears where you can
limit the result set displayed. Depending on your system, the snapshot can give you a wide
range of information, which might lead to a very large result set.
If a snapshot already exists, that is, if you had already chosen Refresh at least once, you can
display the last snapshot taken by choosing Set Selection Criteria.
For more information, see the SAP Online Documentation in the SAP Library.

Explain Function
If a statement is displayed, choose Explain to list the access plan for the statement execution.
The Explain function provides a detailed analysis of expensive SQL statements, for example,
on how DB2 accesses the data to resolve the SQL statements.
To display the access plan of a statement from the SAP performance monitor:
...

1. Follow the procedure as described above.


2. Select a statement.
3. Choose Explain.
For more information, see the IBM documentation Administration Guide: Chapter 26, SQL
Explain Facility.

5.3.3 Updating Statistics for Database Tables and


Checking for Reorganization
Regular updates of statistics on the physical characteristics of the database tables and
indexes provide the necessary information for the DB2 optimizer to determine the access
path to the data.
In a partitioned database system, statistics are collected based on the table data that is
located on the database partition where the command is executed. Global table statistics for
an entire partitioned table are derived by multiplying the values obtained at a database
partition by the number of database partitions on the node group over which the table is
partitioned. The global statistics information is stored in the catalog tables.

July 2006 109


To update database tables’ statistics and to check whether tables need to be reorganized,
you can use the jobs Update Statistics + Reorgchk all tables or Update Statistics and
Reorgchk (DBSTATC) in the DBA Planning Calendar (transaction DB13). These jobs begin
by updating the database statistics (using the DB2 RUNSTATS utility) and then check whether
tables need to be reorganized (using the six formulas of the REORGCHK utility as described in
the IBM documentation IBM DB2 Universal Database Command Reference).
The REORGCHK formulas help to decide if tables and indexes require physical reorganization.
These formulas are general recommendations that show the relationship between the
allocated space and the space that is being used for the data in tables. Three formulas are
used for tables, and three are used for indexes. The results are stored in SAP internal tables.

To reorganize tables we recommend that you use the jobs provided in the DBA
Planning Calendar. These jobs automatically update the table and index
statistics afterwards.

5.3.4 Job Monitoring

The information provided in this section is valid for SAP Web AS 6.10 and
higher.
For SAP system Release 4.6x, you must make sure that you have installed the
DBA Cockpit as described in SAP Note 300828.
You can schedule background jobs to display information about protocol records on all jobs
that were executed by the SAP performance monitor by calling transaction DB6COCKPIT and
choosing Jobs → DBA Log in the navigation frame of the DBA Cockpit. If you want to display
details on a single protocol record, double-click it.
For more information, see the SAP Online Documentation in the SAP Library.

5.4 Database Backup


Backups are complete copies of the database. You must perform backups on a regular basis
in order to be able to restore the database to a consistent state that is as up-to-date as
possible.
You can perform backups in online or offline mode:
• Online mode
Access to the database is not blocked. The users can continue to work normally during
the backup.
• Offline mode
The backup process connects to the database in exclusive mode. The database can be
restored without log files.

110 July 2006


In either case, the database can be restored completely and brought up-to-date by rolling in
the log files generated after the backup was taken.
To perform both online and offline backups of the database, you can either use the BACKUP
DATABASE command, the DB2 Control Center or the DBA Planning Calendar within the SAP
system.

5.4.1 Backup Considerations

You cannot back up a database that is not in a usable state except for a
database in the backup pending or the rollforward pending state.
The following is necessary to perform a backup:
• You must have SYSADM, SYSCTRL, or SYSMAINT authorization to use the BACKUP
DATABASE command.
• You must start the database manager (db2start) before taking a database backup. If
you want to use the DB2 Control Center, you do not need to explicitly start the DB2
Database Manager.
• In a partitioned database system, keep a copy of the db2nodes.cfg file with any
backup copies you take. This copy is as a protection against possible damage to this
file.
The database may be local or remote. The backup remains on the database server unless a
storage management product, such as Tivoli Storage Manager (TSM), is used.
You can back up a database to a specified disk, a tape, or a location managed by TSM or
another vendor storage management product.
After an online backup, DB2 forces the currently active log file to be closed and as a result it
will be archived. This ensures that an online backup has a complete set of archived log files
available for recovery.

5.4.2 Performing the Backup


Backing Up a Single-Partitioned Database
You can perform these actions either using the DB2 command line or the DB2 Control
Center.

DB2 Command Line


1. Log on to the database server as user db2<dbsid>.
2. Enter the following command:
db2 backup db <DBSID>…

For the complete syntax of this command check the DB2 documentation.

July 2006 111


DB2 Control Center

Make sure that you have installed and set up the DB2 Control Center before
performing these steps. Fore more information, see Installation of the DB2
Control Center [Page 61] and Setting Up the DB2 Control Center [Page 62].
1. Start the DB2 Control Center
2. From the context menu of <DBSID> choose Backup → Database… .
3. In the dialog box that appears, enter the required values, including the correct backup
target.
4. Choose Backup now.
A job will be generated that can be monitored using the DB2 Control Center Journal.

Backing Up a Multi-Partitioned Database


You can perform these actions either using the DB2 command line or the DB2 Control
Center.

DB2 Command Line


1. Log on to the database server as user db2<dbsid>.
2. Enter the backup command for the catalog node:
db2_all “<<+n< db2 backup db <DBSID> …”

For the complete syntax check the DB2 documentation and replace n wit the
catalog node number (the default value is 0).
3. To back up all other nodes in parallel, enter the following command:
db2_all "<<-n< db2 backup db <DBSID> ... "

DB2 Control Center

Make sure that you have installed and set up the DB2 Control Center before
performing these steps. Fore more information, see Installation of the DB2
Control Center [Page 61] and Setting Up the DB2 Control Center [Page 62].
...

1. Start the DB2 Control Center


2. From the context menu of <DBSID> choose Open → Database Partitions….
3. From the context menu of the node number where the system catalog resides (default:
0), choose Backup….
4. In the dialog box that appears, enter the required values, including the correct backup
target.
5. Choose Backup now.
6. Repeat steps 4 to 7 for all other nodes.
A job will be generated that can be monitored using the DB2 Control Center Journal.

112 July 2006


5.4.3 Integrity of Backups
The db2ckbkp utility allows the user to test the integrity of a backup image on disk or tape
and determine whether or not it can be restored. It can also be used to display the meta data
stored in the backup header in order to determine information about a particular backup
image. One or more parts of an image can be checked. You can use the utility as follows:
If the full backup consists of multiple objects, the validation will only succeed if db2ckbkp is
used to validate all of the objects at the same time.
When checking multiple parts of an image, the first backup image object (.001) must be
specified first.

db2ckbkp SAMPLE.0.krodger.NODE0000.CTN0000.19990817150714.*

If the backup resides on TSM, refer to the information about db2adutl and db6adutl
provided in Managing Backups and Logs Archived on TSM [Page 131].
For more information about the db2ckbkp utility, see db2ckbkp - DB2 Check Backup Utility
[Page 166].

5.4.4 Frequency of Backups and Time Required


You should take full database backups regularly, regardless of how often log files are
archived. A recent full backup means that there are fewer archived log files to apply to the
database in case of recovery, which reduces the amount of time required by the
ROLLFORWARD utility to recover the database. It also reduces the chance of a log file not
being available (corruption or loss).
To reduce the amount of time that the database is not available, consider using online
backups.

You can only use an online backup for recovery if the database log files that are
created during the online backup are available.

July 2006 113


5.4.5 Advanced Backup Techniques
The following list provides information about advanced backup techniques:
• Incremental or delta backups
To reduce the backup and restore time, you can use incremental or delta backups. For
more information, see the IBM documentation Data Recovery and High Availability
Guide and Reference.
• Backup by file system copy
For information about using tool db2inidb as a mirror for a file system-based backup,
see The db2inidb Tool [Page 132].
• Standby database for backup purposes
For information about using tool db2inidb as a standby database for a backup, see
The db2inidb Tool [Page 132].

114 July 2006


6 Advanced Tasks

6.1 The db6util Tool


The db6util tool contains a collection of utility routines that are mainly used during the SAP
system upgrade. The following db6util options are also useful for database administration
and troubleshooting and can be entered using the command line. To generate a complete list
of all db6util options, you can call db6util –h from the command line.
The results or messages generated by all db6util commands may be redirected by the
command options [ -o <log file> ] or [ -w <resultfile> ] .

Tablespace Free Space


To generate a free space list for all tablespaces, enter the following command:
db6util –f

DB2 RUNSTATS Options


• To perform RUNSTATS on a single table, enter the following command:
db6util -r <tabname>
• To perform RUNSTATS on all tables specified in the file, create a file containing a list of
tables and enter the following command:
db6util –rf <filename>
• To perform RUNSTATS on all tables that were temporarily marked as VOLATILE in the
database and to remove the VOLATILE attribute from the tables after RUNSTATS has
run, enter the following command:
db6util –rv
Tables that are marked with an N in the ACTIVE column in table DBSTATC are not
affected by this option.

Database Lock Overview


db6util helps to analyze database lock wait situations by extracting all involved processes
from a snapshot for applications and displaying their dependencies in the form of a syntax
diagram. Detailed information about those processes, such as the last SQL statement that
was executed or lock types, is displayed.
• To display processes that are only involved in a deadlock situation, enter the following
command:
db6util –sd
• To display all processes that are involved in a lock wait situation, enter the following
command:
db6util –sl

July 2006 115


Both commands can be executed with additional parameters to take snapshots periodically.
Enter:
db6util –sd [sleep time] [number of snapshots]
db6util –sl [sleep time] [number of snapshots]
For more information about the syntax of db6util, see db6util - Tool to Assist Database
Administration [Page 169].

6.2 Setting and Updating Passwords


You can set and update the password of the users <sapsid>adm and sap<sapsid> or
sapr3 (for systems up to and including 4.6D) using the command line:
...

1. Log on as user <sapsid>adm.


2. Enter the following command:
dscdb6up <user> <password>
This command updates the contents of the dscdb6.conf file, which must not be modified
manually, and the operating system password. On multi-partitioned systems, this must be
done on all database nodes.

If you inadvertently delete or destroy file dscdb6.conf, you can recreate it by


entering the following command:
dscdb6up –create <sap<sapsid>/sapr3 password> <<sapsid>adm
password>

The operating system passwords are not changed when you use the -create
option.

6.3 Using the Journal in the DB2 Control Center


Extensions
Most tasks in the DB2 Control Center Extensions are logged in the Admin DB. You can
access these logs by choosing Journal. You can display completed tasks, such as archiving
or restoring log files, initializing tapes and also display tasks still running. In addition, you can
display the logs of the user exit. To access the journal:
...

1. In the Log File Management, Tape Management or Log File Maintenance dialog box,
choose Journal.
2. Choose the radio button with the category of actions you want to browse.
A list of actions is displayed with start and end time, return code (RC), category and
return message.
3. If you want to see an action that took place more than seven days ago, you can use the
Back button to go back in steps of seven days.

116 July 2006


4. Choose an action from the list.
The detailed output of that action is displayed in the Description group box.

To update the list of actions with the most current data, choose Refresh.

6.4 Advanced Log File Management Tasks


As outlined in Basic Concepts [Page 23], you can archive log files either automatically using
the User Exit or let the User Exit copy them to the archive directory. From this directory you
have to archive them as described in Archiving Log Files from Disk to Tape or TSM [Page
98].
If you need archived log files for a roll-forward recovery, you have to restore them into the
retrieve directory as described in Log File Restore of the SAP Database [Page 148]. The
Admin DB ADM<DBSID> keeps track of the current location of the log files.

July 2006 117


As outlined in Deleting Log Files [Page 101], you can delete log files from the log directory,
archive directory, tape, storage management products and any other backend using a
customer script. However, there are two special cases that require advanced log file
management skills:
• Log files can have special states that can be maintained in special dialog boxes. These
particular log files need to be deleted manually from the Admin DB. For details on how
to delete these log files, see Deleting Special Log Files [Page 118].
• Tapes can become unreadable or can be lost. In this case, you must manually delete
the entry for the tape from the Admin DB. For more information, see Deleting Tapes
from the Admin DB [Page 120].

6.4.1 Deleting Special Log Files


Use
You use the following procedure to delete log files that can have a special status. The log
files can be maintained in special dialogs. The status of these log files can be as follows:
• If you archive log files and choose at the same time to leave them in the archive
directory (DB2DB6_ARCHIVE_PATH), they have two locations assigned.
• If you retrieve log files, they have two locations assigned − the retrieve directory
(DB2DB6_RETRIEVE_PATH) and the archive location (for example, on tape).
• A log file has the status invalid. This can happen if you restore a database without
rolling it forward to the end of the logs. In this case log files with the same sequence
number are created again. In the Admin DB the old log files are marked as invalid.

Procedure
You can delete (or maintain) these special log files using either the DB2 Control Center
Extensions or the DB2 command line.

Using the DB2 Control Center Extensions


...

1. In the DB2 Control Center select the SAP database <DBSID>.


2. From the context menu of <DBSID> choose SAP Logfile Management.
3. If required, enter user <sapsid>adm or db2<dbsid> and the corresponding
password.
The Log File Management dialog box appears.
4. Choose Log File Maintenance… .
The Logfile Maintenance dialog box appears.

118 July 2006


5. Choose the node where you want to delete or maintain log files.
6. Choose one of the three radio buttons:
{ archived
Displays log files previously archived and not deleted from the archive directory.
{ restored
Displays log files previously restored.
{ from database
Displays log files known to the Admin DB and which are marked as INVALID.
7. Select a range of log files you want to delete.
8. Choose Delete.

Using the DB2 Command Line


• To delete log files from the archive directory that have already been archived but not
removed from the archive directory, enter the following command:
brarchive –ds –out
• To delete log files from the retrieve directory that have been restored but not removed
from the retrieve directory, enter the following command:
brrestore –dr –out
• To delete log files that are marked as INVALID, enter the following command:
brarchive –do -out

July 2006 119


6.4.2 Deleting Tapes from the Admin DB
Use
You use this procedure to delete tapes that have become unreadable or were lost from the
Admin DB to keep the content of the Admin DB up-to-date.

Procedure
Using the DB2 Control Center Extensions
...

1. In the DB2 Control Center choose the SAP database <DBSID>.


2. From the context menu of <DBSID> choose SAP Tape Management.
3. If required, enter user <sapsid>adm or db2<dbsid>.
The Tape Management dialog box appears.
4. In the navigation tree of the Tape Management dialog box, select the tape that you
want to delete.
5. From the context menu choose Delete.
The Attention dialog box appears.
6. Confirm the operation by choosing Yes.

Using the DB2 Command Line


To delete tapes from the Admin DB, enter the following command:
brrestore –dt –v <tape> -out

To delete tape PRD01 from the Admin DB, enter the following command:
brrestore –dt –v PRD01 –out

6.5 Reorganization of Tables and Tablespaces


Reorganization of Tables
A table can become fragmented as a result of large numbers of updates, deletes or inserts,
causing performance to deteriorate. In general, newly inserted rows cannot be placed in the
physical sequence corresponding to the logical sequence defined by an index. This means
that the DB2 Database Manager has to perform additional read operations to access the
data, because logically sequential data may be on different physical pages that are not
sequential.
Therefore, you should use the DB2 reorganization utility (REORG) to rearrange the data in the
tables and indexes and to remove the free space that is inherent in fragmented data. The
result will be faster accessing of data and, consequently, improvements in performance.

120 July 2006


The DBA Planning Calendar (transaction DB13) provides the following jobs for the
reorganization of tables and tablespaces:
• REORG and RUNSTATS of Flagged Tables
You can use this job to reorganize tables, particularly those for which reorganization is
recommended.
Whether or not it would be beneficial to reorganize a table is calculated by the Update
Statistics Job described in Updating Statistics for Database Tables and Checking for
Reorganization [Page 109].
This job displays a maximum of 100 tables recommended for reorganization as well as
additional data, such as delta table size and the duration of the last reorganization. You
choose which of the proposed tables to reorganize.
The selected tables are reorganized according to the order of the primary index using
the DB6CLP tool. The table statistics are subsequently updated.
• REORG of Tables in Tablespace(s)
Sometimes, you may want to reorganize all the tables of a particular tablespace to
remove fragmented data, thus increasing the free space. The DBA Planning Calendar
(transaction DB13) provides a utility allowing you to do this.
The job uses the external program dmdb6rts to reorganize all tables of a tablespace
and to subsequently update the table statistics.
• Automatic REORG
This job can be used to do automatic reorganizations of tables according to REORGCHK
recommendations. This job is additionally controlled by user-defined limitations such as,
for example, table size or runtime.
• REORG and RUNSTATS for Single Table
Yon can use this job to reorganize one single table
In all jobs you can specify the temporary tablespace where the DB2 Database Manager can
temporarily store the table that is being reconstructed. If no temporary tablespace is entered,
the DB2 Database Manager stores a working copy of the table in the tablespace in which the
table being reorganized resides. This temporary table will be at least as large as the original
table, so you must make sure that the tablespace used for reorganization has at least
sufficient free space to hold the original table.

Keep in mind that you may be reorganizing a table within a temporary


tablespace that is using pages larger than 4 KB (for example, 8 KB, 16 KB or 32
KB).
During the reorganization, the temporary tablespace, which is used during the
reorganization, must have the same size pages as the base tablespace.
For more information, see the SAP Online Documentation in the SAP Library.

July 2006 121


6.6 Redirected Restore
The redirected restore tool brdb6brt retrieves a database backup and creates a CLP script
for the restore of this backup image. Before you run the script, you can modify it, for example,
change the name and structure of the database.

2 Create Restore
brdb6brt
Script

Retrieve Data &


1 Create 3
Backup DB
Edit 4
Backup
Image
Redirected Restore 9
for homgeneous
system copy

Customized
Source DB DB Copy Restore User
Script 5 Create

Redirected
Restore 8

brdb6brt Check 7
to change
container Create 6
layout

Customized
Restore
Script

The graphic above illustrates the tasks relevant to a redirected restore process. First of all,
back up the database and retrieve data on the container layout (1) using tool brdb6brt. The
tool creates a backup of the database (3) and a CLP script for restoring this backup (2). This
script corresponds to the container layout of the database at the time of the backup. The
script can then be adapted to the needs of the database to be restored (4). This can involve
changes to the number, size or location of the containers for a restore to the same database
(6 + 8). Another possibility is to perform a homogeneous system copy (9) that normally
requires major changes to the script to match the new machine setup (5). Additionally,
brdb6brt can serve to check the script (7). It reports any failure the restore process might
encounter. In this way, failures can be avoided before they occur.

122 July 2006


6.6.1 Usage of Tool brdb6brt
You can use the brdb6brt redirected restore tool to:
• Perform simple backups.
• Retrieve an overview of the container layout.
• Perform a redirected restore.
• Change the container layout.
• Perform a homogeneous system copy.
• Create a script for restoring certain tablespaces only.
• Check the restore script.
• Move existing containers do other directories.
• Change text during script generation if required.
The following sections provide example commands. For more information about the syntax of
brdb6brt, see brdb6brt - Redirected Restore Tool [Page 160].

Performing a Simple Backup


You want to make a backup of the entire database to TSM with two sessions. The source
database is called SAMPLE. The backup is made online.
Enter the following command:
brdb6brt –s SAMPLE –bm BACKUP –bpt ADSM 2 –ol

Retrieving an Overview of the Container Layout


If you want to have an overview of the layout of the database containers, you can create a
restore script only.
To do so for database SAMPLE as instance owner db2user with password PASS123, enter
the following command:
brdb6brt –s SAMPLE –bm RETRIEVE –user db2user –using PASS123
The script contains the current time as the backup timestamp. You can also use this script for
a restore operation if you have taken a backup of the database separately. You will have to
change the script to the timestamp of the backup image you created separately.

Performing a Redirected Restore


After the script has been edited, it has to be executed from the command line. The DB2
Command Line Processor (DB2 CLP) provides an option allowing DB2 to read statements
from a file. This is called background mode.
Enter the following command:
db2 –tvf <script file>

July 2006 123


The parameters have the following meaning:
Parameter Meaning
-t Forces the CLP to use a semicolon (;) as terminating
character for an SQL statement. The use of this option is
mandatory for the execution of the script.
-v Forces the CLP to print each statement on the screen.
-f <file> Forces the CLP to read the statements from the specified
file. By default, the brdb6brt tool creates a script file of
the name <DBSID>scr, where <DBSID> is the name of the
source database.
If a backup and restore script of the database SAMPLE was created, the script should now be
executed. Enter the following command:
db2 –tvf SAMPLE.scr

Changing the Container Layout

The following procedure only applies if you are using DMS tablespaces. You
must not use it for tablespaces that are managed by DB2’s automatic storage
management.
You want to change the layout of the containers of your current database. This can comprise
changing the number of containers of a tablespace, changing their sizes or their location in
the file system. The following procedure is an example of of changing the container layout
and storing the backup into three separate directories:
...

1. To create the backup and the restore script, enter the following command:
brdb6brt –s <DBSID> –bm BOTH –bpt Y:\BACKUPS1 Y:\BACKUPS2
Y:\BACKUPS3
Since the database is rather large, the backup splitted and stored in three separate
directories..
2. Edit the script SDB.scr and change the container’s location, size and number.
3. To change the container layout, restore the database using the following command:
db2 –tvf <DBSID>.scr

Changing the Storage Path

The following procedure only applies if you are using AutoStorage


tablespaces and a database that also has automatic storage enabled.

If automatic storage is enabled for a database, the database can have AutoStorage
tablespaces as well as DMS tablespaces without AutoStorage. The database has one or
more storage paths (that are database parameters) and automatically handles the space
allocation for the automatic storage table spaces. The DMS tablespaces without AutoStorage
are handled as described under Changing the Container Layout.

124 July 2006


The following procedure is an example of changing the storage paths for the AutoStorage
tablespaces and storing the backup into three separate directories:
1. Create the backup and the restore script by entering the following command:
brdb6brt –s <DBSID> –bm BOTH –bpt Y:\BACKUPS1 Y:\BACKUPS2
Y:\BACKUPS3
Since the database is rather large, the backup splitted and stored in three separate
directories.
2. Edit the SDB.scr script and change the AutoStorage paths for the AutoStorage
tablespaces.
3. To change the container layout, restore the database using the following command:

db2 –tvf <DBSID>.scr

Performing a Homogeneous System Copy


You want to copy your database to another machine. For this purpose the container locations
have to be adapted. To do so for the database SDB, proceed as follows:
...

1. To create the backup and the restore script, enter the following command:
brdb6brt –s <DBSID> –bm BOTH –bpt Y:\BACKUPS1 Y:\BACKUPS2
Y:\BACKUPS3
Since the database is rather large, the backup is splitted and stored in three separate
directories..
2. Make the backup images and the script available on the target machine. This can be
accomplished by copying them to the machine via ftp.
3. Log on to the target machine and edit the script SDB.scr. Change the container’s
locations. You also need to adapt the location of the backup image to the directory
where the containers are available on the target machine.
4. Restore the database by entering:
db2 –tvf <DBSID>.scr

July 2006 125


Creating a Script for Restoring Certain Tablespaces Only
You want to back up one or more tablespaces rather than of the entire database. The
tablespaces for backup have the names USERSPACE1, TBSPACE and TESTSP2. The backup
is done to TSM (three sessions). The database name is SAMPLE. The restore script is created
to restore only the specified tablespaces.
Enter the following command:
brdb6brt –s SAMPLE –bm BOTH –bpt TSM 3 –tbs USERSPACE1 TBSPACE
TESTSP2

Checking the Restore Script


After the script has been edited, the script can be checked whether it would succeed on that
machine. The check allows scripts that perform full database or tablespace level restores.
Also, restoring to a new or existing database is considered. The user running the check
should be the user that will later run the script with DB2 CLP, in most cases the DB2 instance
owner (db2<DBSID>). To run a check on the SAMPLE.scr script, enter the following
command:
brdb6brt –bm CHECK -ip SAMPLE.scr
The output from the check run shows possible errors, warnings and information about the
redirected restore operation that the script will perform. Possible errors start with [E],
warnings with [W] and informational messages with [I]. The output is also saved to a file in
the current directory. The file name is the script name replaced by the file ending .chk. In
this example, the check output would be written to file SAMPLE.chk.
With the content of the check output, which is mainly error and warning messages, the
database administrator now should be able to find errors in the script or on the database
server system, for example, duplicated file names, missing write authorizations, out of space
situations. Additional information about the used file systems is provided, such as:
• List of tablespace containers
• Information about used space
• Information about free space
• Information about missed space
• Information about required space in the DB2 log directory
Especially on UNIX database servers you should be aware that new tablespace containers
will be placed in the topmost existing directory and therefore in the underlying file system. So
before running brdb6brt, the tablespace container layout (distribution of tablespace
containers in the file system(s)) should be implemented by creating file systems, directories
and links to get sound check output.

If you have a multi-partitioned database, you need to run brdb6brt for all
partitions of your database. To do so, use the –nn <node number>
parameter. The scripts created include the partition number, which prevents
existing scripts from other database partitions from being overwritten.
If you use the –nn all option, scripts for all database partitions are
automatically created.

126 July 2006


Moving Existing Containers to Other Directories
for DMS tablespaces

If you are using AutoStorage tablespaces and a database that also has
automatic storage enabled, you must not use the following procedure.
With brdb6brt patch 5 or higher, you can create relocate scripts to move existing containers
to other directories using the db2relocatedb tool. Furthermore, you can use these scripts
to initialize mirrored databases with a modified container layout using the db2inidb tool and
its parameter RELOCATE USING.
1. To create the relocate script, enter the following command:
brdb6brt –s SAMPLE –bm RETRIEVE_RELOCATE
Script SAMPLE is generated. You need to modify it according to your requirements.
2. To move containers using the db2relocatedb tool, enter the following command:
db2relocatedb –f SAMPLE.scr
3. To initialize the mirrored database, for example, to create a database snapshot using
the db2inidb tool, enter the following command:
db2inidb SAMPLE as snapshot relocate using SAMPLE.scr

Changing the Storage Path

The following procedure only applies if you are using AutoStorage tablespaces
and a database that also has automatic storage enabled.
When automatic storage is enabled for a database, it can have automatic storage table
spaces as well as “normal” DMS table spaces. The database has one or more storage paths
(that are database parameters) and automatically handles the space allocation for the
automatic storage table spaces. The “normal” DMS table spaces are handled as described
under Changing the Container Layout.
To change the storage paths for the AutoStorage tablespaces, proceed as follows:
1. Create the relocate script by entering the following command:
brdb6brt –s SAMPLE –bm RETRIEVE_RELOCATE
2. Edit the script SDB.scr and change the autostorage paths for the autostorage table
spaces
3. Move containers using the db2relocatedb tool by entering the following command:
db2relocatedb –f SAMPLE.scr

July 2006 127


Changing Text During Script Generation
brdb6brt creates the scripts that are used to perform a redirected restore and to relocate
the database (relocate DB script). The script then needs to be adapted according to
your requirements.
With brdb6brt patch 5 or higher, a new parameter –replace <ReplaceDefinition>
was introduced. You can use this parameter to adjust the script output during its generation
instead of adapting the output manually afterwards.

For example, you can use this parameter to change the destination database
name from SAMPLE to SAM and the container location from /db2/sample to
/db2/sam:
brdb6brt –s SAMPLE –bm RETRIEVE –replace
SAMPLE=SAM,/db2/sample=/db2/sam

6.7 Command Line Tasks Using db6clp


DB2 UDB for UNIX and Windows provides the command line tool Command Line Processor
(CLP) that allows you to administer your databases and instances as well as to access your
databases via SQL.
CLP accepts certain administrative commands like BACKUP DATABASE and SQL commands
like SELECT. However, you cannot chain commands on the command line.
On Windows you need a special environment to use CLP. The reason is that you can only
access CLP on Windows by using a special command shell installed with DB2. Tool db6clp
was developed specifically for this reason. It is actually a wrapper of the original CLP.

128 July 2006


It allows you to chain commands by separating them with semicolons. Furthermore, it is not
necessary to call it in the special DB2 command shell on Windows. The tool is defined as an
external command in the SAP system and can be used on all platforms. There are other
additional functions, which are presented in the following table.
Option Meaning
-a Explicitly attaches to the database instance before the command
execution. The instance is the one to which the database given with
the –db switch belongs. If –db switch is omitted, <DBSID> is assumed
as the database name.
If S is specified, the attachment is made using user sap<sapsid>.
If A is specified, user <sapsid>adm will be used.
The password is retrieved using the password services of SAP
systems for DB2. Thus the correct environment must exist for a
successful run (DB2DB6EKEY must be set).
This switch can only be used if the caller is one of the users
db2<dbsid> or<sapsid>adm; or sapse<sapsid> on Windows.
-c Explicitly connects to the database given with the –db switch.
If –db switch is omitted, <DBSID> is assumed as the database name.
For specification of S or A the same comments as for the –a switch
apply.
This switch can only be used if the caller is one of the users
db2<dbsid> or <sapsid>adm; or sapse<sapsid> on Windows.
-l Sets the environment DB2INSTANCE to this value before execution of
the CLP command.
-db If this switch is specified without one of the –a and –c switches, an
explicit connection to the database is only made if it is cataloged
remotely.
-p Sets the partition of the database to which the command applies. This
is applicable in multi-partitioned environments. The environment
variable DB2NODE is set to the given value before the command
execution.
-V Prints out version and patch information of the tool.

<command> The command to be executed by DB2 CLP. Multiple commands can


be specified by separating them with semicolons.

July 2006 129


The formal syntax of the command is as follows:
db6clp -V |
[-a S|A [-db <db name>]
| -c S|A [–db <db name>]
| -i <instance>
| -db <db name>]
[-p <partition>]
<command>
See also:
• For more information about external commands, see the SAP Online Documentation in
the SAP Library at SAP Web Application Server → Computing Center Management
System → Background Processing.
• For more information about DB2 CLP and administrative commands, see the IBM DB2
administration documentation Command Reference.
• For more information about SQL, see the IBM DB2 documentation SQL Reference.

6.8 Monitoring Database Alerts


For information about how to monitor database alerts, see the SAP Online Documentation in
the SAP Library.

6.9 Monitoring Lock Waits and Deadlocks


Monitoring Lock Waits
A lock wait is a situation when one application updates or inserts a row without COMMIT and a
second application tries to access this row. As a result, the second application gets the status
lock wait.
You can access information about lock waits by calling transaction ST04 and choosing
Performance → Lock Waits in the navigation frame of the DBA Cockpit.
If you want to display data for the first time, choose Refresh. You can choose between the
display layouts by using the list box Layout.
For more information, see the SAP Online Documentation in the SAP Library.

130 July 2006


Monitoring Deadlocks
Deadlocks are situations where two or more applications block each other, each waiting for
the other(s) to release a lock, for example, application 1 and application 2 update or insert
different rows without COMMIT. Then application 1 tries to access the rows that are locked by
application 2, and application 2 tries to access rows that are locked by application 1.
You can access the Deadlocks screen by calling transaction ST04 and choosing
Performance → Deadlocks in the navigation frame of the DBA Cockpit. You can display all
deadlocks that occurred in the past by choosing Show History.
For more information, see the SAP Online Documentation in the SAP Library.

6.10 Managing Backups and Logs Archived on


TSM
TSM distinguishes between:
• TSM backup copy group
A defined number of versions of each file is kept on the TSM server.
• TSM archive copy group
Each file is kept on the TSM server for a defined number of days.
The definition of kept versions and days must be performed on the TSM server and cannot be
changed by the TSM client.
The following table shows which type of TSM copy group is used by DB2 and the Admin
Tools.
DB2 Backup brarchive User Exit in
Direct Mode
TSM Copy Group TSM backup copy Default: TSM Default: TSM
group archive copy group. archive copy group.
If not present on the If not present on the
TSM server then TSM server then
TSM backup copy TSM backup copy
group group

To query, extract and delete backups and log files, you should use the following tools:
DB Backups Log Files saved Log Files saved
with brarchive using the User
Exit in Direct
Mode
TSM Backup Mode db2adutl brarchive db6adutl

TSM Archive Mode -- brarchive db6adutl

July 2006 131


To run the program db6adutl, use the instance owning user db2<dbsid>. db6adutl is
part of the Admin Tools and is installed in the following directory:
• For 6.NN Admin Tools
{ UNIX: $INSTHOME/admintools/bin
{ Windows: %INSTHOME%\admintools/bin
• For 4.6D Admin Tools
{ UNIX: /usr/sap/<SAPSID>/SYS/exe/run
{ Windows: <drive>:\usr\sap\<SAPSID>\SYS\exe\run
The syntax of this command is provided in Appendix A: Tool Command Line Parameters
[Page 157].
Additionally, db2adutl allows you to check backups, logs, and load copy images saved
using TSM. This utility is installed in the following directory:
UNIX: $INSTHOME/sqllib/misc
Windows: <DB2 install path>\sqllib\misc
The syntax of this command is shown in Appendix A: Tool Command Line Parameters [Page
157].
For more information about TSM, see the TSM documentation at:
www.tivoli.com/support/storage_mgt/adsm/pubs/
For more information about where log files are archived to on the TSM server, see Indirect
Archiving to TSM [Page 88] and Archiving Directly to TSM [Page 80].

6.11 The db2inidb Tool


DB2 tool db2inidb and the write suspend feature are new features of DB2 UDB for
UNIX and Windows Version 7.2. Tool db2inidb in combination with hardware technologies
like EMC Timefinder® or IBM ESS® provides the basis for fast backups or database clone
creation.
With these technologies you can split up an entire file system very fast, that is create a split
image of a file system. This split image can be mounted on a different machine, in a different
directory on the same machine where the original file system is located or replace the current
content of the original file system in case of failure. EMC Timefinder® or IBM ESS® also
provide functions to archive a split image to storage devices, for example, tape.
The db2inidb tool provides the following options:
• as mirror
You use this option to create fast backups and fast database restores with nearly no
system outage. For more information, see db2inidb Option: as mirror [Page 133].
• as snapshot
You use this option to create database clones for quality assurance or test systems.
For more information, see db2inidb Option: as snapshot [Page 136]

132 July 2006


• as standby
You use this option to:
{ Create normal DB2 backups with nearly no system outage. For more
information, see db2inidb Option: as standby for Backups [Page 138].
{ Build up a hot-standby system that is synchronized over log files. For more
information, see db2inidb Option: as standby for Hot-Standby Database [Page
139].

The procedures provided in the following sections are only intended for
experienced DB2 database administrators. Be aware that when using these
options, problems with the log file management tools might occur.
For more detailed information about the db2inidb tool, see the IBM DB2
documentation Data Recovery and High Availability Guide and Reference.

6.11.1 db2inidb Option: as mirror


Use
You use the db2inidb tool option as mirror to:
• Perform fast backups or restores.
The split image is created while the database is in write suspend mode. The
creation of the split image is very fast if you are using hardware technologies such as
EMC Timefinder® or IBM ESS®. This means you have nearly no system outage during
the backup of the split image.
To restore the database, you mount the split image and roll forward the database. The
mount time of the split image is very fast compared to a normal database restore. This
means you save the time for a normal database restore from a normal DB2 backup
image.
• Compress backups with the standard system command compress before archiving.
For example, the split image can be compressed before you archive it to tape. Thus,
tape space and I/O bandwidth are saved.
• Store log files to any storage management system.
Using this function you are not restricted to the destinations provided by the DB2
backup command. All storage management systems are able to archive files from the
file systems. You use this function to store all important DB2 files and database
containers.

With DB2, archiving and restoring the database files and database containers is
only allowed in conjunction with the write suspend feature and the
db2inidb tool for the regular DB2 backup and restore function. If you do not
use these tools, you may cause irrevocable data loss or unexpected system
behavior.

July 2006 133


Procedure
Performing a Backup
Ll...

1. To switch the database mode to write suspend, log on to the database server as
user db2<dbsid> and enter the following command:
db2 set write suspend for database
The database only allows read access now.
2. Create the split image. The split image must include:
{ All database containers (sapdata*)
{ The database directory:
UNIX: /db2/<DBSID>/db<dbsid>
Windows: <drive>:\db2\<DBSID>\db<dbsid>

Make sure that the image does not include log directory, archive directory and
retrieve directory. This is important because, if the split image is mounted for a
database restore, the current log files, which are contained in these directories,
will be overwritten with the old log files contained in the split image.
3. To switch the database mode back to normal operation, enter the following command:
db2 set write resume for database
The database now allows full access again.
4. Archive the split image.

Performing a Restore
1. Log on to the database server as user db2<dbsid>.
2. To restore the split image using the storage management system tools, enter the
following command:
db2inidb <DBSID> as mirror
The database is now in rollforward pending mode.
3. Make sure that the log files required for rollforward recovery are available:
{ For direct archiving:
The User Exit retrieves log files as required during rollforward recovery directly
from the storage management product.
{ For indirect archiving:
You have to recreate the Admin DB and restore required log files. To do so,
proceed as follows:
i. Delete the Admin DB using the following command:
db2 drop db ADM<DBSID>
ii. Restore the latest Admin DB backup SAR file using brrestore –ex or
use the SAR file located in directory
<DB2DB6_TEMP_DIR>\adminDB_<DBSID> using program sddb6ins.

134 July 2006


iii. To do so, enter the following command:
sddb6ins –r <latest_Admin_DB_backup_SAR_file>
iv. Restore log files required for rollforward recovery using brrestore.

You can avoid the recreation of the Admin DB in this scenario if the Admin DB
uses a file system that is not located in the default database path
/db2/<DBSID>. Then the Admin DB is not contained in the split image and
contains up-to-date information after the split image has been mounted.
By default, the Admin DB is created in the path specified by the database
manager configuration parameter DFTDBPATH. You can use the redirected
restore tool to move an existing Admin DB. Alternatively, if the Admin DB has
not existed so far, you can set the database manager configuration parameter
DFTDBPATH to a different directory, for example, to /db2/ADM<DBSID> before
calling sddb6ins –i. You should reset parameter DFTDBPATH after
sddb6ins –i was called.
4. Perform a rollforward recovery to the end of logs as follows:
a. Start the rollforward recovery using the following command:
db2 rollforward database <DBSID> to end of logs
b. Check if the rollforward recovery is complete using the following command:
db2 rollforward database <DBSID> query status
If the rollforward recovery is not complete, you have to correct the problem, for
example, by providing missing log files and repeating step a.
c. Complete the rollforward recovery using the following command:
db2 rollforward database <DBSID> to end of logs and
complete
If the operation was successful, the database should now be in the most current
state and can be accessed again.

Log File Management Considerations


If you want to use indirect archiving, you have to consider the following:
If no normal database backup (that is a regular online or offline backup) was performed on
the system, the log files are assigned to the last backup made on the system. This affects, for
example, the usability of the brrestore –delete option.

July 2006 135


The brrestore –delete option requires that you specify a backup timestamp. Since no
normal backup is performed, the backup timestamp is not known to the Admin Tools. To
avoid the log file deletion problem, brrestore option –force was introduced. If you use
–force in conjunction with –delete <TS>, you can specify a timestamp that is not a
backup timestamp.

As an example, the following command would delete all log files before 1
January 2003:
brrestore –delete 20030101000000 –force

Since indirect archiving is very complex and thus very error prone in conjunction
with db2inidb tool option as mirror, we strongly recommend that you use
direct archiving.

6.11.2 db2inidb Option: as snapshot


Use
You use the db2inidb option as snapshot to create a database clone for test or quality
assurance systems from your production system. In the past it was necessary to copy a SAP
system using the homogeneous system copy. The homogeneous system copy requires a full
database backup and a redirected restore on the target system. This procedure can be time-
consuming if your source system is very large (for example, several 100 MB). The db2inidb
tool option as snapshot allows you to perform a homogeneous system copy for large
databases very fast.

Procedure
On the source system:
...

1. To switch the database mode to write suspend, log on to the database server as
user db2<dbsid> and enter the following command:
db2 set write suspend for database
The database only allows read access now.
2. Create the split image. The split image must include:
{ All database containers (sapdata*)
{ The database directory:
UNIX: /db2/<DBSID>/db<dbsid>
Windows: <drive>:\db2\<DBSID>\db<dbsid>
{ Log directory log_dir
The log files are required to roll back open transactions when db2inidb option
as snapshot is called on the target system.

136 July 2006


Make sure that the split image does not include the archive and retrieve
directory.
3. To switch the database mode back to normal operation, enter the following command:
db2 set write resume for database
The database now allows full access again.
On the target system:
1. Prepare a standard SAP system environment for SAP databases using homogeneous
system copy methods.
2. Mount the split image using the storage system tools.
3. To initialize the database, enter the following command:
db2inidb <DBSID> as snapshot
Alternatively, if you want to change the container layout on the target system to
distinguish it from the one on the source system, you can use the following command:
db2inidb <DBSID> as snapshot using relocate <relocate db script>
You can easily create the <relocate db script> using the brdb6brt option
–bm RETRIEVE_RELOCATE on the source system. All open transaction are rolled back
and the target database can be accessed now.
Before accessing the target database, however, you should perform the following tasks
to clean up the target system.
If the source system was configured for indirect archiving, you must delete the Admin
DB on the target system. The reason is that the Admin DB, which uses circular logging
(that is, LOGRETAIN is switched OFF), is included in the split image, but the db2inidb
<DBSID> as snapshot command only supports databases where LOGRETAIN is
switched ON.:
a. To delete the Admin DB, enter the following command:
db2 drop db ADM<DBSID>
b. Prune the backup history file as the information included in that file is valid for
the source system. To do so, enter the following command:
db2 prune history force
..

Log File Management Considerations


If you want to use the target system for quality assurance or test purposes, you should
consider to set parameter LOGRETAIN to OFF and to use circular logging instead. Thus, you
do not need to use the log file management tools.

Be aware that all databases using circular logging are subject to some
restrictions, for example, online backups and rollforward recovery are not
supported. If you require these features on the target system, you must reinstall
and reconfigure the log file management tools on the target system.

July 2006 137


6.11.3 db2inidb Option: as standby for Backups
Use
You use the db2inidb tool option as standby to perform fast backups with nearly no
system outage, especially if you are using hardware technologies such as EMC Timefinder®
or IBM ESS®. Backups and restores are simply performed with standard DB2 commands. In
comparison to the db2inidb option as mirror, where split images are used to back up the
database, normal DB2 backup images are created.
The normal DB2 backup images offer the following advantages:
• The backup image can be used to restore the database on a different hardware
platform.
• The backup image can be used to perform a redirected restore.
• The backup image can be used to restore the database into a newer DB2 version, for
example to build up a quality assurance or test system on a new database version.

Procedure
Performing a Backup
On the source system:
...

1. To switch the database mode to write suspend, log on to the database server as
user db2<dbsid> and enter the following command:
db2 set write suspend for database
The database only allows read access now.
2. Create the split image. The split image must include:
{ All database containers (sapdata*)
{ The DB2 instance directory:
UNIX: /db2/<DBSID>/db<dbsid>
Windows: <drive>:\db2\<DBSID>\db<dbsid>
3. To switch the database mode back to normal operation, enter the following command:
db2 set write resume for database
The database now allows full access again.
4. Archive the split image.
On the target system:
1. To create a database instance using DB2 instance creation tool db2icrt, enter the
following command:
db2icrt <instance_owner>
2. Log on as instance owner.
3. To start the database instance, enter the following command:
db2start

138 July 2006


4. Recreate the database from the split image:
a. Mount the split image.
b. Initialize the standby database using the following command:
db2inidb <DBSID> as standby
5. To create a database online backup using the DB2 backup command, enter the
following command:
db2 backup db <DBSID> online to /tmp

Performing a Restore
The backup images created with the backup command on the standby system can be used
as normal backups for the source system. Thus, the restore procedure is equivalent.

The backup performed on the standby system is not listed in the backup history
of the source system.

Log File Management Considerations


If you want to use indirect archiving, you have to consider the following:
If no normal database backup (that is a regular online or offline backup) was performed o the
system, the log files are assigned to the last backup made on the source system. This affects,
for example, the usability of the brrestore –delete option.
The brrestore –delete option requires that you specify a backup timestamp. Since no
normal backup is performed, the backup timestamp is not known to the Admin Tools. To
avoid the log file deletion problem, brrestore option –force was introduced. If you use –
force in conjunction with
-delete <TS>, you can specify a timestamp that is not a backup timestamp.

As an example, the following command would delete all log files before 1
January 2003:
brrestore –delete 20030101000000 –force

6.11.4 db2inidb Option: as standby for Hot-Standby


Database
Use
You use the db2inidb tool option as standby to synchronize two databases using log
files, that is you create a hot-standby database. Hot-standby database systems are used to:
• Avoid long restore operations after a hardware failure. The hot-standby database
buffers are allocated and filled with the most recently changed data pages.
• Allow a fast recovery from logical failures.
In this case, the hot-standby system is kept in a state with a defined time delay
compared to the source system. If a logical error is detected on the source system, you

July 2006 139


can switch to the state of the hot-standby system that may not have applied this logical
error.
The setup can be as follows:
The source database works normally. The hot-standby database is in roll-forward pending
mode. All log files are created on the source database and are copied to the
hot-standby database using the ROLLFORWARD command as shown in the following graphic.

source system hot-standby system

hot-
source
standby
database
database

log file copied on regular


basis
log_dir log_dir

The following graphics show the differences for direct or indirect archiving.

Overview of Standby Databases If Direct Archiving Is Used

source system hot-standby system

hot-
source
standby
database
database

log_dir log_dir

Storage
db2uext2 Management db2uext2
ARCHIVE System RETRIEVE

140 July 2006


Overview of Standby Databases If Indirect Archiving Is Used

source system hot-standby system

hot-
source
standby
database
database

log_dir Admin DB Admin DB log_dir

db2uext2
RETRIEVE
without DB
db2uext2
ARCHIVE copy log file on
regular basis
log_archive standby_dir log_archive

brarchive

backend

Procedure

The following procedures describe the end of log scenario. The other
scenario, that is recovering from logical failures, works according to the end of
log scenario, but you must use rollforward to <point of time>
instead of rollforward to end of logs to ensure the time delay for the
hot-standby system.

Preparing the Source Database


• If you are using indirect archiving:
Configure environment variable DB2DB6_STANDBY_DIR in file init<DBSID>.db6.
The User Exit then writes a copy of the log file into the standby directory in addition to
the one the User Exit writes into the archive directory.
• If you are using direct archiving:
The central point for the log files is the storage management system. No further action
is required.

July 2006 141


Creating an Initial Hot-Standby Database Version
On the source system:
Create a database snapshot of the source system that is used as the starting point for the
hot-standby system:
...

1. To switch the database mode to write suspend, log on to the database server as
user db2<dbsid> and enter the following command:
db2 set write suspend for database
The database only allows read access now.
2. Create the split image. The split image must include:
{ All database containers (sapdata*)
{ The database instance directory:
UNIX: /db2/<DBSID>/db<dbsid>
Windows: <drive>:\db2\<DBSID>\db<dbsid>

Make sure that the image does not include the log directory, the archive
directory and the retrieve directory.
3. To switch the database mode back to normal operation, enter the following command:
db2 set write resume for database
The database now allows full access again.
4. Archive the split image.
...

On the hot-standby system:


1. Create the database by mounting the split image from the source system.
2. Initialize the hot-standby database using the following:
db2inidb <DBSID> as standby
The open transactions are not rolled back and the hot-standby database is now in roll-
forward pending mode.

Preparing the Hot-Standby Database


If you want to use indirect archiving:
1. Drop the Admin DB using the following command:
db2 drop db ADM<DBSID>
The Admin DB of the hot-standby system is empty until the system failover.
2. Set environment variable DB2DB6_UEXIT_RETRIEVE_WO_DB in file
init<DBSID>.db6 to ON.
The Admin DB on the hot-standby system does not have any knowledge about log files
created on the source database. To enable the User Exit to retrieve log files during roll-
forward recovery, you have to activate this flag. The User Exit then retrieves the latest
log files with the log file number requested by the database engine during roll-forward
recovery.

142 July 2006


If you want to use direct archiving:
If you are using TSM, you have to configure the same NODENAME (TSM configuration
parameter) on the hot-standby system as on the source database.

Keeping the Hot-Standby Database in Synchronization with the Source


Database
To keep the hot-standby database in synchronization with the source database, you have to
perform the following tasks on a regular basis.
If you want to use indirect archiving:
• In most cases, the standby directory (DB2DB6_STANDBY_DIR) of the source database
is a shared file system pointing to the archive directory of the hot-standby database
system (DB2DB6_ARCHIVE_PATH>/<DBSID>). If this is not the case, you have to
transport the log files from the source database system to the hot-standby system.
• Perform a rollforward recovery on the hot-standby system (without the
stop/complete option) using the following command:
db2 rollforward db <DBSID> to end of logs
• Delete log files that have already been applied to the hot-standby database using
rollforward recovery and that have already been archived on the source system using
brarchive.
If you want to use direct archiving:
You perform a rollforward recovery on the hot-standby system (without the stop/complete
option) using the following command:
db2 rollforward db <DBSID> to end of logs
The User Exit then retrieves the required log files directly from the storage management
system, where the source database had stored them.

Switching Over to the Hot-Standby Database System


If you are using direct archiving, you perform a rollforward recovery to the end of log files on
the
hot-standby system.
1. To start the rollforward recovery, enter the following command:
db2 rollforward db <DBSID> to end of logs
2. To check if the rollforward recovery is complete, enter the following command:
db2 rollforward db <DBSID> query status
If the rollforward recovery is not complete, you have to correct the error, for example,
by providing missing log files and repeat step a.
3. To stop the rollforward recovery, enter the following command:
db2 rollforward database <DBSID> and complete
If the operation was successful, the hot-standby database is now in the most current
state and can be accessed again.

July 2006 143


If you are using indirect archiving, you perform the following tasks on the hot-standby
system:
...

1. Recreate the content of the Admin DB on the hot-standby system using the latest
Admin DB backup SAR file. You can find the latest Admin DB backup SAR file in one of
the following locations:
{ In the standby directory (DB2DB6_STANDBY_DIR).
The SAR file is only available in the standby directory if you have set
configuration parameter DB2DB6_STANDBY_DIR_ADMDBSAR to ON in the
init<DBSID>.db6 file.
{ In directory <DB2DB6_TEMP_DIR>/adminDB_<DBSID> that is located on the
source system.

If the Admin DB backup SAR file is not in one of these locations or cannot be
accessed, you have to perform an emergency restore using
brrestore –ex.
To recreate the content of the Admin DB, enter the following command:
sddb6ins –r <SAR file>
2. Perform a rollforward recovery to end of log files.
a. To start the rollforward recovery, enter the following command:
db2 rollforward db <DBSID> to end of logs
b. To check if the rollforward recovery is complete, enter the following command:
db2 rollforward db <DBSID> query status
If the rollforward recovery is not complete, you have to correct the error, for
example, by providing missing log files and repeat step a.
c. To complete the rollforward recovery, enter the following command:
db2 rollforward database <DBSID> and complete
If the operation was successful, the hot-standby database should now be in the
most current state and can be accessed again.

Log File Management Considerations


If you are using indirect archiving, the Admin DB of the hot-standby database does not
contain any information about log files and database backups before the system failover. The
system failover is relatively complex and error-prone. Thus, we recommend that you use
direct archiving.

144 July 2006


6.12 Dual Logging
Dual logging is a new feature of DB2 Version 7.2. It provides the option to keep two copies of
the log files, which are normally only in the log directory.
To activate dual logging on DB2 V7:
Set...

1. Set DB2 instance registry variable DB2_NEWLOGPATH2 using db2set. Enter the
following command:
db2set DB2_NEWLOGPATH2=ON
DB2 creates the name of the second log directory from the first log directory by adding
2.
2. To activate this change, restart the instance.
To activate dual logging on DB2 UDB for UNIX and Windows Version 8, proceed as follows:
1. Set DB configuration parameter MIRROR_LOGPATH. Enter:
db2 update db cfg for <DBSID> using MIRROR_LOGPATH <second log
directory>
2. To activate this change, restart the instance.

DB2 calls the User Exit just once for each log file regardless if dual logging is
activated or not. This means that the log files are not archived twice. If you use
indirect archiving, the Admin DB keeps track of only one log file. brarchive
stores only one log file.

6.13 Adjusting the Content of the Admin DB


Use
You adjust the content of the Admin DB by using the brarchive option –GAL.

Before you enter the –GAL option of brarchive you should use the preview
mode with the –DMP option to make sure that your changes to the Admin DB are
correct.

Procedure
To adjust the content of the Admin DB, you use the following brarchive options:
• -GAL add
Log files that are not known to the Admin DB but located in the archive directory are
added to the Admin DB.

July 2006 145


• -GAL remove
Log files that are assumed to be in the archive directory but do not exist there are
removed from the Admin DB.
• -GAL revert
With this option, you can revert the state of log files from ARCHRET (archive retained) to
OFFLRET (offline retained) if the log files are still in the archive directory. The next time
brarchive is run to archive log files, these log files will be treated like log files that
have not yet been archived; they will then be archived again.

146 July 2006


7 Emergency Tasks

7.1 SAP Database Recovery


If you are using a full database backup as a basis, you can choose to have DB2 apply all the
units of work for any or all of the tablespaces in the database, up to any point within the time
period covered by the logs ROLLFORWARD recovery. As long as all the log files are available
covering the time period from the time of the backup through to the current time, roll-forward
recovery re-applies the completed units of work recorded in the database logs to the restored
database, tablespace or tablespaces. You can specify that roll-forward recovery is done to
the end of logs, or to a particular point in time.
During the restore phase, a copy of the SAP database and SAP database logs is needed for
recovery.
The database administrator db2<dbsid> or the SAP system administrator <sapsid>adm
can restore or rollforward the database. In a partitioned database environment, the rollforward
must be issued from the catalog node of the database. The restore command can be entered
from the command line processor, DB2 Command Center or DB2 Control Center.
A database must be restored successfully before it can be rolled forward; but a tablespace
does not. A database rollforward runs offline. The database is not available for use until the
rollforward completes either by reaching the end of the logs during a tablespace rollforward,
or by specifying STOP on the ROLLFORWARD command. You can, however, perform an online
rollforward of tablespaces as long as SYSCATSPACE is not included. When you perform an
online rollforward operation on a tablespace, it is not available for use, but the other
tablespaces in the database are.
When the rollforward recovery method completes successfully, the last log that was used by
rollforward is truncated, and logging begins with the next sequential log. The practical effect is
that any log in the log directory with a sequence number greater than the last log used for
rollforward recovery is re-used. You have to make a copy of the logs before executing the
ROLLFORWARD command if not already done by the User Exit program.
The DB2 Database Manager ensures that an incorrect log is not applied during rollforward
recovery, but it cannot detect the location of the required log. If the active log file is not
sufficient for a recovery, the db2uext2 interface will be called with the RETRIEVE request to
get the missing log file.

Restoring Databases from an Offline Backup Without Rolling Forward


You can only restore without rolling forward at the database level, and not at the tablespace
level. To restore a database without rolling forward, you could either restore a non-
recoverable database, that is, a database that uses circular logging, or you could specify the
WITHOUT ROLLING FORWARD parameter for the restore utility.

July 2006 147


Restoring Databases and Tablespaces and Rolling Forward
You do not have to recover your database with the latest backup copy of the database. You
can start with any backup as long as you have the logs associated with and following that
backup.
One type of problem that requires point-in-time rollforward recovery is the corruption of data
that is caused by errant logic or incorrect input in an application. You can use rollforward
recovery to recover the database to a point-in-time that is close to when the application
began working with the database.
A log uses a timestamp associated with the completion of a unit of work. The timestamp in
the log uses the Coordinated Universal Time (CUT). CUT helps to avoid having the same
timestamp associated with different logs, for example, because of a change in time
associated with daylight savings time. The timestamp used on the backup is based on the
local time that the backup started. As a result, when you call the ROLLFORWARD command,
you must specify the time in CUT.

Restoring Databases Using the New RECOVER DATABASE Command


DB2 version 8.2 offers the new command RECOVER DATABASE that combines the
functionality of the RESTORE DATABASE and ROLLFORWARD DATABASE command.
Using this command, you specify a point-in-time to which the database should be recovered.
You do not have to indicate which backup image must be restored or which log files are
required to reach the specific point-in-time.

7.2 Log File Restore of the SAP Database


As outlined in Basic Concepts [Page 23], you can restore log files either automatically using
the User Exit program or you have to restore them from the retrieve directory. From there the
User Exit is able to retrieve log files to the online log directory. If you choose to restore from
storage into the retrieve directory, use one of the following procedures.
You can restore log files from storage (tape, TSM or any other backend where you archived
log files to using customer script) either with the brrestore tool or with the DB2 Control
Center Extensions for the SAP system.

Restoring Log Files with the DB2 Control Center:


To restore the log files, proceed as follows:
...

1. In the navigation frame of the DB2 Control Center, from the context menu of the SAP
database, choose SAP Log File Management.
2. If required, enter user <sapsid>adm or db2<dbsid>.
The Logfile Management dialog box appears.

148 July 2006


3. Choose Restore.
4. Choose the node where you want to restore log files.
5. To determine which log files are to be restored, choose a backup date.
All available log files for the selected backup are displayed together with the number of
locations on which they are stored.
6. In the Restore logiles taken at group box select a log file range to be restored.

Due to a program limitation, the oldest log file must be at the start of the range.

July 2006 149


7. To start the restore procedure, choose Restore.
The Select Location dialog box appears.

8. Choose the location to be used for the restore process.


The best location is the default value. All log files that can be restored from the chosen
location are displayed.
If you choose a tape location from where all matching devices are retrieved, you have
to choose a tape device in the Select tape drive field.
9. To start restoring from the selected location, choose Start.
A dialog box appears informing you that the restore process has been started.
After the restore has finished, a check is made whether all selected log files were
restored. If so, a dialog box appears displaying a success message.
If there are still log files left to be restored, the Select Location dialog box reappears
again and you have to repeat the process for all different locations where necessary.
All restore actions and their results can be seen on the Journal screen.

Restoring Log Files with the Command Line Tool brrestore


brrestore can be used to retrieve any log file archived using brarchive. Calling
brrestore on the command line gives the administrator access to all command line options
and may therefore be more flexible than using the DB2 Control Center.
The following tables describes the most common usage of brrestore. If this fails, an
emergency restore can be attempted, although we do not recommend this action.

The -a arguments (shown in the following tables) must be log file numbers and
not log file names. For more information about the syntax of brrestore, see
brrestore - Log File Retrieval Tool [Page 163].

150 July 2006


Restoring Log Files From a Tape

Command brrestore -a 110-120 -d tape -v D4XA99 –out –sid


syntax SAPSID
Description This command tries to retrieve the log files with the numbers 110 to
120 from tape D4XA99. Messages are written to the standard output
and a protocol file.

Restoring Log Files From TSM

Command brrestore -a 110-120 -d tsm –out –sid SAPSID


syntax
Description This command tries to retrieve the log files with the numbers 110 to
120 from TSM. Messages are written to the standard output file and a
protocol file.

Restoring Log Files Archived Using Customer Script

Command brrestore -a 110-120 -d script –out –sid SAPSID


syntax
Description This command tries to retrieve the log files with the numbers 110 to
120, which where archived using your own script. Messages are
written to the standard output file and a protocol file.

Emergency Restore of Log Files Using brrestore -ex


Use this procedure either when both the Admin DB and the SAP database have been
destroyed or normal log file retrieval methods fail. Do not use an emergency restore for
normal management purposes, as the Admin DB is not updated.

We recommend that you first recover the Admin DB if necessary, and then use
the standard restore command brrestore -a as described in the tables
above.

Prerequisites
• The SAP database has been restored from a backup and left in
ROLLFORWARD_PENDING state.
• You have started the database ROLLFORWARD and determined that DB2 requests log
files that cannot be retrieved directly from the active log or by the User Exit from the
archive or retrieve directory.

July 2006 151


Procedure
You can perform the following procedures using either the DB2 Control Center or
brrestore.

DB2 Control Center


...

1. Locate the most recent backup of the Admin DB ADM<DBSID> on TSM or tape and
recreate the database as described in Recovery of the Admin DB [Page 153].
2. Use the DB2 Control Center Extensions to restore the log files from TSM or tape as
described in “Restoring Log Files” in this section.

brrestore
If you do not currently have access to the Admin Tools, you can restore the log files
completely independently of the DB2 Control Center and the Admin DB. This procedure
allows you to retrieve log files and Admin DB backups directly from tape or TSM.
...

1. After restoring the SAP database and starting the rollforward recovery, determine which
log files are not yet available but will be required for the recovery process. That is,
which log files were created after the backup was taken but are currently not in the
log_dir, log_archive or log_retrieve directories.
2. To find out where these files are located, enter the following command:
brrestore -q <file pattern> { -d tsm | -d tape -t <tape address>
| -d script }
3. To restore the log files from the archive, enter the following command:
brrestore –ex <file pattern> [<from time>[<to time>]] { -d tsm |
-d tape –t <non rewind addr> | -d script }
<non_rewind_addr> is the non-rewind address of the tape for restoring from tape.
4. Put the files where DB2 or the User Exit expects to find them (log_dir,
log_retrieve) and continue the rollforward recovery.

To restore all files from a tape on Windows, enter the following command:
brrestore -d tape –ex "*" -t /dev/nmt0.1
To retrieve all log files in the number range 100 to 199 that were archived to
TSM between November 1997 and the current day, enter:
brrestore -d tsm -ex "S00001*" 199711
For more information about the syntax of brrestore and non-rewind addresses, see
brrestore - Log File Retrieval Tool [Page 163].

152 July 2006


7.3 Recovery of the Admin DB

7.3.1 General Information


The Admin DB contains information about objects such as log files and their locations. This
information is required to process these log files, for example, to recover them. The Admin
DB data itself may need to be recovered for the following reasons:
• The Admin DB is lost or damaged.
• The SAP system is being moved or a duplicate SAP system is being set up on another
machine. The SAPSID and DBSID must remain unchanged. Otherwise, you must
create a new empty Admin DB.
You can deal with these situations as follows:
• You create a new Admin DB and take a backup of the SAP database.
If you do not need the old log files, for example, on a test system, this is the fastest way
of recovering or recreating the Admin DB. Otherwise, you must recover the Admin DB
from a safety copy as described below.
If the Admi...

a. If the Admin DB still exists, drop it using the following command:


DROP DB ADM<DBSID>
b. To recreate an empty Admin DB, call sddb6ins –i.

It is not essential but useful to prune the DB2 backup history file (PRUNE…).
c. Make sure that the SAP database parameters LOGRETAIN and USEREXIT are
both set to ON.
d. Perform a full backup of the SAP database.
• You recover the Admin DB from a safety copy.
To make sure that the Admin DB ADM<DBSID> can be recovered, an export of
essential information from that database is archived to the same target as the log files
just archived.
brarchive does this export and archiving automatically after successfully archiving
one or more log files. This database safety copy is not a database backup but a
compressed archive file (adminDB<timestamp>.SAR) made up of individual table
exports. This database backup image does not contain job information such as the one
shown on journal pages in the DB2 Control Center. This data is lost when
ADM<DBSID> is recreated using this image.

July 2006 153


7.3.2 Recovery Process
The recovery process consists of the following steps:
Re...

1. Retrieving the Admin DB backup image from archive.


2. Recreating the Admin DB using sddb6ins or manually.

Retrieving the Admin DB Backup Image from Archive (TSM, Customer


Script or Tape)
A copy of the latest Admin DB safety copy export archive file
(adminDB.<timestamp>.SAR) should be located in subdirectory
<DB2DB6_TEMP_DIR>/adminDB_<DBSID>. If this file is available, you do not need to
recover the Admin DB backup image from storage and you can continue with “Recreating the
Admin DB” described further below in this section.
• TSM:
If the database log files were archived to TSM, Admin DB backup images are also
stored there. To find the most recent file, it may be necessary to retrieve several or all
SAR files from TSM. If you specify adminDB.*.SAR as the file pattern, all safety files
will be retrieved. If you specify a part of the timestamp in the file pattern, the number of
files is reduced. You can restore the SAR file from TSM using the following command:
brrestore –d tsm –ex <file pattern> -out
• Customer script:
If the database logs were archived using a customer script, Admin DB backup images
are also stored using a customer script. You need to restore the SAR file manually from
where the customer script has stored it.
• Tape:
If database safety copies (and log files) are archived to tape, restore the safety file of
the Admin DB from the current tape to the current working directory using the following
command:
brrestore –d tape –ex <file pattern> -t <non rewind addr> -out

<non rewind addr> is the non-rewind address of the tape for restoring from
tape. For more information about non-rewind addresses, see brrestore – Log
File Retrieval Tool [Page 163].

You can use the pattern adminDB.20000626*.SAR to retrieve all safety files
of the Admin DB archived on August 26, 2000. This pattern reduces the number
of log files that are to be retrieved. To retrieve the above mentioned safety file(s)
to the current working directory, enter the following command:
• For TSM:
brrestore –d tsm –out –ex “adminDB.20000626*.SAR“
• For tape:
brrestore –d tape –out –ex “adminDB.20000626*.SAR“

154 July 2006


Recreating the Admin DB
The Admin DB can be recreated either using program sddb6ins or manually.

Recreating the Admin DB Using Program sddb6ins


1. Log on to the database server:
On UNIX:
As user <sapsid>adm and switch to user root (su root).
On Windows:
As user <sapsid>adm.
2. Create the Admin DB using sddb6ins. To do so, enter the following command:
sddb6ins –r <file name>

sddb6ins –r adminDB.20000626123504.SAR
This command performs the following actions:
• It creates the Admin DB.
• It extracts SAR file.
• It imports IXF files from SAR file.
• It adds backups, which were made after the SAR file has been created, to
the Admin DB.
• It adds log files from log_archive that are not known to the Admin DB to
the Admin DB. The reason is that these log files are moved to log_archive
after the SAR file has been created.

Recreating the Admin DB Manually


1. To recreate the Admin DB step-by-step from the SAR file, enter the following command:
On UNIX:
a. Log on as user <sapsid>adm and switch to user root using the following
command:
su root
b. As user root, enter the following command:
sddb6ins –I
On Windows:
Log on to your database server as user <sapsid>adm and enter the following
command:
sddb6ins –i –db2dbnamepwd <password of user db2<dbsid>>
2. Extract the SAR file using the following command:
SAPCAR –xvf adminDB.<timestamp>.SAR
3. Import IXF files using the db2move tool.

July 2006 155


4. To import the original data, call db2move as user <sapsid>adm from the directory
where the archive was unpacked. db2move is located in the DB2 directory misc.
Enter the following command:
db2move ADM<DBSID> IMPORT –io INSERT_UPDATE
This command performs the following actions:
{ Backups that were made after the SAR file was created are added to the Admin
DB (brarchive –q backups –out).
{ Log files that are not known to the Admin DB are added from log_archive to
the Admin DB. The reason is that these log files are moved to log_archive
after the SAR file has been created (brarchive –GAL add –out).

The output of the db2move command can be as follows:


IMPORT: -Rows read: 2109; –Rows committed; 2109 Table:
SAPR3.DB6IDENTIFIER
IMPORT: -Rows read: 19; –Rows committed; 19 Table:
SAPR3.DB6CONFIG
IMPORT: -Rows read: 774; –Rows committed; 774 Table:
SAPR3.DB6LOGFILE
IMPORT: -Rows read: 1774; –Rows committed; 1774 Table:
SAPR3.DB6LFSTATE
All errors and warnings are recorded in the table-specific message files named
tab?.msg.
As a result, backups that are made after the SAR file has been created are
added to the Admin DB using the following command:
brarchive –q backups –out
Tool db2move also adds log files that are not known to the Admin DB from
log_archive to the Admin DB using the following command:
brarchive –GAL add –out. The reason is that these log files are moved to
log_archive after the SAR file has been created.

156 July 2006


Appendix A: Tool Command Line
Parameters
brarchive - Log File Archive Tool

July 2006 157


Command Parameter Actions

Parameter Action
-h Displays the application command line syntax.
-help
-V Displays the application information and library version
-Version information if -d is specified.

-do Deletes obsolete files.


-dt Deletes tape with label volume from the Admin DB.
For tape, also specify –v.
You use this option if the tape is lost or is physically
damaged.
-i <subcommand> <subcommand> can be replaced by one of the
-initialize ... following:
• show
Displays the tape volume name (default).
• set
Re-initializes the old archive tape.
• force
Initializes the new tape or re-initializes the old tape
containing the active log files.
-s Stores log file(s). For tape, also specify –v and –t.
Files are not deleted on disk after they are archived.
-sd Stores and deletes log file(s). For tape, also specify –v
and –t. Successfully archived files are deleted from
disk.
-ss Stores each log file twice to backend. For tape, also
specify –v and –t. Files are not deleted on disk after
they are archived.
-ssd Tape only:
Same as –ss action but removes original copies from
disk.
-ds Deletes stored log file(s). Removes original copies
from disk.
-q <type> <type> can be replaced by one of the following:
-query <type> • backups
Displays the timestamps of all known backups.
• check
Displays detailed information about a tape. Similar
to
-i show

158 July 2006


Command Parameter Modifiers

Modifier Description
-d <device> Device to archive files to retrieve files from tape,
tsm or any other backend using a customer
-device <device>
script. -d tsm can be followed by a single TSM
management class or by two TSM management
classes separated by ‘+‘.
-DEB [<level>] Switches on trace. <level> is a value between
1 (low detail) and 9 (high detail). However, the
trace is normally turned on in the
init<DBSID>.db6 file.
-one No automatic tape eject after successful archive
operation
-out Displays the protocol on the command line
(stdout).

Without this parameter no output is


displayed except -h and -V.
-n <number> Maximum number of log files to process. The
oldest files are processed first. The numerical
-number <number>
argument does not refer to a log file number.
-node NODExxxx Node on which to perform processing or all
nodes on which to perform processing. The
-node ALL
default value is NODE0000.

- node ALL cannot be used with all


actions. This parameter is only
required with multi-partitioned
systems.
-sid <SAPSID> SAP system ID to which the operation applies
-t <device> Tape only:
[<dev2>]
Tape device(s), for example, /dev/rmt/0 on
-tape_device ... Solaris. Two arguments are required for -ss and
–ssd.
-v <volume> Tape only:
[<vol2>]
Volume name(s) on tape(s). Two arguments are
-volume ... required for -ss and –ssd.
-vndlib <lib> File name (including path) of the vendor library to
load

brarchive and brrestore only automatically display output with -h and -V.
To display the output for other actions, -out must be specified.

July 2006 159


brdb6brt - Redirected Restore Tool
brdb6brt runs in the following four modes:
• Backup/retrieve
• Check
• Tool information
The following sections provide syntax examples of each mode.

Backup/Retrieve Mode
To create a backup or a restore script, use the following syntax:

Command Parameter:

Parameter Description
-V Displays the version information (patch level) brdb6brt.
-h Displays an overview of the command line options of
brdb6brt.
-bm BACKUP Creates a backup of the specified database only.
-bm RETRIEVE Creates the restore script for the specified database only.

160 July 2006


-bm BOTH Creates a backup of and the restore script for the specified
database.
-bm RETRIEVE Creates the relocate script for the specified database.
RELOCATE
-s <SourceDB> Name of the database for which the backup and/or restore
script should be created
-pp <ProtocolPath> Directory where the protocol file for the brdb6brt run will
be written to. The default value is the working directory. The
protocol file is named <SourceDB>.brp or
<SourceDB>_NODE<NodeNumber>.brp in a multi-
partitioned environment.
-i <ScriptPath> Directory where the restore script will be written to. The
default value is the working directory. The restore script is
named <SourceDB>.scr or
<SourceDB>_NODE<NodeNumber>scr in a multi-
partitioned environment.
-nb Number of buffers reserved for the execution of the backup.
<NumberOfBuffers> The default value is 2.
-bs <BufferSize> Size of the buffer for the backup operation, in 4 KB
allocation units. The default value is 1024.
-es The restore script is created for experts, that is, only
comments that are really needed are included.
-ol Backup operation is done online.
-ts <Timestamp> Only used in retrieve mode. If specified, the timestamp in
the restore script is set to this value which must be in the
form YYYYMMDDhhmmss. The default value is the current
date and time.
-replace With this option you replace strings in the generated scripts
<ReplaceDefinition> for redirected restore and relocate. Parameter
ReplaceDefinition must have the format <orig.
string 1>=<repl. string 1>,<orig. string
1>=<repl. string 2>,…. This option only makes sense
for –bm RETRIEVE, -bm BOTH and –bm RETRIEVE
RELOCATE.
-parallelism Allows you to specify the parallelism degree for backup and
<degree> redirected restore operations.
-nn <NodeNr> In a multi-partitioned environment the backup operation is
done against this node. The restore script is specific for this
-nn ALL
node and is named
<SourceDB>_NODE<NodeNumber>.scr.
To address all nodes in one run, use option –nn ALL.
-bpt <Device> To back up the database to tape, specify a valid tape
device. You can split the backup into multiple pieces by
specifying multiple devices separated by blanks.

July 2006 161


-bpt <Directory> To back up the database to a directory, specify a valid
directory. Make sure it has sufficient space to hold the
backup volume. It is possible to split the backup into
multiple pieces by specifying multiple directories separated
by blanks.
-bpt TSM With this option you back up the database into TSM. Specify
[<NumberOfSessions>] NumberOfSessions for the TSM connection.
-bpt XBSA With this option you back up the database into an XBSA-
[<NumberOfSessions>] compliant storage management system. Specify
NumberOfSessions for the XBSA connection. This feature
can only be used on DB2 V8.
-bpt VENDOR With this option you use a third party shared library to
<LibName> perform the backup operation. Specify the library as
[<NumberOfSessions>] LibName and optionally the NumberOfSessions.

-tbs <Tablespace> If this option is not specified, a full database backup is


performed. However, you may choose to back up only one
or more tablespaces of the database. To do so, specify the
tablespaces separated by blanks. The restore script is
created only for the specified tablespaces.
-user <Username> To perform the whole operation of brdb6brt as another
user, you can specify the user name here.
-using <Password> Password for the specified user

162 July 2006


Check Mode
Use this syntax to check whether a given restore script would succeed on this machine. The
user who performs the check mode should be the instance owner of the database instance.
The terminal output of the check run is written to a protocol file in the current directory. The
name of the protocol file is <SourceDB>.chk or <SourceDB>_NODE<NodeNumber>.chk
depending on the specified script name.

Command Parameters

Parameter Description
-bm CHECK Checks whether a given restore script would succeed on
this machine
-ip <ScriptName> Name of the restore script to be checked on this machine.
By default, the restore script is named <SourceDB>.scr
or <SourceDB>_NODE<NodeNumber>.scr in a multi-
partitioned environment.
-nn <NodeNr> In a multi-partitioned environment the check operation is
done against this node.
-user <Username> To perform the database dependent checking of the check
mode as another user, you can specify the user name
here.
-using <Password> Password for the specified user

July 2006 163


brrestore - Log File Retrieval Tool

Command Parameter Actions

Parameter Action
-h Displays the application command line syntax.
-help
-V Displays application information and library version
information if -d is specified.

-dr Deletes restored log file(s). Removes restored copies from


[<number>|<range>] disk.
-a <number> Restores log file(s) from archive.
-a <range> Each parameter is a log file number and not a log file name,
for example, -a 5 or -a 5-10 to restore log file 5 only or
files 5 to 10.

164 July 2006


-ex <pattern> Performs emergency restore of log files when the Admin DB
is not available.
Tape argument -t must refer to a non-rewind device. Non-
rewind address examples are described under “Non-Rewind
Tape Device Addresses” later in this section.
-delete <timestamp> Deletes all known log files in an archive (TSM only) older
[<pattern>] than the given backup timestamp ts. An additional (optional)
file pattern can be specified to force all matching files older
than the timestamp to be deleted, even if they are not known
to the Admin DB. If you want to specify a timestamp that is
not a backup timestamp, you need to specify the –force
option in addition.
-q <type> <type> can be replaced by one of the following:
-query <type> • adsmMC
Displays known TSM management classes.
• <pattern>
Requests a list of log files matching the given file pattern
on the TSM server, for example, –q "*.LOG" (TSM
only).
-force Currently only used in conjunction with –delete ts-.

Command Parameter Modifiers

Modifier Description
-d <device> Device to archive files to retrieve files from tape, TSM or
-device <device> any other backend using a customer script. -d tsm can
be followed by an TSM management class
-DEB [<level>] Switches on trace. level is a value between 1 (low
detail) and 9 (high detail). However, the trace is normally
turned on in the init<DBSID>.db6 file.
-one No automatic tape eject after successful archive
operation
-out Displays the protocol on the command line (stdout).

Without this parameter no output is displayed


except -h and -V.
-n <number> Maximum number of log files to process. The oldest files
are processed first. The numerical argument does not
-number <number>
refer to a log file number.

July 2006 165


-node NODExxxx Node on which to perform processing. The default value
-node ALL is NODE0000 or ALL nodes.

-node ALL cannot be used with all actions.


This parameter is only required with multi-
partitioned systems.
-sid <SAPSID> SAP system ID to which the operation applies
-t <device Tape device, for example, /dev/rmt/0 on Solaris.
address>
brrestore can only access one tape a time.
-tape_device
-v <volume> Volume name on tape.
-volume brrestore can only access one tape at a time.
-vndlib <lib> File name (including path) of the vendor library to load

brarchive and brrestore only automatically display output with -h and -V.
To display output for other actions, -out must be specified

Non-Rewind Tape Device Addresses


This form of the addresses is only required for emergency restore (-ex). With the exception
of AIX, it is formed by adding an "n" to the standard (rewind) address:
• Windows: /dev/nmt0
• AIX: /dev/rmt0.1
• Solaris: /dev/rmt/0n
• Linux: /dev/nst0
• HP-UX: /dev/rmt/0mn

If you have more than one tape device to address, replace the “0” with “1”, “2”
and so on as appropriate. For example, the non-rewind address of the second
tape on Solaris is /dev/rmt/1n.

166 July 2006


db2uext2 - DB2 User Exit

Wrong usage of this function can make database backups unusable.


The user exit is normally only called by the database engine. The syntax
description here is only for qualified SAP support personnel and administrators
who have been explicitly instructed to perform an action involving the User Exit
by SAP support.

Unlike the other programs described here, the User Exit parameters allow no
spaces before their arguments.
The -SP and -LS parameters are only used if a raw device is used for logging.

DB2 Parameters Passed to the User Exit Program

Parameter Description
-OS<os> Platform on which the instance is running, for example, AIX,
Windows, Solaris, HP-UX and Windows 98
-RL<db2rel> DB2 release level
-RQ<request> Request type, for example, archive or retrieve
-DB<dbname> Database name
-NN<nodenum> Local node number
-LP<logpath> Fully qualified path to the log files. The path must contain the
trailing path separator.
-LN<log name> File name of the log file
-AP<TSMpasswd> TSM password. It is passed to the User Exit if it is provided
in the database configuration.
-SP<startpage> Log extent starts at this number in steps of 4 KB pages of
the device.
-LS<logsize> Size of the log extent in 4 KB pages
-V Displays the version information of the db2uext2 tool

July 2006 167


db6adutl - SAP TSM Management Tool

Parameter Description
QUERY Queries the TSM server for log files.
EXTRACT Copies log files from the TSM server to the current
directory on the local machine.
DELETE Either deactivates log files or deletes log files on the
TSM server.
ARCHIVE Performs action for log files in TSM archive copy group.
BACKUP Performs action for log files in TSM backup copy group.
BOTH Performs action for log files in TSM archive and backup
copy group.
BETWEEN <sn1> AND Specifies that the logs between log sequence number 1
<sn2> and log sequence number 2 are to be used.
DB <dbname> Considers only those objects associated with the
specified database name.
NODE <n> Considers only those objects created by the specified
node number.
WITHOUT PROMPTING The user is not prompted for verification before objects
are deleted.

Archived Admin DB safety files (adminDB.<timestamp>.SAR) should be


deleted using brrestore before changing from indirect archiving to direct
User Exit archiving.

168 July 2006


db6util - Tool to Assist Database Administration

Parameter Description
-h Prints help text.
-V Prints version information.
-n <dbname> Database name. The default value is the value of environment
variable DB2DBDFT.
-auth User authentication. If this option is not specified, db6util tries
to retrieve the <sapsid>adm password from the DB2 password
service.
-o Log file. The default value is stdout.
-w Result file. The default value is stdout.
-r RUNSTATS on single tables and all indexes
-rf RUNSTATS on tables provided in file first
-rv RUNSTATS on tables with VOLATILE attribute. Tables flagged in
DBSTATC with ACTIVE = N are not affected. The VOLATILE
attribute is removed after RUNSTATS.
-f Gets tablespace free space information.
-dg Gets database parameter.
-dm Modifies database parameter.
-mg Gets database manager parameter.
-mm Modifies database manager parameter.
-sd Displays overview over deadlocked processes in application
snapshot.
-sl Displays overview over deadlocked processes and processes in
lock wait status in application snapshot.

July 2006 169


dmdb6bkp - Database Backup Tool

Command Parameters

Parameter Description
<dbName> Specifies the SAP database name <DBSID>.
NODExxxx Partition number, for example, NODE0002
ONLINE | OFFLINE Specifies online or offline backup mode.
ADSM OPEN <num> SESSIONS Number of I/O sessions to be used with TSM
TSM OPEN <num> SESSIONS Identical to the –ADSM option
TO <targetArea> Lists directory or tape device names.
XBSA <vendorLibrary> Name of shared library that is compliant with the
XBSA standard, whichcontains the vendor backup
I/O functions
LOAD <vendorLibrary> Name of shared library containing the vendor backup
OPEN <num> SESSIONS I/O functions and the number of I/O sessions to be
used
BUFFERS <num> Number of buffers to be used
BUFFERSIZE <size> Size, in pages, of the buffer used when building the
backup image. The default value is 1024.
PARALLELISM <p> Number of buffer manipulators to be spawned during
the backup process. The default value is 1.

170 July 2006


INCREMENTAL Specifies a cumulative backup image. The backup
includes all database data that has changed since
the most recent successful full backup. –
INCREMENTAL DELTA Specifies a non-cumulative backup image. The
backup includes all database data that has changed
since the most recent successful backup of any type.
COMPRESS Indicates,that a backup should be compressed.
COMPRLIB-name Indicates the name of the library to be used to
perform the compression (fully qualified path). If this
parameter is not set, the default DB2 compression
library is used.
EXCLUDE Indicates that the compression library will not be
stored in the backup.
COMPROPTS Describes a block of binary data that will be passed
to the initialization routine of the compression library.
UTIL_IMPACT_PRIORITY Specifies, that the backup will run in throttled mode,
with the priority specified. Throttling allows to control
the impact of the backup operation on the database
performance
INCLUDE LOGS Specifies that the backup image should include the
range of log files that are required to restore and
rollforward the backup image to some consistent
point in time.

You cannot use this option for an offline


backup.
EXCLUDE LOGS Specifies that the backup image does not include
any database transaction log files. By default, this is
option is set.

July 2006 171


dmdb6srp - Update Statistics Tool

Command Parameters

Parameter Description
-V Prints out the version information (patch level) of
dmdb6srp
-h Prints out an overview of the command line
options of dmdb6srp
-n <dbsid> Specifies the SAP database name <DBSID>.
-t ALL Performs the operation on all database tables.
-t DBSTAT Performs the operation on all selected DBSTATC
tables.
-t CALL Calculates REORGCHK information about all
database tables with current statistics.
-t <tabschema>.<tabname> Table name, for example, SAPR3.MONI
-m <statisticalOption> To use a statistical option, specify one of the
following letters:
• Y Basic table and extended index statistics
This is the default value.
• B Basic table and basic index statistics.
• T Basic table and no index statistics

• A Distributed table and extended index


statistics

• E Distributed table and basic index statistics

• D Distributed table and no index statistics

• I Basic Index and no table statistics

• X Extended Index and no table statistics

172 July 2006


-z <maxRuntime> Maximum amount of time (in minutes) for the
execution of the program. The default value is
300 minutes.
-P Does NOT write protocol data to CCMS protocol
tables
-I Ignores column dbstatc-ameth – In case you
perform a RUNSTATS for a single table, you can
override the DBSTATC entry for the analysis
method for the specific table. Without the –I
parameter, a given –m analysis method would
have no effect.
-l <longFieldTimeFrame> Maximum amount of time (in minutes) spent on
the calculation of the size of long fields. The
default value is 3 minutes.

dmdb6rts - Table Reorganization Tool

Command Parameters

Parameter Description
-V Prints out the version information (patch level)
dmdb6rts
-h Prints out an overview of the command line options for
the tool dmdb6rts
-n <dbName> Specifies the SAP database name <DBSID>.
-t <tablespace> Specifies the name of the tablespace that contains the
tables to be reorganized.
-m Specifies the name of the tablespace where the DB2
<tempTablespace> Database Manager can temporarily store the table
being reconstructed.
The page size must match the page size of the
tablespace specified with the –t switch.

July 2006 173


sddb6ins - Admin Tools Installation Program

On UNIX, sddb6ins must always be called with root authorization but with the
user environment for user db2<dbsid> as described in Installation and Setup
[Page 41].

Command Parameters

Parameter Description

-h Prints the usage of sddb6ins.


-V Prints the version of sddb6ins.
-i [<target release>] Installs the Admin Tools. The default value of
<target release> is the release of
sddb6ins.
-u <start SAP release> Upgrades the Admin Tools. <start
[<target release>] release> indicates the release of the already
installed Admin Tools (for example, 46D). The
default value of <target release> is the
default release of sddb6ins.
-d Deinstalls the Admin Tools
-r [<adminDB backup image>] Recreates the Admin DB using the Admin DB
backup SAR file.
-checkonly [<target release>] Checks if the Admin Tools are installed
correctly. The default value of <target
release> is the release of sddb6ins.

174 July 2006


[-db2dbnamepwd <pwd>] All of these parameters have useful default
[-sidadmpwd <pwd>] values, except -db2dbnamepwd <pwd>. The
Windows only: following default values apply:
[-db2dbnamedomain <domain>] • The value of the USERDOMAIN environment
[-sidadmdomain <domain>] variable is the default value for <domain>.
• The value for -sidadmpwd <pwd> is read
from the dscdb6up password file.
For the installation of the 6.NN Admin Tools on
Windows, the -db2dbnamepwd <pwd> is
mandatory.
-s <SAPSID> Specifies the SAP system ID. The value of the
SAPSYSTEMNAME environment variable is the
default value for <SAPSID>.
-DEB [<level>] Activates the tracing facility. The detail level can
be specified using <level>. <level> can be
between 1 and 9. The default value is 3. The
value 9 means "very detailed".
-NOADMDB The Admin DB is not needed because log files
are archived directly to the vendor storage
product by the User Exit program.

July 2006 175


sddb6mir - Admin DB Creation and Mirror Tool
Utility

Command Parameters

Parameter Description
-V Prints out the version information (patch level) of sddb6mir
-h Prints out an overview of the command line options of sddb6mir
-m Mirrors the Admin DB ADM<DBSID> to the SAP database
<DBSID>.
-DEB Activates the tracing facility. The detail level can be specified using
[<level>] <level>. <level> can be between 1 and 9. The default value is
3. The value 9 means “very detailed”.

176 July 2006


Appendix B: Troubleshooting

DB2 Traces
The DB2 software provides several trace facilities to track down a variety of problem
categories that might occur when running or developing DB2 applications.
The decision to run a trace must be carefully met. The following facts should be taken into
consideration:
• In most cases, system performance will decrease.
• It is a time-consuming task.
• The amount of trace data can be enormously large. For this reason, it is essential to
find the smallest possible scenario that reproduces the problem. It might be necessary
to drill down, or even stop other activities while recreating the problem situation with the
trace turned on.
• Interpreting trace data properly requires detailed low-level knowledge of DB2. For this
reason, traces are usually only run at the request of DB2 support.
• Problem situations that have been observed might disappear during attempts to
reproduce them with the trace turned on.
All DB2 traces are documented in the Troubleshooting Guide of the DB2 Online
Documentation delivered with the software.

DB2 Trace Facility db2trc


The DB2 trace, controlled by the command db2trc, traces events. It must be run by the DB2
instance owner on the database server. To get an overview of the available options, run the
command with no options.
When turned on, options for the location of trace data are:
• In shared memory
For this, the amount of memory available for tracing is limited by the amount of
available shared memory. In many cases, this reduces the duration of the trace to a
few minutes. Once the problem has been traced, trace data first needs to be dumped
before the trace is turned off.
• In a file
This severely affects performance. Given the number of activities in an SAP
environment, DB2 will probably come to a standstill.
To get the trace into readable form, trace data needs to be formatted on the system the trace
was taken on.

July 2006 177


Usually, the sequence of activities using this kind of trace is as follows:
...

1. To store trace data in a preallocated buffer of size <memory> in shared memory, turn
the trace on by entering the following command:
db2trc on –l <memory> -s
2. Reproduce the problem.
3. Dump the trace data to a file named, for example db2trc.dmp, by entering the
following command:
db2trc dmp db2trc.dmp
4. Turn off the trace by entering the following command:
db2trc off
5. Format the trace into two files, db2trc.fmt and db2trc.flw by entering the
following command:
db2trc fmt db2trc.dmp db2trc.fmt
db2trc flw db2trc.dmp db2trc.flw
While formatting, the output is written to the screen. If the output mentions that the trace has
wrapped, the amount of memory reserved for trace data was insufficient and the trace might
not be useful. The trace needs to be repeated with a larger amount of memory. Typical
values to start with are 20000000 or 40000000 (20 or 40 million bytes).

DB2 CLI Trace


The DB2 CLI trace traces all activities of the Call Level Interface (CLI), that is, the SQL
interface of DB2. It is run on the machine running the DB2 application program. It is activated
for an application process when the trace is turned on or the process connects to the
database. There is no option to activate the trace for a process while it is being connected to
the database.

Procedure
...

1. To turn the DB2 CLI trace on or off, log on as DB2 instance owner.
2. To activate the trace, parameter TRACE in the CLI configuration needs to be set to 1.
To do so for all databases in a DB2 instance, enter the following command:
db2 update cli cfg for section common using trace 1
3. To de-activate the trace, enter the following command:
db2 update cli cfg for section common using trace 0
4. To configure the trace, several parameters can be set. Enter the following command:
db2 update cli cfg for section common using <parameter> <value>
5. To verify the current settings, enter the following command:
db2 get cli cfg

178 July 2006


Examples of Available Parameters

Parameter Description
TRACEFILENAME <file> Path of the file containing all trace data
TRACEPATHNAME <path> Directory to store trace files, one per
process
TRACEFLUSH 0|1 If this parameter is set to 1 it forces a write
to disk for each entry.

Admin Tools Traces


You can activate all tracing activities of most SAP DB2 kernel tools using variable settings in
environment file init<DBSID>.db6. This environment file is located in the
$INSTHOME/admintools directory (UNIX) or on the environment settings (Windows, also
Registry settings). Each component of the Admin Tools can be traced separately.

The trace output is intended for experienced support personnel and the
application developers. There are often several items that appear to be errors,
but are acceptable under certain conditions.

Environment Variables

Environment Variable Values


DB2DB6_TRC_<TOOL> ON or OFF
Default value: OFF
For example: DB2DB6_TRC_DB2UEXT2=ON
DB2DB6_TRC_<TOOL>_LEVEL Default value: 2
1 Errors
Error tracing
2 Footprint
Function internal info
3 DEV: Development trace
DB2DB6_TRC_<TOOL>_PATH Any path where db2<dbsid> has write access.
For example:
DB2DB6_TRC_DB2UEXT2_PATH/db2/PRD/admintools/TraceFiles
DB2DB6_TRC_<TOOL>_FILE A fixed name for the file to be used for all traces, which is
overwritten by each new trace. This should normally be left unset
to use the default behavior of creating one file per trace.

In the table above, <TOOL> is DB2UEXT2, BRARCHIVE, BRRESTORE,


SDDB6JDS, or BRDB6BRT.

July 2006 179


You can control brarchive and brrestore tracing using the command line option –DEB,
which overrides the environment, or an optional trace level and trace directory. The trace
level can have a value between 0 and 9.

Tracing of sddb6ins can only be activated using the command line option
-DEB. You can neither use the environment nor the ini file.

Default Trace File Names

Admin Tools File Names


DB2 administration server sddb6jds.<timestamp>.trc
DB2 User Exit db2uext2.<timestamp>.trc
Log file management brarchive.<timestamp>.trc
brrestore.<timestamp>.trc
Data collector dmdb6rdi.<timestamp>.trc
Update statistics dmdb6srp.<timestamp>.trc
Redirected restore brdb6brt.<timestamp>.trc
Backup tool dmdb6bkp.<timestamp>.trc
DB6CLP (command line processor) db6clp.<timestamp>.trc

The default trace file directories are:


• UNIX: $INSTHOME/admintools/TraceFiles
• Windows: %INSTHOME%\admintools\TraceFiles

Downloading Admin Tool Patches from SAP Service


Marketplace

Ggf. Verweis auf Hinweis, in dem die DL parameter stehen … (BRITTA) Was is hier nochmal
mit DL gemeint?

You can download the latest available versions of the Admin Tools from SAP Service
Marketplace at service.sap.com/patches.

For 4.6D Admin Tools


• For 32 Bit
Choose SAP R/3 → SAP R/3 4.6C → Binary Patches → SAP KERNEL 4.6D →
<Your OS> → DB2 UDB.
• For 64 Bit
Choose SAP R/3 → SAP R/3 4.6C → Binary Patches → SAP KERNEL 4.6D 64-BIT →
<Your OS> → DB2 UDB.

180 July 2006


For 6.NN Admin Tools
• For 32 Bit
Choose SAP Web AS → SAP Web AS <Release> → Binary Patches → SAP KERNEL
<Release> → <Your OS> → DB2 UDB.
• For 64 Bit
Choose SAP Web AS → SAP Web AS <Release> → Binary Patches → SAP KERNEL
<Release> 64-BIT → <Your OS> → DB2 UDB.

There is no Unicode version of sddb6ins. Therefore, you must use the non-
Unicode version.
For brdb6brt, there is both a Unicode and a non-Unicode version.
The following table provides an overview of the files available:
File Description
SAPCAR.CAR Contains the extraction tool SAPSAR(.exe).
DB6CCEXT_HW.SAR Contains the SAP DB2 Control Center Extensions.
sddb6ins.CAR/SAR Contains the installation program sddb6ins(.exe).
dscdb6up.CAR UNIX only and only for SAP system Releases 4.6x

Keep in mind that HW stands for UNIX if the DB2 Control Center runs on UNIX,
or I386 if it runs on Windows.

July 2006 181


Troubleshooting Admin Tools and Programs
The following section provides information and advice on how to proceed when problems
occur.

General Troubleshooting Comments


Many recent customer problems were caused by problems with the runtime environment. An
installation may not have completed successfully, or a user inadvertently changed the
environment. For example, an environment variable was changed or unset, or file or directory
authorizations were changed. You can now check the runtime environment for the Admin
Tools by calling sddb6ins –checkonly.
Password file problems are also common. Use dscdb6up to resynchronize passwords. For
detailed information, see Setting and Updating Passwords [Page 116]. Also, check that the
operating system user has not revoked users.
Problems with devices are a frequent issue. Older versions of the Admin Tools, that is, SAP
system Release 3.1I, are not compatible with TSM. ADSM must be still used in this case.
Initializing tapes with non-default values, for example, with a different block size, will cause
problems if these values conflict with the parameters in those in the Admin DB. For more
information, see Changing the Admin Tools Configuration [Page 70].
If brrestore or brarchive can not terminate properly, a lock file may be left behind.
Running the tool again will cause an LFA158 error that will contain the path of the lock file.
Ensure that neither brarchive nor brrestore are running and delete the file.
Often, defects that you find have already been found and addressed. Downloading and
installing the latest patch from SAP Service Marketplace will often resolve the problem. For
more information, see Downloading Admin Tool Patches from SAP Service Marketplace
[Page 180] in this appendix.
Customers occasionally run out of disk space. Make sure that the DB2 protocol file
db2diag.log in the db2dump directory has not become too large. Running brarchive will
free up space by removing log files from the archive directory. If the database cannot be
started, it may be necessary to first temporarily move some log files out of the log directory to
provide space. It is important to choose only the most recent inactive files as the user exit and
brarchive will move older files first. Make sure that files are no longer active before moving
them. As soon as enough space is available, when the User Exit has archived several files,
brarchive should then be called and the log files in temporary storage moved back to the
log directory.

182 July 2006


Initial Troubleshooting Steps
Implement the following steps until the problem is resolved.
...

1. Look in the protocol file for the error.


2. Look up the meaning of the error message in this appendix.
3. Perform the suggested action.
4. If there is an SQL return code in the error message, look it up in the DB2 Message
Reference and perform the recommended action.
5. Search SAP Notes for solutions to previous occurrences of this error.
6. Check SAP Service Marketplace at service.sap.com/patches for new patches.
Download and install the latest patch version.
7. If not, run the installation tool with the -checkonly option and check the output. Make
any appropriate adjustments to the runtime environment.
8. Switch on Admin Tool tracing. Run the action again. Create a message using SAPNet
− R/3 Frontend. Upload the protocol and trace files, the protocol file
init<DBSID>.db6, and any core file to the SAP server.
To ensure efficient troubleshooting, go through the above steps and gather as much
information as possible about the problem before contacting SAP support.

Installation (sddb6ins) Troubleshooting


Installation Failure
In general, if the installation or upgrade has not completed successfully, you can retry this
operation without causing data loss. The following error can occur during the installation of
the Admin Tools:
Error Error opening file <file> with mode wb.
Message
Reason File cannot be replaced because the executable or shared library
is currently in use.
Action Retry installation or upgrade operation.
Required

Common Installation Problem


The password file is inconsistent with the operating system; variable DB2DB6EKEY changed.
The passwords given when installing the SAP system or using the dscdb6up utility must
match the operating system passwords for the same users. DB2DB6EKEY must have the
same value on all systems. By default, the value is based on the machine name, which is
often different on multi-node systems (DB2 UDB EEE V7 or DB2 UDB ESE V8 with multiple
partitions).

July 2006 183


User Exit Troubleshooting
The following errors might occur:
• The log directory (database parameter LOGPATH) becomes full.
• No new log files appear in the archive directory.
• Entries in diagnostic file db2diag.log and db2alert.log or
db2uext2.err.NODEXXXX (located in the DIAGPATH database parameter) report a
User Exit failure.
To check the reasons for these errors, you can use the following procedure that is valid for
the ARCHIVE and RETRIEVE actions of the DB2 User Exit program:
...

1. Look at the db2uext2 protocol and error files.


These files are located in the DIAGPATH database parameter and are written for each
database partition. The file names are as follows:
{ Protocol file: db2uext2.log.NODEXXXX
{ Error file: db2uext2.err.NODEXXXX
2. Look at the journal page for User Exit entries. See the following table for details.
For the User Exit error message, the return codes have the following description:

User Exit Error Messages

Return Description
Code
0 Successful
1 DB2 shared library not found. For detailed analysis, activate the tracing facility.
On UNIX: Verify if environment variable INSTHOME is set correctly.
4 Temporary error encountered (system memory). Retry. If the problem persists,
contact your system administrator and SAP support.
5 TSM shared lib could not be loaded.
Check if the specified shared library is in the path of the DB2 instance owner:
UNIX: libApiDS (for 64bit libApiDS64)
Windows: ADSM32.dll
If files are being archived directly to TSM by the User Exit, check environment
variable DB2DB6_VENDOR_UEXIT.
6 Function module in the shared library could not be loaded. Check previous
error messages.
8 The User Exit returns this value to the DB2 Database Manager for most
failures. The DB2 Database Manager automatically retries archive operations
again after five minutes. If processing of the same log file fails repeatedly,
check the error file db2uext2.err.NODExxxx for more detailed information.

184 July 2006


12 Hardware error
16 Error with the User Exit program or system function used by the program, for
example, signal handling). Retry. If the problem persists, contact SAP support.
20 Error with one or more of the parameters passed to the User Exit program.
Check whether you are using a version of db2uext2 that is compatible with the
database product release.
21 Invalid database parameter. This is an internal error that you must report to
SAP support.
22 Invalid database manager parameter. This is an internal error that you must
report to SAP support.
23 Admin DB access error. Contact SAP support.
24 The User Exit program was not found. This return code is recorded in the
db2diag.log. Check if program db2uext2 is available in the following
directories:
UNIX: $INSTHOME/sqllib/adm/
Windows: <DRIVE>:\sqllib\bin\
28 Failure of I/O

30 File I/O error. Accompanying message should contain the system error number
defined in file errno.h.
32 Operator or user terminated process
33 Operator or user terminated process
34 Copy of log file (archive or retrieve operation) failed
35 • Archive operations:
If the source is the log file to be archived by the DB2 User Exit, this is just
a warning. The log file has probably been moved out of the online log
directory. Make sure that the log file is still available. If not, you may have
problems if a database recovery becomes necessary.
• Retrieve operations (ROLLFORWARD):
If the DB2 User Exit was called to retrieve log files, the log file could not be
found in either the archive or the retrieve directory. Attempt to retrieve it
using brrestore. If the file does not exist (and never has existed) you
are finished and can perform ROLLFORWARD STOP. This is a safety
feature to ensure that the ROLLFORWARD is not accidentally stopped when
log files still exist that could be recovered using brarchive. This is
deliberately different to the default (simplified) User Exits provided as
source code together with DB2.
36 Opening file failed. Log file does not exist. Check error file
db2uext2.err.NODExxxx for more detailed information.
Retrieve operations (ROLLFORWARD):
This is not necessarily an error. Ensure that the file has never existed and then
perform ROLLFORWARD STOP.

July 2006 185


37 Opening file failed. Check the messages and access authorizations. Check
error file db2uext2.err.NODExxxx for more detailed information.
38 Reading from file failed. Wait to see if db2uext2 succeeds at a future attempt.
If not, check at the file system level. Check error file
db2uext2.err.NODExxxx for more detailed information.
39 Writing to file failed: The log file could not be copied to the archive directory.
There could be a free space problem. Check error file
db2uext2.err.NODExxxx for more detailed information.

40 Closing of log file failed.


41 Creating directory failed. Check the file system access authorizations. Check
error file db2uext2.err.NODExxxx for more detailed information. It may be
necessary to modify the environment variables DB2DB6_ARCHIVE_PATH and
DB2DB6_RETRIEVE_PATH.
43 Unable to read environment variable. Check error file
db2uext2.err.NODExxxx for more detailed information.
44 Error when accessing file. Check the file system access authorizations. Check
error file db2uext2.err.NODExxxx for more detailed information (for
example, errno).
45 RC_AUDIT_IO_ERROR: Problem writing to db2uext2.err.NODExxxx or
db2uext2.log.NODExxxx
46 File I/O seek error. Check error file db2uext2.err.NODExxxx for more
detailed information (for example, errno).
48 SQL error occurred. Check error file db2uext2.err.NODExxxx for more
detailed information. Check the SQL code in DB2 Message Reference.
49 SQL warning occurred. Check error file db2uext2.err.NODExxxx for more
detailed information. Check the SQL code in DB2 Message Reference.
50 Registration of file space on ADSM/TSM server failed.
51 Binding of ADSM/TSM management class failed.
52 The API call “begin transaction” of the ADSM/TSM API failed.
53 The API call “end transaction” of the ADSM/TSM API failed.
54 Initialization of request to send object to ADSM/TSM server failed.
55 Sending of data stream to ADSM/TSM failed.
56 End of data sending to ADSM/TSM failed.
57 The API call “begin query” of the ADSM/TSM API failed.
58 The API call “end query” of the ADSM/TSM API failed.
59 Query of object on ADMS/TSM server failed.
60 Start of retrieve operation in ADSM/TSM storage failed.
62 Getting data stream from ADSM/TSM failed.
63 Obtaining requested object data from ADSM/TSM failed.
64 Signifying end of getting object cycle failed

186 July 2006


67 Object was not found on ADSM/TSM server.
68 Initialization of ADSM/TSM session failed.
69 Termination of ADSM/TSM session failed.
70 Deletion of object on ADSM/TSM server failed
80 DB2 CLI statemnet allocation failure. This is an internal error that you must
report to SAP.
81 DB2 CLI Set statement option failure. This is an internal error that you must
report to SAP.
82 DB2 CLI Prepare statement failure. This is an internal error that you must
report to SAP.
83 DB2 CLI Bind parameter failure. This is an internal error that you must report to
SAP.
84 DB2 CLI Execute statement failure. This is an internal error that you must
report to SAP.
85 DB2 CLI Transcation statement failure. This is an internal error that you must
report to SAP.
86 DB2 CLI Free statement. Failure.
Internal error. Report to SAP.
90 Windows only: Environment variable DSCDB6HOME not set. Check your
environment.
91 Environment variable DB2DB6EKEY not set. Check your environment.
92 Password could not be retrieved from password file dscdb6.conf.
On UNIX
Check the file authorizations of /sapmnt/<SAPSID>/global
(permission 700, owner <sapsid>adm, group db<dbsid>adm) and
/sapmnt/<SAPSID>/global/dscdb6.conf
(permission 600, owner <sapsid>adm, group sapsys).
On Windows
Check if share \\DSCDB6HOME\sapmnt is available and if the DB2 service has
been started by user db2<dbsid>.
93 Environment variable DB2DBDFT not set. Check your environment.
101 Database management (DBM) parameter DFTDBPATH is not set or could not be
retrieved. Try to retrieve this parameter on the command line. Check the
database environment.
102 Database management (DBM) parameter DIAGPATH is not set or could not be
retrieved. Try to retrieve this parameter on the command line. Check the
database environment.
104 Log file ID cannot be obtained. Any log file to be archived by the DB2 User Exit
is assigned a unique ID. It is generated in the Admin DB. If this error occurs,
check the ADM<DBSID> database of your managed instance and contact SAP
support.
110 Recording information failed: An action step cannot be protocolled in the Admin
DB. Processing continues. Check error file db2uext2.err.NODExxxx for
more detailed information.

July 2006 187


111 Protocol database connect error. Check from the DB2 command line (CLP)
whether a connection to ADM<DBSID> can be established. If not, contact SAP
support. See also SAP Note 543779.
112 ADM<DBSID> object creation failed. No log file entry can be made in the Admin
DB. Processing cannot continue. Check error file db2uext2.err.NODExxxx
for more detailed information.
113 ADM<SID>: Write configuration parameter failed:
Internal error. Report to SAP.
114 ADM<SID>: Could not move log file to other location:
Internal error. Report to SAP.
115 Last backup timestamp could not be retrieved from the database recovery
history file and could not be inserted in the Admin DB. Check error file
db2uext2.err.NODExxxx for more detailed information.
116 The vendor user exit program could not be started. Check error file
db2uext2.err.NODExxxx for more detailed information.
117 Vendor user exit program error. For detailed information, refer to the vendor
user exit documentation.

For more detailed information about the most current documentation of the db2uext2 tool
return codes, see SAP Note 104019.

188 July 2006


brarchive/brrestore Troubleshooting
Checking the protocol output and corresponding corrective actions can solve most problems
involving brarchive and brrestore.

However, when called directly on the command line the protocol is by default
only written to file and no output appears on the command line. To override this,
option -out must be included in the program call.
If an application does not perform correctly, make sure that you are using the most recent
patch available on SAP Service Marketplace at service.sap.com/patches. The version
and patch level of each program can be seen near the top of each protocol.
As mentioned above, in addition to the standard environment tracing switches, brarchive
and brrestore also allow activation of tracing on the command line using parameter
-DEB <level>, for example, 1…9.

brarchive and brrestore Messages


The following tables list brarchive and brrestore message IDs, their texts, and
suggested corrective actions.
• brarchive and brrestore information messages have no numbers - only warnings
and errors.
• LFA000 to LFA099 are brarchive and brrestore warning messages.
• LFA100 to LFA999 are brarchive and brrestore error messages.
• VND000 to VND999 are back end library error messages.

July 2006 189


brarchive and brrestore Warning Messages

ID Message Comment
LFA000 Action ended Main action completed successfully but warnings
with warnings. were issued. See other messages for more
information.
LFA001 <OLD> syntax Although the program still supports this old command
supported but line option it may not in future releases. It is better to
archaic. Use use the new syntax. Use option –help to see the
new syntax. syntax.
LFA002 <OLD> syntax A command line option was ignored because it is no
archaic and longer valid syntax. Use the new syntax. Use option –
ignored. Use help to see the syntax.
new syntax.
LFA005 <OLD> option Although the program still supports this old command
supported but line option it may not in future releases. It is better to
archaic. Use use the new syntax. Use option –help to see the
<NEW OPTION>. syntax.
LFA006 -s with two Although the program still supports this old command
devices and line option it may not in future releases. It is better to
volumes use the new syntax. Use option –help to see the
supported but syntax.
archaic. Use -
ss.
LFA007 -sd with two Although the program still supports this old command
devices and line option it may not in future releases. It is better to
volumes use the new syntax. Use option –help to see the
supported but syntax.
archaic. Use -
ssd.
LFA009 Option Although the program still supports this old command
<OPTION><ARG> line option it may not in future releases. It is better to
supported but use the new syntax. Use option –help to see the
archaic – syntax.
Interpreted
literally
LFA010 -d/-device not Use -d tape to explicitly specify the device type.
specified but
tape implied.
LFA011 -d/-device not Use -d adsm to explicitly specify the device type.
specified but
ADSM implied.
LFA015 Unexpected Use quotes for pattern, for example, '*.SAR'.
pattern
argument
LFA015 No file pattern Warning if no file pattern is given. ‘*’ will be used.
given

190 July 2006


LFA021 No action Specify an action option. See the syntax diagram that
specified on is displayed.
command line.
Assuming '-
help'.
LFA023 Using Ensure that environment variable
<DIRECTORY> for DB2DB6_TEMP_DIR is set for user db2<dbsid>.
temporary
files.
LFA024 Device not Use -d tape or -d adsm to explicitly specify the
specified or device type. The default value is tape.
implied. Using
tape.
LFA025 Device not Use -d tape or -d adsm to explicitly specify the
specified or device type. The default value was changed to TSM
implied. Using in the Admin DB using the DB2 Control Center
adsm (default Extensions.
in the config
table of the
Admin
database).
LFA031 File <FILE> A file intended for deletion was not found. No action
could not be is necessary as the file would have been deleted
found for anyway. However, try to determine why the file was
deletion. missing.
LFA032 Tape is This is a valid log file archiving tape but appears to be
initialized but owned by a different SAP system. Use -i force to
volume unknown force tape re-initialization for the current system.
to system.
LFA034 Unable to Check installation and program authorizations. May
change real cause other errors. Use option –checkonly of
user. May program sddb6ins to verify the installation. For
result in more information about authorizations, see Installing
errors. the Admin Tools Manually [Page 47].
LFA036 Program Look for the protocol file in the temporary directory
finished before set in environment variable DB2DB6_TEMP_DIR.
INSTHOME or
db2<dbsid> home
dir determined.
Protocol file
will remain in
temp dir.
LFA037 Signal handling Internal problem caused by an error. Application may
looping. Clean not be able to terminate properly.
up may not be
successful.

July 2006 191


LFA038 ... Operation Action was successful but warnings occurred. Check
completed with the protocol file for warning statements.
warnings.
LFA039 Unable to Check if db2start has been executed. Otherwise,
connect to check the database error files. For the SQL return
admin db. ls db code, check the DB2 Message Reference.
started? (rc =
<VALUE>)
LFA040 Query operation Query may not be appropriate.
ended with
warning.
LFA041 Could not For the SQL return code, check the DB2 Message
delete backup Reference.
timestamp
entries (rc =
<VALUE>).
LFA042 No backup Warning: No backups appear to have been
timestamp performed to this target.
entries found.
LFA043 Unable to Non-critical error. Entries not found or internal error
remove old when accessing or deleting them.
protocol
entries from
admin db.
LFA044 Are the program Normally suggested in connection with another error
ownership and or warning. Check the executable authorizations.
permissions set
correctly?
LFA046 XDB DB access SAP Basis Release 4.6D only:
function error Log files may not be displayed in transaction DB13. If
(rc=<VALUE>). this causes concern, contact SAP support.
LFA047 Return without Check DB environment or permission to connect to
trying to the Admin DB.
connect to DB
LFA048 config Value of the configuration parameter in table
parameter too DB6CONFIG too long
long
LFA051 Unable to eject Tape must be ejected manually.
tape.

192 July 2006


LFA053 Directory <DIR> Only a problem if other messages reflect this.
cannot be
written to.
LFA070 Tape has SID Tape belongs to another system. If you are certain
<SAPSID> and this tape is not needed, the tape header must be
not <SAPSID> as overwritten using operating system commands, for
expected! example, tar, cpio, or dd.
LFA071 Tape # has been This tape must be replaced as soon as possible. It is
reused # times no longer reliable.
(>#) and should
be replaced.
LFA073 Bad environment The environment variable value may be invalid.
value ? Check this variable in the user environment.
<VARIABLE> =
<VALUE

brarchive and brrestore Error Messages

ID Message Comment
LFA101 Parameter <OPTION> Use option –help to see the syntax.
unknown.
LFA102 Action not allowed Use option –help to see the syntax.
for <PROGRAM>.
LFA103 Action only allowed Use option –help to see the syntax.
for <PROGRAM>.
LFA104 <OPTION> argument Use a shorter argument value. Be careful that
"<VALUE>" too long. you have not used wild card characters
interpreted by the shell.
LFA105 <OPTION> argument Required argument is missing. Use option –
missing. help to see the syntax.
LFA106 <OPTION> argument Check and replace the bad string argument
"<VALUE>" not OK. value. If the problem is not clear, refer to the
option documentation.
LFA107 <OPTION> argument Check and replace bad numeric argument
"<VALUE>" not OK. value. If the problem is not clear, refer to the
option documentation.
LFA108 Too many actions on Only one action option is permitted. Use
the command line. option
–help to see the syntax.
LFA109 <OPTION> results in Check for repeating or conflicting options, for
repeated or example, . –d ADSM or –d TAPE.
conflicting Use option –help to see the syntax.
parameters.
LFA110 The option <OPTION> The action requires that the additional option
is required for this be used. Add the required option to the call.
action.

July 2006 193


LFA112 <VAL> “<VAL>”: Same Do not repeat arguments on the command
device given twice. line.
LFA113 The option <OPTION> Provide the correct number of arguments.
requires two
arguments for this
action.
LFA114 The option Use the new syntax. The old syntax may no
<OPTION><ARG> is 31I- longer be supported in a later release. Use
specific. Please option –help to see the syntax.
refer to new syntax.
LFA115 The option Use option -help to see the syntax.
<OPTION><ARG> is not
supported by
<PROGRAM>
LFA120 Problem determining Check the db2<dbsid> user environment.
value of <ENVIRONMENT
VARIABLE>.
LFA121 Value of environment Check the db2<dbsid> user environment.
variable <ENV.
VARIABLE> too long.
LFA130 Application error. Application error. Refer to other messages. If
the cause is not clear, contact SAP support.
LFA131 Admin-tool database Internal database call failed. Refer to other
error (rc = VALUE). messages. Refer to the DB2 Message
Reference for an explanation of the SQL
code.
LFA132 Log-file delete Unable to delete the file. Refer to other
failed. messages.
LFA133 Error initializing Unable to initialize the tape. Refer to other
tape. error messages.
LFA134 Error while preparing Error creating the file list for processing. Refer
list of files to to other error messages.
process.
LFA136 Backend function Backend library function failed. Refer to other
error (rc = <VALUE>). messages.
LFA137 Error while getting Most likely an error occurred opening the
tape label. session with the backend library. Refer to
other messages.
LFA138 New tape label not Tape initialization failed. Retry the operation.
set correctly.
LFA141 <CONFIGURATION Check the default, tape device and tape
PARAMETER> parameter device class values using the DB2 Control
error. Check value in Center Extensions. For more information, see
control center. (ADG Configuration [Page 70].
rc = <VALUE>)

194 July 2006


LFA142 Unable to open Library initialization failed. Refer to other
backend session. messages.
LFA143 Emergency restore Emergency restore operation failed. Refer to
failed. other error messages.
LFA144 Transfer operation Archive or restore operation failed. Refer to
failed. other error messages.
LFA145 Query operation Query operation failed. Refer to other error
failed. messages.
LFA146 Unable to create file Error creating the file list for processing. Refer
list. to other error messages.
LFA147 Unable to determine Check the user environment (db2<dbsid>,
value for <sapsid>adm) of the program caller.
<ENVIRONMENT
VARIABLE>.
LFA148 Delete on backend Delete operation for an archived log file failed.
failed. Refer to other error messages.
LFA149 Unable to load Unable to find or load brarchive or
backend library. brrestore library. Check the Admin Tools
installation. Use option –check_only of the
installation tool and check the installation
documentation specifically for file
authorizations.
For more information, see :
• SAP Web Application Server Installation
on UNIX: IBM DB2 Universal Database
for UNIX and Windows
• SAP Web Application Server Installation
on Windows: IBM DB2 Universal
Database for UNIX and Windows
LFA150 Unable to initialize Library initialization failed. Refer to other
session info. messages.
LFA151 Action failed. Operation failed. Refer to other error
messages.
LFA152 <VALUE> is not a Check the command line parameters and
valid device. arguments.

July 2006 195


LFA153 Cannot access Unable to access an essential tool file. Check
sap<sapsid>/db2<dbsid the Admin Tools installation. Use the
> data file. –check_only option of the installation tool
and check installation documentation
specifically for file authorizations.
For more information, see:
• SAP Web Application Server Installation
on UNIX: IBM DB2 Universal Database
for UNIX and Windows
• SAP Web Application Server Installation
on Windows: IBM DB2 Universal
Database for UNIX and Windows.
LFA154 Error preparing for Refer to other messages.
operation.
LFA155 No files were Error prohibited file processing. Retry
successfully operation.
processed to
completion.
LFA156 Not all files were Error prohibited some file processing. Retry
successfully operation.
processed to
completion.
LFA157 Unable to create file Internal error. Refer to other messages.
sub list.
LFA158 Error brarchive or brrestore may already be
getting/releasing running. If not, delete the file and restart the
lock: <FILE>. program.
LFA159 No log_archive entry Target directory unknown but should have
in Admin DB. Has User been made available by the User Exit. Check
Exit been run? the User Exit protocols. This error can also be
caused by incorrectly performed upgrade.
LFA160 '-i set' not ok if The action -i set can only be used to
tape already labeled. initialize tapes that are out-of-date. Use -i
Use -i force. force to force re-initialization of a current
tape.
LFA161 Tape <DEVICE> must be The tape is not initialized. Use -i force to
initialized first. force initialization of a new, invalid or current
Use –I set or -i tape.
force.
LFA162 Tape <NUMBER> volume The label found on the referenced tape does
<LABEL> does not not match the value specified with -v on the
match command line command line. Check that the correct tape
value <LABEL>. being used.
LFA163 Default tape rewind Check the default, tape device and tape
and non-rewind device class values using the DB2 Control
addresses identical Center extensions. For more information
(<DEVICE>) about non-rewind address examples, see
brrestore - Log File Retrieval Tool [Page 163].

196 July 2006


LFA164 Tape is not known to The tape is not known. Use -i force to
system. Initialize force initialization of a new, invalid or current
with -i force. tape.
LFA165 Tape is initialized The tape label is not a valid format. Use -i
but volume is force to force initialization.
unreadable. Use -i
force.

The tape may be damaged or may


have come from an incompatible
system (Windows/UNIX).
LFA166 User is <USER> but Only db2<dbsid> or <sapsid>adm users
should be <USER> or should start programs brarchive and
<USER>. brrestore.
LFA167 Program is already A lock file is already present. Either
running. If not, brarchive or brrestore is running
delete <LOCK FILE>. elsewhere at the same time (wait for program
to end) or a previous program call terminated
unexpectedly (in this case delete <LOCK
FILE>).
LFA168 Volume name <VOLUME> Name already exists. Name can only be re-
used on other tape. used if tape with this name is re-initialized.
Use new name or re-
initialize old tape.
LFA169 Tape not initialized Tape has not been initialized by brarchive.
or already used.
Initialize with –i
set/force.
LFA170 Tape not used and can Attempting to restore from the wrong tape?
therefore have no
files.
LFA171 Tape device <DEVICE> See “Tape Management” in Indirect Archiving
not known. Must be to Tape [Page 82].
registered in Control
Center.
LFA180 Unable to allocate System memory error. Check system memory
memory. Check system resources and retry operation.
resources.

July 2006 197


LFA181 Unable to load Unable to find or load the brarchive or
library <LIBRARY brrestore library. Check the Admin Tools
NAME>. installation. Use option –check_only of the
installation tool and check the installation
documentation specifically for files and file
authorizations.
For more information, see:
• SAP Web Application Server Installation
on UNIX: IBM DB2 Universal Database
for UNIX and Windows
• SAP Web Application Server Installation
on Windows: IBM DB2 Universal
Database for UNIX and Windows.
LFA182 Delete failed for Delete operation for the log file failed. Refer to
file <FILENAME>. other error messages. Check the file
errno = <VALUE>. authorizations of <FILENAME>.
LFA184 Unable to determine If environment variable INSTHOME is not set,
home directory of the application attempts to determine the
<USER>. home directory of user db2<dbsid>. Set
variable INSTHOME.
LFA188 Unable to set signal System error that may result in incorrect
handler. program execution. Contact your system
administrator.
LFA189 Unable to find file Refer to other message and check the
or directory <VALUE>. existence of the item. Has the file been
automatically deleted by TSM or moved
manually?
LFA190 Log file <FILE> has Check log file name is valid, for example,
wrong format. S0000000.19920211152635.NODE0000.
LFA191 Directory <dir> Check installation using the check option of
cannot be written to. program sddb6ins. If the problem is not
resolved, contact SAP.
LFA200 Get backup timestamp No backup is known to the Admin DB. Make
entries failed (rc = sure that you performed a database backup
<VALUE>) when you activated database recovery.
LFA201 Check backup Wrong timestamp format or length. See the
timestamp is valid. output of the query for the correct format.
Use: -q backups –out
LFA202 Unable to extend file Cannot allocate memory to extend the file list.
list
LFA203 Add missing backups Check the reason.
failed
LFA240 Unexpected action. Internal error. Check the command line action
option.
LFA241 Unexpected device. Internal error. Check the command line device
option.

198 July 2006


LFA242 Unexpected log file Internal error. Contact SAP support.
status.
LFA243 Unexpected return Internal error. Contact SAP support.
code.
LFA244 Unexpected value. Internal error. Contact SAP support.
LFA245 Error creating Admin Internal error. Contact SAP support.
DB backup file.
LFA280 Error deleting <TYPE> Internal error. Contact SAP support.
DB entry (rc =
<VALUE>)
LFA281 Error retrieving Internal error. Contact SAP support.
<TYPE> DB entry (rc =
<VALUE>)
LFA282 Error updating <TYPE> Internal error. Contact SAP support.
DB entry (rc =
<VALUE>)
LFA283 Error creating <TYPE> Internal error. Contact SAP support.
DB entry (rc =
<VALUE>)
LFA284 New entry already in Internal error. Contact SAP support.
DB (rc = <VALUE>)
LFA285 Action <action> Try to interpret the error text. If the meaning is
failed with not clear to you, contact SAP support.
<error_text>
LFA286 SQL Error: <SQL error Try to interpret the error text. If the meaning is
text> not clear to you, contact SAP support.

brarchive and brrestore Library Error Messages

ID Message Comment
VND000 Environment Check the db2<dbsid> user environment. See
variable also accompanying system error message VND180.
<ENVIRONMENT
VARIABLE> is not
set.
VND001 Not enough disk Delete files or increase the size of the file system.
space in
<DIRECTORY>.
Available:
<VALUE> MB; Compressed file systems may calculate
needed: <VALUE> the amount of space available wrongly.
MB.
VND002 File size The original file size does not match the size of the
mismatch for file restored. If the problem persists, the file may be
<FILE>. <VALUE> damaged. You may be able to restore the file using
on disk and the emergency restore option -ex.
<VALUE> kB on
tape

July 2006 199


VND003 Unable to access See previous error messages.
list of files to
be processed.
VND004 Failed to save Store operation failed. If the problem persists, the
<FILE> (rc = media may be damaged. Note return code for SAP
<VALUE>)! Cannot support.
continue…
VND005 Failed to Restore operation failed. If the problem persists, the
retrieve <FILE> media may be damaged. Note the return code for
(rc = <VALUE>)! SAP support.
Cannot continue…
VND006 Failed to delete Delete operation failed. If the problem persists, the
<FILE> (rc = media may be damaged.
<VALUE>)! Cannot
continue…
VND008 Error writing Check the file and directory authorizations.
data to file
<FILE> (rc =
<VALUE>).
VND009 Error reading Check the file and directory authorizations.
data from file
<FILE> (rc =
<VALUE>).
VND010 Error closing System error. If the problem persists, contact SAP
file <VALUE> support.
just sent
to/retrieved.
VND011 Error opening Check the file and directory authorizations.
file <FILE> to
be sent
to/retrieved.
VND012 Query <Value> is Backend does not support the query. Check the
not supported by backend version.
back-end
library.
VND013 Command <Value> Backend does not support the command. Check the
is not supported backend version.
by back-end
library.
VND020 Volume size According to the tape device class tape entry -size
limit reached - in the DB2 Control Center, the tape must now be
no more log full. Check that this entry matches the real tape size.
files will be Complete the (restart) operation with a new tape.
processed.
VND021 If the log file A temporary lock file is still present. Verify that
management tool brarchive is not already running for the same
was terminated, node or using the same device(s).
delete file
<FILE>.

200 July 2006


VND022 Volume in device Tape needs initializing.
<DEVICE> has no
label.
VND023 Check the volume Check the tape or tape drive. See other messages.
or device.
VND024 Label on volume Tape needs initializing or may be damaged. In both
in device cases, see other messages.
<DEVICE> has the
wrong format.
VND025 Wrong volume Put the correct tape in the drive or specify the
<LABEL> in correct label on the command line.
device <DEVICE>,
should be:
<LABEL>
VND026 Volume in device If the tape should be written to, remove the write
<DEVICE> is protection.
write protected!
VND027 Volume label Check the tape and device. See other messages.
could not be
written to
<DEVICE>.
VND028 Tape has to be Initialize the tape.
initialized
prior to usage.
VND029 Character The tape device class tape entry -size in the DB2
'K','M','G' or Control Center is incorrect.
'T' should
directly follow
volume size.
VND030 Tape <Device A tape lock file is already present. Either
name> is already brarchive or brrestore is running elsewhere at
in use. If not, the same time (wait for program end) or a previous
delete the lock program call terminated unexpectedly (in this case
file or look for delete the lock file).
error (<file
name or error
message>).
VND031 SAP-SID on tape Tape is used by another SAP system. To overwrite
is <SAPSID>, data on tape, use the brarchive option -i
should be force.
<SAPSID>!
VND032 Wrong tape Check the command line parameters and the
number <#> in version of the backend.
device <Device
name>, should be
<#>
VND042 Error Check the TSM installation and configuration.
registering ADSM Check the accompanying messages for return
file space codes and TSM error messages. Contact Tivoli
'<FILE>' of Type support if necessary.
'<String>’.

July 2006 201


VND043 ADSM mgmt class Check the TSM installation and configuration. Look
bind (<STRING>) at the accompanying messages for return codes
failed! (FS- and TSM error messages. Contact Tivoli support if
name: <STRING> - necessary.
HL-name:
<STRING> - LL-
name: <FILE>)
VND044 Error starting Check the TSM installation and configuration. Look
ADSM at the accompanying messages for return codes
transaction. and TSM error messages. Contact Tivoli support if
necessary.
VND045 Error sending Check the TSM installation and configuration. Look
object to ADSM. at the accompanying messages for return codes
and TSM error messages. Contact Tivoli support if
necessary.
VND046 Error sending Check the TSM installation and configuration. Look
data to ADSM. at the accompanying messages for return codes
and TSM error messages. Contact Tivoli support if
necessary.
VND047 Error ending Check the TSM installation and configuration. Look
process for at the accompanying messages for return codes
sending object and TSM error messages. Contact Tivoli support if
to ADSM. necessary.
VND048 Error ending Check the TSM installation and configuration. Look
ADSM at the accompanying messages for return codes
transaction. and TSM error messages. Contact Tivoli support if
necessary.
VND049 Error starting Check the TSM installation and configuration. Look
ADSM <STRING> at the accompanying messages for return codes
query. and TSM error messages. Contact Tivoli support if
necessary.
VND050 Error ending Check the TSM installation and configuration. Look
ADSM <STRING> at the accompanying messages for return codes
query. and TSM error messages. Contact Tivoli support if
necessary.
VND051 ADSM objects No entries match the queries. See other messages.
query found no
match.
VND052 Error starting Check the TSM installation and configuration. Look
data transfer at the accompanying messages for return codes
from ADSM and TSM error messages. Contact Tivoli support if
'STRING' necessary.
repository.
VND053 Error getting Check the TSM installation and configuration. Look
object from ADSM at the accompanying messages for return codes
<STRING> and TSM error messages. Contact Tivoli support if
repository. necessary.

202 July 2006


VND054 Error during Check the TSM installation and configuration. Look
data transfer at the accompanying messages for return codes
from ADSM. and TSM error messages. Contact Tivoli support if
necessary.
VND055 Error concluding Check the TSM installation and configuration. Look
object transfer at the accompanying messages for return codes
from ADSM and TSM error messages. Contact Tivoli support if
<STRING> necessary.
repository.
VND056 Error concluding Check the TSM installation and configuration. Look
data transfer at the accompanying messages for return codes
from ADSM and TSM error messages. Contact Tivoli support if
<STRING> necessary.
repository.
VND059 ADSM reason TSM reason for an error
<No>: <String>
VND060 ADSM error <No>: TSM error number and description
<String>
VND061 Unable to load Check that TSM has been correctly installed.
ADSM API DLL.
VND062 Client's API brarchive executables and library do not match.
version is Check the Admin Tools installation.
higher than the
ADSM version
VND063 Client's ADSM brarchive executables and library do not match.
API structures Check the Admin Tools installation.
are
incompatible/hav
e changed
VND064 File <FILE> not No matching files in TSM. Use TSM tools to verify if
found in ADSM. files exist.
VND101 … failed Operation failed. Refer to other error messages.
VND102 Internal library Internal error. Refer to other error messages.
error.
VND111 Tape <DEVICE> Check the command line device name and DB2
should be a non- Control Center configuration values. For more
rewind address. information about non-rewind address examples,
see brrestore - Log File Retrieval Tool [Page 163].
VND149 Rewind of volume Check the tape and device.
in device
<DEVICE> failed.
VND150 Copying <FILE> See other error messages.
to/from
<LOCATION>
failed due to
previous errors.

July 2006 203


VND170 File <FILE> File already exists and will be overwritten.
already exists.
VND181 Restore of See other error messages.
<FILE> failed.
VND182 Space Delete files or increase the size of the file system.
information
about device
<DEVICE>.
Available: Compressed file systems may calculate
<VALUE> MB; the amount of space available wrongly.
Needed: <VALUE>
MB
VND186 <FILE> is not a Check if <FILE> is a directory; check if there is
directory. enough free space in the directory.
VND190 File <FILE> does Check the file.
not exist.

DB2 Control Center Extensions Troubleshooting


The following tables provide information about error messages from the DB2 Control Center
installation program on Windows:
Please change directory to <CDROM-drive>:\\NT\\I386\\ADMIN and start
again!

Cause The installation program was not started in the specified


directory.
Solution Switch to the specified directory and restart the installation.

DB2HOME not found

Cause DB2 client application enabler (CAE) is not installed or an


error occurred during Registry access.
Solution Install DB2 client application enabler (CAE). Check that you
can access the Registry and that there is a key
software\IBM\DB2\DB2 Folder Name under
HKEY_LOCAL_MACHINE.

Directory does not exist

Cause Directory <directory> does not exist.


Solution Check whether directory <directory> exists. If the
directory is missing, one of the software components might
not have been installed.

204 July 2006


Error executing car.exe

Cause Program car could not be executed.


Solution Contact SAP support.

Menu does not appear

Cause The DB2 administration tools were probably not installed


correctly.
Solution Check whether directory...\sqllib\bin contains file
sapdef.dll.

Logon dialog is not displayed

Cause The DB2 administration tools were probably not installed


correctly.
Solution Check whether directory...\sqllib\bin contains files
sapact.dll and sddb6wfm.dll.

Dialog is not displayed

Cause The DB2 administration tools were probably not installed


correctly.
Solution Check whether directory...\sqllib\bin contains files
sddb6wfm.dll, db6achpw.exe, db6atape.exe,
db6algfl.exe, db6algfl.exe, db6aopt and
db6ar3db.exe.

Since DB2 Control Center Extensions are an extension of the DB2 Control Center, a special
start script switches on tracing for the DB2 Control Center. To run the DB2 Control Center
with the DB2 Control Center Extensions trace switched on, start it with script
db2ccdebug.bat. A trace file called db6cc.log is created in your TEMP directory.

Collecting Diagnostic Information for SAP Support


While processing issues reported to SAP support, SAP support often needs data required for
further investigation. Many of the data requested by SAP support for DB2 UDB for UNIX and
Windows can be grouped together to form typical data sets.
To ease data collection, a tool is provided that is described in SAP Note 83819. At present,
the tool currently runs on UNIX systems only. To speed up processing of reported issues in
DB2 UDB for UNIX and Windows, the data collecting tool can be run when the issue is sent
to SAP. The data collected needs to be provided to SAP. When you create a problem
message, you should mention the file name and location.

July 2006 205


Appendix C: Implementation Details

This appendix is only intended as a reference for SAP support personnel to


assist with problem determination, or for customers directed by SAP support to
perform specific operations.
Customers may wish to read this information for a better understanding of the
tools and to inspect the system, but must not use this knowledge to change the
system without an explicit request from SAP support.

Admin DB Structure

Wrong use of this information may make the log file management tools fail or
make it impossible to recover log files required to fully restore a database
backup
The Admin DB (or ADM<DBSID> database) is the core component of SAP DB2
administration. It contains administration management data, configuration parameters, and
administration action protocols.
The most important tables in the Admin DB refer to log files and their locations. This
information is used in recovering archived files. On occasion, support personnel will ask
database administrators to extract information from this database to assist in problem
determination. Other tables record information such as tape volume management and Admin
Tools protocol data.
To understand the log file information in the Admin DB, it is essential that you understand the
file states described in Log File States [Page 37].
The Admin DB should require very little administrative attention. The database administrator
can decide whether to back up the database. However, this is not strictly necessary as
brarchive in archive mode also stores the essential parts of the database from which it can
be rebuilt.
Transaction logging is circular for the Admin DB, that is, LOGRETAIN and USEREXIT are set
to OFF. This has the advantage that the Admin DB should continue to function even when the
main SAP database is blocked by a file system containing log files that are becoming full.
The following graphic shows the Admin DB tables and their relationships.

206 July 2006


The following table describes the Admin DB tables shown in the graphic above, together with
their keys. To see the complete structure of each table, use the DB2 DESCRIBE command.

Admin DB Tables

Table Name Key Description


DB6IDENTIFIER OBJID Unique identifier. Relates each
object to a database node if
appropriate.
DB6CONFIG OBJID Contains Admin Tools
configuration parameters. These
(from DB6IDENTIFIER)
can normally only be set using the
DB2 Control Center.
DB6LOCATION LOCID Contains the locations of log files
and backups, plus tape
(OBJID in
information, for example, the TSM
DB6IDENTIFIER)
server name.
DB6BACKUP OBJID Contains imported backup
information from the database
(from DB6IDENTIFIER)
recovery history file.
DB6LOGFILE OBJID Contains information about log
files.
(from DB6IDENTIFIER)

The OBJID key is not


the log file number.
DB6LFSTATE OBJID Contains the location and state of
each log file.
(from DB6IDENTIFIER) +
LOCID (from
DB6LOCATION)

July 2006 207


DB6TAPE OBJID Contains tape volume information.
(from DB6IDENTIFIER)
DB6TAPETOC OBJID Contains the position of log files on
each tape (accelerates recovery).
(from DB6TAPE) + LFID
(OBJID in DB6LOGFILE)
DB6DEVCLASS Name Contains tape device classes and
related information, for example,
8mm, DLT
DB6DEVICE Name Contains physical tape devices
and related information, for
example, /dev/rmt0.
DB6ACTION Contain the tool protocols used by
DB2 Control Center Extensions.
DB6ACTIONDETAIL
These tables can become very
large.
DB6CACHE Contain temporary data used for
internal communication.
DB6MESSAGE

Additional Notes and Troubleshooting Information


• Schema
The Admin DB tables are created with schema SAPR3 (even with MCOD systems), so
all table references in SQL statements must be qualified with this value. For example,
to list all location information, enter the following SQL statement:
SELECT * from sapr3.db6location.
• Admin DB size
If the Admin DB is running out of space, this is usually due to the DB6ACTION and
especially the DB6ACTIONDETAIL tables. Make sure that the Admin Tools are up-to-
date. Only recent versions of brarchive prune these tables automatically.
Alternatively, if a tool is looping or being called repeatedly due to an error situation,
these tables will fill very quickly. This can be determined by studying the contents of
these tables.
• Log file information view DB6LOGFILE_PLACE
Log file numbers are stored in the integer column NAME in the DB6LOGFILE table.
This number is the number contained in the log file name, for example,
S0000456.LOG is log file number 456.
A convenient method of studying log file information is using the LOGFILE_PLACE
view. This view joins several tables and displays the information in a slightly more user-
friendly way. For example, enter the following SQL statement:
SELECT * from sapr3.db6logfile_place

208 July 2006


The output can be limited by specifying a value or range for the NAME column (which
contains the log file number). This view contains no node information.
In a multi-partitioned environment, if you require node-specific information, you must
join this view with the DB6IDENTIFIER table, where the OBJID columns have the same
value and NODE=’NODExxxx’ (replace xxxx with the node number).
• Recursive deletion
The relationships between tables DB6IDENTIFIER, DB6CONFIG, DB6LOCATION,
DB6BACKUP, DB6LOGFILE, DB6LFSTATE, DB6TAPE, and DB6TAPETOC are set
up with cascading deletes. In other words, if an object in DB6IDENTIFIER that relates
to a log file is deleted, all related rows will also automatically be deleted from the tables
DB6LOGFILE, DB6LFSTATE, and DB6TAPETOC.

Each tape has two object IDs – one related to the DB6LOCATION table and one
related to the DB6TAPE table. There is no direct relationship joining these two
objects.
• Backup data in table DB6BACKUP
The information in the DB6BACKUP table is extracted from the backup history file by
the User Exit. This information is used to associate log files with a backup. If no backup
is performed after the Admin Tools are installed, the User Exit will not be able to add
this association. If the User Exit has not yet been run before brarchive is called for
the first time, the backup information will be missing and brarchive also generates
an error.
For best User Exit performance, it is also important that the backup history file is not
too long. It may be necessary to prune the file occasionally.
• Configuration table DB6CONFIG
This table contains information to configure the Admin Tools. Normally it can only be
updated using the DB2 Control Center Extensions. You can also use SQL to update
the entries directly.
If an entry is corrupt or lost, this table can be reset to the default values. You can do
this by using SQL to delete all related entries from the DB6IDENTIFIER table.

Be very careful only to delete the OBJIDs found in the configuration table
DB6CONFIG and running sddb6ins -i.
• Mirroring in Admin Tools Release 4.6D
There is an extra executable in Admin Tools releases up to 4.6D called sddb6mir.
This is used to mirror (duplicate) informative Admin DB information to the SAP
database.

The mirror contains most of the tables that the Admin DB contains but these
tables have one column less. They all have no mirror flag column. Although this
should not be necessary, if you want to create the mirrored tables manually, do
not attempt to create these tables using exactly the same structure as in the
Admin DB.

July 2006 209


brarchive and brrestore backend Library Architecture
brarchive and brrestore were designed with an open interface to separate log file
management logic from the lower-level code responsible for archiving and restoring data. The
interface is described in the SAP system header file vnddb6lfm.h, which can be made
available to vendors intending to provide a library interfacing to their archiving product. The
separation of logic permits the log file management applications to retain full control over the
Admin DB, whose interface is not open. At the same time it permits storage product
manufacturers to provide backend libraries that implement low-level file storage to their
products, for example, Tivoli Data Protection.

brarchive Admin
brrestore
DB

LfmVndInterface

tape TSM script vendor


library library library library

customer
backend
Tape script
TSM

backend

210 July 2006


DB2 Control Center Extensions Architecture
The DB2 Control Center Extensions make use of an open DB2 interface to add functions to
the DB2 Control Center via additional menu options. These functions are implemented using
the following architecture:

The DB2 Control Center looks in directory sqllib/cc for a file called db2plug.zip. If this
file exists, it will be loaded. It comprises the SAP extensions for the DB2 Control Center. In
the context menu of any SAP DB2 instance or database, supplementary menu options will be
offered. If any of these options is chosen, the corresponding SAP extension window appears.
From this window, the user can perform several SAP DB2-specific administrative operations.
Since all these operations are done on the server, stored procedure sddb6jds is called
viJDBC. Sddb6jds calls the Admin Tools and manages the Admin DB ADM<DBSID>.

July 2006 211


Appendix D: Example of File
init<DBSID>.db6
File init<DBSID>.db6 on UNIX
The following is an example of an environment file under UNIX:
########################################################################
# #
# SAP DB2 Universal DB for Unix/Windows Environment File #
# #
# Enclose parameter values which consist of more than one symbol in #
# double quotes. #
# After any symbol, parameter definition can be continued on the next #
# line. #
# A parameter value list should be enclosed in parentheses, the list #
# items should be delimited by commas. #
# There can be any number of white spaces (blanks, tabs and new lines) #
# between symbols for parameter definition. #
# #
########################################################################

# db2<dbsid> home directory


#
# default: no default
INSTHOME = /db2/Y6D

# Log file archive directory


#
# default: /db2/<DBSID>/log_archive
DB2DB6_ARCHIVE_PATH = /db2/Y6D/log_archive

# Log file retrieve directory


#
# default: /db2/<DBSID>/log_retrieve
DB2DB6_RETRIEVE_PATH = /db2/Y6D/log_retrieve

# Temporary work directory


#
# default: /tmp
DB2DB6_TEMP_DIR = /tmp

# Standby directory
#
# default: no default
# DB2DB6_STANDBY_DIR =

# ignore errors on standby dir


#
# default: OFF
# DB2DB6_STANDBY_DIR_NOERR = ON

# if ON, brarchive copies Admin DB backup SAR file to STANDBY_DIR


#
# default: OFF
# DB2DB6_STANDBY_DIR_ADMDBSAR = ON

# Direct userexit archiving


#
# default: no default
DB2DB6_UEXIT_DIRECT = TSM:DEFAULT

# Vendor userexit archiving


#
# default: no default
# DB2DB6_VENDOR_UEXIT =

212 July 2006


# user exit archive without ADMDB
#
# default: OFF
DB2DB6_UEXIT_ARCHIVE_WO_DB = ON

# user exit retrieve without ADMDB


#
# default: OFF
# DB2DB6_UEXIT_RETRIEVE_WO_DB = ON

# deactivate signal handling for SIGSEGV and SIGBUS


#
# default: OFF
# DB2DB6_CORE = ON

# done eject tape (same as -one)


#
# default: OFF
# DB2DB6_NO_EJECT = ON

# Script name for -d script


#
# default: no default
DB2DB6_LIBDB6SC_SCRIPT =

# TSM multithread support is required, if TSM LANFREE option should be used


#
# default: OFF
# DB2DB6_TSM_MULTITHREADED = ON

# TSM shared library


#
# default: libApiTSM64.a(dsmapish_64.o)
# DB2DB6_TSM_SLIB = libApiTSM64.a(dsmapish_64.o)

# Admin DB reorg frequency in days


#
# default: 7
# DB2DB6_ADMDB_REORG_FREQUENCY = 7

# Disconnect from TSM after this time in seconds of no response. A value of zero turns
off this timeout mechanism.
#
# default: 0
# DB2DB6_TSM_TIMEOUT = 0

# Userexit Trace
# DB2DB6_TRC_DB2UEXT2 = ON
DB2DB6_TRC_DB2UEXT2_LEVEL = 3
DB2DB6_TRC_DB2UEXT2_PATH = /db2/Y6D/db2dump

# Brarchive Trace
# DB2DB6_TRC_BRARCHIVE = ON
DB2DB6_TRC_BRARCHIVE_LEVEL = 3
DB2DB6_TRC_BRARCHIVE_PATH = /db2/Y6D/db2dump

# Brrestore Trace
# DB2DB6_TRC_BRRESTORE = ON
DB2DB6_TRC_BRRESTORE_LEVEL = 3
DB2DB6_TRC_BRRESTORE_PATH = /db2/Y6D/db2dump

# Stored Procedure Trace


# DB2DB6_TRC_SDDB6JDS = ON
DB2DB6_TRC_SDDB6JDS_LEVEL = 3
DB2DB6_TRC_SDDB6JDS_PATH = /db2/Y6D/db2dump

# TSM Util Trace


# DB2DB6_TRC_DB6ADUTL = ON
DB2DB6_TRC_DB6ADUTL_LEVEL = 3
DB2DB6_TRC_DB6ADUTL_PATH = /db2/Y6D/db2dump

July 2006 213


# Backup/Restore tool Trace
# DB2DB6_TRC_BRDB6BRT = ON
DB2DB6_TRC_BRDB6BRT_LEVEL = 3
DB2DB6_TRC_BRDB6BRT_PATH = /db2/Y6D/db2dump

# DB6CLP Trace
# DB2DB6_TRC_DB6CLP = ON
DB2DB6_TRC_DB6CLP_LEVEL = 3
DB2DB6_TRC_DB6CLP_PATH = /db2/Y6D/db2dump

# Data Collector Trace


DB2DB6_TRC_DMDB6RDI = ON
DB2DB6_TRC_DMDB6RDI_LEVEL = 9
DB2DB6_TRC_DMDB6RDI_PATH = /tmp

# Runstats Tool Trace


DB2DB6_TRC_DMDB6SRP = ON
DB2DB6_TRC_DMDB6SRP_LEVEL = 3
DB2DB6_TRC_DMDB6SRP_PATH = /tmp

# Reorg Tablespace Tool Trace


# DB2DB6_TRC_DMDB6RTS = ON
DB2DB6_TRC_DMDB6RTS_LEVEL = 3
DB2DB6_TRC_DMDB6RTS_PATH = /db2/Y6D/db2dump

# Backup DB Tool Trace


# DB2DB6_TRC_DMDB6BKP = ON
DB2DB6_TRC_DMDB6BKP_LEVEL = 3
DB2DB6_TRC_DMDB6BKP_PATH = /db2/Y6D/db2dump

# History Utility
# DB2DB6_TRC_SDDB6HIS = ON
DB2DB6_TRC_SDDB6HIS_LEVEL = 3
DB2DB6_TRC_SDDB6HIS_PATH = /db2/Y6D/db2dump

# Mirror Utility
# DB2DB6_TRC_SDDB6MIR = ON
DB2DB6_TRC_SDDB6MIR_LEVEL = 3
DB2DB6_TRC_SDDB6MIR_PATH = /db2/Y6D/db2dump

# backup retries
#
# default: 10
# DB2DB6_DMDB6BKP_RETRIES = 10

# backup block size for tapes


#
# default: 1024
# DB2DB6_DMDB6BKP_BLOCK_SIZE = 1024

# backup util impact priority


#
# default: 0
# DB2DB6_DMDB6BKP_UTIL_IMPACT_PRIORITY = 0

# enable backup compression


#
# default: OFF
# DB2DB6_DMDB6BKP_COMPRESS = OFF

# online backup including logs


#
# default: OFF
# DB2DB6_DMDB6BKP_INCLUDE_LOGS = OFF

# Update threshold in percent to flag tables for RUNSTATS


#
# default: 15
# DB2DB6_DMDB6SRP_UPDATE_THRESHOLD = 15

214 July 2006


# Minimum table size in rows to flag tables for RUNSTATS
#
# default: 1000
# DB2DB6_DMDB6SRP_TABLESIZE_THRESHOLD = 1000

# backup block size for tapes


#
# default: no default
# DB2DB6_DB2DB6_BLOCK_SIZE = 1024

# Percentage of rows read for table size calculation for long and lob columns
#
# default: 10
# DB2DB6_DB6SRPRTS_PCT_LONG_LOB = 10

# Number of days to refresh CCMS archive log information


#
# default: 14
# DB2DB6_DMDB6RDI_REFRESH_LOG_INFO = 14

########################################################################
# End of Environment File #
########################################################################File

July 2006 215


init<DBSID>.db6 on Windows
The following is an example of an environment file on Windows:
########################################################################
# #
# SAP DB2 Universal DB for Unix/Windows Environment File #
# #
# Enclose parameter values which consist of more than one symbol in #
# double quotes. #
# After any symbol, parameter definition can be continued on the next #
# line. #
# A parameter value list should be enclosed in parentheses, the list #
# items should be delimited by commas. #
# There can be any number of white spaces (blanks, tabs and new lines) #
# between symbols for parameter definition. #
# #
########################################################################

# db2<dbsid> home directory


#
# default: no default
INSTHOME = c:\db2n4d

# Log file archive directory


#
# default: <drive>:\db2\<DBSID>\log_archive
DB2DB6_ARCHIVE_PATH = c:\db2\N4D\log_archive

# Log file retrieve directory


#
# default: <drive>:\db2\<DBSID>\log_retrieve
DB2DB6_RETRIEVE_PATH = c:\db2\N4D\log_retrieve

# Temporary work directory


#
# default: C:\WINNT\TEMP\1
DB2DB6_TEMP_DIR = C:\WINNT\TEMP

# Standby directory
#
# default: no default
# DB2DB6_STANDBY_DIR =

# ignore errors on standby dir


#
# default: OFF
# DB2DB6_STANDBY_DIR_NOERR = ON

# if ON, brarchive copies Admin DB backup SAR file to STANDBY_DIR


#
# default: OFF
# DB2DB6_STANDBY_DIR_ADMDBSAR = ON

# Direct userexit archiving


#
# default: no default
DB2DB6_UEXIT_DIRECT = TSM:DEFAULT

# Vendor userexit archiving


#
# default: no default
# DB2DB6_VENDOR_UEXIT =

# user exit archive without ADMDB


#
# default: OFF
DB2DB6_UEXIT_ARCHIVE_WO_DB = ON

# user exit retrieve without ADMDB


#

216 July 2006


# default: OFF
# DB2DB6_UEXIT_RETRIEVE_WO_DB = ON

# deactivate signal handling for SIGSEGV and SIGBUS


#
# default: OFF
# DB2DB6_CORE = ON

# done eject tape (same as -one)


#
# default: OFF
# DB2DB6_NO_EJECT = ON

# Script name for -d script


#
# default: no default
# DB2DB6_LIBDB6SC_SCRIPT =

# TSM multithread support is required, if TSM LANFREE option should be used


#
# default: OFF
# DB2DB6_TSM_MULTITHREADED = ON

# TSM shared library


#
# default: adsmv3.dll
# DB2DB6_TSM_SLIB = adsmv3.dll

# Admin DB reorg frequency in days


#
# default: 7
# DB2DB6_ADMDB_REORG_FREQUENCY = 7

# Userexit Trace
# DB2DB6_TRC_DB2UEXT2 = ON
DB2DB6_TRC_DB2UEXT2_LEVEL = 3
DB2DB6_TRC_DB2UEXT2_PATH = c:\db2\N4D\db2dump

# Brarchive Trace
# DB2DB6_TRC_BRARCHIVE = ON
DB2DB6_TRC_BRARCHIVE_LEVEL = 3
DB2DB6_TRC_BRARCHIVE_PATH = c:\db2\N4D\db2dump

# Brrestore Trace
# DB2DB6_TRC_BRRESTORE = ON
DB2DB6_TRC_BRRESTORE_LEVEL = 3
DB2DB6_TRC_BRRESTORE_PATH = c:\db2\N4D\db2dump

# Stored Procedure Trace


# DB2DB6_TRC_SDDB6JDS = ON
DB2DB6_TRC_SDDB6JDS_LEVEL = 3
DB2DB6_TRC_SDDB6JDS_PATH = c:\db2\N4D\db2dump

# TSM Util Trace


# DB2DB6_TRC_DB6ADUTL = ON
DB2DB6_TRC_DB6ADUTL_LEVEL = 3
DB2DB6_TRC_DB6ADUTL_PATH = c:\db2\N4D\db2dump

# Backup/Restore tool Trace


# DB2DB6_TRC_BRDB6BRT = ON
DB2DB6_TRC_BRDB6BRT_LEVEL = 3
DB2DB6_TRC_BRDB6BRT_PATH = c:\db2\N4D\db2dump

# DB6CLP Trace
# DB2DB6_TRC_DB6CLP = ON
DB2DB6_TRC_DB6CLP_LEVEL = 3
DB2DB6_TRC_DB6CLP_PATH = c:\db2\N4D\db2dump

# Data Collector Trace


# DB2DB6_TRC_DMDB6RDI = ON
DB2DB6_TRC_DMDB6RDI_LEVEL = 3
DB2DB6_TRC_DMDB6RDI_PATH = c:\db2\N4D\db2dump

July 2006 217


# Runstats Tool Trace
# DB2DB6_TRC_DMDB6SRP = ON
DB2DB6_TRC_DMDB6SRP_LEVEL = 3
DB2DB6_TRC_DMDB6SRP_PATH = c:\db2\N4D\db2dump

# Reorg Tablespace Tool Trace


# DB2DB6_TRC_DMDB6RTS = ON
DB2DB6_TRC_DMDB6RTS_LEVEL = 3
DB2DB6_TRC_DMDB6RTS_PATH = c:\db2\N4D\db2dump

# Backup DB Tool Trace


# DB2DB6_TRC_DMDB6BKP = ON
DB2DB6_TRC_DMDB6BKP_LEVEL = 3
DB2DB6_TRC_DMDB6BKP_PATH = c:\db2\N4D\db2dump

# History Utility
# DB2DB6_TRC_SDDB6HIS = ON
DB2DB6_TRC_SDDB6HIS_LEVEL = 3
DB2DB6_TRC_SDDB6HIS_PATH = c:\db2\N4D\db2dump

# Mirror Utility
# DB2DB6_TRC_SDDB6MIR = ON
DB2DB6_TRC_SDDB6MIR_LEVEL = 3
DB2DB6_TRC_SDDB6MIR_PATH = c:\db2\N4D\db2dump

# backup retries
#
# default: 10
# DB2DB6_DMDB6BKP_RETRIES = 10

# tape pattern
#
# default: \\
# DB2DB6_DMDB6BKP_TAPE_PATTERN = \\

# backup block size for tapes


#
# default: 1024
# DB2DB6_DMDB6BKP_BLOCK_SIZE = 1024

# backup util impact priority


#
# default: 0
# DB2DB6_DMDB6BKP_UTIL_IMPACT_PRIORITY = 0

# enable backup compression


#
# default: OFF
# DB2DB6_DMDB6BKP_COMPRESS = OFF

# online backup including logs


#
# default: OFF
# DB2DB6_DMDB6BKP_INCLUDE_LOGS = OFF

# Update threshold in percent to flag tables for RUNSTATS


#
# default: 15
# DB2DB6_DMDB6SRP_UPDATE_THRESHOLD = 15

# Minimum table size in rows to flag tables for RUNSTATS


#
# default: 1000
# DB2DB6_DMDB6SRP_TABLESIZE_THRESHOLD = 1000

# backup block size for tapes


#
# default: no default
# DB2DB6_DB2DB6_BLOCK_SIZE = 1024

218 July 2006


# Percentage of rows read for table size calculation for long and lob columns
#
# default: 10
# DB2DB6_DB6SRPRTS_PCT_LONG_LOB = 10

# Number of days to refresh CCMS archive log information


#
# default: 14
# DB2DB6_DMDB6RDI_REFRESH_LOG_INFO = 14

########################################################################
# End of Environment File #
########################################################################

July 2006 219


220 July 2006
Appendix E: Example of Customer Script
db6sctsm.smp
#!/bin/sh
#*********************************************************************
# *
# SAP AG Walldorf / Germany *
# Systeme, Anwendungen und Produkte in der Datenverarbeitung *
# *
# (C) Copyright SAP AG *
# *
# *
# db6sctsm.smp *
# *
# *
# Sample script to be used with brarchive/brrestore -d script. *
# *
# This sample script uses TSM (dsmc) to handle the log files. *
# Instead of dsmc you can use your own commands. Also you can *
# use os commands like cp, tar, ... . *
# *
# Attention: It is important to return LFMVND_RC_ERROR if the *
# archive, retrieve or delete command failes! *
# *
# Arguments: *
# action *
# directory *
# filename *
# *
# Returncodes *
# LFMVND_STATUS_OK *
# LFMVND_RC_ERROR *
# LFMVND_COMMAND_NOT_SUPPORTED *
# *
#*********************************************************************
#*********************************************************************
# ReturnCodes
#
LFMVND_STATUS_OK=0
LFMVND_RC_ERROR=64
LFMVND_COMMAND_NOT_SUPPORTED=71
#*********************************************************************
# Variables
#
res=$LFMVND_RC_ERROR
outfile=/tmp/dsmc$$.out
LANG=C
export LANG
#*********************************************************************
# Arguments
#
action=$1
directory=$2
file=$3
#*********************************************************************
# Messages
#
echo "action =$action"
echo "directory=$directory"
echo "file =$file"
#*********************************************************************
# Configuration section
#
mgmtclass=DEFAULT
INIFILE=$INSTHOME/admintools/init$DB2DBDFT.db6
if [ ! -f $INIFILE ]
then
INIFILE=/usr/sap/$SAPSYSTEMNAME/SYS/global/init$DB2DBDFT.db6
fi

July 2006 221


#*********************************************************************
# Path to put the retrieved logfile
#
arch_path=`grep DB2DB6_ARCHIVE_PATH $INIFILE | cut -f 2 -d =`/$DB2DBDFT/
case "$action" in
#*********************************************************************
# This section puts the logfile to the archive
#
"ARCHIVE")
$DSM_DIR/dsmc archive -archmc=$mgmtclass -description='Log file' -compressa=yes
$directory/$file | tee $outfile
G=`grep 'Archive processing of.*finished without failure' $outfile`
if [ "$G" = "" ]
then
res=$LFMVND_RC_ERROR
fi
;;
#*********************************************************************
# This section retrieves the logfile from the archive
#
"RETRIEVE")
$DSM_DIR/dsmc retrieve -replace=yes $arch_path/$file $directory/$file | tee
$outfile
G=`grep 'Retrieving.*\[Done\]' $outfile`
if [ "$G" = "" ]
then
res=$LFMVND_RC_ERROR
fi
;;
#*********************************************************************
# This section delete the logfile in the archive
#
"DELETE")
$DSM_DIR/dsmc delete archive -noprompt $arch_path/$file | tee $outfile
G=`grep 'Archive Delete.*\[Sent\]' $outfile`
if [ "$G" = "" ]
then
res=$LFMVND_RC_ERROR
fi
;;
#*********************************************************************
#
*)
echo "ERROR: action $action not supported"
res=$LFMVND_COMMAND_NOT_SUPPORTED
;;
esac
echo "rc =$res"
rm -f $outfile
exit $res

222 July 2006


Appendix F: References

DB2 UDB for UNIX and Windows V7 - Additional


Documentation
The following table divides the DB2 books into two categories:
• DB2 guide and reference information
These books contain the common DB2 information for all platforms.
• DB2 installation and configuration information
These books are for DB2 on a specific platform, for example, there are separate Quick
Beginnings books for DB2 on platforms based on Windows and UNIX.
All manuals listed in the following table are available at www.software.ibm.com/db2.

Name Description
Administration Guide Administration Guide: Planning provides an overview of
database concepts, information about design issues (such as
logical and physical database design), and information about
high availability.
Administration Guide: Implementation provides information
about implementation issues such as implementing your
design, accessing databases, auditing, backup and recovery.
Administration Guide: Performance provides information
about database environment and application performance
evaluation and tuning.
Administrative API Describes the DB2 application programming interfaces
Reference (APIs) and data structures that you can use to manage your
databases. This book also explains how to call APIs from
your applications.
Application Building Guide Provides environment setup information and step-by-step
instructions about how to compile, link, and run DB2
applications on Windows, OS/2, and UNIX platforms.
Application Development Explains how to develop applications that access DB2
Guide databases using embedded SQL or Java (JDBC and SQLJ).
Discussion topics include writing stored procedures, writing
user-defined functions, creating user-defined types, using
triggers, and developing applications in partitioned
environments or with federated systems.
CLI Guide and Reference Explains how to develop applications that access DB2
databases using the DB2 Call Level Interface, a callable SQL
interface that is compatible with the Microsoft ODBC
specification.

July 2006 223


Command Reference Explains how to use the command line processor and
describes the DB2 commands that you can use to manage
your database.
Data Movement Utilities Explains how to use DB2 utilities, such as import, export,
Guide and Reference load, AutoLoader, and DPROP, that facilitate the
movement of data.
Message Reference Lists messages and codes issued by DB2, the Information
Catalog Manager, and the Data Warehouse Center, and
describes the actions you should take.
SQL Getting Started Introduces SQL concepts and provides examples for many
constructs and tasks.
SQL Reference, Volume 1 Describes SQL syntax, semantics, and the rules of the
and Volume 2 language. This book also includes information about release-
to-release incompatibilities, product limits, and catalog views.
System Monitor Guide Describes how to collect different kinds of information about
and Reference databases and the database manager. This book explains
how to use the information to understand database activity,
improve performance, and determine the cause of problems.
Troubleshooting Guide Helps you determine the source of errors, recover from
problems, and use diagnostic tools in consultation with DB2
Customer Service.
What’s New Describes the new features, functions, and enhancements in
DB2 UDB for UNIX and Windows Version 7.
DB2 Enterprise – Provides planning, installation, and configuration information
Extended Edition for UNIX for DB2 Enterprise - Extended Edition on UNIX platforms.
Quick Beginnings This book also contains installation and setup information for
many supported clients.
DB2 Enterprise – Provides planning, installation, and configuration information
Extended Edition for for DB2 Enterprise - Extended Edition for Windows 32-bit
Windows Quick operating systems. This book also contains installation and
Beginnings setup information for many supported clients.
DB2 for UNIX Quick Provides planning, installation, migration, and configuration
Beginnings information for DB2 Universal Database on UNIX platforms.
This book also contains installation and setup information for
many supported clients.
DB2 for Windows Quick Provides planning, installation, migration, and configuration
Beginnings information for DB2 Universal Database on Windows 32-bit
operating systems. This book also contains installation and
setup information for many supported clients.

224 July 2006


DB2 UDB for UNIX and Windows V8 - Additional
Documentation
All manuals listed in the following table are available at software.ibm.com/db2.

Name Description
Administration Guide Administration Guide: Planning provides an overview of
database concepts, information about design issues (such as
logical and physical database design), and information about
high availability.
Administration Guide: Implementation provides information
about implementation issues such as implementing your
design, accessing databases, auditing, backup and recovery.
Administration Guide: Performance provides information about
database environment and application performance evaluation
and tuning.
Administrative API Describes the DB2 application programming interfaces (APIs)
Reference and data structures that you can use to manage your
databases. This book also explains how to call APIs from your
applications.
Application Development Provides environment setup information and step-by-step
Guide: Building and instructions about how to compile, link, and run DB2
Running Applications applications on Windows, OS/2, and UNIX platforms.
Application Development Explains how to develop applications that access DB2
Guide, Programming databases using embedded SQL or Java (JDBC and SQLJ).
Client Applications and Discussion topics include writing stored procedure, writing
Programming Server user-defined functions, creating user-defined types, using
Applications triggers, and developing applications in partitioned
environments or with federated systems.
CLI Guide and Explains how to develop applications that access DB2
Reference Volume 1 and databases using the DB2 Call Level Interface, a callable SQL
Volume 2 interface that is compatible with the Microsoft ODBC
specification.
Command Reference Explains how to use the command line processor and
describes the DB2 commands that you can use to manage
your database.
Data Movement Utilities Explains how to use DB2 utilities, such as import, export,
Guide and Reference load, AutoLoader, and DPROP, that facilitate the movement
of data.
Message Reference Lists messages and codes issued by DB2, the Information
Catalog Manager, and the Data Warehouse Center, and
describes the actions you should take.

July 2006 225


SQL Getting Started Introduces SQL concepts and provides examples for many
constructs and tasks.
SQL Reference, Volume Describes SQL syntax, semantics, and the rules of the
1 and Volume 2 language. This book also includes information about release-
to-release incompatibilities, product limits, and catalog views.
System Monitor Guide Describes how to collect different kinds of information about
and Reference databases and the database manager. This book explains
how to use the information to understand database activity,
improve performance, and determine the cause of problems.
What’s New Describes the new features, functions, and enhancements in
DB2 UDB for UNIX and Windows Version 8.
Quick Beginnings for Provides planning, installation, migration, and configuration
DB2 Servers information for DB2 Universal Database servers.
Quick Beginnings for Provides planning, installation, migration, and configuration
DB2 Clients information for DB2 Universal Database client.

226 July 2006


Glossary and Index
This glossary defines terms used in this documentation or terms often used by support
personnel in connection with the Admin Tools. If appropriate, it also includes links to other
parts of this documentation, which describe the term in more detail.

If you are unable to find an appropriate link for a topic in this documentation,
refer to the table of contents or the DB2 documentation.

Term Description
<DBSID> and <dbsid> Refer to “<SAPSID> and <sapsid>” in this table.
(SAP database name)
<SAPSID> and <sapsid> With the introduction of MCOD systems, it is necessary to
(SAP system ID) differentiate between SAP system IDs and SAP database
names. The changes are as follows:
• The former SAP system ID <SID> or <sid> changes
to <SAPSID> or <sapsid>.
• The former SAP database name <SID> or <sid>
changes to <DBSID> or <dbsid>.

The IDs and the SAP database names are


case-sensitive. Make sure that you observe
lower and upper case!
Additionally, user IDs (db2<dbsid>, <sapsid>adm,
sapr3, sap<sapsid>) and directory names are
affected. They are explained in more detail in Admin
Tools: Enhancements and Changes [Page 13].
The new terms are valid for SAP systems with Release
4.6D and higher.
Admin Database Refers to the database associated with the log file
management tools.
Admin DB
The Admin DB has the name ADM<DBSID>. This is
separate from the SAP system database <DBSID> but
part of the same database manager instance
db2<dbsid>.
Admin Tools Refers to the SAP DB2 administration tools described in
this documentation.

ADSM The IBM storage product ADSM has been renamed to TSM
(Tivoli Storage Manager). For more information, see
Naming Conventions [Page 12].
archiving Refers to the movement or copying of a file to other longer-
term storage, with the assumption that the file is less likely
archival
to be lost there in case of system failure.
See the term User Exit for an example. Not to be confused

July 2006 227


with backup. The opposite of retrieving.
archive directory Refers to the directory where brarchive stores log files,
usually /db2/<DBSID>/log_archive. It is defined in the
ini file as DB2DB6_ARCHIVE_PATH.
backend Refers to the target used to archive files to, such as tape,
TSM or a vendor product
backup Refers to the action of storing the database in a form,
which will allow it to be recovered (restored) later.
DB2 Control Center DB2 product offering a graphical interface used to
administer databases. Offers extra functions when used
with the SAP DB2 Control Center Extensions.
DB2 Control Center Refer to SAP DB2 Control Center Extensions.
Extensions
DB2 Database Manager Refers to the DB2 software controlling a database instance
and its databases.
ESE Product name and refers to IBM DB2 UDB Enterprise
Server Edition. For more information, see Naming
Conventions [Page 12].
ini file File init<DBSID>.db6 contains environment variables
used by the Admin Tools for tasks such as turning on
init<DBSID>.db6
tracing. For more information, see Actions Performed by
the sddb6ins Program [Page 53] and Appendix D: Example
of File init<dbsid>db6 [Page 212].
log directory Refers to the directory where DB2 stores log files, usually
/db2/<DBSID>/log_dir/NODExxxx. This is a DB
parameter (db cfg) defined as “Path to log files”.
log file Refers to a file generated by DB2 to keep track of changes
made to the database, for recovery purposes.
log file management tools The term log file management tools refers to components
of the Admin Tools that perform log file management
tasks:
• brarchive
• brrestore
• db2uext2 (User Exit)
• db6adutl
• libdb6ds (brarchive/brrestore library)
• libdb6tp (brarchive/brrestore library)
• libdb6sc (brarchive/brrestore library)
• sddb6mir (4.6D Admin Tools only)
mirror Has two meanings depending on the context:
• A copy of the Admin DB tables mirrored in the SAP
database
• A copy of the entire SAP database, often on a

228 July 2006


neighboring machine
Multiple Components in Multiple Components in One Database is referred to as
One Database (MCOD) MCOD.
This means that you can install an additional SAP system
into an existing database. The Admin Tools have been
modified to support this SAP system feature. For more
information, see Admin Tools: Enhancements and
Changes [Page 13].
For more information about released platforms and
availability, see SAP Service Marketplace at
www.service.sap.com/platforms and choose
Multiple Components in One Database (MCOD).
password file Refers to file dscdb6.conf containing encrypted
passwords. Contents are set using the dscdb6up utility.
For more information, see Setting and Updating Passwords
[Page 116].
protocol file Refers to a file generated by an application, such as one of
the Admin Tools, which indicates what the tool has done
and contains any results or errors.
restore Refers to the action of restoring the database from a
backup. This may be done after a system failure or in order
to generate a database copy. This will often require a
database roll-forward afterwards.
retrieving Refers to the movement or copying of a file back to disk
from longer-term storage. This is normally only necessary
retrieval
after a system failure. See the term User Exit for an
example. Not to be confused with restore, which is the
opposite of archiving.
retrieve directory Refers to the directory where brrestore stores log files,
usually /db2/<DBSID>/log_retrieve. It is defined in
the ini file as DB2DB6_RETRIEVE_PATH.
roll-forward Refers to the extraction of database transaction data from
log files. This information is added to a database after a
restore operation in order to bring it up to date. Refer to the
DB2 documentation in Appendix F: References [Page 223].
SAP DB2 Control Center Product installed together with the Admin Tools, which
Extensions extends the functionality of the DB2 Control Center to
perform SAP-specific database administration tasks. For
more information, see Installation and Setup of the DB2
Control Center Extensions [Page 60].
TSM The IBM storage product ADSM has been renamed to TSM
(Tivoli Storage Manager). For more information, see
Naming Conventions [Page 12].
User Exit Executable db2uext2. Used directly by DB2 to archive log
files out of the log directory to either the archive directory,
or directly to TSM. Also used by DB2 to retrieve log files in
order to perform roll-forward operations after a database
restore operation. For more information, see SAP Log File
Management [Page 28].

July 2006 229


230 July 2006

Das könnte Ihnen auch gefallen