Академический Документы
Профессиональный Документы
Культура Документы
Date 03.08.2004
Standby databases serve to accelerate recovery processes if the master instance of the database is
not available any more. Log shipping allows an asynchronous replication of the modifications in a
master instance to a standby instance.
This document gives references and hints, how with SAP DB/MaxDB and liveCache standby
databases can be set up. The procedure works with
SAP DB version >= 7.3.00 Build 50,
SAP DB / liveCache version >= 7.4.03 Build 34,
MaxDB / liveCache version >= 7.5.00 Build 31 and
all higher version numbers.
DBMCLI commands clarify the proceeding. Also the DBMGUI and/or WebDBM can be used. More
information about the DBMCLI Commands can be taken from the documentation “Database Manager
CLI: SAP DB...”.
Through log recovery the standby database with a time delay receives/reaches the same status of
data as the master database. In our example 2 instances are used, the master instance SRC and the
standby instance TRG. Usually SRC and TRG run on different servers.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 1 of 16
Prerequisites
Database version
The master instance and the standby instance must use the same database version.
Terms
Some Terms have changed with version 7.4.03:
This document always uses the new terms. The command examples still use the older
terminology as this still works with the new database versions.
Shared Files
The standby instance and the master instance do not access shared files. The
RUNDIRECTORY has to be different.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 2 of 16
Moving the backups
To accelerate the Backup/Restore process data backups can be moved through remote pipes.
OSS note 489615 describes this process.
Log backups have to be written to versioned files. As an example, they can be moved through
ftp, copied via a shared file system or written to mirrored file systems.
Direct access to shared files by the database is slow and risky. Thus this access method
should be avoided.
Status ‚Online’
The standby instance must stay in admin or offline mode. It must not be set online unless the
instance should take over the work of the master instance because of a system failure. If once
online the standby instance cannot work as standby any longer. It would have to be initialized
and provided with a complete backup again to resume its work as standby instance.
The DBMCLI commands can be entered at the command prompt. Alternatively the commands can be
entered via an input script using the option ‘-i’. The input script also can be a pipe. Some commands
(command sequences) require a DBMCLI session and thus cannot be entered at the command
prompt of a shell or DOS box.
DBMCLI can work remote by using the option ‘-n’ to specify the node of the database. It has not
necessarily to be started on the database server.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 3 of 16
This document will use the representation for the input script of the master and standby instance as
follows:
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 4 of 16
Proceeding
Start of the standby instance to a certain point of time by restoring the logs
Start of the standby instance without loosing committed data (point of failure/takeover)
Recreate Indexes
If by mistake the log history is broken or the standby instance has been set online the process can be
reentered with initializing the standby instance.
The standby instance will be set up with the common installation and administration tools.
During use of the Database Wizard of the DBMGUI version 7.3 or 7.4 at the last step
‚Restore’ has to be chosen. The steps ‘Activate ServerDB’ and ‘Load Systemtables’ are
obsolete.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 5 of 16
Select „Create instance for recovery“ in the installation wizard of DBMGUI version 7.5.
With version 7.3 the backup can be created without a checkpoint (for recovery) because in
the target system (standby instance) always matching log backups will be restored. As of
version 7.4 backups are always created without checkpoints.
Initialize the standby instance and restore the backup with version 7.3 and 7.4
The standby instance must be initialized before a data backup should be restored to the
instance with version 7.3 and 7.4.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 6 of 16
Attention: The ‚init config’ command completely deletes all data content of the instance.
Initialize the standby instance and restore the backup with version 7.5
Version 7.5 and above perform both, the initialization and the restore within one step.
This picture shows how a backup is transferred and restored to the target system using a
remote pipe:
Backup Media for log backups on both master and standby instance
The standby instance requires a medium to restore the log backup. Example :
To avoid log full situations between two log backups it is recommended to enable automatic
log backup:
The current setting of the automatic log backup can be determined as follows:
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 7 of 16
SRC > autolog_show
Example:
The backup history shows all backups with their execution dates.
If the output does not fit into the buffer of DBMCLI the continuation output can be received by:
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 8 of 16
As of version 7.4.3 the command ‘recover_cancel’ sets the database offline. For further
actions the database has to be set to the status admin (with command db_cold). To restore
further log backups, a new restore session will be opened with recover_start.
The database provides the last log page of which the data has been made persistent in the
data area:
The line „Used LOG Page“ displays from which log page the next entries are to be taken.
The (log) backup history of the master instance shows, which log pages are part of which
backup:
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 9 of 16
SRC > backup_history_close
Alternatively the information about which log pages are part of a log backup can be received
directly out of the log backup:
Log backup 009 contains logpages 5087 to 5542 (“First LOG Page” + “Page Count”).
If a wrong log backup is specified, the restore command will return –7075. Afterwards a new
restore session has to be opened with recover_start.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 10 of 16
The instance will be set ‚online’ directly. That means that all data that has been cached during
the restore process will stay cached and does not have to be read from the volumes again.
The instance TRG now does not contain all modifications, which have not yet been transferred
from the instance SRC via log backups.
Start of the standby instance to a certain point in time by restoring the logs
Log backups can be restored to a certain point in time (restore log until). This time
specification can be provided with recover_start.
If recover_start or recover_replace do not return –8020 but 0 the database has reached the
status online. The ‘UNTIL’ specification can be given only once during a restore session.
Start of the standby instance without loosing committed data (point of failure/failover)
Often the switch from the master instance to the standby instance happens because of a
server failure on the master instance. So if the standby instance will only be provided with log
backups some data will be lost because the recently written log has not been saved yet.
If the log volumes are based on an external disk, the standby server might be able to access
these volumes too.
If the number of log volumes and their sizes are equal in both master and standby instance
the log volumes of the master instance can be copied on the log volumes of the standby
instance.
An ‚until’ point in time can be specified. This works if the until time has not been applied to the
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 11 of 16
standby instance, yet:
Recreate Indexes
If CREATE INDEX commands are found in the log these indexes will not be created during log
recovery. Only the repository entries for such indexes will be created. The index will be
marked as ‘bad’ and can be created when the database instance is online.
A returncode of 100 ‘Row Not Found’ indicates that there are no ‘bad’ indexes. Otherwise if
indexes are listed they can be built:
As of version 7.5.00 Build 11 indexes are created automatically after the restart of the
instance with the parameter setting AUTO_RECREATE_BAD_INDEXES=YES. This may
delay the restart of the database.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 12 of 16
Special Actions
The recovery process on the standby instance is finished, if the instance has reached the status
online. During the recovery process further action on the standby instance are possible.
Verify
Within the standby instance the internal structure of trees and data pages can be checked
with the verify command. With version 7.3 and 7.4 the recovery has to be interrupted. The
instance has to be set offline before and after the verification. Example:
As of version 7.5 the verify can run in parallel to the log recovery. Start the action either inside
an open dbmcli session with running recovery session or in a separate dbmcli session. The
command db_execute does not need a utilty session.
The check data was not able to check non-rebuild indexes if it returns error –9041. The error
does not indicate corrupt data.
Set the standby instance temporarily online and later continue the standby proceeding
Database Snapshots help setting the standby instance temporarily online. The instance can
return to the snapshot and continue with the log recovery process.
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 13 of 16
older point in time and go online temporarily. The following example script crates a snapshot
at 8:00 a.m., continues the log recovery until 4:00 p.m., returns to 8:00 a.m., repeats the
recovery until 10:00 a.m. and sets the database online. The script sets the instance back to
8:00 a.m. after the online tasks have finished and continues with the log recovery procedure.
Data Backup
If a data backup of the standby instance was created after a cancellation of the recovery, the
recovery process cannot be continued. The standby instance can be set online (without
copying the log volumes from the master instance).
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 14 of 16
TRG > util_connect <dbm-user>,<password>
TRG > backup_start FULL DATA
TRG > db_offline
TRG > db_cold
TRG > util_connect <dbm-user>,<password>
TRG > recover_start LOG_SAVE 014
RETURNCODE –8003
TRG > db_warm
The instance gets a new identification with the data backup. Log backups from the master
instance still have the identification of the master instance. The recovery procedure checks if
the log backup fits to the instance. The check fails with error –8003.
Errors / Malfunctions
Returncodes
- 8020 „Next Medium required
A log backup has been restored. Either a subsequent log backup or the restart of the
instance is expected.
o Version 7.3
The instance executes an ‚emergency shutdown’. The file ‘knldiag’ contains messages as
follows:
...
… WRN 53025 DATA PAGES USED 99(9 PAGES LEFT)
… WRN 53025 DATA PAGES USED 99(1 PAGES LEFT)
…
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 15 of 16
o Version 7.4
The instance executes an ‚emergency shutdown’. The file ‘knldiag’ contains messages as
follows:
...
… WRN 6 Kernel_E 97 % of data base occupied, 312 pages free
… WRN 6 Kernel_E 98 % of data base occupied, 208 pages free
o Version 7.5
the instance stops but stays in mode admin. The file ‘knldiag’ contains messages as
follows:
The instance size has to be increased. Then the restore of the log backups can continue:
In future versions db_adddevice will be able to add a new data volume without using a utility
session. The database can be increased during the running recovery with this feature.
Example:
The file knldiag of the standby instance can be shown with the command
Copyright SAP AG 2004, Standby Databases with SAP DB/MaxDB or liveCache Page 16 of 16