16.8.3 Backup operation example (using OS commands)
This subsection provides an example of a backup operation using OS commands (an operation example for acquiring a full backup).
- Organization of this subsection
(1) System configuration examples
In the multi-node configuration consisting of three nodes (hadb01, hadb02, and hadb03), the master node is set as hadb01. The DB directory, the archive directory, the directory for storing synonym dictionary files, and the audit trail directory have the following directory structures:
■ Directory structure of hadb01
-
DB directory configuration
/HADB/db ADBDIC ... Block special file (10 MB in size) ADBMST ... Block special file (512 MB in size) ADBSTBL ... Block special file (512 MB in size) ADBWORK ... Directory on the local file system ADBWRK ... Block special file (2 GB in size) ADBUTBL01 ... Block special file (4 GB in size) ADBUIDX01 ... Block special file (2 GB in size) SPOOL ... Directory on the local file system ADBSYS ... System directory
-
Archive directory structure
/HADB/archive
The archive directory is created when defining an archivable multi-chunk table.
-
Synonym dictionary file storage directory structure
/mnt/syndict
The synonym dictionary file storage directory is created in environments where synonym searches will be performed.
-
Audit trail directory structure
/HADB/audit
The audit trail directory is created in environments where the audit trail facility is used.
■ Directory structure of hadb02
-
DB directory configuration
/HADB/db ADBDIC ... Block special file ADBMST ... Block special file ADBSTBL ... Block special file ADBWORK ... Directory on the local file system ADBWRK ... Block special file ADBUTBL01 ... Block special file ADBUIDX01 ... Block special file SPOOL ... Directory on the local file system ADBSYS ... Mount point to the file system of the system directory
-
Archive directory structure
/HADB/archive
The archive directory is created when defining an archivable multi-chunk table.
-
File system mount point for synonym dictionary file storage directory
/mnt/syndict
The synonym dictionary file storage directory is created in environments where synonym searches will be performed.
-
Audit trail directory structure
/HADB/audit
The audit trail directory is created in environments where the audit trail facility is used.
■ Directory structure of hadb03
-
DB directory configuration
/HADB/db ADBDIC ... Block special file ADBMST ... Block special file ADBSTBL ... Block special file ADBWORK ... Directory on the local file system ADBWRK ... Block special file ADBUTBL01 ... Block special file ADBUIDX01 ... Block special file SPOOL ... Directory on the local file system ADBSYS ... Mount point to the file system of the system directory
-
Archive directory structure
/HADB/archive
The archive directory is created when defining an archivable multi-chunk table.
-
File system mount point for synonym dictionary file storage directory
/mnt/syndict
The synonym dictionary file storage directory is created in environments where synonym searches will be performed.
-
Audit trail directory structure
/HADB/audit
The audit trail directory is created in environments where the audit trail facility is used.
(2) Making a backup
The following shows the procedure for using OS commands to back up a database.
Procedure:
-
Terminate the HADB servers in the multi-node configuration.#1
adbstop KFAA90000-I adbstop processing started. KFAA91154-I The HADB system was terminated normally. KFAA90001-I adbstop processing ended. (return code = 0) monend
After normally terminating the HADB servers on all nodes by executing the adbstop command on master node hadb01, execute HA Monitor's monend command.
-
Use OS commands to make a backup.
Back up the following directories by executing the OS's cp and dd commands on the master node hadb01:
-
Backing up the DB directory
cp -r /HADB/db/ADBSYS /HADB_bkup/db/ADBSYS dd if=/HADB/db/ADBMST of=/HADB_bkup/db/ADBMST bs=524288 dd if=/HADB/db/ADBDIC of=/HADB_bkup/db/ADBDIC bs=524288 dd if=/HADB/db/ADBSTBL of=/HADB_bkup/db/ADBSTBL bs=524288 dd if=/HADB/db/ADBUTBL01 of=/HADB_bkup/db/ADBUTBL01 bs=524288 dd if=/HADB/db/ADBUIDX01 of=/HADB_bkup/db/ADBUIDX01 bs=524288
The backup data is stored in the /HADB_bkup/db directory.
If the system directory is not mounted in $DBDIR/ADBSYS, mount it by executing the operating system's mount command.
When data in a block special file is backed up, the size of the backup will be larger than the actual size of the data being used because the entire volume is copied.
-
Backing up the archive directory
cp -r /HADB/archive /HADB_bkup/archive
If an archivable multi-chunk table is defined, you need to back up the archive directory.
If the archive directory was created on an NFS server, you do not need to back up the archive directory on slave nodes.
-
Backing up the directory for storing synonym dictionary files
cp -r /mnt/syndict /HADB_bkup/syndict
In environments where synonym searches are used, you need to back up the directory for storing synonym dictionary files.
- Note
-
Because the audit trail files in the audit trail directory are regularly moved to the audit trail storage directory, you do not need to back up the audit trail directory.
-
-
Start the HADB servers in the multi-node configuration.#2
adbstart
On all nodes from hadb01 to hadb03, execute the adbstart command and the HA Monitor monbegin command. After executing the adbstart command, execute the HA Monitor monbegin command from another terminal (command input screen).
- Important
-
Execute the monbegin command before the adbstart command terminates.
monbegin
- #1
-
Instead of step 1, you can perform the following process:
Execute the adbchgsrvmode command on master node hadb01 to change the HADB server operation mode of the master node to the quiescence mode.
adbchgsrvmode --quiescence
- #2
-
If the process described in footnote 1 is performed in step 1, execute the adbchgsrvmode command on master node hadb01 to change the HADB server operation mode of the master node to the normal mode.
adbchgsrvmode --normal
(3) Recovering the database from a backup
The following shows the procedure for recovering the database from a backup.
Procedure:
-
Terminate the HADB servers in the multi-node configuration.
adbstop KFAA90000-I adbstop processing started. KFAA91154-I The HADB system was terminated normally. KFAA90001-I adbstop processing ended. (return code = 0) monend
After normally terminating the HADB servers on all nodes by executing the adbstop command on master node hadb01, execute HA Monitor's monend command.
-
Use OS commands to recover the database.
Recover the following directories from the backup by executing the OS's cp and dd commands on the master node hadb01:
-
Recovering the DB directory
cp -r /HADB_bkup/db/ADBSYS /HADB/db/ADBSYS dd if=/HADB_bkup/db/ADBMST of=/HADB/db/ADBMST bs=524288 dd if=/HADB_bkup/db/ADBDIC of=/HADB/db/ADBDIC bs=524288 dd if=/HADB_bkup/db/ADBSTBL of=/HADB/db/ADBSTBL bs=524288 dd if=/HADB_bkup/db/ADBUTBL01 of=/HADB/db/ADBUTBL01 bs=524288 dd if=/HADB_bkup/db/ADBUIDX01 of=/HADB/db/ADBUIDX01 bs=524288
The backup file is stored in the directory /HADB_bkup/db.
If the system directory is not mounted in $DBDIR/ADBSYS, mount it by executing the operating system's mount command.
-
Recovering the archive directory
rm -r /HADB/archive/* cp -r /HADB_bkup/archive/* /HADB/archive
If an archivable multi-chunk table is defined, you need to recover the archive directory.
If the archive directory was created on an NFS server, you do not need to recover the archive directory on slave nodes.
-
Recovering the directory for storing synonym dictionary files
rm -r /mnt/syndict/* cp -r /HADB_bkup/syndict/* /mnt/syndict
In environments where synonym searches are used, you need to recover the directory for storing synonym dictionary files.
-
-
Start the HADB servers in the multi-node configuration.
adbstart
On all nodes from hadb01 to hadb03, execute the adbstart command and the HA Monitor monbegin command. After executing the adbstart command, execute the HA Monitor monbegin command from another terminal (command input screen).
- Important
-
Execute the monbegin command before the adbstart command terminates.
monbegin
After the HADB servers in the multi-node configuration start, if the HADB server operation mode of the master node is the quiescence mode, execute the adbchgsrvmode command on master node hadb01 to change the HADB server operation mode of the master node to the normal mode.
adbchgsrvmode --normal
-
Synchronize the synonym dictionary files.
adbsyndict -s
Execute the adbsyndict command on the master node hadb01 to synchronize the synonym dictionary files. This step is only required in environments that use synonym searches.