Hitachi

Hitachi Advanced Database Setup and Operation Guide


16.17.2 Notes on executing the adbinit command when adding nodes

When adding a node, you execute the adbinit command on the node you are adding, but you might not be able to use the initialization options used on other nodes as is. If you have changed the configuration of the DB area, you need to apply those changes to the specifications in the initialization options, and execute the adbinit command. Therefore, you need to apply the information that differs due to the changes to the configuration of the DB area, to the initialization options used on the slave nodes. If you cannot do that, create initialization options according to the procedure explained in this section.

The overall flow of the procedure explained in this section is as follows: First execute the command to extract the current DB area information to a file. Edit that file to create the initialization options.

Important
  • In this explanation, $DBDIR means the DB directory. When actually executing the command, specify the DB directory path.

  • Execute the following procedure on the master node.

Organization of this subsection

(1) Creating the base for the initialization options

echo "set adb_init_mst_blk_path = \"$(ls -l $DBDIR/ADBMST \
| sed -e 's/.*ADBMST ->/ADBMST ->/g' | awk '{print $3}')\"" >adbinit.opt

Execute the preceding command, and create the base of the initialization option file (adbinit.opt file). In this example, the adbinit.opt file is created in the current directory.

When you execute the preceding command, the following adbinit.opt file is created:

▪ Content of the adbinit.opt file at this point

set adb_init_mst_blk_path = "/dev/disk/by-id/wwn-0x60....93bc"

(2) Add information such as the adbinitdbarea operand to the adbinit.opt file

adbdbstatus -d used | grep Used | awk -F',' '{print $3, $9}' | uniq \
| awk '{print $1, $2}' \
| sed -e 's/DBarea_name DBarea_filename/set adb_init_dbarea_initialize = N/g' \
      -e 's/\"ADBDIC\"/set adb_init_dic_blk_path =/g' \
      -e 's/\"ADBSTBL\"/set adb_init_stbl_blk_path =/g' \
| sed -e 's/^\"\(.*\)\" \"\(.*\)\"/adbinitdbarea -n \\\"\1\\\" -i 0K,x -v \2,\\/g' \
>>adbinit.opt

When you execute the preceding adbdbstatus command, information such as the adbinitdbarea operand is added to the adbinit.opt file you created in (1). When you execute the preceding command, the adbinit.opt file is created in a somewhat organized state, which can save trouble in editing the adbinit.opt file from (3) onward.

▪ Content of the adbinit.opt file at this point

set adb_init_mst_blk_path = "/dev/disk/by-id/wwn-0x60....93bc"
set adb_init_dbarea_initialize = N                                             ...1
set adb_init_dic_blk_path = "/dev/disk/by-id/wwn-0x60....e259"                 ...2
set adb_init_stbl_blk_path = "/dev/disk/by-id/wwn-0x60....311b"                ...3
adbinitdbarea -n \"DBAREA1\" -i 0K,x -v "/dev/disk/by-id/wwn-0x60....0000",\   ...4
adbinitdbarea -n \"DBAREA1\" -i 0K,x -v "/dev/disk/by-id/wwn-0x60....0001",\   ...5
adbinitdbarea -n \"NEWAREA1\" -i 0K,x -v "/dev/disk/by-id/wwn-0x60....0400",\  ...6
adbinitdbarea -n \"NEWAREA1\" -i 0K,x -v "/dev/disk/by-id/wwn-0x60....0401",\  ...7
adbinitdbarea -n \"NEWAREA1\" -i 0K,x -v "/dev/disk/by-id/wwn-0x60....0402",\  ...8

The preceding operands 1-8 are added.

(3) Correcting the content of the adbinit.opt file

Open the adbinit.opt file in a text editor, and correct the specifications in the initialization options. For information about specifying the initialization options, see Format of initialization options in Specification format for the adbinit command in adbinit (Initialize the Database) in the manual HADB Command Reference.

In this example, you need to correct the specified options for the adbinitdbarea operand.

[Figure]

[Explanation]

Specify the adbinitdbarea operand as follows:

  • If any rows contain duplicate DB area names in the -n option of the adbinitdbarea operand

    Perform steps 1-3 in the preceding figure.

  • If no rows contain duplicate DB area names in the -n option of the adbinitdbarea operand

    Perform steps 1 and 3 in the preceding figure.

The numbers in the following explanation correspond to the numbers in the preceding figure:

  1. Change the specified number of files in the -i option, from x to the number of duplicate rows. In this example, the value is changed to 2 and 3.

  2. Delete the enclosed specifications.

  3. Delete the final ",\" at the end of each duplicate row.

▪ Content of the adbinit.opt file after correction

set adb_init_mst_blk_path = "/dev/disk/by-id/wwn-0x60....93bc"
set adb_init_dbarea_initialize = N
set adb_init_dic_blk_path = "/dev/disk/by-id/wwn-0x60....e259"
set adb_init_stbl_blk_path = "/dev/disk/by-id/wwn-0x60....311b"
adbinitdbarea -n \"DBAREA1\" -i 0K,2 -v "/dev/disk/by-id/wwn-0x60....0000",\
                                        "/dev/disk/by-id/wwn-0x60....0001"   
adbinitdbarea -n \"NEWAREA1\" -i 0K,3 -v "/dev/disk/by-id/wwn-0x60....0400",\
                                         "/dev/disk/by-id/wwn-0x60....0401",\
                                         "/dev/disk/by-id/wwn-0x60....0402"   

The preceding enclosed areas are corrected.

(4) Checking the files immediately under the DB directory

If you are storing any symbolic links to a DB area file in a subdirectory of the DB directory, you need to add a specification of the -f option to the adbinitdbarea operand that specifies that DB area's information. In this case, perform the following procedure:

ls $DBDIR

▪ Example display of the execution results

ADBDIC  ADBMST  ADBSTBL  ADBSYS  ADBWORK  ADBWRK  AREAS  DBAREA1  DBAREA1.00001  SPOOL

Use the OS ls command to display the list of files immediately under the DB directory. Check whether there are any files with the same name as the DB area.

In the preceding example, there is a file called DBAREA1, but not NEWAREA1. Therefore, you need to add the -f option to the adbinitdbarea operand that specifies NEWAREA1.

(5) Investigating the directory storing NEWAREA1

find $DBDIR -name NEWAREA1 2>/dev/null

Execute the preceding command to investigate the storage directory in the DB directory of the DB area file NEWAREA1.

▪ Example display of the execution results

$DBDIR/AREAS/NEW/NEWAREA1      ...1
$DBDIR/AREAS/OLD/NEWAREA1      ...2

In the following explanation, 1 denotes file 1, and 2 denotes file 2.

If multiple files with the same name but different paths are displayed as in the preceding example, you need to investigate the link destinations by using the OS ls command.

(6) Checking the link destination for file 1

ls -l $DBDIR/AREAS/NEW/NEWAREA1* | sed -e 's/.* -> //g'

Execute the OS ls -l command to check the link destination for file 1.

▪ Example display of the execution results

/dev/disk/by-id/wwn-0x60....0400
/dev/disk/by-id/wwn-0x60....0401
/dev/disk/by-id/wwn-0x60....0402

The preceding three links' destinations match the content of the adbinit.opt file.

Content of the adbinit.opt file

adbinitdbarea -n \"NEWAREA1\" -i 0K,3 -v "/dev/disk/by-id/wwn-0x60....0400",\
                                         "/dev/disk/by-id/wwn-0x60....0401",\
                                         "/dev/disk/by-id/wwn-0x60....0402"

(7) Checking the link destination for file 2

ls -l $DBDIR/AREAS/OLD/NEWAREA1* | sed -e 's/.* -> //g'

Execute the OS ls -l command to check the link destination for file 2.

▪ Example display of the execution results

/dev/disk/by-id/wwn-0x60....a000

The preceding link's destination does not match the content of the adbinit.opt file.

(8) Correcting the specifications in the initialization options

Based on the results of checking (6) and (7), we can see that file 1 corresponds to the adbinit.opt file.

Among the path names of file 1, add the following underlined part to the specification in the -f option:

$DBDIR/AREAS/NEW/NEWAREA1

In the preceding example, the -f option is added as follows:

-f \"AREAS/NEW/\"

Content of the adbinit.opt file after correction

set adb_init_mst_blk_path = "/dev/disk/by-id/wwn-0x60....93bc"
set adb_init_dbarea_initialize = N
set adb_init_dic_blk_path = "/dev/disk/by-id/wwn-0x60....e259"
set adb_init_stbl_blk_path = "/dev/disk/by-id/wwn-0x60....311b"
adbinitdbarea -n \"DBAREA1\" -i 0K,2 -v "/dev/disk/by-id/wwn-0x60....0000",\
                                        "/dev/disk/by-id/wwn-0x60....0001"
adbinitdbarea -n \"NEWAREA1\" -f \"AREAS/NEW/\" -i 0K,3\
              -v "/dev/disk/by-id/wwn-0x60....0400",\
                 "/dev/disk/by-id/wwn-0x60....0401",\
                 "/dev/disk/by-id/wwn-0x60....0402"

Add the underlined part in the preceding commands.

(9) Adding operands relating to the work table DB area

Add the following operands as necessary:

In the adb_init_wrk_blk_path operand, specify the block special file name of the work table DB area file to be assigned to each node. For details, see (4) Creating a DB directory on each slave node in 16.3.8 Creating a database.

With the preceding steps, correction of the initialization options is now complete. When adding a node, use the initialization options you created here to execute the adbinit command.