因工作需要,需導入歷史庫以查詢歷史數據,因幾次數據庫清理所以導出的歷史庫文件分了好幾部分,費千辛萬苦找全了文件後,開始導數:
1、load第一個文件(50多萬行)用:load from ... of ixf replace into .. nonrecoverable (測試環境空間較小,不要日志了!)
很久後,報:
SQL0289N Unable to allocate new pages in table space "USERSPACE1".
SQLSTATE=57011
查db2diag.log,報:
Tablespace 2(USERSPACE1) is full
..
DIA9999E An internal error occurred. Report the following error code :
"0xFFFFD121".
表空間滿了,一開始沒想到,刪掉幾個沒用的大表後,先load....terminate....,消除load pending狀態,重新導入,成功。
2、load第二個文件,報:
SQL3125W The character data in row "F0-1" and column "3" was truncated
because the data is longer than the target database column.
^C 強行中斷!
select 查詢表內容,報:
SQL0290N Table space Access is not allowed. SQLSTATE=55039
查表空間狀態,為load pending,執行load...terminate....卻失敗,報:
SQL3508N Error in Accessing a file or path of type "RESTART/TERMINATE INFO"
during load or load query. Reason code: "1". Path: "".
再查表空間狀態,為0x000c QuIEsced: EXCLUSIVE load pending,
再次執行load...terminate....,很長時間沒動靜,按捺不住,又^C強行中斷!報:
SQL3501W The table space(s) in which the table resides will not be placed in
backup pending state since forward recovery is disabled for the database.
SQL3110N The utility has completed processing. "0" rows were read from the
input file.
^C
DB21017E The Command Line Processor encountered a system error with the
frontend process output queue. Reason code = -2498.
一不做二不休,做一個force application all ,再list applications還有?!
看一下表空間狀態,0x0004 QuIEsced: EXCLUSIVE
再load...terminate....,報:
SQL3508N Error in Accessing a file or path of type "TEMP_FILE" during load or
load query. Reason code: "1". Path:
"/db2catalog/db2inst/NODE0000/SQL00001/lo".
這幾個提示連看都沒仔細看,就db2stop,不成功!
開始著急,干脆把庫drop掉重建,於是drop db ,不成功,報:
SQL1137W The database manager was unable to remove the database path or some
of the containers when dropping database "TEST". Cleanup is required.
看都沒看,做uncatalog
做redirect恢復時,報:
SQL1036C An I/O error occurred while Accessing the database. SQLSTATE=58030
查幾個container所在的lv的屬組屬主均正確,查編目表空間(SMS)、臨時表空間(SMS)的目錄屬組屬主權限均正常!
試做db2untag,成功!但再redirect恢復,仍報SQL1036C!
不解!
回過頭再看前面SQL3508N錯時,看到Path: "/db2catalog/db2inst/NODE0000/SQL00001/lo"
進入編目目錄,看到db2catalog/db2inst/NODE0000/SQL00001/load/DB200002.PID/DB200916.OID/load.msg文件,應該是在做LOAD時留下的MSG,db2inst目錄屬組屬主均同實例用戶,將db2catalog下的所有文件目錄清空,再redirect恢復,成功!
3、恢復完庫再LOAD完第一個文件後,查看LOAD第二個文件報的錯,查db2diag.log,發現報"0xFFFF8138".即“Invalid state transition”,查表結構,才發現表結構比導入文件多一個字段,重建表結構,導入,成功!
教訓:1、一定要仔細查看理解語句所報的錯誤,如果仔細點,報SQL3125時,就應該知道是表結構不對,報SQL3508N時就應該去清理catalog目錄,報SQL1137W就更應該知道去清理!而且以上錯誤在db2diag.log裡均有提示,如果早注意就不會費那麼多事兒了,浪費了mymm一天的時間!
2、在建庫以前一定要將各SMS管理的目錄清理干淨!SQL1036C錯誤無非都是些權限錯誤!
一點教訓,拿出共勉!
忘記說環境了:AIX 4.3.3
DB2 7.2、實例db2inst、數據庫test
SYSCATSPACE-SMS
TEMPSPACE1-SMS
USERSPACE1-DMS