15.12.10

SAP Note 13550 - Using BRBACKUP and BRARCHIVE

Symptom:

Customer letter, April 1994
Caution:
This note describes the BRBACKUP and BRARCHIVE status of Releases 2.0, 2.1, and 2.2 (including 2.1G). The functions described here, are also valid for later releases. However, many restrictions were relaxed and the functions were substantially enhanced. Please read also the most recent Online documentation.

Cause and prerequisites

Customer information

Solution

Using BRBACKUP and BRARCHIVE
******************************

Overview

This documentation is intended to support you in getting more familiar with all the options provided by the backup programs BRBACKUP and BRARCHIVE and in using these programs properly.

The descriptions in the following sections supplement the documentation in this manual.


SAP Database Backup Programs

Versions of BRBACKUP and BRARCHIVE
------------------------------------
The following terminology is used to describe the BRBACKUP and BRARCHIVE versions:
BRBACKUP/BRARCHIVE M.NX (for example, 2.0C)
where
M.N stands for the version (for example, 2.0)
M.NX stands for the release (for example, 2.0C)

The release is specified in the messages BR051I and BR002I with BRBACKUP/BRARCHIVE calls.

Different maintenance levels can be displayed using the command
brbackup¦brarchive -h version.

The new 2.0 versions of BRBACKUP and BRARCHIVE include enhancements for SAP release 2.1.
Since these enhancements include important features especially with respect to data security, they have been released for SAP release 2.0 also.

Overview of the BRBACKUP/BRARCHIVE versions
released:

Old version -until SAP maintenance level 2.0E
Exception: for OSF/1 only until 2.0B

New version -from SAP maintenance level 2.0F
(Version 2.0) Exception: for OSF/1 from 2.0C
-for all SAP releases greater than 2.1

A short description of the enhancements in the new maintenance levels of BRBACKUP/BRARCHIVE is included in the release information for the SAP maintenance levels 2.0F and 2.0G.
For further details please refer to Appendix A and B of the manual.

List of Backup Programs
------------------------
The following three backup programs are available:

  • BRBACKUP
    This program backs up the database files (that is, the data files, online redo logs and the control file).
  • BRARCHIVE
    This program backs up the archived redo logs.
  • BRCONNECT
    This program monitors the database during a BRBACKUP process, that is BRCONNECT checks whether the database is running during an online backup or remains stopped during an offline backup. If not, the backup is terminated.

BRBACKUP and BRARCHIVE can be called directly from the UNIX command level or from the SAPDBA menu.

BRBACKUP/BRARCHIVE do not have a graphical interface. They can run in any UNIX window and under any shell.

BRBACKUP/BRARCHIVE are interactive programs. If you do not want any user intervention, use the option -c.

BRBACKUP/BRARCHIVE should be started on UNIX systems as the user who owns the database (default: ora, for example, orac11.

Objects Saved by BRBACKUP/BRARCHIVE
-----------------------------------
The programs BRBACKUP and BRARCHIVE can be used to back up all files that belong to the Oracle database.

  • BRBACKUP saves:
    • data files of tablespaces of the database
    • online redo logs (only in connection with an offline full database backup)
    • a control file
  • BRARCHIVE saves:
    • the online redo logs copied to the archive directory by Oracle as offline redo logs (often called archive or offline redo logs)
  • In addition, BRBACKUP and BRARCHIVE copy the
    following files to tape:
    • a copy of the profile init.ora
    • a copy of the profile init.sap
    • the detailed (complete) BRBACKUP or BRARCHIVE log
    • the BRBACKUP or BRARCHIVE summary log

BRBACKUP writes the last two log files only to the last tape mounted on a tape device during a backup.

Saving the logs helps to determine the backup tape content even when the BRBACKUP/BRARCHIVE database and file system logs are lost.

Non-Database Files
------------------
As mentioned above, BRBACKUP and BRARCHIVE save only database files. However, the SAP System also uses other UNIX files. How should these files be saved?

The non-database files are either of a constant or temporary nature. You should back up the constant files (for example, from the subdirectory tree /usr/sap//SYS) after every change (for example, profile change) using UNIX utilities such as tar.
Losing temporary files (for example, from the subdirectory tree /usr/sap//) is not very critical and does not cause data inconsistencies. If you lose such files, you can use SAP tools that reset the references to these files within the database. For further details please refer to the manual R/3 System Administration Guide.

Backup Media
------------
You can use BRBACKUP/BRARCHIVE for direct backup to the following media:

  • local tape devices:
    backup_dev_type = tape
  • remote tape devices;
    the remote computer must be a UNIX computer:
    backup_dev_type = pipe

BRBACKUP can also be used for backup on local disks and disks mounted via NFS:
backup_dev_type = disk

BRBACKUP also supports devices with automatic tape changing (for example, tape stacker).
These devices can be
local: backup_dev_type = tape_auto
or remote : backup_dev_type = pipe_auto

Caution:Some of these devices require a time to change tapes. You should define the parameter rewind_offline in the profile init.sap accordingly.

Example:

rewind_offline = "mt -f $ offline; sleep 30"

External Backup Programs
------------------------
The new versions of BRBACKUP and BRARCHIVE provide an open interface that can be used to access external backup programs.

This interface can only be used if an interface program is provided by the manufacturer of the external backup program.

If you use this interface, tasks are distributed as follows:

  • BRBACKUP/BRARCHIVE take care of database handling.
  • The external backup program is responsible for managing backup media.
  • BRBACKUP/BRARCHIVE pass on a backup request to the external backup program. This request consists of a list of the files to be saved.
  • BRBACKUP/BRARCHIVE evaluate the confirmation messages of the external backup program.


Advantages
-----------
With this interface you can use new backup media, which are specific to manufacturers. For example, BRBACKUP/BRARCHIVE do not currently support direct backup to optical media (MO). Such media can now be used using the open interface via an external backup program.

By using an external backup program, you can set up a consistent backup procedure for file systems and databases.

Many backup programs are not hardware-specific and can be used in the network (for example, backup to an automatic tape system on a mainframe).

The following partners plan to support this interface: HP for OmniBack, IBM for ADSM, HiComp for HiBack

For further details please contact the corresponding partner (Competence Center).

Profile init.sap

Syntax
------
As compared to earlier versions, the syntax of
the profile init.sap has been adjusted to
the syntax of the profile init.ora.

All parameter values in the profile init.sap<(> that consist of several symbols must be enclosed in double quotes. Please change the parameters concerned unless you have already done so
parameter: rewind, rewind_offline,
compress_cmd, read_fifo_cmd, copy_in_cmd and copy_out_cmd.

Delete the pipe character ("¦") and the dd command from the parameter read_fifo_cmd. Define the dd command in the two new parameters of init.sap
copy_in_cmd and copy_out_cmd.

New Parameters
--------------
The following list shows the new parameters in init.sap with default values:

expir_period = 30
Tape expiration period in days, default value: 30

tape_use_count = 100
recommended tape use count, default value: 100

rewind_offline = "mt -f $ offline"
Command to rewind and eject the tape for one
tape device, default value:
Value of the rewind parameter

util_par_file = initC11.utl
Parameter file only for external backup programs, no default value

read_fifo_cmd = "remsh hs0001"
Command for backup on remote computers via "pipe", no default value

copy_in_cmd = "dd bs=5k if=$"
Used only for backup on remote computers via
"pipe", no default value

copy_out_cmd = "dd bs=5k of=$"
Used only for backup on remote computers via
"pipe", no default value

From SAP maintenance levels 2.0F and 2.1D, the directory usr/sap//SYS/exe/run contains a sample profile init.sap, which contains default values for all parameters (including those specific to operating systems).

For further details about the new init.sap parameters, refer to the Appendix: Configuring BRBACKUP and BRARCHIVE in this manual. Also refer to the release information for maintenance levels 2.0F and 2.0G.

Test profile
------------
If you do not have a test database and want to test backup or tape management strategies, you should use a test profile of the form init.sap (of course with another profile name). Please do not forget to change thetape names in this test profile to avoid problems with automatic tape management.

Effect of Command Options
--------------------------
You can overwrite some parameters in the profile init.sap if you call up BRBACKUP/BRARCHIVE with the appropriate command option.

The following list shows the profile parameters and the options to overwrite these parameters.
Parameter Command option

backup_mode -m ¦-mode only BRBACKUP
backup_type -t ¦-type only BRBACKUP
backup_dev_type -d ¦-device
compress -k ¦-compress
volume_archive -v ¦-volume only BRARCHIVE
volume_backup -v ¦-volume only BRBACKUP
util_par_file -r ¦-parfile

Parameter tape_size;
----------------------
In the new version of BRBACKUP/BRARCHIVE, the parameter tape_size always defines the physical tape size (tape length x writing density). This value refers to the total size of the data that can be written to a tape actually without compression. You can save different data volumes on one tape depending on whether using compression or not. BRBACKUP/BRARCHIVE consider this fact already, so you should and need not change the physical tape size if you use software compression or hardware compression (for tape stations with hardware compression).

Examples

Guide values for tape devices without hardware compression:

    • 60 m DAT tape/4 mm DDS-1: 1200 MB
    • 90 m DAT tape/4 mm DDS-1: 1800 MB
    • 120 m DAT tape/4 mm DDS-2: 3800 MB
    • 112 m video tape/8 mm: 2000 MB
    • 112 m 8 mm/high density: 4500 MB
    • 3480 IBM tape: 700 MB

When using tape devices with hardware compression, you should always have spare space (approx. 200 MB) since the compression rate cannot be determined precisely. The compression rate is estimated based on an analogous software compression and is therefore not exactly the same as the actual compression rate of a hardware compression. Guide values for tape devices with hardware compression:

    • 60 m DAT tape/4 mm DDS-1: 1000 MB
    • 90 m DAT tape/4 mm DDS-1: 1600 MB
    • 120 m DAT tape/4mm DDS-2: 3600 MB
    • 112 m video tape/8mm: 1800 MB
    • 112 m 8mm/high density: 4300 MB
    • 3480 IBM tape: 500 MB

Cpio: Multiple

If the tape size is defined too large, the cpio command may reach the physical end of the tape. In this case, you get cpio message indicating the end of the tape (end of tape, end of medium, end of volume).

As of SAP maintenance levels 2.0G or 2.1D you can continue the backup on another tape unless you are running a parallel backup on several tape devices. Please ensure that this tape is not one of the tapes initialized for BRBACKUP/BRARCHIVE since no label check takes place for the continuation tape. For BRBACKUP/BRARCHIVE the cpio continuation tape is not "visible", i.e, it is regarded as one logical tape together with the first one.

In restore situations SAPDBA will also request one tape; however, both tapes must be mounted.

None of the database files should be larger than the size specified in tape_size (if required, after compression) in order to avoid the situation described above.


Parameter tape_use_count
------------------------
This parameter is intended to avoid unreadable backups as a result of defective tapes.
Read/Write errors are more likely to occur as the tape use count increases. When a certain value is exceeded, the risk is no longer acceptable.

The parameter default value 100 is only a clue about the actual value value. To find out what the value should be, contact the manufacturer of your tapes.

BRBACKUP/BRARCHIVE issues a warning message (BR235W) when the value of the parameter tape_use_count is exceeded. Do not use such tapes for further backups.

Parameters volume_backup and volume_archive
--------------------------------------------
With these parameters you can specify a large
number of tape names. The number of tape names should be at least as large as the number of tapes used within the tape expiration period.

Example: The expiration period is 14 days. Two tapes are required for the backup. The backup is to take place on workdays (Monday through Friday). In this case, define at least 20 tapes in the profile init.sap.

We recommend that you define more tapes than required to take into account backups that have to be repeated or additional backups after major database changes such as a reorganization. If there is no free tape available, BRBACKUP/BRARCHIVE will terminate with the error message BR105E.

As of SAP maintenance levels 2.0G and 2.1D on, BRBACKUP and BRARCHIVE goes through the list of available tapes while in the SAP maintenance levels 2.0F, 2.1A, 2.1B and 2.1C, the first free tapes in the list (whose expiration period had ended) were proposed as backup media.

All tapes defined in the profile init.sap should also exist physically. If required, initialize new tapes accordingly.

Production System

In production systems you should perform a full database backup daily. Offline backup is recommended; however, if the system has always to be available, only an online backup is possible.

SAP recommends that you perform an offline backup at least once within the tape expiration period. The expiration period of the tapes should be at least 2 weeks, better 4 weeks.

You should save the archived redo logs using BRARCHIVE after the database backup. If you run an online backup, you should do this immediately afterwards.

In production systems, it is important to have two copies of the archived redo logs. Use the BRARCHIVE options -sc or -scd for this (if only one tape device exists) or -ss or -ssd (if you have two tape devices).

Standard backup media are tape devices attached locally to the database server. Backup on a remote computer is appropriate only if:

  • the database is not very large because parallel backup on multiple tape devices is not supported in this case.
  • the network is very reliable.

Test Database
-------------
The data in a test database do not need to be be saved frequently. One copy of the archived redo logs is usually sufficient.

The database can be run in NOARCHIVELOG mode if it is sufficient that you can reset your database to the last offline backup after an error. If you do not back up the test database, you have to reinstall it if a recovery situation occurs.

You can back up a test database on a remote computer without problems. For example, you could back up the test database on remote tape devices that are attached to the computer on which the production database runs.

Two-Level Backup
----------------
As an alternative to direct backup on tape, you can perform two-level backups:

    1. Phase 1 BRBACKUP backup on disks
    2. Phase 2 Copying the saved files using UNIX utilities (e.g. tar, cpio) from disk to tape. This copy operation can be given lower priority.

Advantages
----------

  • The first phase can be much shorter than direct backup to tape.
  • In a recovery situation, the restore phase can be much shorter because the last backup is available online on disks.

Disadvantages
-------------

  • Additional storage space is required.
  • Additional effort is required for phase 2.
  • If a recovery is required, SAPDBA can only perform an automatic restore based on the last backup.
  • You can not use the tape management.

Parallel Backup
---------------
You can back up your database on several tape stations in parallel. Parallel backup reduces the backup time and enables unattended operation (backup in unattended mode).

Parallel backup is possible only on local tape devices.
If hardware compression is possible with these tape devices, the init.sap parameter compress = hardware should be defined.

The addresses of the tape devices are defined in the init.sap parameters tape_address and tape_address_rew.

Example:

tape_address = (/dev/rmt/0mn, /dev/rmt/1mn)
tape_address_rew = (/dev/rmt/0m, /dev/rmt/1m)

Backup on Several Disks
-----------------------
You can use BRBACKUP for backup on several disks if the space available on one disk or logical volume is not sufficient.

For this purpose you have to specify the directories on different disks to which you want to save your database files in the init.sap profile parameter backup_root_dir.

Example:

backup_root_dir = (/usr/ora/mount1, /usr/ora/mount2)

BRBACKUP uses the free space available in these directories to save the database files according to the sequence specified in backup_root_dir.

Backup on a Remote Computer

BRBACKUP/BRARCHIVE can back up files on a remote tape device, i.e., on a remote computer.

The remote computer must be a UNIX computer, which can be accessed via network. The UNIX versions of the local and remote computer do not need to be identical. If, for example, the database runs on an HP-UX computer, the backup can be performed on an AIX computer.

The individual database files are transferred to the remote computer via a remote shell call (via "pipe"). The remote computer can be defined in the init.sap
parameter read_fifo_cmd as follows:

  • read_fifo_cmd = "remsh "
    if the UNIX user who started the backup also exists on the remote computer
  • read_fifo_cmd = "remsh -l
    " if the backup on the remote computer is to be performed under another UNIX user

A prerequisite for a successful remote SHELL call is for example the following entry in the file .rhosts, which is in the HOME directory of the remote UNIX user on the remote computer:



is the computer on which the
database runs.
is the UNIX user who starts
the backup.

On the remote computer the files are written to tape using the UNIX command dd. This command is defined in the profile init.sap as as follows:

copy_in_cmd = "dd bs=5k if=$"
copy_out_cmd = "dd bs=5k of=$"

Caution

For performance reasons the parameter bs=5k is mandatory.

You can use several tape devices on the remote
computer for backup (only serially).

Backup on a remote computer is only appropriate when the database is not too large (because parallel backup on several tape devices is not possible) and the network is very fast and stable. For example, you could save a test database on remote tape devices attached to the computer on which the production database runs.

Using Several Tape Devices with Software Compression and Remote Backup
-----------------------------------------------------------------------
From SAP maintenance levels 2.0G and 2.1D, you can use several tape devices even when you work with software compression or perform backups on a remote computer.
This means that unattended backup of large databases is possible even if you do not have a tape device with hardware compression or want to perform remote backups.

If several tapes are required for a backup, the tape devices are used one after another. As described in the section: Parallel Backup, the tape devices must be defined in the parameters tape_address and tape_address_rew.

Tape Devices with Hardware Compression
--------------------------------------
If you can use tape devices with hardware compression, you should use this option. It is thus possible to write more data on a tape and reduce the backup time required.

In this case you have to define the init.sap parameter compress as follows:
compress = hardware

The amount of data that can actually be written to a tape depends on the compression rate. The compression rate considerable changes because some of the data in the database are already compressed. This applies to data in the following tablespaces: PSAPSOURCED, PSAPLOADD, PSAPCLUD and PSAPDOCUD. Additional compression of the files from these tablespaces does not lead to a significant data volume reduction.

The average compression rate of a SAP database with a large amount of data is between 3 and 5. For new or comparatively empty database files, this value can be much higher.

BRBACKUP
--------
If you use tape devices with hardware compression, BRBACKUP needs the current compression rates of the database files to determine the data volume after the hardware compression.

BRBACKUP can determine the data volume to be written on tape only approximately. It needs this value in order not to exceed the tape size and to distribute the database files properly to several tapes.

Since BRBACKUP cannot determine the real hardware compression rates directly, it uses the software compression rates instead to determine the hardware rates approximately. It is assumed that the results of software and hardware compression are similar.

Therefore you should start a dummy compression backup: brbackup -k only. before the first backup to tape devices with hardware compression.

No backup will be started. The database files are merely compressed to determine the compression rates. These values are stored in table SDBAD.

Caution

Repeat this process at least once per month to update the compression rates.

BRARCHIVE
---------
When saving archived logs with BRARCHIVE, previous software compression is useless because the compression rates determined cannot be used for the next archive logs. If BRARCHIVE does not have any specifications for the compression rates, it assumes a default of 1. For example, this means that with a tape size of 1600 MB and a size of the redo log files of 20 MB up to 80 archived logs can be written to a tape.

However, if more logs per day, you can change the parameter tape_size accordingly.

Please consider the following: A hardware compression reduces the archive logs on an average by at least one third. This means that you can increase the init.sap parameter tape_size by approximately 50% (in the example to 2400 MB) and thus take into account the actual compression rate. It will be possible to save a lot more (in the example up to 120) archive logs with one BRARCHIVE.

In this case you can define a separate profile init.sap for BRARCHIVE in order to not to affect the BRBACKUP database backup.

Size of the Compression Directory
---------------------------------
In connection with software compression, BRBACKUP uses the compression rates to determine the space required in the compression directory (compress = yes or compress = only). The free space must be at least as large as the largest compressed file. The compression rates are evaluated and stored in the database table SDBAD.

Caution

When the new version of BRBACKUP is started for the first time, compression rates are not available. In this case BRBACKUP uses internal default values that are usually smaller than the actual compression rates. Successful compression is then ensured only if the compression directory has at least as much free space as the largest database file needs before the compression.

From SAP maintenance levels 2.0G and 2.1E disk space in the compression directory is not required for using compress = only (determining the compression rates). The sizes are evaluated by reading the compressed files directly (via redirection). As a prerequisite for this, the redirection character ">" must be used in the parameter compress_cmd (as set already by default).

Cpio Error
----------
cpio may report an I/O error. If this error occurs irregular, you should check whether it is connected to a certain tape. If you find this to be true, you should no longer use this tape for backups.

If this error occurs frequently, you should have your tape device checked.

Backup Time
------------
Backup may often take a long time. For example, if you use DAT tape devices as a backup medium, you can backup 600-800 MB per hour (without hardware compression) or 1000- 1500 MB per hour (with hardware compression). This means that backing up a 10 GB database on one tape device of this type would take approximately 10 hours.

Parallel Backup
---------------
To solve this problem, you can use BRBACKUP to perform data backups in parallel on several tape devices. To do this, you have to assign several tape devices to the init.sap parameters tape_address and tape_address_rewind. For example, you can then save a 20 GB database in parallel on 5 tape devices in 5 hours.

If you use several tape devices for parallel backups, BRBACKUP tries to optimize the distribution of the database files to tape devices (load balancing, BRABCKUP tries to distribute equal load to every tape).

  • If possible, files on one disk are backed up on one tape device to reduce disk head movements.
  • BRBACKUP tries to optimize the time required for the individual processes in order that the load on the tape devices is distributed evenly.

Logical Volumes
---------------
If you are using the Logical Volume Manager, a logical volume is considered to be one disk.
Therefore, you should not distribute a logical volume over several physical disks with no need.

Backup on Disk
--------------
To reduce the backup time, you can perform the backup on disk (backup_dev_type = disk). You can then copy the backups with low priority from disk to tape using UNIX utilities (tar, cpio). For more information, refer to the section: Two-Level Backup.

Unattended Backup
-----------------
The following sections explain how to perform unattended backups.

Parallel Backup
---------------
You can perform automatic (unattended) backups if you have enough online tape devices. This means that you need n tape devices if you require n tapes for the backup.

Then BRBACKUP can perform a parallel backup to those n tape devices. Operator intervention is not required in this case because tapes do not need to be changed.

Devices for Changing Tapes Automatically
----------------------------------------
Devices that change tapes automatically are another possibility to perform automatic backups. The new version of BRBACKUP supports these devices. You only need to define the parameter rewind_offline accordingly and set backup_dev_type to tape_auto or pipe_auto.

For more information please refer to the section: Backup Media.

Serial Backup
-------------
From SAP maintenance levels 2.0G and 2.1D, unattended backup is possible even when you use software compression (compress = yes) or if backup takes place on a remote computer (backup_dev_type = pipe). If you need several tapes for a backup, the tape devices are not used in parallel but serially.

To perform a parallel or serial backup on several tape devices, you have to define the addresses of those tape devices in the init.sap parameter tape_address_rewind.

Example:
tape_address = (dev/rmt/0mn, /dev/rmt/1mn)
tape_address_rew = (dev/rmt/0m, /dev/rmt/1m)

Backup Using CRON
------------------
The following requirements exist for successful unattended backup using CRON:

  • The parameters in init.sap are maintained correctly.
  • The number of tapes or the disk space is sufficient.
  • The crontab entries have been created under he user root.
  • The correct tapes have been mounted on the tape devices.

If automatic tape management is active, first determine the tape names by entering the commands brbackup¦brarchive -q.

If automatic tape management is not active, mount tapes which are expired.

Example 1:

Online backup of the complete database; unattended operation; daily;

Monday through Friday; backup to be started at 10.00 p.m.

#Min(0-59) Std(0-23) Tag(1-31) Mon(1-12) WT(0-Son,...,6-Sam)
00 22 * * 1-5 su - ora -c "brbackup -c -u"%system/
Example 2:

Offline backup of the complete database; unattended operation; daily;
Monday through Friday; backup to be started at 10.00 p.m, SAP System to be stopped

#Min(0-59) Std(0-23) Tag(1-31) Mon(1-12) WT(0-Son,...,6-Sam)
00 22 * * 1-5/backup.sh

The script backup.sh in the root directory could have the following content: su - adm -c "stopsap R3"
su - ora -c "brbackup -c -u" <
END su - adm -c "startsap R3"
Example 3:

Offline backup of the complete database; unattended operation; daily; Monday through
Friday; backup to be started at 10.00 p.m.; SAP System not stopped

#Min(0-59) Std(0-23) Tag(1-31) Mon(1-12) WT(0-Son,...,6-Sam)
00 22 * * 1-5 su - ora -c "brbackup -t offline_force -c -u"%system/

Example 4:

Backup of the archived redo logs; unattended operation; daily; Monday through Friday; backup to be started at 8.00 a.m.;
parallel backup on two tape devices

#Min(0-59) Std(0-23) Tag(1-31) Mon(1-12) WT(0-Son,...,6-Sam)
00 8 * * 1-5
su - ora -c "brarchive -ssd -c -u"%system/


Tape Management
***************

Automatic Tape Management
--------------------------
Automatic tape management by BRBACKUP and BRARCHIVE refers to the proper selection of tapes to be used for the next backup.

The tapes that are not logically locked are selected from the pool of tapes available.

The pool of tapes available for BRBACKUP is defined in the profile parameter volume_backup, the pool for BRARCHIVE in the parameter volume_archive.

All tapes defined should exist physically. Otherwise you should initialize new tapes accordingly.

From SAP maintenance levels 2.0G and 2.1D onwards, BRBACKUP and BRARCHIVE try to use all available tapes cyclically. In the SAP maintenance levels 2.0F, 2.1A, 2.1B and 2.1C, the first free tapes in the list (i.e., the tapes that are expired) were proposed as backup media.

With automatic tape management you do not need to bother about the correct tape for a backup. In addition, it is ensured that valid backups are not overwritten.

Finding the Names of the Right Backup Tapes
--------------------------------------------
You can display the names of the tapes to be mounted for the next backup using the following calls:
brbackup -q or brarchive -q, respectively.

If you use automatic tape management, the tape names should refer neither to weekdays nor to days in a month because BRBACKUP/BRARCHIVE does not check whether or not the period after the last backup includes a holiday, as a result of which days may be confused.

SAP recommends that you include the database name (SID) and a sequential number (nn) in the tape name, for example: SIDAnn for BRARCHIVE tapes, SIDBnn for BRBACKUP tapes.

Deactivating Automatic Tape Management
--------------------------------------
You can deactivate automatic tape management by setting the init.sap parameter volume_backup = SCRATCH and volume_archive = SCRATCH or by calling BRBACKUP/BRARCHIVE using the option -v SCRATCH.

The programs BRBACKUP/BRARCHIVE then prompt you to mount scratch tapes, i.e., tapes with arbitrary names whose expiration period has ended.

In this case, the operator is responsible for selecting the tapes. However, the program still checks the expiration period. Any expired BRBACKUP/BRARCHIVE tape is accepted (see also section: Physical Lock in this chapter).

BRBACKUP/BRARCHIVE prompt you to provide the number of scratch tapes required for the backup with message BR104I.

If you use scratch tapes, it can be useful to specify the weekday or day of a month for the tape name as described in the following section.

Using Utilities to Determine the Names of Backup Tapes
------------------------------------------------------
You can use external utilities to determine the tape names relevant to a backup. You can, for example, use an external tape management system or a shell script.

BRBACKUP/BRARCHIVE can be started with a list of tape names by the command option -v.

Example:

brbackup -v SIDB141,SIDB142,SIDB143
brarchive -ssd -v SIDA141,SIDA142

The external tool used for tape selection must ensure that only tapes that are not locked are provided for the backup. Otherwise the programs BRBACKUP/BRARCHIVE may terminate because they cannot find enough free tapes.

Always ensure that the number of tapes provided for backup is sufficient.

If you call BRBACKUP/BRARCHIVE using the option -v, automatic tape management is switched off almost completely; however, the tape label check remains active.

Example for a script that generates tape names according to the convention SIDXttn, where SID is the Oracle SID (database name), X=A stands for BRARCHIVE or B for BRBACKUP, tt=day in a month, n=tape sequence number within a backup.

day=`date ¦ cut -f 3 -d " "`
if [ ${day} -le 9 ]; then day=`echo 0${day}`;
fi
brbackup -v SIDB${day}1,SIDB${day}2,SIDB${day}3 -c
brarchive -ssd -v SIDA${day}1,SIDA${day}2 -c

This script makes it possible to assign the tape names to the day of a month on which the backup is started.

In this case the operator is not responsible for correct naming and selection of tapes. It is clear without any further checks which tapes were used for backup on which day.

Initializing Tapes
------------------
Tape "initialization" refers to the writing of a label (file with the name .tape.hdr0) to the tape concerned.
This label file is read when the tape is checked. If this label file does not exist, the check fails and the tape is rejected.

You have to initialize only new tapes or tapes that were not used by BRBACKUP/BRARCHIVE. Tapes used by older versions of BRBACKUP/BRARCHIVE programs are accepted.

You should initialize all your tapes only once according to your backup strategy before the first backup. However, you have to reinitialize a tape if you want to change its name. You cannot change tape names during a backup.

Your tapes should also have paper labels in order to make the tape name immediately visible.

Initialization Procedure
------------------------
Tapes are initialized using the programs BRBACKUP and BRARCHIVE.

All tapes to be used by BRBACKUP/BRARCHIVE for the first time must be initialized.

The following options can be used for initializing tapes:

    • i = initialize (initialize tape and check expiration period)
    • i force = initialize force (no check of expiration period)
    • v = volume (tape name)
    • n = number (number of tapes to be initialized)

Example 1:

Initializing tapes with the tape names specified in volume_backup/volume_archive:

Use the BRBACKUP/BRARCHIVE option -i [force]. Mount a tape and enter the following command:

brbackup¦brarchive -i [force]

All tapes specified in the parameters
volume_backup/volume_archive are initialized one after another.

New tapes and non-BRBACKUP/BRARCHIVE tapes must always be initialized with the option force.

If you initialize a tape without this option, the expiration period of the tape is checked. Locked tapes or tapes without label are rejected, non locked tapes are renamed.

Example 2:

Initializing x tapes with the first x tape names specified in volume_backup/volume_archive:

brbackup¦brarchive -i [force] -n x

Example 3:

Initializing tapes with a specific name:

brbackup¦brarchive -i [force] -v
[,]

All tapes to be initialized must be mounted on the tape device one after another.

If you initialize BRBACKUP/BRARCHIVE tapes with the addition force, the tape use count stored in the tape label is set to 1. Otherwise this value is increased accordingly.

Number of Tape Devices
----------------------
From SAP maintenance levels 2.0G and 2.1E, several tape devices can be used for initializing tapes. The tape devices defined in the profile init.sap in the parameters tape_address and tape_address_rew are used sequentially during the initialization process.

Tapes can then be changed at the same time on all the tape devices available.

Scratch Tape
------------
The section: Deactivating Automatic Tape Management describes the function of the scratch tapes. When BRBACKUP/BRARCHIVE requests a scratch tape for backup, this means that any tape whose expiration period has ended can be used. It does not mean that you have to mount a tape with the name SCRATCH.

You can also initialize a tape with the name SCRATCH explicitly (for example, brbackup -i -v SCRATCH). Such a tape is always accepted, even when a tape with another name is requested. In this case the tape mounted gets the name of the requested tape. It is usually not possible to rename tapes during a backup. The above case is an exception, however, you can use this option for example, when an additional tape is requested unexpectedly during a backup operation.

A backup on a tape named SCRATCH should never exist. This situation may occur when a scratch tape is requested and a tape named SCRATCH is mounted.

Information in the Tape Label
-----------------------------
The tape label is always the first file on a tape. This file has a format specific to BRBACKUP/BRARCHIVE and is written to the tape via cpio.

This label file has always the name:
.tape.hdr0.

You can display the content of a tape label using the call brbackup¦brarchive -i show -n 1.

Content of the label file:

  • tape name
  • generation time (start timestamp of the backup performed by BRBACKUP or BRARCHIVE)
  • database name (ORACLE_SID)
  • BRBACKUP/BRARCHIVE-Aktions-ID (encoded timestamp of the BRBACKUP/BRARCHIVE log names)
  • BRBACKUP/BRARCHIVE function ID (extension of the log file name of BRBACKUP/BRARCHIVE)
  • tape use count

    Checking the Tape Label
    -----------------------

Before the backup
Before BRBACKUP/BRARCHIVE writes on a tape, it reads the tape label file. If this file does not exist, you have to either initialize the tape or mount another tape.

The following tape label information is checked:

  • tape name
    If you have mounted a tape with an incorrect name, you get an error message. If a scratch tape was requested, you can mount any tape.
  • expiration period
    You get an error message if the requested expiration period (number of the days specified in the init.sap parameter expir_period that must have expired before the tape can be used again) has not ended yet.
  • tape use count
    You get a warning message (message BR235W) if the tape has been overwritten more frequently than specified in the init.sap parameter tape_use_count.

After the backup After a backup on tape is completed, the tape label is checked once more. This is to detect tape, tape device, driver or hardware errors that would prevent a successful backup and would not even output an error message.

The system checks whether the database name, the action ID and the function ID match the current values. This ensures that the first file (tape label) has been written to the tape successfully.

Tape Expiration Period
The following section provides some suggestions for setting the tape expiration period.

The tape expiration period is defined in days using the init.sap profile parameter expir_period.

Example:

expir_period = 2 means that writing on a tape is possible on the second day after the tape has been mounted and used. For example, if you use a tape on Monday, you cannot use it for another backup before Wednesday.

The start time of BRBACKUP/BRARCHIVE determines the first day of the lock for all tapes used for a backup, irrespective of when the tape label was written.

The lock period always expires at midnight (0.00 am) when the last day of the lock is reached.

If you set an expiration period of 0 days, this means that the tape is not locked. The tapes can be overwritten on the same day. Therefore, please do not set expir_period to zero.

SAP recommends an expiration period of at least 14 days, 28 days would be even better (the default value is 30 days).

The current value of the parameter expir_period is decisive for whether or not a tape is locked, not the value of the parameter during the backup. This means that the backup tapes are locked for n days after the last backup operation, n being the current value of the parameter. When the value of expir_period is changed, the expiration period is changed for all tapes.

Locking Tapes
**************
Tapes can be locked physically and logically.

Physical Lock
--------------
The tape generation date specified on the tape label is decisive for a physical lock. This generation date is determined when the tape label is written.

A tape is locked physically when the system checks the tape label and finds that the expiration period for the tape has not ended yet, i.e., the value of the current date is less than the total of the tape generation date stored in the tape label and the value of expir_period.

Logical Lock
------------
The internal information in the BRARCHIVE/BRBACKUP logs is decisive for a logical lock. The logs are updated when a database file has been backed up successfully.

A tape is locked logically when the automatic tape management system checks the tape and finds that the expiration period stored internally has not ended yet, i.e., the value of the current date is less than the total of the tape generation date stored in the BRBACKUP/BRARCHIVE logs and the value of expir_period.

Discrepancies between physical and logical locks may occur.

Example 1:

During a backup the tape label was written on the tape but the backup was terminated before the first database file could be written to the tape.

This means that the tape is locked physically but not logically. It is selected from the list by the automatic tape management system (volume_backup or volume_archive) but is rejected when the physical tape label check takes place.

The tape must be reinitialized, for example, using the call brbackup¦brarchive -i -v .

The parameter init.sap expir_period must temporarily be set to 0 to circumvent the physical lock. When using this procedure, you should not use the addition force since the use count number stored in the tape label would be lost afterwards.

Example 2:

A tape was reinitialized before the expiration period has ended. This means that the tape is no longer locked physically; however, it is not selected by the automatic tape management system because it is still locked logically.
If you want to use this tape neverthelesss (i.e., before the logical lock has expired), you have to switch off automatic tape management temporarily, for example, by calling brbackup¦brarchive -v SCRATCH.

Information about Used Tapes
----------------------------
Information about which tapes were already used is contained in the BRBACKUP/BRARCHIVE logs.
BRBACKUP and BRARCHIVE write two types of logs:

  • a file system log
  • a database log in the tables SDBAH and SDBAD

    File System Log
    There are two types of file system logs:
  • a detailed (complete) log, which is generated new for each BRBACKUP/BRARCHIVE run
  • a summary log which is extended by each BRBACKUP/BRARCHIVE run

These log files should include only information written by BRBACKUP/BRARCHIVE. You should not make any changes.

As basis for selecting free tapes by automatic tape management, BRBACKUP uses the database log, BRARCHIVE uses the file system summary log. BRARCHIVE cannot use the database logs because the program must be operable even when the database has been stopped.

Database Log
The database logs of BRBACKUP/BRARCHIVE are stored in the tables SDBAH and SDBAD.

SDBAH
-------
Table SDBAH contains information about the backup:

    • start time
    • end time
    • BRBACKUP/BRARCHIVE return code
    • BRBACKUP/BRARCHIVE action ID
      (encoded timestamp of file system log names))
    • BRBACKUP/BRARCHIVE function ID (extension of file system log names)

      SDBAD
      ------

Table SDBAD contains information about the backuped files:

    • file name
    • Oracle file ID or log group number
    • end time of the file backup
    • name of the tape on which the file was saved
    • position of the file on the tape
    • backup ID of an external backup utility
    • software compression rate
Table SDBAD also contains internal BRBACKUP information about compression rates and the backup duration for the individual database files.

The information in these tables is evaluated and obsolete entries are deleted by the Computer Center Management System.

This information may not be changed except by BRBACKUP/BRARCHIVE and the Computer Center Management System.

Key word: BRBACKUP

No comments:

Post a Comment