The DB2® Advanced Copy Services (ACS) protocol files are created by the library for DB2 ACS and contain information that is needed by scripts for snapshot operations.
The protocol files are located in the protocol file repository. You should create a directory for this repository before performing your snapshot operation. You specify the repository by using the options parameter with the relevant command. If you do not create a directory, the protocol file repository will be the same directory that the script is located.
For a list of functions see DB2 Advanced Copy Services (ACS) API functions
cmd: path_to_script -a action
-c protocol_file_reposity/protocol_file_name.cfg
Key name | Description |
---|---|
ACTION | Action that is being performed:
|
APP_OPTIONS | Hex value that combines the DB2BACKUP_* |
DATAPATH_AUTOSTORAGE | Key for each storage path that is configured in the database |
DATAPATH_DB | Database paths configured in the database |
DATAPATH_GENERIC |
|
DATAPATH_LOCAL_DB | Local database paths configured in the database |
DATAPATH_TBSP_CONTAINER | Key for each DMS container that is configured in the database |
DATAPATH_TBSP_DEVICE | Key for each raw device that is configured in the database |
DATAPATH_TBSP_DIR | Key for each SMS storage path that is configured in the database |
DB_NAME | Name of the database for that the operation is done |
DBPARTNUM | Database partition number to be operated on |
DB2BACKUP_MODE | Whether the backup is offline or online |
DB2BACKUP_LOGS | Whether log files are included in or excluded from the backup. If logs are excluded, LOG_DIR and MIRRORLOG_DIR are not contained in the protocol file. |
DELETE_OBJ_ID | Object ID of the object to be deleted |
EXTERNAL_OPTIONS | Lists any options that you specify in the backup and restore command and are automatically copied into to the custom script. |
EXTERNAL_SCRIPT | Name of the script for the snapshot operation |
FIRST_ACTIVE_LOG_CHAIN | The log chain of the first active log |
FIRST_ACTIVE_LOG_ID | Number of first active log of the database during the time the snapshot was taken |
INSTANCE | Name of the instance for the database |
LOGPATH_MIRROR | Mirror log directory |
LOGPATH_PRIMARY | Log directory of the database |
METADATA | String that represents the Base64 encoded meta data memory block |
METADATA_CHECKSUM | Checksum of the Base64 metadata string |
METADATA_SIZE | Size of the encoded metadata string |
METADATA_DECODED_SIZE | Size of the decoded metadata block |
OBJ_DB2ID_LEVEL | Fix pack level that was used during the backup |
OBJ_DB2ID_RELEASE | Release level of the DB2 product that was used during the backup |
OBJ_DB2ID_VERSION | Version of the DB2 product that was used during backup |
OBJ_HOST | Host server where the database partition resides |
OBJ_ID | Unique identifier for each stored object |
OBJ_OWNER | Owner of the object |
OBJ_TYPE | Snapshot |
OPERATION | Operation identifier:
|
QUERY_DB | Name of the database that is queried for |
QUERY_HOST | Name in the host in the object |
QUERY_INSTANCE | Name of the instance of the database that is contained in the backup image |
QUERY_OWNER | Owner of the object |
QUERY_DBPARTNUM |
|
QUERY_TIMESTAMP | Timestamp queried for |
QUERY_TYPE | Type of the object to be queried, snapshot or hex code representing the type |
RC_DELETE | Return code of the deletion operation. A non-zero value indicates that an error happened in the section. |
RC_OPERATION | Return code of the complete backup operation. A non-zero value indicates that an error happened in the section. |
RC_PREPARE | Return code of the prepare action. A non-zero value indicates that an error happened in the section. |
RC_RESTORE | Return code of the complete restore operation. A non-zero value indicates that an error happened in the section. |
RC_SNAPSHOT | Return code of the snapshot action. A non-zero value indicates that an error happened in the section. |
RC_STORE_METADATA | Return code of store_metadata operation. A non-zero value indicates that an error happened in the section. |
RC_VERIFY | Return code of the verify action. A non-zero value indicates that an error happened in the section. |
RESULT_n_FILE | The name of the nth file during query, delete and restore |
SIGNATURE | Software level of the DB2 version being used |
# ==============================================
# db2ACSInitialize(): BEGIN [2012-11-30 08:15:45]
EXTERNAL_SCRIPT=/home/hotellnx99/jklauke/libacssc.sh
HANDLE=1354281345
START_TIME=1354281345
DB_NAME=SAMPLE
INSTANCE=jklauke
DBPARTNUM=0
SIGNATURE=SQL10020
EXTERNAL_OPTIONS=/home/hotellnx99/jklauke/repository 2ndoption
# db2ACSInitialize(): END
# ==============================================
# ==============================================
# db2ACSBeginOperation(): BEGIN [2012-11-30 08:15:45]
OPERATION=snapshot
# db2ACSBeginOperation(): END
# ==============================================
# ==============================================
# db2ACSPartition(): BEGIN [2012-11-30 08:15:06]
OBJ_HOST=hotellnx99
OBJ_OWNER=
OBJ_TYPE=snapshot
OBJ_DB2ID_LEVEL=0
OBJ_DB2ID_RELEASE=2
OBJ_DB2ID_VERSION=10
APP_OPTIONS=0x1000
DB2BACKUP_MODE=OFFLINE
DB2BACKUP_LOGS=INCLUDE
LOGPATH_PRIMARY=/home/hotellnx99/jklauke/jklauke/NODE0000/SQL00001/LOGSTREAM0000/
DATAPATH_DB=/home/hotellnx99/jklauke/jklauke/NODE0000/SQL00001/MEMBER0000/
DATAPATH_LOCAL_DB=/home/hotellnx99/jklauke/jklauke/NODE0000/sqldbdir/
DATAPATH_DB=/home/hotellnx99/jklauke/jklauke/NODE0000/SQL00001/
DATAPATH_AUTOSTORAGE=/home/hotellnx99/jklauke/jklauke/NODE0000/SAMPLE/
# db2ACSPartition(): END
# ==============================================
# ==============================================
# db2ACSPrepare(): BEGIN [2012-11-30 08:15:45]
# cmd: /home/hotellnx99/jklauke/libacssc.sh -a prepare
-c /home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1353420068.cfg
/home/hotellnx99/jklauke/repository 2ndoption
RC_PREPARE=0
# db2ACSPrepare(): END
# ==============================================
If this
step completes successfully, the database manager puts the database
in SET WRITE SUSPEND state (assuming the snapshot backup is online). Note that the content between ACTION=DB2ACS_ACTION_WRITE and RC_SNAPSHOT is specific to the sample script, which compresses all of the paths shown in the db2ACSPartition section of the protocol file into one tar file and all log files (primary and mirror log files) to a second tar file.
# ============================================================================
# db2ACSSnapshot(): BEGIN [2013-01-15 10:18:23]
OBJ_ID=0
ACTION=DB2ACS_ACTION_WRITE
# cmd:/home/hotellnx99/jklauke/sqllib/samples/BARVendor/libacssc.sh -a snapshot
-c /home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1358263103.cfg
BACKUP_FILE=/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20130115101824.001.tar
# cmd: awk -F= '/^DATAPATH/
{ print $2; }' /home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1358263103.cfg
| tar -Pcf /home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20130115101824.001.tar
-T - 2>/dev/null && echo 0 || echo 1
# backup tar created, rc=0
# Logs to be included
BACKUP_LOGS=/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20130115101824.log.tar
# cmd: awk -F= '/^LOGPATH/ { print $2; }'
/home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1358263103.cfg
| tar -Pcf /home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20130115101824.log.tar
-T - 2>/dev/null && echo 0 || echo 1
# tar for logs created, rc=0
RC_SNAPSHOT=0
# db2ACSSnapshot(): END [2013-01-15 10:18:24]
# ============================================================================
After this step completes, the database manager puts the
database in WRITE RESUME state.# ==============================================
# db2ACSVerify(): BEGIN [2012-11-30 08:15:08]
FIRST_ACTIVE_LOG_ID=2
FIRST_ACTIVE_LOG_CHAIN=3
# cmd: /home/hotellnx99/jklauke/libacssc.sh -a verify -c /home/hotellnx99/jklauke/repository/db2acs_SAMPLE_1354281306_0.cfg
/home/hotellnx99/jklauke/repository 2ndoption
# Backup '/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.1354281306.001.tar' checked: looks okay
# Logs '/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.1354281306.log.tar' checked: looks okay
RC_VERIFY=0
# db2ACSVerify(): END
# ==============================================
If the
script returns a non-zero return code, the following db2ACSStoreMetaData()
call is skipped and db2ACSEndOperation is called instead. In the case
of the example script, the library for DB2 ACS
invokes the script with the rollback action. For an example of this,
see this section.# ============================================================================
# db2ACSStoreMetaData(): BEGIN [2013-01-15 10:18:24]
START_TIME=1358263104
METADATA_SIZE=12024
METADATA=U1FMV...
METADATA_CHECKSUM=16941
# cmd: /home/hotellnx99/jklauke/sqllib/samples/BARVendor/libacssc.sh -a store_metadata
-c /home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1358263103.cfg
RC_STORE_METADATA=0
# db2ACSStoreMetaData(): END [2013-01-15 10:18:24]
# ============================================================================
# ==============================================
# db2ACSEndOperation(): BEGIN [2012-11-30 08:15:08]
RC_OPERATION=0
# db2ACSEndOperation(): END
# ============================================================================
# db2ACSEndOperation(): BEGIN [2013-01-18 05:26:06]
RC_OPERATION=1
# cmd:/home/hotellnx99/jklauke/sqllib/samples/BARVendor/libacssc.sh -a rollback
-c /home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1358504766.cfg
# Delete old backup file :
/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20130118052606.001.tar
# Delete old backup file :
/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20130118052606.log.tar
RC_ROLLBACK=0
# db2ACSEndOperation(): END [2013-01-18 05:26:06]
# ============================================================================
# ==============================================
# db2ACSTerminate(): BEGIN [2012-11-30 08:15:08]
# db2ACSTerminate(): END
# ==============================================
# ==============================================
# db2ACSInitialize(): BEGIN [2012-11-30 08:27:38]
REPOSITORY_PATH=/home/hotellnx99/jklauke/repository/
EXTERNAL_SCRIPT=/home/hotellnx99/jklauke/libacssc.sh
HANDLE=1354282058
START_TIME=1354282058
DB_NAME=SAMPLE
INSTANCE=jklauke
DBPARTNUM=0
SIGNATURE=SQL10020
EXTERNAL_OPTIONS=/home/hotellnx99/jklauke/repository
# db2ACSInitialize(): END
# ==============================================
# db2ACSBeginOperation(): BEGIN [2012-11-30 08:27:38]
OPERATION=restore
# db2ACSBeginOperation(): END
# ==============================================
# ==============================================
# db2ACSBeginQuery(): BEGIN [2012-11-30 08:27:38]
QUERY_TYPE=snapshot
QUERY_PARTNUM=0
QUERY_DB=SAMPLE
QUERY_INSTANCE=*
QUERY_HOST=*
QUERY_OWNER=*
QUERY_TIMESTAMP=20121130082717
# cmd: /home/hotellnx99/jklauke/libacssc.sh -a prepare
-c/home/hotellnx99/jklauke/db2acs.SAMPLE.0.jklauke.1353421208.cfg
/home/hotellnx99/jklauke/repository
RC_PREPARE=0
# db2ACSBeginQuery(): END
# ==============================================
# ============================================================================
# db2ACSGetNextObject(): BEGIN [2012-12-13 08:01:39]
RESULT_0_FILE=/home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1355341475.cfg
# read result object with timestamp 20121212144436
# db2ACSGetNextObject(): END [2012-12-13 08:01:39]
# ============================================================================
# db2ACSGetNextObject(): BEGIN [2012-12-13 08:01:39]
RESULT_1_FILE=/home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1355341690.cfg
# read result object with timestamp 20121212144811
# db2ACSGetNextObject(): END [2012-12-13 08:01:39]
# ============================================================================
# db2ACSGetNextObject(): BEGIN [2012-12-13 08:01:39]
RESULT_2_FILE=/home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1355341892.cfg
# read result object with timestamp 20121212145133
# db2ACSGetNextObject(): END [2012-12-13 08:01:39]
# ============================================================================
# ==============================================
# db2ACSRetrieveMetaData(): BEGIN [2012-11-30 08:27:39]
GET_META_OBJ_ID=3
METADATA_DECODED_SIZE=9004
METADATA_CHECKSUM=14583
# db2ACSRetrieveMetaData(): END
# ==============================================
# ==============================================
# db2ACSSnapshot(): BEGIN [2012-11-30 08:27:40]
OBJ_ID=3
ACTION=DB2ACS_ACTION_READ_BY_OBJECT
# cmd:/home/hotellnx99/jklauke/libacssc.sh -a restore
-c /home/hotellnx99/jklauke/repository/db2acs_SAMPLE_1354282058_0.cfg
/home/hotellnx99/jklauke/repository
# cmd: tar -xf /home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20121130082717.001.tar
&& echo 0 || echo 1
# tar extracted, rc=0
# cmd: tar -xf /home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20121130082717.log.tar
&& echo 0 || echo 1
# logs extracted, rc=0
RC_RESTORE=0
# db2ACSSnapshot(): END
# ==============================================
If an
appropriate backup image is found, the meta data is read from the
protocol file and the restore is started by invoking the customer
library.# ==============================================
# db2ACSEndOperation(): BEGIN [2012-11-30 08:27:41]
END_ACTION=0
# db2ACSEndOperation(): END
# ==============================================
# ==============================================
# db2ACSTerminate(): BEGIN [2012-11-30 08:27:41]
# db2ACSTerminate(): END
# ==============================================
# db2ACSInitialize(): BEGIN [2012-11-20 09:10:17]
REPOSITORY_PATH=/home/hotellnx99/jklauke/
EXTERNAL_SCRIPT=/home/hotellnx99/jklauke/libacssc.sh
HANDLE=1353420617
DB_NAME=*
INSTANCE=*
DBPARTNUM=0
SIGNATURE=SQL10020
EXTERNAL_OPTIONS=/home/hotellnx99/jklauke/
# db2ACSInitialize(): END
# ==============================================
# db2ACSBeginOperation(): BEGIN [2012-11-20 09:10:17]
OPERATION=delete
# db2ACSBeginOperation(): END
# ==============================================
# db2ACSBeginOperation(): BEGIN [2012-11-30 08:27:38]
OPERATION=restore
# db2ACSBeginOperation(): END
# ==============================================
# ============================================================================
# db2ACSBeginQuery(): BEGIN [2012-12-13 08:24:42]
QUERY_TYPE=0x0
QUERY_DBPARTNUM=-1
QUERY_DB=*
QUERY_INSTANCE=*
QUERY_HOST=*
QUERY_OWNER=*
# cmd: /home/hotellnx99/jklauke/sqllib/samples/BARVendor/libacssc.sh -a prepare
-c /home/hotellnx99/jklauke/repository/db2acs.0.1355405082.cfg
RC_PREPARE=0
# db2ACSBeginQuery(): END [2012-12-13 08:24:42]
# ============================================================================
# ==============================================
# db2ACSGetNextObject(): BEGIN [2012-11-20 09:10:17]
RESULT_0_FILE=/home/hotellnx99/jklauke/db2acs.SAMPLE.0.jklauke.1353420375.cfg
# read result object with timestamp 20121120090616
# db2ACSGetNextObject(): END
# ==============================================
# db2ACSGetNextObject(): BEGIN [2012-11-20 09:10:17]
# db2ACSGetNextObject(): END
# ==============================================
# ============================================================================
# db2ACSDelete(): BEGIN [2012-12-13 08:24:44]
DELETE_OBJ_ID=5
# cmd: /home/hotellnx99/jklauke/sqllib/samples/BARVendor/libacssc.sh -a delete
-o 5 -t 20121213051805
-c /home/hotellnx99/jklauke/repository/db2acs.0.1355405082.cfg
# Delete old backup file and logs:
/home/hotellnx99/jklauke/repository/SAMPLE.0.jklauke.0.20121213051805.001.tar
# Delete old configuration file:
/home/hotellnx99/jklauke/repository/db2acs.SAMPLE.0.jklauke.1355393884.cfg
RC_DELETE=0
# db2ACSDelete(): END [2012-12-13 08:24:44]
# ============================================================================
# ==============================================
# db2ACSEndQuery(): BEGIN [2012-11-20 09:10:19]
# db2ACSEndQuery(): END
# ==============================================
# ==============================================
# db2ACSEndOperation(): BEGIN [2012-11-20 09:10:19]
END_ACTION=0
# db2ACSEndOperation(): END
# ==============================================
# ==============================================
# db2ACSTerminate(): BEGIN [2012-11-20 09:10:19]
# db2ACSTerminate(): END
# ==============================================