Hitachi

Hitachi Advanced Database Setup and Operation Guide


10.3.3 Backup operation example (using OS commands)

This subsection provides an example of a backup operation using OS commands.

Organization of this subsection

(1) Directory configuration example

In this example, you will back up the following directories:

The following table lists and describes the configuration example of the preceding directories.

Table 10‒7: Configuration example of directories to be backed up

No.

Names of directories and files to be backed up

Description

File type

To be backed up?

1

/HADB/db/ADBDIC

Dictionary DB area file

Regular file

Y

2

/HADB/db/ADBMST

Master directory DB area file

Regular file

Y

3

/HADB/db/ADBSTBL

System-table DB area file

Regular file

Y

4

/HADB/db/ADBSYS

System directory

Regular file group

Y

5

/HADB/db/ADBWORK

Work directory

Regular file

N

6

/HADB/db/ADBWRK

Work table DB area file

Regular file

N

7

/HADB/db/ADBUTBL01#1

Data DB area file

Block special file

Y

8

/HADB/db/ADBUIDX01#1

Data DB area file

Block special file

Y

9

/HADB/db/SPOOL

Error information (core file) output destination file

Regular file group

N

10

/HADB/archive

Archive directory#2

Regular file

Y

11

/HADB/syndict

Directory for storing synonym dictionary files#3

Regular file

Y

12

/HADB/audit

Audit trail directory

Regular file

N

Legend:

Y: A backup is acquired.

N: A backup is not acquired.

#1

Assumed to consist of eight block special files.

#2

If an archivable multi-chunk table is defined, you need to back up the archive directory.

#3

If synonym search is performed, you need to back up the directory for storing synonym directory files.

(2) Using OS commands to make a backup

The following figure shows an example of using OS commands to back up a database.

Figure 10‒3: Example of using OS commands to make a backup

[Figure]

In this example, a backup is acquired in line with the following assumptions:

Conditions:
  • Following database initialization, the HADB server was started at least once.

  • It has been confirmed that there are no non-updatable base tables.

  • To suppress database updating, the HADB server is terminated normally.

  • A full backup is used.

  • The DB directory, archive directory, and the directory for storing synonym dictionary files are to be backed up.

Procedure:

  1. Suppress database updating.

    Before backing up the database, suppress database updating. Here, terminate the HADB server normally.

    adbstop
  2. Check the HADB server's status.

    Confirm that the HADB server terminated normally in step 1.

    adbls -d srv

    Confirm that the item STATUS in the execution result shows STOP.

  3. Back up directories (by copying them using OS commands).

    Use OS commands to copy all files that need to be backed up, as described in (1) Directory configuration example.

    • Copying destination for the files under the DB directory

      /HADB_bkup/db directory

    • Copying destination for the files under the archive directory

      /HADB_bkup/archive directory

    • Copying destination for the files under the directory storing synonym dictionary files

      /HADB_bkup/syndict directory

    The OS commands that you need to execute are listed below. We recommend that you use the cp command to back up regular files and the dd command to back up block special files.

    cp -r /HADB/db/ADBSYS  /HADB_bkup/db/ADBSYS
     
    cp -H /HADB/db/ADBMST  /HADB_bkup/db/ADBMST
     
    cp -H /HADB/db/ADBDIC  /HADB_bkup/db/ADBDIC
     
    cp -H /HADB/db/ADBSTBL /HADB_bkup/db/ADBSTBL
     
    dd if=/HADB/db/ADBUTBL01
       of=/HADB_bkup/db/ADBUTBL01 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00001
       of=/HADB_bkup/db/ADBUTBL01.00001 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00002
       of=/HADB_bkup/db/ADBUTBL01.00002 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00003
       of=/HADB_bkup/db/ADBUTBL01.00003 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00004
       of=/HADB_bkup/db/ADBUTBL01.00004 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00005
       of=/HADB_bkup/db/ADBUTBL01.00005 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00006
       of=/HADB_bkup/db/ADBUTBL01.00006 bs=524288
     
    dd if=/HADB/db/ADBUTBL01.00007
       of=/HADB_bkup/db/ADBUTBL01.00007 bs=524288
     
    dd if=/HADB/db/ADBUIDX01
       of=/HADB_bkup/db/ADBUIDX01 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00001
       of=/HADB_bkup/db/ADBUIDX01.00001 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00002
       of=/HADB_bkup/db/ADBUIDX01.00002 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00003
       of=/HADB_bkup/db/ADBUIDX01.00003 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00004
       of=/HADB_bkup/db/ADBUIDX01.00004 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00005
       of=/HADB_bkup/db/ADBUIDX01.00005 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00006
       of=/HADB_bkup/db/ADBUIDX01.00006 bs=524288
     
    dd if=/HADB/db/ADBUIDX01.00007
       of=/HADB_bkup/db/ADBUIDX01.00007 bs=524288
     
    cp -r /HADB/archive  /HADB_bkup/archive
     
    cp -r /HADB/syndict  /HADB_bkup/syndict
    Important

    The data size in block special files will become larger than its actual size because entire volumes are copied.

  4. Release the database from update suppression.

    Once you have used OS commands to make a backup, you can release the database from update suppression. Here, execute the following command to start the HADB server.

    adbstart

(3) Using OS commands to recover a database from a backup

The following figure shows an example of using OS commands to recover a database from a backup.

Figure 10‒4: Example of using OS commands to recover a database from a backup

[Figure]

Procedure:

  1. Terminate the HADB server.

    Before recovering a database from a backup, you must terminate the HADB server. Use the following command to terminate the HADB server.

    adbstop
  2. Recover the database from the backup (using OS commands to re-store files).

    Recover the database from the backup that was made.

    First, to delete the system logs before recovering the database from the backup, delete the system directory (/HADB/db/ADBSYS) located under the DB directory. Execute the following OS command:

    rm -r /HADB/db/ADBSYS

    Next, to delete the archive files that were created before recovering the database from the backup, delete the archive files under the archive directory. Execute the following OS command:

    rm -r /HADB/archive/*

    Next, delete the synonym dictionary files that were created before recovering the database from the backup. Execute the following OS command:

    rm -r /HADB/syndict/*

    Then, store again all files that were acquired in step 3. Back up directories (by copying them using OS commands) in (2) Using OS commands to make a backup.

    • Storing destination for the files under the DB directory for which a backup was made

      /HADB/db directory

    • Storing destination for the files under the archive directory for which a backup was made

      /HADB/archive directory

    • Storing destination for the files under the directory for storing synonym dictionary files for which a backup was made

      /HADB/syndict directory

    Execute the following OS commands:

    cp -r /HADB_bkup/db/ADBSYS  /HADB/db/ADBSYS
     
    cp -H /HADB_bkup/db/ADBMST  /HADB/db/ADBMST
     
    cp -H /HADB_bkup/db/ADBDIC  /HADB/db/ADBDIC
     
    cp -H /HADB_bkup/db/ADBSTBL /HADB/db/ADBSTBL
     
    dd if=/HADB_bkup/db/ADBUTBL01
       of=/HADB/db/ADBUTBL01 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00001
       of=/HADB/db/ADBUTBL01.00001 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00002
       of=/HADB/db/ADBUTBL01.00002 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00003
       of=/HADB/db/ADBUTBL01.00003 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00004
       of=/HADB/db/ADBUTBL01.00004 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00005
       of=/HADB/db/ADBUTBL01.00005 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00006
       of=/HADB/db/ADBUTBL01.00006 bs=524288
     
    dd if=/HADB_bkup/db/ADBUTBL01.00007
       of=/HADB/db/ADBUTBL01.00007 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01
       of=/HADB/db/ADBUIDX01 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00001
       of=/HADB/db/ADBUIDX01.00001 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00002
       of=/HADB/db/ADBUIDX01.00002 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00003
       of=/HADB/db/ADBUIDX01.00003 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00004
       of=/HADB/db/ADBUIDX01.00004 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00005
       of=/HADB/db/ADBUIDX01.00005 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00006
       of=/HADB/db/ADBUIDX01.00006 bs=524288
     
    dd if=/HADB_bkup/db/ADBUIDX01.00007
       of=/HADB/db/ADBUIDX01.00007 bs=524288
     
    cp -r /HADB_bkup/archive/*  /HADB/archive
     
    cp -r /HADB_bkup/syndict/*  /HADB/syndict
    Important

    When you recover the files under the DB directory from a backup, copy them into the DB directory (/HADB/db) by overwriting their contents. If you simply copy and store the backup files in an empty directory, database compatibility can no longer be maintained, and the validity of subsequent operations of the HADB server cannot be guaranteed.

  3. Start the HADB server.

    Once you have recovered the database from the backup that was made, start the HADB server. Execute the following command to start the HADB server:

    adbstart
  4. Check the HADB server's status.

    After you have started the HADB server, check whether the HADB server's operation mode is the normal mode. Execute the following command to check the HADB server's status:

    adbls -d srv

    Check the item STATUS in the execution result. If STATUS is ACTIVE, the operation mode is set to the normal mode.