imp匯入時default 按table提交,使用commit按buffer提交

warehouse發表於2009-09-03
imp匯入時default每匯入一個表提交一次,如果使用commit=y則每buffer提交一次,如果擔心undo空間不夠,則可以考慮使用commit=y同時為了防止commit過於頻繁影響效能,最後別忘了適當的增大buffer[@more@]

C:>exp file='c:bakt.dmp' tables=t2

Export: Release 10.2.0.1.0 - Production on 星期四 9月 3 19:16:44 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.


連線到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
已匯出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

即將匯出指定的表透過常規路徑...
. . 正在匯出表 T2匯出了 759316 行
成功終止匯出, 沒有出現警告。

C:>
--=========================
--要匯入的資料佔23m
SQL> select segment_name,bytes/1024/1024 from dba_segments where segment_name='T
2';

SEGMENT_NA BYTES/1024/1024
---------- ---------------
T2 23
--users表空間對應的dataifle 9是4m並且無法自動擴充套件
SQL> select file_id,file_name,tablespace_name,bytes/1024/1024 m ,autoextensible
from dba_data_files;

FILE_ID FILE_NAME TABLESPACE M AUT
---------- ------------------------------ ---------- ---------- ---
1 C:TEMPSYSTEM01.DBF SYSTEM 300 YES
9 C:TEMPUSERS.DBF USERS 4 NO
6 C:TEMPUNDOTBS02.DBF UNDOTBS2 10 NO
5 C:TEMPTEST.DBF TEST 55 YES
3 C:TEMPSYSAUX01.DBF SYSAUX 120 YES
SQL> alter table t2 rename to t2_bak;

表已更改。

SQL> create table t2 tablespace users as select * from t2_bak where 1=2;

表已建立。

SQL>
--====================================
C:>imp file='c:bakt.dmp' full=y ignore=y

Import: Release 10.2.0.1.0 - Production on 星期四 9月 3 19:22:09 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.


連線到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案
已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入
. 正在將 TEST 的物件匯入到 TEST
. 正在將 TEST 的物件匯入到 TEST
. . 正在匯入表 "T2"
IMP-00058: 遇到 ORACLE 錯誤 1653
ORA-01653: 表 TEST.T2 無法透過 128 (在表空間 USERS 中) 擴充套件
IMP-00028: 上一個表的部分匯入已回退: 回退 99149 行
成功終止匯入, 但出現警告。

C:>
--提示"表 TEST.T2 無法透過 128 (在表空間 USERS 中) 擴充套件...回退 99149 行",下面查詢也
驗證了沒有資料匯入
--========================================
SQL> select count(*) from t2;

COUNT(*)
----------
0

SQL>
--========================================
C:>imp file='c:bakt.dmp' full=y ignore=y buffer=8192 commit=y

Import: Release 10.2.0.1.0 - Production on 星期四 9月 3 19:24:51 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.


連線到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案
已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入
. 正在將 TEST 的物件匯入到 TEST
. 正在將 TEST 的物件匯入到 TEST
. . 正在匯入表 "T2"
IMP-00058: 遇到 ORACLE 錯誤 1653
ORA-01653: 表 TEST.T2 無法透過 128 (在表空間 USERS 中) 擴充套件
IMP-00018: 上一個表的部分匯入已完成: 匯入了 99149 行
成功終止匯入, 但出現警告。

C:>
--在匯入時使用了commit=y發現資料匯入了,簡單的驗證了doc上提到的如果
設定了commit=y則匯入是按照buffer提交,否則按table提交
--===========================
SQL> select count(*) from t2;

COUNT(*)
----------
99149

SQL> select segment_name,bytes/1024/1024 from dba_segments where segment_name='T
2';

SEGMENT_NA BYTES/1024/1024
---------- ---------------
T2 3

SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1026617/,如需轉載,請註明出處,否則將追究法律責任。

相關文章