Hitachi

Hitachi Advanced Database Setup and Operation Guide


11.4.12 Changing the chunk status

To change the chunk status, execute the adbchgchunkstatus command. For details about the adbchgchunkstatus command, see adbchgchunkstatus (Change Chunk Status) in the manual HADB Command Reference. For details about chunk statuses, see (4) Changing the chunk status in 2.14.2 Managing data in data-import units (chunks).

By executing the adbchgchunkstatus command, you can make the following types of chunk status changes:

Important
Note
Organization of this subsection

(1) Using the adbchgchunkstatus command to change the status of a chunk

The following is the procedure for using the adbchgchunkstatus command to change the status of a chunk.

■ Procedure for changing the status of a chunk

  1. Determine the chunk ID of the chunk whose status you want to change.

    Determine the chunk ID of the chunk whose status you want to change by following the instructions in (13) Checking for chunks in normal status or (14) Checking for chunks in wait status under C.9 Searching system tables.

  2. Use the adbchgchunkstatus command to change the status of the chunk.

    Based on the chunk ID that you determined in step 1, use the adbchgchunkstatus command to change the status of the chunk. Specification examples of the adbchgchunkstatus command follow.

    Specification example 1 (Changing a chunk in wait status to a chunk in normal status)

    An HADB user (ADBUSER01) changes a chunk in wait status (whose chunk ID is 1) in a shop table (SHOPSLIST) to a chunk in normal status.

    adbchgchunkstatus -u ADBUSER01 -p '#HelloHADB_01'
                      -n 1 SHOPSLIST
    Important

    If there are a large number of chunks in wait status, reduce the number of chunks by merging them before changing their status. If the number of chunks in normal status becomes large, retrieval performance might decline. To merge chunks, see 11.4.9 Merging chunks (to reduce the number of chunks).

    Specification example 2 (Changing a chunk in normal status to a chunk in wait status)

    An HADB user (ADBUSER01) changes a chunk in normal status (whose chunk ID is 2) in a shop table (SHOPSLIST) to a chunk in wait status.

    adbchgchunkstatus -u ADBUSER01  -p '#HelloHADB_01'
                      -w 2 SHOPSLIST

This changes the chunk status.

Note that changing the status of a chunk might result in swapping of the current chunk. For details, see (3) Swapping of the current chunk as a result of a chunk status change. As a result of changing the status of a chunk, if swapping of the current chunk occurs, you can make the chunk that was previously the current chunk the current chunk again. For details about the procedure, see (4) Operational example (replacing the data in a chunk).

(2) Relationship of chunk statuses with SQL statements and commands that can be executed

Depending on the status of a chunk, the SQL statements and commands that can be executed on the data contained in the chunk vary. The following two tables show the relationship of chunk statuses with SQL statements and commands that can be executed.

Table 11‒4: Relationship of chunk statuses with SQL statements and commands that can be executed (for chunks that are not in archived state)

No.

SQL statement or command to be executed

Chunk status

Normal status

Wait status

Delete-pending status

1

SELECT statement

Y

N

N

2

INSERT statement

Y

N

N

3

UPDATE statement

Y

N

N

4

DELETE statement

Y

N

N

5

PURGE CHUNK statement

Y

Y

Y

6

TRUNCATE TABLE statement

Y

Y

Y

7

adbstart command

(for pre-reading of range indexes)

Y

Y

N

8

adbsql command

Y

R#1

N

9

adbmergechunk command

R#2

R#3

N

10

adbexport command

Y

R#4

N

11

adbidxrebuild command

Y

Y#5

N

12

adbdbstatus command

(for referencing chunk information)

Y

Y

Y

13

adbchgchunkcomment command

Y

Y

Y

14

adbchgchunkstatus command

Y

Y

N

15

adbarchivechunk command

Y

R#6

N

16

adbunarchivechunk command

N

N

N

Legend:

Y: Can be executed.

R: Can be executed, but with some restrictions.

N: Cannot be executed.

#1

Only the subcommands #GETDATA and #GETCOUNT of the adbsql command can be executed.

#2

You can merge multiple chunks that are in normal status and not in archived state, with a chunk that is in normal status and not in archived state. You cannot merge other types of chunks.

#3

You can merge multiple chunks that are in wait status and not in archived state with a chunk that is in wait status and not in archived state. You cannot merge other types of chunks.

#4

Only retrieval using the adbexport command with the -c option specified can be executed.

#5

Indexes contained in a chunk in wait status are also rebuilt.

#6

Chunks in wait status that were never in normal status cannot be placed into archived state.

Table 11‒5: Relationship of chunk statuses with SQL statements and commands that can be executed (for archived chunks)

No.

SQL statement or command to be executed

Chunk status

Normal status

Wait status

Delete-pending status

1

SELECT statement

Y

N

N

2

INSERT statement

N

N

N

3

UPDATE statement

N

N

N

4

DELETE statement

N

N

N

5

PURGE CHUNK statement

Y

Y

Y

6

TRUNCATE TABLE statement

Y

Y

Y

7

adbstart command

(for pre-reading of range indexes)

N#1

N#1

N#1

8

adbsql command

Y

R#2

N

9

adbmergechunk command

R#3

R#4

N

10

adbexport command

Y

R#5

N

11

adbidxrebuild command

N#6

N#6

N#6

12

adbdbstatus command

(for referencing chunk information)

Y

Y

Y

13

adbchgchunkcomment command

Y

Y

Y

14

adbchgchunkstatus command

Y

Y

N

15

adbarchivechunk command

N

N

N

16

adbunarchivechunk command

Y

Y

N

Legend:

Y: Can be executed.

R: Can be executed, but with some restrictions.

N: Cannot be executed.

#1

No index exists in data in an archived chunk. Therefore, you cannot use the adbstart command to perform pre-reading of range indexes.

#2

Only the subcommands #GETDATA and #GETCOUNT of the adbsql command can be executed.

#3

You can merge multiple archived chunks that are in normal status with an archived chunk that is in normal status. You cannot merge other types of chunks.

#4

You can merge multiple archived chunks that are in wait status with an archived chunk that is in wait status. You cannot merge other types of chunks.

#5

Only retrieval using the adbexport command with the -c option specified can be executed.

#6

No index exists in data in an archived chunk. Therefore, you cannot use the adbidxrebuild command to perform index rebuild.

(3) Swapping of the current chunk as a result of a chunk status change

When the status of a chunk is changed by the adbchgchunkstatus command, the current chunk might be swapped, depending on the type of chunk whose status is being changed and the content of the status-changing process. Furthermore, the information that is set for the chunk creation date and time in the system table STATUS_CHUNKS differs from the information that is set for the date and time when the current chunk was swapped.

Note

For details about the system table STATUS_CHUNKS, see C.5 Content of STATUS_CHUNKS.

The following table shows the details.

Table 11‒6: Execution conditions for changing the chunk status

Type of chunk whose status is being changed and the content of the status-changing process

Change to a chunk in normal status

None

Chunk in wait status that was in normal status in the past#1

Chunk in wait status that was never in normal status in the past#2

Chunk in wait status that was in normal status in the past #1, and chunk in wait status that was never in normal status in the past#2

Change to a chunk in wait status

None

--

(a)

(b)

(c)

Chunk in normal status that is not the current chunk

(d)

(e)

(f)

(g)

Chunk in normal status that is the current chunk

(h)

(i)

(j)

(k)

Current chunk and a chunk in normal status that is not the current chunk

(l)

(m)

(n)

(o)

Legend:

--: Not applicable.

#1

This is a chunk in wait status for which the chunk creation date and time and the date and time when the current chunk was swapped are set.

#2

This is a chunk in wait status for which the chunk creation date and time and the date and time when the current chunk was swapped are not set.

■ Detailed explanation of (a) through (o)

For details about (a) to (o) in the preceding table, see (a) adbchgchunkstatus command execution example 1 to (o) adbchgchunkstatus command execution example 15.

In each execution example, the adbchgchunkstatus command is executed on the chunks shown in the following figure.

Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command

[Figure]

(a) adbchgchunkstatus command execution example 1

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (a) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒10: Execution of the adbchgchunkstatus command under condition (a)

[Figure]

Explanation

Chunks in wait status that were in normal status in the past (chunks 3 and 4) are changed to chunks in normal status.

■ Processing results when the adbchgchunkstatus command is executed under condition (a)

Current chunk

Not swapped.

Chunk creation date and time

Not set.

Date and time when the current chunk was swapped

Not set.

(b) adbchgchunkstatus command execution example 2

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (b) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒11: Execution of the adbchgchunkstatus command under condition (b)

[Figure]

Explanation

Chunks in wait status that were never in normal status (chunks 6 and 7) are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Furthermore, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (b)

Current chunk

Swapped to one of the chunks in wait status that was never in normal status, and which has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The chunk in wait status that was specified for the -n option of the adbchgchunkstatus command

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and which did not become the current chunk

  • The chunk that was the current chunk before the swap

(c) adbchgchunkstatus command execution example 3

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (c) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒12: Execution of the adbchgchunkstatus command under condition (c)

[Figure]

Explanation

Chunks in wait status that were in normal status in the past (chunks 3 and 4) and chunks in wait status that were never in normal status (chunks 6 and 7) are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Further, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (c)

Current chunk

This is swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, that did not become the current chunk, and that was never in normal status in the past

  • The chunk that was the current chunk before the swap

(d) adbchgchunkstatus command execution example 4

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (d) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒13: Execution of the adbchgchunkstatus command under condition (d)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) are changed to chunks in wait status.

■ Processing results when the adbchgchunkstatus command is executed under condition (d)

Current chunk

Not swapped.

Chunk creation date and time

Not set.

Date and time when the current chunk was swapped

Not set.

(e) adbchgchunkstatus command execution example 5

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (e) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒14: Execution of the adbchgchunkstatus command under condition (e)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) are changed to chunks in wait status. Additionally, chunks in wait status that were in normal status in the past (chunks 3 and 4) are changed to chunks in normal status.

■ Processing results when the adbchgchunkstatus command is executed under condition (e)

Current chunk

Not swapped.

Chunk creation date and time

Not set.

Date and time when the current chunk was swapped

Not set.

(f) adbchgchunkstatus command execution example 6

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (f) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒15: Execution of the adbchgchunkstatus command under condition (f)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) are changed to chunks in wait status. Additionally, chunks in wait status that were never in normal status (chunks 6 and 7) are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Further, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (f)

Current chunk

Swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that did not become the current chunk and was never in normal status in the past

  • The chunk that was the current chunk before the swap

(g) adbchgchunkstatus command execution example 7

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (g) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒16: Execution of the adbchgchunkstatus command under condition (g)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) are changed to chunks in wait status. Additionally, chunks in wait status that were in normal status in the past (chunks 3 and 4), as well as chunks in wait status that were never in normal status (chunks 6 and 7), are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Further, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (g)

Current chunk

This is swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that did not become the current chunk and was never in normal status in the past

  • The chunk that was the current chunk before the swap

(h) adbchgchunkstatus command execution example 8

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (h) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒17: Execution of the adbchgchunkstatus command under condition (h)

[Figure]

Explanation

The current chunk (chunk 5) is changed to a chunk in wait status.

During this process, a new chunk is created and the current chunk is swapped (to chunk 8). Additionally, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (h)

Current chunk

A new chunk is created, and that chunk becomes the current chunk.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The newly-created chunk

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The chunk that was the current chunk before the swap

(i) adbchgchunkstatus command execution example 9

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (i) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒18: Execution of the adbchgchunkstatus command under condition (i)

[Figure]

Explanation

The current chunk (chunk 5) is changed to a chunk in wait status. Additionally, chunks in wait status that were in normal status in the past (chunks 3 and 4) are changed to chunks in normal status.

During this process, a new chunk is created, and the current chunk is swapped (to chunk 8). Additionally, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (i)

Current chunk

A new chunk is created, and that chunk becomes the current chunk.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The newly-created chunk

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The chunk that was the current chunk before the swap

(j) adbchgchunkstatus command execution example 10

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (j) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒19: Execution of the adbchgchunkstatus command under condition (j)

[Figure]

Explanation

The current chunk (chunk 5) is changed to a chunk in wait status. Additionally, chunks in wait status that were never in normal status (chunks 6 and 7) are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Additionally, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (j)

Current chunk

This is swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that did not become the current chunk and was never in normal status in the past

  • The chunk that was the current chunk before the swap

(k) adbchgchunkstatus command execution example 11

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (k) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒20: Execution of the adbchgchunkstatus command under condition (k)

[Figure]

Explanation

The current chunk (chunk 5) is changed to a chunk in wait status. Additionally, chunks in wait status that were in normal status in the past (chunks 3 and 4), as well as chunks in wait status that were never in normal status (chunks 6 and 7), are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Additionally, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (k)

Current chunk

Swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that did not become the current chunk and was never in normal status in the past

  • The chunk that was the current chunk before the swap

(l) adbchgchunkstatus command execution example 12

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (l) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒21: Execution of the adbchgchunkstatus command under condition (l)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) and the current chunk (chunk 5) are changed to chunks in wait status.

During this process, a new chunk is created, and the current chunk is swapped (to chunk 8). Additionally, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (l)

Current chunk

A new chunk is created and that chunk becomes the current chunk.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The newly created chunk

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The chunk that was the current chunk before the swap

(m) adbchgchunkstatus command execution example 13

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (m) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒22: Execution of the adbchgchunkstatus command under condition (m)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) and the current chunk (chunk 5) are changed to chunks in wait status. Additionally, chunks in wait status that were in normal status in the past (chunks 3 and 4) are changed to chunks in normal status.

During this process, a new chunk is created and the current chunk is swapped (to chunk 8). Additionally, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (m)

Current chunk

A new chunk is created, and that chunk becomes the current chunk.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The newly created chunk

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • The chunk that was the current chunk before the swap

(n) adbchgchunkstatus command execution example 14

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (n) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒23: Execution of the adbchgchunkstatus command under condition (n)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) and the current chunk (chunk 5) are changed to chunks in wait status. Additionally, chunks in wait status that were never in normal status (chunks 6 and 7) are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Further, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (n)

Current chunk

Swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, that did not become the current chunk, and that was never in normal status in the past

  • The chunk that was the current chunk before the swap

(o) adbchgchunkstatus command execution example 15

The following shows an example of executing the adbchgchunkstatus command on the chunks shown in Figure 11‒9: Statuses of chunks before execution of the adbchgchunkstatus command, under condition (o) in Table 11‒6: Execution conditions for changing the chunk status.

Figure 11‒24: Execution of the adbchgchunkstatus command under condition (o)

[Figure]

Explanation

Chunks in normal status (chunks 1 and 2) and the current chunk (chunk 5) are changed to chunks in wait status. Additionally, chunks in wait status that were in normal status in the past (chunks 3 and 4), and chunks in wait status that were never in normal status (chunks 6 and 7), are changed to chunks in normal status.

During this process, the current chunk is swapped (to chunk 7). Further, the chunk creation date and time and the date and time when the current chunk was swapped are set.

■ Processing results when the adbchgchunkstatus command is executed under condition (o)

Current chunk

Swapped to one of the chunks in wait status that was never in normal status, and that has the largest chunk ID specified for the -n option of the adbchgchunkstatus command.

Chunk creation date and time

The date and time when the adbchgchunkstatus command was executed is set in the following chunk:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, and that was never in normal status in the past

Date and time when the current chunk was swapped

The date and time when the adbchgchunkstatus command was executed is set in the following chunks:

  • One of the chunks in wait status that was specified for the -n option of the adbchgchunkstatus command, that did not become the current chunk, and that was never in normal status in the past

  • The chunk that was the current chunk before the swap

(4) Operational example (replacing the data in a chunk)

This section provides an operational example for replacing the data in a chunk. To change the data in a chunk, you use the adbchgchunkstatus command to change the chunk status.

Operational example

The shop information of Area C has changed as a result of addition and consolidation of shops. The shop information of Area C is stored in a chunk (chunk ID: 3) in the shop list (SHOPSLIST). The information about the new shops in Area C is stored in a CSV-format file. Therefore, it is necessary to replace all data in the chunk (chunk ID: 3) that stores the old shop information of Area C.

The old shop information of Area C can be viewed while the data is being replaced.

Overview of replacing the data in a chunk

The following is an overview of replacing the data in a chunk:

  1. Background-import the new shop information of Area C.

  2. Change the chunk status so that the old shop information of Area C cannot be viewed (while at the same time the new shop information of Area C can be viewed).

  3. Delete the old shop information of Area C.

Information to check before starting data replacement

When you perform Procedure for replacing the data in a chunk, the current chunk changes. If you do not want the current chunk to change, you must check the chunk ID and comment of the current chunk. Check CHUNK_ID (chunk ID) and CHUNK_COMMENT (comment set for a chunk) as explained in (16) Checking the information about the current chunk in C.9 Searching system tables.

If the current chunk contains the data to be replaced, you do not need to check the chunk ID and comment of the current chunk.

Procedure for replacing the data in a chunk
  1. Background-import the new shop information of Area C.

    adbimport -u ADBUSER01 -p '#HelloHADB_01' -k "'" -s , -g 10
              -w /home/adbmanager/tmp
              -z /home/adbmanager/imp_file/imp_opt_file02.txt
              -b --status wait
              SHOPSLIST
              /home/adbmanager/imp_file/imp_data_path02.txt

    When you execute the adbimport command, specify the --status wait option. If you specify this option, the chunk from which the data is to be imported is placed in the wait status (in this status, the new shop information cannot be viewed).

    Note

    When background import is being executed, the old shop information can be viewed.

  2. Check the chunk ID of the chunk that stores the imported new shop information.

    The KFAA51242-I message is output during the background import in step 1. The chunk ID is displayed in this message.

    KFAA51242-I A chunk was created. (chunk id = 5 )

    In the preceding example, the imported new shop information is stored in the chunk whose chunk ID is 5.

  3. Change the chunk status so that the old shop information of Area C cannot be viewed (while at the same time the new shop information of Area C can be viewed).

    adbchgchunkstatus -u ADBUSER01 -p '#HelloHADB_01'
                      -n 5 -w 3 SHOPSLIST

    Use the adbchgchunkstatus command to change the chunk status so that the old shop information cannot be viewed and the new shop information can be viewed. At this time, specify 5 for the -n option and 3 for the -w option. The chunk that stores the new shop information (chunk ID: 5) is placed in the normal status, causing the data in that chunk to be visible. The chunk that stores the old shop information (chunk ID: 3) is placed in the wait status, causing the data in that chunk to not be viewable.

  4. Delete the old shop information of Area C.

    PURGE CHUNK "SHOPSLIST" WHERE CHUNKID=3

    Use the PURGE CHUNK statement to delete the data in the chunk that stores the old shop information (chunk ID: 3).

    Note that if there is a transaction that references or updates a DB area that will be locked by the PURGE CHUNK statement, the PURGE CHUNK statement results in an error. To check whether there is a transaction that references or updates a DB area, execute the adbls -d lock command, and check whether there are connections that have locked DB areas. For details about the adbls -d lock command, see adbls -d lock (Display the Status of Locked Resources) in the manual HADB Command Reference.

In this example, when the preceding procedure is completed, the chunk whose chunk ID is 5 becomes the current chunk. To make the chunk that was the current chunk previously (before data replacement) the current chunk again, perform the procedure described in Procedure for changing the current chunk.

Procedure for changing the current chunk
  1. Use the adbimport command to create an empty chunk (a chunk containing no data).

    Execute the adbimport command with the -b option to perform background import, specifying an empty file as the input data file.

  2. Merge chunks.

    Use the adbmergechunk command to merge the empty chunk that you created in step 1 and the current chunk that you checked in Information to check before starting data replacement. At this time, for the -m option in the adbmergechunk command, specify the comment that you checked in Information to check before starting data replacement.

    When merging of the chunks finishes, the chunk that was the current chunk previously (before data replacement) becomes the current chunk again.