First of all we need below things
Source Server:P30
Destination Server:S30
Date of which backup required: Latest
Please take configuration and registry backup of database
before proceeding to restore.
Step1:-Login on destination server with db2 user or
root and execute below command.
db2 "RESTORE DATABASE <Source Server instance
name>LOAD '/usr/lib/libnsrdb2.so' OPEN 6 SESSIONS OPTIONS '@<configuration
files> REDIRECT generate script ./hello.ddl
e.g.
db2 "RESTORE DATABASE P30 LOAD
'/usr/lib/libnsrdb2.so' OPEN 6 SESSIONS OPTIONS '@/db2/db2s30/DB2_CFG_P30_restore'
REDIRECT generate script ./db2restorep30_13oct.ddl"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Step2:Once the .ddl file is generated ,copy it in
notepad or use vi editor to make some changes.
-------------------------------------------------------------------------------------------------------------------------------------------------------
Steps3:Below changes need to be done
Replace all P30 with S30 with exception of these lines
(UPDATE COMMAND OPTIONS USING S ON Z ON P30_NODE0000.out V ON , RESTORE
DATABASE P30, OPTIONS '@/db2/db2s30/DB2_CFG_P30_restore')
Use below parameters
OPEN 6 SESSIONS,
DBPATH ON '/db2/S30'
LOGTARGET '/db2/S30/log_dir/NODE0000/'
uncomment taken on and with prompting and Comment last
command in file --RESTORE DATABASE S30 CONTINUE;
Step 4:Once the changes are done in file ,execute
below command .
db2 -tvf <new file name>-z <output file name>
e.g.
db2 -tvf db2restorep30_13oct_1.ddl -z
db2restorep30_13oct_1.out
output:- DB20000I The SET TABLESPACE CONTAINERS
command completed successfully
Then execute second command
----------------------------------------------------------------------
Step5:create a file like this ,if not present on the
server
cat restore_p30_continue.sql
-- ** start redirected restore
--
*****************************************************************************
RESTORE DATABASE P30 CONTINUE;
-- *****************************************************************************
-- ** end of file
--
*****************************************************************************
ROLLFORWARD DATABASE S30 TO END OF LOGS AND COMPLETE;
--
*****************************************************************************
-- ** end of file
--
*****************************************************************************
nohup db2 -tvf restore_p30_continue.sql
>restore13oct.out &
-------------------------------------------------------------------------------------------------------
Step6:Monitor the Db2 restore using db2top
then u
Once the restore complete then run the below command
db2 rollforward db <database name> query status
-----------------------------------------------------------------------------------------------------------------------
Step7:
db2 rollforward db S30 query status
Once the output is not pending ,it means restore is
successful .
No comments:
Post a Comment