Nonstop Database, HiRDB Version 9 System Operation Guide

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

12.1.5 Example 2: Migrating table definition information and table data separately for each table

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) Use the pdrorg command to unload data for TABLE1
(4) Use the pdrels command to release RDAREA1 to RDAREA6 from shutdown status
(5) Create the control statements file for the pdexp command
(6) Use the pdexp command to export table definition information for TABLE1
(7) Store the unload data file and export file on a medium such as CMT
(8) Store the unload data file and export file in the target system
(9) Use the pddef command to define a schema for the user who owns TABLE1
(10) Swap the system log files
(11) Use pdcopy command to back up the data
(12) Use the pdexp command to import table definition information for TABLE1
(13) Use the pdhold command to shut down RDAREA1 to RDAREA6
(14) Create the control statements file for the pdload command
(15) Use the pdload command to reload data for TABLE1
(16) Swap the system log files
(17) Use the pdcopy command to back up the data
(18) 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 /pdrorg/unfile1
 

Explanation
Specifies the name of the unload data file.
(b) HiRDB parallel server configuration
 
unload bes1:/pdrorg/unfile1
 

Explanation
Specifies the name of the unload data file (for bes1)

(3) Use the pdrorg command to unload data for TABLE1

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

Explanation
-k: Specifies unld in order to unload data.
-W bin: Specifies that the unload data file is to be used as the input file (binary format) for the pdload command.
-g: Specifies that TABLE1 is a row-partitioned table on a server in a HiRDB parallel server configuration. A single unload data file is created.
-t: Specifies the name of the table that is to be unloaded.
/pdrorg/rorg01: Specifies the name of the control statements file for the pdrorg command created in step (2).

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

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

(5) Create the control statements file for the pdexp command

The following are the contents of the control statements file (/pdexp/exp01):

 
-t USR01.TABLE1
 

Explanation
USR01: Name of the schema that owns TABLE1.
TABLE1: Name of the table to be exported.

(6) Use the pdexp command to export table definition information for TABLE1

 
pdexp -e /pdexp/expfile1 -f /pdexp/exp01
 

Explanation
-e: Specifies the name of the file to be exported.
-f: Specifies the name of the control statements file for the pdexp command created in step (5).

(7) Store the unload data file and export file on a medium such as CMT

The unload data file created in step (3) and the export file created in step (6) are stored on a medium such as CMT.

The operations at the source system (HiRDB system A) are now complete.

(8) Store the unload data file and export file in the target system

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

The unload data file and export file stored on a medium such as CMT are copied into the target system.

(9) Use the pddef command to define a schema for the user who owns TABLE1

 
pddef
   CREATE SCHEMA AUTHORIZATION USR01;
 

(10) 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.

(11) Use pdcopy command to back up the 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
The RDAREAs are backed up as a safeguard in the event of errors during database migration. The following RDAREAs must be backed up:
  • Master directory RDAREA
  • Data directory RDAREA
  • Data dictionary RDAREAs
  • User RDAREAs and user LOB RDAREAs for storing the imported 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.

(12) Use the pdexp command to import table definition information for TABLE1

 
pdexp -i /pdexp/expfile1
 

Explanation
-i: Specifies the name of the file to be imported.

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

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

(14) 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 /pdrorg/unfile1                           1
idxwork /pdrorg/idxwork                          2
sort /sortwork                                   3
 

Explanation
  1. Specifies the name of the unload data file.
  2. Specifies the name of the directory in which to create an index information file. 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:/pdrorg/unfile1                     1
idxwork bes1 /pdrorg/idxwork                    2
sort bes1 /sortwork                             3
idxwork bes2 /pdrorg/idxwork                    4
sort bes2 /sortwork                             5
 

Explanation
  1. Specifies the name of the unload data file (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).

(15) Use the pdload command to reload data for TABLE1

 
pdload -b -W TABLE1 /pdload/load01
 

Explanation
To re-create the index (INDEX1) at the same time, the -i option is omitted and the index batch creation mode is used.
-b: Specifies that binary data is to be loaded.
-W: Specifies that binary format input data created by the pdrorg command is to be used.
TABLE1: Specifies the name of the table subject to data loading.
/pdload/load01: Specifies the name of the control statements file for the pdload command.

(16) 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.

(17) Use the pdcopy command to back up the 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 directory RDAREA
  • Data directory RDAREA
  • Data dictionary RDAREA
  • User RDAREAs and user LOB RDAREAs for storing the imported 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.

(18) 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.