Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

12.1.4 Example 1: Migrating table definition information and table data simultaneously

This example migrates a table (TABLE1) from HiRDB system A to HiRDB system B.

It is assumed that RDAREAs with the same names (RDAREA1 to RDAREA6) have already been created in the target system.

[Figure]

Organization of this subsection
(1) Enter the pdhold command to shut down RDAREA1 to RDAREA6
(2) Create the control statements file for the pdrorg command
(3) Enter the pdrorg command to export TABLE1
(4) Enter the pdrels command to release RDAREA1 to RDAREA6 from shutdown status
(5) Store the unload file for table migration on a medium such as CMT
(6) Store the unload file for table migration in the target system
(7) Enter the pddef command to define the schema for the user who executes import
(8) Swap the system log files
(9) Enter the pdcopy command to back up data
(10) Use the pdhold command to shut down RDAREA1 to RDAREA6
(11) Create the control statements file for the pdload command
(12) Use the pdload command to import TABLE1
(13) Swap the system log files
(14) Enter the pdcopy command to back up data
(15) Use the pdrels command to release RDAREA1 to RDAREA6 from shutdown status

(1) Enter the pdhold command to shut down RDAREA1 to RDAREA6

 
pdhold -r RDAREA1,RDAREA2,RDAREA3,RDAREA4,RDAREA5,RDAREA6
 

(2) Create the control statements file for the pdrorg command

The following are the contents of the control statements file (/pdrorg/rorg01).

(a) HiRDB single server configuration
 
unload /file/export_file
 

Explanation
Specifies the name of the unload file for table migration.
(b) HiRDB parallel server configuration
 
unload bes1:/file/export_file
 

Explanation
Specifies the name of the unload file for table migration for bes1. Since the -g option is assumed, unload files for table migration are created in one location.

(3) Enter the pdrorg command to export TABLE1

 
pdrorg -k unld -W bin -w -t TABLE1 /pdrorg/rorg01
 

Explanation
-k: Specifies unld in order to export (unload) TABLE1.
-W: Specifies bin -w to create an unload file for table migration.
-t: Specifies the name of the table to be exported.
/pdrorg/rorg01: Specifies the name of the control statements file for the pdrorg command created in step (2) above.

(4) Enter the pdrels command to release RDAREA1 to RDAREA6 from shutdown status

 
pdrels -r RDAREA1,RDAREA2,RDAREA3,RDAREA4,RDAREA5,RDAREA6
 

(5) Store the unload file for table migration on a medium such as CMT

The unload file for table migration created in step (3) is stored on a medium such as CMT.

The operations at the source system (HiRDB system A) have now been completed.

(6) Store the unload file for table migration in the target system

The operations from this point on are performed at the target system (HiRDB system B).

The unload file for table migration stored in a medium such as CMT is copied into the target system.

(7) Enter the pddef command to define the schema for the user who executes import

 
pddef
   CREATE SCHEMA AUTHORIZATION USR01;
 

(8) Swap the system log files

Before acquiring a backup, use the pdlogswap command to swap the system log files.

 
pdlogswap -d sys -w
 

Explanation
In the case of a HiRDB parallel server configuration, specify the -s option and execute the pdlogswap command for each server to be backed up.

(9) Enter the pdcopy command to back up data

 
pdcopy -m /rdarea/mast/mast01 -M r
-r RDMAST,RDDIR,RDDIC,RDAREA1,RDAREA2,RDAREA3,RDAREA4,RDAREA5,RDAREA6
-b /pdcopy/backup01 -p /pdcopy/list01
 

Explanation
Back up the RDAREAs as a safeguard against any errors that might occur during database migration. The following RDAREAs must be backed up:
  • Master directory RDAREA
  • Data directory RDAREA
  • Data dictionary RDAREA
  • User RDAREAs and user LOB RDAREAs for importing the table (RDAREA1 to RDAREA6)
-m: Specifies the name of the first HiRDB file in the master directory RDAREA.
-M: Specifies the backup acquisition mode.
-r: Specifies the names of the RDAREAs to be backed up.
-b: Specifies the name of the backup file.
-p: Specifies the output destination for the pdcopy command's processing results listing.
For details about how to back up data, see 6. Backup Procedures.

(10) Use the pdhold command to shut down RDAREA1 to RDAREA6

 
pdhold -r RDAREA1,RDAREA2,RDAREA3,RDAREA4,RDAREA5,RDAREA6
 

(11) Create the control statements file for the pdload command

The following are the contents of the control statements file (/pdload/load01).

(a) HiRDB single server configuration
 
source /file/export_file                         1
idxwork /idxwork                                 2
sort /sortwork                                   3
 

Explanation
  1. Specifies the name of the unload file for table migration.
  2. Specifies the name of the directory in which an index information file is to be created. The index information file is created under this directory.
  3. Specifies the name of the work directory for sorting.
(b) HiRDB parallel server configuration
 
source bes1:/file/export_file            1
idxwork bes1 /idxwork                    2
sort bes1 /sortwork                      3
idxwork bes2 /idxwork                    4
sort bes2 /sortwork                      5
 

Explanation
  1. Specifies the name of the unload file for table migration (for bes1).
  2. Specifies the name of the directory in which an index information file is to be created (for bes1). The index information file is created under this directory.
  3. Specifies the name of the work directory for sorting (for bes1).
  4. Specifies the name of the directory in which an index information file is to be created (for bes2). The index information file is created under this directory.
  5. Specifies the name of the work directory for sorting (for bes2).

(12) Use the pdload command to import TABLE1

 
pdload -b -W -w all TABLE1 /pdload/load01
 

Explanation
Because an index (INDEX1) is re-created simultaneously, the -i option is omitted and indexes are created in batch index creation mode.
-b: Specifies -W -w to input the unload file for table migration. Also, all is specified to import the table definition information and the table data simultaneously.
/pdload/load01: Specifies the name of the control statements file for the pdload command created in step (11).

During this process, if the endian formats differ between the source system and the target system, the endian format is converted during import. For details about the actions to take when an error occurs during import, see 12.1.10 Actions to take when an error occurs during import.

(13) Swap the system log files

Before you acquire a backup, use the pdlogswap command to swap the system log files.

 
pdlogswap -d sys -w
 

Explanation
In the case of a HiRDB parallel server configuration, specify the -s option and execute the pdlogswap command for each server to be backed up.

(14) Enter the pdcopy command to back up data

 
pdcopy -m /rdarea/mast/mast01 -M r
-r RDMAST,RDDIR,RDDIC,RDAREA1,RDAREA2,RDAREA3,RDAREA4,RDAREA5,RDAREA6
-b /pdcopy/backup02 -p /pdcopy/list02
 

Explanation
The following RDAREAs must be backed up:
  • Master dictionary RDAREA
  • Data directory RDAREA
  • Data dictionary RDAREA
  • User RDAREAs and user LOB RDAREAs for importing the table (RDAREA1 to RDAREA6)
-m: Specifies the name of the first HiRDB file in the master directory RDAREA.
-M: Specifies the backup acquisition mode.
-r: Specifies the names of the RDAREAs to be backed up.
-b: Specifies the name of the backup file.
-p: Specifies the output destination for the pdcopy command's processing results listing.
For details about how to back up data, see 6. Backup Procedures.

(15) Use the pdrels command to release RDAREA1 to RDAREA6 from shutdown status

 
pdrels -r RDAREA1,RDAREA2,RDAREA3,RDAREA4,RDAREA5,RDAREA6
 

We recommend that after the command has executed you check whether the execution results are correct. For details about how to check command execution results, see the manual HiRDB Version 9 Command Reference.