export to tempfile of del select * from TABLENAME where not 清理條件;
load from tempfile of del modified by delprioritychar replace into TABLENAME nonrecoverable;
delprioritychar:防止換行符導入失敗。replace:覆蓋現有資料。nonrecoverable:無日誌模式,速度最快。db2 "load from /dev/null of del terminate into TABLENAME nonrecoverable"
若未用 nonrecoverable,檢查表空間狀態:db2 list tablespaces show detail,必要時離線備份恢復正常。
db2 list application | grep DBNAME
db2 "force application (appl_handle1, appl_handle2)"
db2 get snapshot for application agentid 299 | grep Row
db2 get db cfg for [dbname]
db2 update db cfg using <參數名> <參數值>
db2stop force
解決 SQL1025N 錯誤,隨後 db2start 重啟。
db2 alter bufferpool ibmdefaultbp size 10240
db2 "select * from syscat.bufferpools"
db2 update db cfg for [db] using logretain on → 需立即離線備份解除 BACKUP PENDING。db2 update db cfg for [db] using logretain off。db2 get db cfg for [db] 查看 Path to log files 與 First active log file。db2 prune logfile prior to S0015913.LOG。db2 get dbm cfg 中 DIAGPATH 確定)。db2 "update cdmcrd set offset = (select cdmlsl.offset from cdmlsl where cdmlsl.crdno=cdmcrd.crdno) where cdmcrd.crdno in (select cdmlsl.crdno from cdmlsl)"
db2 "update A set bal=(select txnamt from B where actno=A.actno and cnlno=A.cnlno) where A.actno||A.cnlno in (select actno||cnlno from B)"
db2 "select * from A where actno like 'B_AAA%'"
db2 "select * from A where actno like '%-AAA%'"
restore db db1 to /tstdb2/catalog into db newlogpath /tstdb2/db2log buffer 2048 replace existing redirect parallelism 16;
set tablespace containers for 1 using (path '/tstdb2/db2tmp');
set tablespace containers for 2 using (device '/dev/rtstcontlv00' 2621440, device '/dev/rtstcontlv01' 2621440, device '/dev/rtstcontlv02' 2621440, device '/dev/rtstcontlv03' 2621440);
restore db db1 continue;
恢復完成後若報 ROLL-FORWARD PENDING,執行:
db2 rollforward db db1 to end of logs and complete