数据库恢复出现问题
数据库恢复出现问题
1 首先备份
db2 backup db testdb online to /data1 compress
Backup successful. The timestamp for this backup image is : 20141230165426
[db2inst1@DB2 data1]$ db2 connect to testdb
Database Connection Information
Database server = DB2/LINUXX8664 9.5.0
SQL authorization ID = DB2INST1
Local database alias = TESTDB
2 建立表
第一笔数据是16点55分30秒插入的
[db2inst1@DB2 data1]$ db2 "create table t2 (col1 char(10))"
DB20000I The SQL command completed successfully.
[db2inst1@DB2 data1]$ db2 "insert into t2 values ('111')"
DB20000I The SQL command completed successfully.
[db2inst1@DB2 data1]$ db2 "values current timestamp"
1
--------------------------
2014-12-30-16.55.30.169873
1 record(s) selected.
第二笔数据是16点55分43秒插入的
[db2inst1@DB2 data1]$ db2 "insert into t2 values ('222')"
DB20000I The SQL command completed successfully.
[db2inst1@DB2 data1]$ db2 "values current timestamp"
1
--------------------------
2014-12-30-16.55.43.116725
1 record(s) selected.
第二笔数据是17点02分34秒插入的
[db2inst1@DB2 data1]$ db2 "insert into t2 values ('333')"
DB20000I The SQL command completed successfully.
[db2inst1@DB2 data1]$ db2 "values current timestamp"
1
--------------------------
2014-12-30-17.02.34.283375
1 record(s) selected.
3 恢复数据库
db2 restore db testdb taken at 20141230165426
SQL2539W Warning! Restoring to an existing database that is the same as the
backup image database. The database files will be deleted.
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
4 进行前滚,滚到第二笔数据插入的时间点,但是系统却报这个错误
db2 rollforward db testdb to 2014-12-30-16.55.43.116725 using local time
SQL1266N Database "TESTDB" has been rolled forward to
"2014-12-30-17.54.26.000000 Local", which is past the specified point-in-time.