实战演练
88504018喜欢 db2 java的朋友进来了使用表空间进行数据库重建(REBUILD)
1.环境请参考实战演练 - 08,做表空间的备份。
CMD: db2 "backup database backupts tablespace(syscatspace) to /mnt/hgfs/F/backup/"
Backup successful. The timestamp for this backup image is : 20100719151443
CMD: db2 "backup database backupts tablespace(masterts) to /mnt/hgfs/F/backup/"
Backup successful. The timestamp for this backup image is : 20100719151458
CMD: db2 "backup database backupts tablespace(headerts,detailts) to /mnt/hgfs/F/backup/"
Backup successful. The timestamp for this backup image is : 20100719151514
CMD: ls -l /mnt/hgfs/F/backup
total 70776
-rwxrwxrwx 1 root root 89182208 Jul 19 15:14 BACKUPTS.3.db2inst1.NODE0000.CATN0000.2010071 9151443.001
-rwxrwxrwx 1 root root 22310912 Jul 19 15:14 BACKUPTS.3.db2inst1.NODE0000.CATN0000.2010071 9151458.001
-rwxrwxrwx 1 root root 33456128 Jul 19 15:15 BACKUPTS.3.db2inst1.NODE0000.CATN0000.2010071 9151514.001
2。表空间故障
CMD: rm -fR /home/db2inst1/backupts/db2inst1/NODE0000/SQL00001/SQLT000*
CMD: rm /home/db2inst1/ts/*
CMD: db2 connect reset
SQL1024N A database connection does not exist. SQLSTATE=08003
CMD: db2 connect to backupts
SQL0293N Error accessing a table space container. SQLSTATE=57048
3。使用REBUILD选项利用表空间进行数据库恢复
CMD: db2 "restore db backupts rebuild with all tablespaces in database from /mnt/hgfs/F/backup taken at 20100719151514"
SQL2561W Warning! Rebuilding a database from a table space image or using a
subset of table spaces. The target database will be overwritten. The restore
utility also reports the following sqlcode "2539".
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
4。数据库处于前滚暂挂状态
CMD: db2 connect to backupts
SQL1117N A connection to or activation of database "BACKUPTS" cannot be made
because of ROLL-FORWARD PENDING. SQLSTATE=57019
5。前滚恢复
CMD: db2 "rollforward database backupts to end of logs and stop"
Rollforward Status
Input database alias = backupts
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = -
Last committed transaction = 2010-07-19-07.14.46.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
6。数据库恢复正常
CMD: db2 connect to backupts
Database Connection Information
Database server = DB2/LINUXX8664 9.7.1
SQL authorization ID = DB2INST1
Local database alias = BACKUPTS
CMD: db2 list tablespaces
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = System managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 1
Name = TEMPSPACE1
Type = System managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 3
Name = HEADERTS
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 4
Name = DETAILTS
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 5
Name = MASTERTS
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
页:
[1]