hidden:Database Restore exercised on the Test Core

From Lsdf
Jump to navigationJump to search

Reference "HPSS Troubleshooting and Recovery Guide v1.3.pdf"

1. set db2 environment

. /var/hpss/hpssdb/sqllib/db2profile

2. get db2 service name

-bash-4.1$ db2 get dbm cfg|grep -i svcename
TCP/IP Service name                          (SVCENAME) = DB2_hpssdb
SSL service name                         (SSL_SVCENAME) = 

3. DB2 Offline Backup

3.1 shutdown hpss

/opt/hpss/bin/hpssadm.pl -U hpssssm -a /var/hpss/etc/hpss.unix.keytab
User 'hpssssm' not authorized to connect to System Manager.
/opt/hpss/bin/hpssuser -add hpssssm -ssm
/opt/hpss/bin/hpssadm.pl -U hpssssm -a /var/hpss/etc/hpss.unix.keytab
hpssadm>server list
hpssadm>server shutdown -all
hpssadm>server list 
hpssadm>quit

3.2 shutdown startup daemon

/opt/hpss/bin/rc.hpss -d stop

3.3 shutdown system manager

/opt/hpss/bin/rc.hpss -m stop

3.4 shutdown all (stop DB2)

/opt/hpss/bin/rc.hpss stop
ps -ef | grep -i db2(if any db2 process still running)

4. DB2 offline backup

su - hpssdb
. /var/hpss/hpssdb/sqllib/db2profile
ps -ef |grep -i db2

5. start only db2 in order to take an offline backup

db2start

6. make anoffline backup(just in case)

db2 backup db hcfg to /db2_backup/offline/hcfg compress
db2 backup db hsubsys1 to /db2_backup/offline/hsubsys1 compress
on the productive core server
  db2 backup db hcfg to /db2_backup1/offline/hcfg compress
  db2 backup db hsubsys1 to /db2_backup1/offline/hsubsys1 compress
  db2 backup db hghi to /db2_backup1/offline/hghi compress

7. start hpss as root

/opt/hpss/bin/rc.hpss start
/opt/hpss/bin/hpssadm.pl -U hpssssm -a /var/hpss/etc/hpss.unix.keytab
hpssadm>> server start -all
hpssadm>> server list
hpssadm>> quit

8. make an online backup(just in case)

/hpss_src/scripts/db2_fullbackup.ksh -p /db2_backup -t online -b none >>/db2_backup/db2_backup_fullbackup.out
on the productive core
/hpss_src/scripts/db2_fullbackup.ksh -p /db2_backup1 -t online -b none >>/db2_backup1/db2_fullbackup.out 2>&1

9. ingest a file in hpss => create a record in db2

on test core
[root@hpsstcr03 Sample_Code]# /hpss_src/htp/Sample_Code/hpssls -l /
-rw-rw-r--   1 303     301    99  303 0            0 Jul 11 12:28 file1
drwxrwxr-x  10 303     301    NS  NS  NS         512 Jul 21 16:52 home
drwxrwxr-x   2 301     301    NS  NS  NS         512 Jul 11 09:44 log
-rw-rw-r--   1 303     301    102 303 0      5242880 Jul 11 14:12 scb22
[root@hpsstcr03)#/opt/hpss/bin/lshpss -cos
[root@hpsstcr03 Sample_Code]# /hpss_src/htp/Sample_Code/hpssputdata -c 102 1000000000 /1g.file
File transferred successfully
./hpssputdata: "/1g.file" 1000000000 Bytes in 10.617 sec -> 89.761 MB/sec
[root@hpsstcr03 Sample_Code]# /hpss_src/htp/Sample_Code/hpsscat /1g.file > /dev/null 

on the productive core
cd /hpss_src/htp_wl/bq/Sample_Code
./hpssls -l /
./hpssputdata -c 1103 1000000000 /1g.file #1103=cos
./hpsscat /1g.file > /dev/null

10. Restore db2

10.1 stop hpss

/opt/hpss/bin/hpssadm.pl -U hpssssm -a /var/hpss/etc/hpss.unix.keytab
hpssadm>server shutdown -all
hpssadm>server list
hpssadm> quit
/opt/hpss/bin/rc.hpss -d stop
/opt/hpss/bin/rc.hpss -m stop
/opt/hpss/bin/rc.hpss stop
ps -ef | grep -i hpss
ps -ef | grep -i db2

10.2 Restore db2

su - hpssdb
. /var/hpss/hpssdb/sqllib/db2profile
db2start 
db2 list history backup since 20141021 for hcfg
----------------------------------------------------------------------------
Comment: DB2 BACKUP HCFG ONLINE
Start Time: 20141021150931
End Time: 20141021150933
Status: A
----------------------------------------------------------------------------
EID: 52 Location: /db2_backup/hcfg
db2 "restore db hcfg from /db2_backup/hcfg taken at 20141021150931"
db2 "rollforward db hcfg to end of logs and complete"
db2 list history backup since 20141021 for hsubsys1
db2 "restore db hsubsys1 from /db2_backup/hsubsys1 taken at 20141021150934"
db2 "rollforward db hsubsys1 to end of logs and complete"
on the productive core do it for hghi db as well
db2 activate db hcfg
db2 activate db hsubsys1
'on the productive core activate the hghi as well

11. Verify the restore

db2 connect to hsubsys1
db2 "select count(*) from hpss.bitfile"

12. start hpss as root

/opt/hpss/bin/rc.hpss start
/opt/hpss/bin/hpssadm.pl -U hpssssm -a /var/hpss/etc/hpss.unix.keytab
hpssadm>server start -all
hpssadm>server list
hpssadm>quit
/hpss_src/htp/Sample_Code/hpssls -l /

13. start hpssgui

/opt/hpss/bin/hpssgui.pl &
see monitor->alarm etc...