这些是 LOAD .. 不可恢复的缺点
这种方式加载的表根本无法恢复 - 即使是
加载前存在的数据。只有在
LOAD 操作后备份表空间/数据库时,您才能恢复数据。
LOAD表操作导致数据库恢复表状态不可用。
关于 LOAD
DB2 为 LOAD 命令提供了如下选项:
·COPY NO(缺省)
·COPY YES
·NONREVERABLE
·NONREVERABLE选项会将 LOAD 操作标志为不可恢复,即数据库不能通过后续的前滚操作而被恢复。LOAD 操作结束后,数据库既不会处于“备份暂挂”状态,也不会产生任何的备份。
解决办法:此时只有将表删除,重新构建,或使用 LOAD 操作时间点之后所做的数据库全备份或表空间备份来恢复该表。
allow reed access load而且是COPY NO和在线备份不兼容
[db2inst1@node ~]$ db2 backup db testy
Backup successful. The timestamp for this backup image is : 20210915165603
[db2inst1@node ~]$ db2 connect to testy
Database Connection Information
Database server = DB2/LINUXX8664 10.5.3
SQL authorization ID = DB2INST1
Local database alias = TESTY
[db2inst1@node ~]$ db2 "load query table SALES120120401_29"
Tablestate:
Normal
[db2inst1@node ~]$ db2 "load from 1.del of del insert into SALES120120401_29 nonrecoverable"
SQL3109N The utility is beginning to load data from file "/home/db2inst1/1.del".
[db2inst1@node ~]$ db2 "select * from SALES120120401_29"
ID SALES_PERSON REGION SALES_DATE
----------- -------------------------------------------------- -------------------------------------------------- ----------
1 test 1 04/30/2012
1 record(s) selected.
[db2inst1@node ~]$ db2 connect reset
DB20000I The SQL command completed successfully.
[db2inst1@node ~]$ db2 restore db testy taken at 20210915165603
SQL2539W The specified name of the backup image to restore is the same as the
name of the target database. Restoring to an existing database that is the
same as the backup image database will cause the current database to be
overwritten by the backup version.
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
[db2inst1@node ~]$ db2 connect to testy
SQL1117N A connection to or activation of database "TESTY" cannot be made
because of ROLL-FORWARD PENDING. SQLSTATE=57019
[db2inst1@node ~]$ db2 rollforward db testy to end of logs and stop
Rollforward Status
Input database alias = testy
Number of members have returned status = 1
Member ID = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0000045.LOG - S0000045.LOG
Last committed transaction = 2021-09-15-08.57.07.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
[db2inst1@node ~]$ db2 connect to testy
Database Connection Information
Database server = DB2/LINUXX8664 10.5.3
SQL authorization ID = DB2INST1
Local database alias = TESTY
[db2inst1@node ~]$ db2 load query table SALES120120401_29
Tablestate:
Unavailable
[db2inst1@node ~]$




