db2資料庫資料的匯出匯入
因為我本地的資料庫是auto increment的,所以使用這句:
db2 => import from /home/movedata/mytbl2.ixf of ixf modified by identityignore insert into mytbl2
但是一直遇到以下出錯:
[db2inst1@oc0644314035 ~]$ db2 "import from /home/elsa/desktop/databackup/holiday.ixf of ixf modified by identityignore insert into
sr.holiday"
sql3030c an i/o error (reason = "sqlofopn -2079391743") occurred while
opening the input file.
sql3110n the utility has completed processing. "0" rows were read from the
input file.
在網上看了一些資料,提到的普遍觀點是:
二、建立乙個新的folder,問題就沒有了。
三、重灌data studio的。
ibm官網的knowledge center只是把錯誤提示再給貼一遍,也是醉了:
第三種情況除非是萬不得已的情況下,不然我是不會採取的。
所以我採取的解決方案是:在/home/db2inst1裡建立乙個folder叫做databasebackup,然後把之前那個放有ixf檔案的folder移到這個db2inst1的許可權下的folder裡,再在命令列裡切換到su - db2inst1的許可權,執行以下命令進行匯入:
db2 "import from holiday.ixf of ixf modified by identityignore insert into sr.holiday"
報錯的時候,我看到很多都是跟其他**相關的,按理說應該是沒問題的。
今天再次實驗的時候,出現以下這種情況,說我的ixf檔案不正確:
sql3054n the input file is not a valid pc/ixf file. the file is too short to
contain a valid h record.
sql3110n the utility has completed processing. "0" rows were read from the
input file.
換了乙個ixf檔案,匯入成功:
[db2inst1@oc0515384300 localbackup]$ db2 "import from tab8.ixf of ixf modified by identityignore insert into sr.pool"
sql3150n the h record in the pc/ixf file has product "db2 02.00", date
"20150831", and time "154119".
sql3153n the t record in the pc/ixf file has name "tab8.ixf", qualifier "",
and source " ".
sql3109n the utility is beginning to load data from file "tab8.ixf".
sql3110n the utility has completed processing. "3" rows were read from the
input file.
sql3221w ...begin commit work. input record count = "3".
sql3222w ...commit of any database changes was successful.
sql3149n "3" rows were processed from the input file. "3" rows were
successfully inserted into the table. "0" rows were rejected.
number of rows read = 3
number of rows skipped = 0
number of rows inserted = 3
number of rows updated = 0
number of rows rejected = 0
number of rows committed = 3
但是檢視了一下匯入後的資料,依然是按照本地順序去插入的。所以還是不能符合我的需求……
所以我想在不drop table的情況下,清空我本地的這些資料。然後匯入我從伺服器上備份下來的資料。
清空**
在檢視清空**的時候:
講到以下幾種方法:
alter table sr.holiday activate not logged initially with empty table (這個我試過了,不能阻止auto increment繼續計數)
import from /dev/null of del replace into sr.holiday (匯入乙個空表,這個我試過了,也不能阻止auto increment繼續計數)
DB2匯入匯出資料庫資料
匯出資料庫中資料 在db2cmd命令下生成建庫指令碼 z指定模式名 db2look d bbs z db2admin u db2admin e o bbs.sql 在db2cmd命令下匯出資料 db2move bbs export sn db2admin u db2admin p db2admin ...
db2 資料庫的匯出匯入
1記錄源資料庫的相關配置引數,包括資料庫登錄檔變數 db2set 資料庫管理系統引數 dbm cfg 資料庫配置引數 db cfg 2用db2look匯出建庫ddl指令碼,用於在目標庫中建立資料庫物件 3用db2move匯出源資料庫的資料 4使用匯出的建庫ddl 由於平台不同可能需要作少量修改 建庫...
DB2資料庫之 檔案匯出
最近專案需要從db2生產資料庫匯出資料,這裡做個簡單的記錄 直接上例項,db2 export to db ccp dbhome ccpusr pqb0073 20150202.csv of del select t2.eml nam,t1.crd nbr,t1.bnk nbr,t1.bll nbr,...