• No results found

Make sure to perform the following before you query for the DB2 data and log backup details and restore them to a disk: 1. Use qlogin from Data Protection Suite/Base directory. You must be a valid DB2 user to use this DB2 utility.

2. Start the powershell prompt. You can type powershell from windows prompt or start it from the command line prompt. Use the following steps to run this script:

1. Enable the powerShell script execution on the system:

2. Execute the script for usage:

JOB Restore data and logs to a disk based on the backup job id. The logs will be restored if the backup job id contains logs.

-d Name of database to be restored

-j Backup job id for the data or log to be restored.

-f Start Log Sequence number

-t End Log sequence number

-p Directory to which backup job data has to be restored, valid for '-r JOB' case.

-s Source Db2 instance name

-c Source Client name

-n DPF To be specified for DPF clients

-i Data Protection Suite Instance name

TESTDB.0.DB2INST7.NODE0000.CATN0000.20130719155240.001 TESTDB.0.DB2INST7.NODE0000.CATN0000.20130719155240.002

./db2util.sh -a <option file> [-i <Data Protection Suite_instance>]

OPTION

DESCRIPTION

-a Name of the file containing inputs for script

-i Data Protection Suite Instance name. If no Data Protection Suite Instance is specified, Instance001 would be used The option file may be used to specify following options:

CVSRCCLIENTNAME <Source Client name> CVSRCDB2INSTANCENAME <Source Db2 instance name>

OPERATION <Specify an operation QA/QL/QD(QUERY)or RL/RJ(RESTORE) to be performed on database> RESTOREDIR Directory to which backup job data has to be restored, valid for 'RJ' case.>

JOBID <Backup job id for the data to be restored>

DBNAME <Name of database>

APPLICATION DPF Only for DPF

FROMLSN <log number>

TOLSN <log number>

qlogout [-cs commserver] [-all] [-tf tokenfile] [-tk token] [-h]

qlogin -cs <cs_name>

>set db2instance=<db2_instance_name> >powershell

This Script can be used to query the data, logs backups using Data Protection Suite and restore them on to the disk. -- Prints usage information

Query Data and Log Backups:

-- Queries the Data Protection Suite and display data, log file backup details for database <dbname>, for the currently logged in db2 instance user. Options:

Restoring to a Disk

Use the following command to restore a backup image to a disk:

1. Options:

z For restore backup image to disk (-r parameter with JOB), a new folder with this restore job id will be created to local computer with parameter -p location. The backup image and db2 logs will be restored under this job id folder. If a -p provider do not exist, the system will create a new folder on current directory (where db2util.ps1 is running) with a folder name dump_<timestamp>\restoreJobid. The db2util will restore the backup jobs to Data Protection Suite/Base/Temp if the destination location is not provided using parameter –p. if you do not require these restore images, you need to manually clean the restores from this temp folder. z If you are using -r JOB, the -f and -t for the range of db2 logs will be ignored.

z This command line will not support the IntelliSnap (non-traditional db2 backup image) when you provide the Jobid. All Jobids should be the traditional db2 jobs. z If you are using -r LOG, the -p target location will be ignored. By default, the db2 retrieve path will be used for log files restore location. The -r LOG command

request both -f and -t for db2 archive log beginning sequence # and last sequence #.

z Use this query on cross machine to query and restore the backup image to cross machine location. You must have installed a DB2 application and DB2 iDataAgent on the cross computer/server . The platform should be the same and the DB2 version should be same or higher.

z On a Windows computer, you must stop the powershell on command prompt after a restore job.

z Data Protection Suite supports restoring the backup image to disk using db2util.ps1 for a single job id only. The last job id in one cycle will be only be considered. The multiple job ids ( one cycle) in command will be ignored.

z Data Protection Suite supports restoring the backup image to disk using db2util.ps1 if the backup has multiple streams. The backup job will be restored to disk with multiple images which have the same timestamps as shown in the example below:

using an input options file

PS C:\Program Files\CV\Data Protection Suite\iDataAgent> db2util.ps1

db2util.ps1 -q LOG|DATA|ALL -d <dbname> [-s <db2 instance name>] [-c <client name>] [-i <Data Protection Suite_instance>]

OPTION

DESCRIPTION

-q Query operation

LOG Query log backup

DATA Query data backup

ALL Query data and log backup

-d Name of database to be queried

-s Source Db2 instance name to query

-c Source Client name

-i Data Protection Suite Instance name

-o Target database name. This is an optional option. If you do not provide this option, Data Protection Suite assumes the source database name to use.

-r Retrieves the log files under the db2 retrieve path.

db2util.ps1 -r JOB|LOG -d <dbname> [-j <jobId>]|[-f <from seq> -t <to seq>] [-p <restore directory>] [-s <db2 instance name>] [-c <client name>][-n DPF] [-i <Data Protection Suite_instance>]

OPTION

DESCRIPTION

-r Restore operation

LOG Restore Logs to retrieve directory

JOB Restore data and logs to a disk based on the backup job id. The logs will be restored if the backup job id contains logs.

-d Name of database to be restored

-j Backup job id for the data or log to be restored

-f Start Log Sequence number

-t End Log sequence number

-p Directory to which backup job data has to be restored, valid for '-r JOB' case.

-s Source Db2 instance name

-c Source Client name

-n DPF To be specified for DPF clients

-i Data Protection Suite Instance name

TESTDB.0.DB2INST7.NODE0000.CATN0000.20130719155240.001 TESTDB.0.DB2INST7.NODE0000.CATN0000.20130719155240.002

Use the following command to use an input options file which include all the query and restore commands for execution:

Once the job completes, logout from the CommServe using the qlogout command. db2util.ps1 -a <option file> [-i <Data Protection

Suite_instance>]

OPTION

DESCRIPTION

-a Name of the file containing inputs for script

-i Data Protection Suite Instance name. If no Data Protection Suite Instance is specified, Instance001 would be used The option file may be used to specify following options:

CVSRCCLIENTNAME <Source Client name> CVSRCDB2INSTANCENAME <Source Db2 instance name>

OPERATION <Specify an operation QA/QL/QD(QUERY)or RL/RJ(RESTORE) to be performed on database> RESTOREDIR Directory to which backup job data has to be restored, valid for 'RJ' case.>

JOBID <Backup job id for the data to be restored>

DBNAME <Name of database>

APPLICATION DPF Only for DPF

FROMLSN <log number>

TOLSN <log number>

Related documents