- Defining a backup template
- Starting a backup
- Checking the progress of a backup while it is running
- Checking a backup after completion
Defining a backup template
At first a backup template (formerly known as backup medium) is required. You can define a template for a serial or a parallel backup. It's not necessary to specify all possible options while creating such a template. For a normal backup most additional options can be left at their default values and don't have to be specified. Please consider that there are differences in syntax depending on database version. The following examples are listed using database version 7.9 (Backing Up Databases).
You can easily define a backup template by using the command backup_template_create
.
Preconditions:
DBM session is available (Database Manager CLI), example database is named DB1
, operating system is Microsoft Windows, backup to file (create backup directories)
Create a template:
dbmcli on DB1> backup_template_create <backup_template> to <backup_destination> <backup_content>
Option | Meaning | Additional information |
---|---|---|
| defines the name of the template | up to 64 characters can be used |
| defines the type, path and the file name where the backup is written to | some other file option could also be defined here |
| defines the type of the backup | CONTENT DATA: complete data backup |
Create template d1 for data backup:
dbmcli on DB1> backup_template_create d1 to FILE C:\MaxDB\Backup\DAT0001 CONTENT DATA
Create template l1 for log backup:
dbmcli on DB1> backup_template_create l1 to FILE C:\MaxDB\Backup\LOG CONTENT LOG
Create a template md for a data backup using files in parallel:
dbmcli on DB1> backup_template_create md to FILE C:\MaxDB\Backup\DAT0001 NAMED b1 FILE C:\MaxDB\Backup\DAT0002 NAMED b2 CONTENT DATA
Please note:
Directories (like in this examples C:\MaxDB\Backup
won't be created automatically. So this has to be done before.
Log backups are only possible for types FILE and PIPE.
A parallel backup via a so defined template (using data carriers in parallel) is only possible for backup types DATA and INCREMENTAL.
For operating system Unix the only difference is the corresponding <location>
including the required permissions. Enter an absolute path beginning with /
.
For more information use DBM command explain
:
dbmcli on DB1> explain backup_template_create
Also refer to SAP MaxDB documentation version 7.9: backup_template_create
Starting a backup
Examples for starting a backup via the backup templates d1 and md:
Start backup via backup template d1:
dbmcli on DB1> db_connect
dbmcli on DB1> backup_start d1
Start parallel backup via backup template md:
dbmcli on DB1> db_connect
dbmcli on DB1> backup_start md
Please note:
It is not required to specify the type of the backup here. This information comes from the backup template definition. Remember that parallel backups are only possible for backup types DATA and INCREMENTAL. If you would like to create more than one data backup via the same backup template it is required to move the file (in the example above DAT0001
) after the first backup to another location or to change the file name within the backup template definition. Log backups will be serially numbered automatically. As long as function AUTOSAVE LOG is switched on no interactiv log backups can be started.
For more information use DBM command explain
:
dbmcli on DB1> explain backup_start
Also refer to SAP MaxDB documentation version 7.9: backup_start
Checking the progress of a backup while it is running
While the backup is running you can check the status as follows:
Precondition: A second DBM session is available.
Check progress of backup via template d1:
dbmcli on DB1> backup_state
Information of interest are for example return code, pages transferred, pages left.
For more information use DBM command explain
:
dbmcli on DB1> explain backup_state
Also refer to SAP MaxDB documentation version 7.9: backup_state
Checking a backup after completion
1. Review the output from command backup_start
after the backup was created.
2. Use DBM command medium_label
(in this example for the backup template d1
) to display the backup information :
dbmcli on DB1> medium_label d1
You get information about the last backup created via this backup template.
For more information use DBM command explain
:
dbmcli on DB1> explain medium_label
Also refer to SAP MaxDB documentation version 7.9: medium_label
3. Check the backup history using DBM command backup_history_list
:
dbmcli on DB1> backup_history_list -c label,action,pages,stop,media,error
The column error
shows if and what error occured.
For more information use DBM command explain
:
dbmcli on DB1> explain backup_history_list
Also refer to SAP MaxDB documenation version 7.9: backup_history_list
4. Check log files (for example KnlMsgArchive
) in the run directory of the database.
Evaluate run directory name using DBM command param_directget
:
dbmcli on DB1> param_directget RunDirectoryPath
In this file search for SAVE DATA
resp. SAVE LOG
. Here you find information about the backup and possible errors.
Also refer to SAP MaxDB Documentation version 7.9: param_directget, Log Files