没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
A Practical Guide to Backup and Recovery of
IBM DB2 for Linux, UNIX and Windows in SAP
Environments
Part 1 – Backup and Recovery – Overview
Version 1.4
IBM SAP DB2
Center of Excellence
Revision date:
20.08.2009
Authors: Olaf Depper
Edgardo G. Koenig
Hans-Jürgen Moldowan
Thomas Rech
DB2 for Linux, UNIX and Windows Backup and Recovery – Introduction
2
About this paper
The database is the foundation of the SAP
®
system. All relevant business data and also the
application code that is executed by the SAP application server are stored in the database. It is critical
to have an effective and secure strategy for database backups and recovery planned, implemented
and tested. Therefore a detailed understanding of the backup and recovery procedures for the
database of the SAP system is required.
The following document is part one out of a series of documents that will cover the essential topics
around backup and recovery for IBM
®
DB2
®
for Linux
®
, UNIX
®
, and Windows
®
(DB2 for Linux, UNIX
and Windows) together with SAP Applications based on SAP NetWeaver
®
.
To manage the balancing act between quick start and advanced topics, the series of papers is
planned to describe with the following dedicated topics:
• Backup and recovery overview (this paper)
• Backup integration with vendor solutions
• Backup tuning and optimizations
• Backup best practices
• Backup and recovery in partitioned environments (DB2 Database Partitioning Feature)
It is planned to publish the documents sequentially. For updates and new editions of these documents,
check the appropriate information sources, for example, IBM developerWorks
®
or SAP Developer
Network.
The following paper introduces the basics of backup and recovery for DB2 database. It explains the
architecture for backup and recovery, the most relevant commands and discusses the DB2 log file
management. In addition, the integration of the DB2 backup and recovery architecture into SAP
NetWeaver™ is described.
The document is designed as an introduction. It is intended to provide a fast start for the development
and implementation of a reliable backup and recovery strategy.
DB2 for Linux, UNIX and Windows Backup and Recovery – Introduction
3
Table of Contents
1 BACKUP AND RECOVERY – OVERVIEW..................................................................................4
1.1 Database Objects .................................................................................................................4
1.2 Logging with DB2 databases.................................................................................................5
1.3 Backup Architecture..............................................................................................................8
1.4 Integration of the DB2 Backup Utility in SAP Environments .................................................12
2 LOG FILE MANAGEMENT – DETAILS .....................................................................................13
2.1 Basic Log File Management Concepts ................................................................................13
2.2 Archiving of Log Files..........................................................................................................14
2.3 Log File Chaining ................................................................................................................16
3 BACKUP AND RECOVERY – DETAILS....................................................................................17
3.1 BACKUP DATABASE .........................................................................................................17
3.2 RESTORE DATABASE.......................................................................................................20
3.3 Redirected Restore .............................................................................................................22
3.4 ROLLFORWARD DATABASE.............................................................................................23
3.5 RECOVER DATABASE ......................................................................................................24
4 ADDITIONAL COMMANDS AND UTILITIES .............................................................................25
4.1 DB2CFEXP / DB2CFIMP ....................................................................................................25
4.2 ARCHIVE LOG ...................................................................................................................25
4.3 LIST HISTORY ...................................................................................................................26
4.4 LIST UTILITIES...................................................................................................................27
4.5 GET SNAPSHOT................................................................................................................28
4.6 db2pd .................................................................................................................................29
4.7 LIST APPLICATIONS / FORCE APPLICATION...................................................................31
5 DB2 AND SAP INTEGRATION..................................................................................................32
5.1 Configuration of Backup and Logging..................................................................................32
5.2 Performing Backups............................................................................................................33
5.3 Monitor Backup History .......................................................................................................36
DB2 for Linux, UNIX and Windows Backup and Recovery – Introduction
4
1 Backup and Recovery – Overview
The following chapter highlights some of the architectural components with respect to the backup and
recovery architecture. It explains the DB2 objects relevant for backups and the different methods of
backup, for example, offline backup or online backup. The chapter describes the DB2 backup
architecture and the DB2 logging. This information is aimed to enable you to develop and implement a
DB2 backup and recovery strategy.
1.1 Database Objects
DB2 databases are created in DB2 instances on the database server. A DB2 instance is also called
“database manager” as it provides the environment to host one or more databases. On one physical
server, multiple DB2 instances can be created. In an SAP environment each instance holds only one
database. While the database name or alias is determined by the SAP system ID (<SAPSID>) itself,
the DB2 instance is called db2<dbsid>.
Each database has multiple table spaces and a dedicated set of log files. You can mirror DB2 online
log files using database means. Each table space consists of one or more containers. Containers can
be directories, files or raw devices. The table space containers hold the database objects like tables
and indexes. Table spaces are a logical element with the table space containers as the physical
representation on disk. In a typical DB2 installation, the majority of the disk space is used by the table
space containers and log files. The DB2 instance and the database representation itself consist mainly
of configuration and administrative files in the respective directories.
The instance directory contains, for example, the database manager configuration files, the system
database directory, the node directory and the instance registry. It also holds the links to the installed
database software as well as some executables that are local to the instance.
The database directory contains the critical configuration files of the database. These files define, for
example, the buffer pools, table spaces, or the configuration of the database. The database directory
is also the location for the log file header as well as the history file.
In addition to the instance and database configuration, the DB2 system has a profile registry. Settings
in the DB2 profile registry can affect the instance (for example, parameters that are related to
communication) or the database (for example, parameters that are related to the behavior of the SQL
optimizer). In an SAP environment, one of these DB2 registry variables is ‘DB2_WORKLOAD’ which in
our case has the value ‘SAP’. Most of the parameters are set in the instance profile registry that is
stored in the instance directory. Some entries, however, are set for the database server. These
registry settings are set in the global registry which is stored in the file ‘/var/db2/global.reg’ in Linux,
UNIX environments. In Windows environments, the DB2 profile registry is stored in the Windows
registry (in the hive with key: HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\GLOBAL_PROFILE).
The following Figure 1-1 shows the simplified relationship between the different objects discussed.
DB2 for Linux, UNIX and Windows Backup and Recovery – Introduction
5
Database Manager
db2<dbsid>
Database
<DBSID>
Online Log Files
Table Spaces
Container
Instance Directory:
/db2/db2<dbsid>/sqllib
Database Directory:
/db2/<DBSID>/db2<dbsid>
Log Directory:
/db2/<DBSID>/log_dir
Storage Paths:
/db2/<DBSID>/sapdata<n>
Database Manager
db2<dbsid>
Database
<DBSID>
Online Log Files
Table Spaces
Container
Instance Directory:
/db2/db2<dbsid>/sqllib
Database Directory:
/db2/<DBSID>/db2<dbsid>
Log Directory:
/db2/<DBSID>/log_dir
Storage Paths:
/db2/<DBSID>/sapdata<n>
Figure 1-1: Database Objects
In addition to the already mentioned objects, the DB2 database system has further level of logical
objects or group of objects – the database partitions and database partition groups. Another and older
term for database partition is node. These logical objects are related to the database partitioning
feature (DPF) of DB2 for Linux, UNIX and Windows. DPF-related topics are not described in this
document. Backup and recovery in partitioned database environments will be described in an
upcoming document of this series. For non-partitioned environments, the default partition (node)
always is ‘0000’.
Why are these objects important to understand in the context of the DB2 backup utility? The DB2
database backup saves all information that is necessary to recover the database. However, as
described, objects exist outside the database. Consequently, they are not part of the DB2 database
backup. The data itself, the database and table space configuration and – as the default behavior of
DB2 9.5 and higher – the log files are saved as part of an online database backup. The database
manager configuration and the registry, however, are not included in this image. Although these
configuration files are not essential for a full disaster recovery, it is of some interest to understand this
fact. For more information about how to save and recover these configuration files, see Chapter 4.1
“DB2CFEXP / DB2CFIMP”.
1.2 Logging with DB2 databases
The DB2 database system uses a write-ahead logging algorithm as the transaction recovery method
that supports fine-granularity logging and partial rollbacks. Write-ahead logging forces the log record
to be written to the log file for an update before the corresponding data page is written to disk. All log
records for a transaction must be written to the log files before a COMMIT is completed. The database
stores information that is related to the changes in a set of log files in the database log directory.
The default location of the DB2 log files in SAP environments is ‘/db2/<DBSID>/log_dir’. The DB2
database management system automatically appends the number of the database partition (in the
form ‘NODE<nnnn>’) to the log path to maintain uniqueness for DPF environments. This node number
is appended also in non-partitioned environments. For example, in a non-partitioned DB2/SAP system
the path for the online log files would be ‘/db2/<DBSID>/log_dir/NODE0000’.
The DB2 database system distinguishes between primary and secondary log files. Both, primary and
secondary log files reside in the database log directory. During startup, the database pre-allocates all
primary log files in case they do not already exist. In case that long-running transactions fill up all
剩余39页未读,继续阅读
swj_1120
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1