0% found this document useful (0 votes)
9 views

db2_restore_command

Uploaded by

masbin
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

db2_restore_command

Uploaded by

masbin
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Untuk laporan test restore

TSM :
ambil sample backup dari host 10.251.1.36
di path /BACKUP/GOLD24 atau /BACKUP/EMAS24
ambil salah satu file .001 di bulan laporan berjalan
target directory adalah /BACKUP/test/

DB2 :
dari 10.251.1.36:/BACKUP/test/*.001
tadi dikirim ke 10.251.1.48
(atau 10.251.2.27) diletakkan di /BACKUP/test
restore backup tersebut dengan
format nama database TSM_02 (02 adalah bulan report)
db2 create db AUDIT_S on /db2data
###################################################################################
###################################################################################
#

db2ckrst -d EDWPROD -t 20211103190001

monitor proses restore:


db2 list utilities show detail

Kirim file:
time scp EMAS24.0.db2inst2.DBPART000.20220306000448.001
[email protected]:/backup/test/
time scp G24.0.db2inst1.DBPART000.20220515004905.001
[email protected]:/BACKUP2/G24
G24.0.db2inst1.DBPART000.20220515004905.001
time scp G24.0.db2inst1.DBPART000.20220520012809.001
[email protected]:/BACKUP2/G24
G24.0.db2inst1.DBPART000.20220520012809.001

time db2 restore db EMAS24 incremental automatic taken at 20220509001330 into


EMAS_08 LOGTARGET /BACKUP2/EMAS24

Switch user jd root:


su -

restore:
time db2 restore db EMAS24 taken at 20220302001146 into TSM_03 LOGTARGET
/BACKUP2/GOLD24
time db2 restore db EDWPROD from /backup/EDWPROD taken at 20211025190002 into
EDWPROD LOGTARGET /backup/EDWPROD redirect generate script EDWPROD.clp without
prompting
time db2 restore db PROMISE taken at 20211117190002
time db2 restore db EDWPROD incremental automatic taken at 20220307220001
time db2 restore db EMAS24 incremental automatic taken at 20220322234741 into
EMAS_21 LOGTARGET /BACKUP2/EMAS24
db2ckbkp EDWPROD.0.db2inst1.DBPART000.20211103190001.001
time db2 restore db EMAS24 incremental automatic taken at 20220509001330 to EMAS_08
LOGTARGET /BACKUP2/EMAS24
time db2 restore db EMAS24 incremental automatic use from /BACKUP2/EMAS24 taken at
20220509001330 into EMAS_08 LOGTARGET /BACKUP2/EMAS24
time db2 restore db EMAS24 incremental automatic taken at 20220509001330 into
EMAS_25
time db2 restore db EMAS24 incremental taken at 20220509001330 into EMAS_25
time db2 restore db EMAS24 taken at 20220508010612 into EMAS_26

time db2 restore db EMAS24 taken at 20220604220117 into TSM_06 LOGTARGET


/BACKUP2/GOLD24

jika nyangkut:
time db2 restore db nama_db incremental abort taken at <timestamp> into <namadb>
time db2 restore db nama_db incremental abort taken at 20220322234741 into EMAS_21
db2 rollforward db EOM_K to end of logs
db2 rollforward db EOM_K to end of backup and stop
db2 rollforward db EOM_K complete
db2 rollforward db <nama db> to 2023-5-27-03.00.00

buat database:
db2 create db EDWPROD on /db2data

backup:
db2 "backup database EDWPROD tablespace (TS_2020) online to /dev/null"
0 19 * * * /home/db2inst1/bin/backup_online_inc.sh >>
/home/db2inst1/bin/backup_online_inc.sh.log = crontab -e (jadwal backup MIS)
time db2 "backup database edwprod online incremental to /backup/EDWPROD compress
include logs without prompting"

restore database:
time db2 restore db EMAS24 taken at 20210101021101 into TSM_01 LOGTARGET
/BACKUP2/GOLD24
db2 restore db EDWPROD incremental automatic abort taken at 20211108190001

rollfwd db:
db2 "rollforward db STG_G24 to end of logs and stop overflow LOG
PATH('/BACKUP2/G24')"
db2 rollforward db STG_G24 to end of logs and complete
db2 get db cfg for STG_G24 | grep LOGARCH
time db2 rollforward db TSM_02 to end of logs and stop overflow log path
"(BACKUP2/GOLD24)"
time db2 rollforward db TSM_06 to end of logs and stop overflow log path
"(BACKUP2/GOLD24)"

modif hak akses:


chown -R db2inst1:db2iadm1 /backup/test
chown -R sy24inst:db2iadm1 SYAR24.0.sy24inst.DBPART000.20220423232650.001
chmod -R g+w /backup
chmod -R 777 /home/db2inst1

connect dan disconnect db:


db2 connect to <nama_db>
db2 disconnect <nama_db>
db2 deactivate db <nama_db>

Menghapus database:
db2 drop db <nama_db>
db2 drop db AUDIT_S
db2 terminate

You might also like