Ⅰ 數據無法導入怎麼辦 導入不了數據如何解決
導入數據時報1659的錯誤的原因主要是資料庫表空間剩餘空間不足引起的。
分析原因
1、表空間剩餘空間不足。
使用下面語句,查看錶空間剩餘空間
select Upper(f.tablespace_name) "表空間名",
d.tot_grootte_mb "表空間大小(M)",
d.tot_grootte_mb - f.total_bytes "已使用空間(M)",
to_char(round((d.tot_grootte_mb - f.total_bytes) /
d.tot_grootte_mb * 100, 2),'990.99') || '%' "使用比",
f.total_bytes "空閑空間(M)",
f.max_bytes "最大塊(M)"
from (select tablespace_name,
round(sum(bytes) / (1024 * 1024), 2) total_bytes,
round(max(bytes) / (1024 * 1024), 2) max_bytes
from sys.dba_free_space
group by tablespace_name) f,
(select dd.tablespace_name,
round(sum(dd.bytes) / (1024 * 1024), 2) tot_grootte_mb
from sys.dba_data_files dd
group by dd.tablespace_name) d
where d.tablespace_name = f.tablespace_name
order by f.tablespace_name;
表空間剩餘空間不足時,可以根據原資料庫表空間大小增加表空間。
alter tablespace 表空間名 add datafile '數據文件名' size 數據文件大小;
2、剩餘表空間還很多。
使用下面語句查看原資料庫表表定義,找到initial_extent值大的表,將這些表的
創建語句導出後修改initial_extent值,在目標資料庫中創建後再導入數據,導入時
增加參數ignore=y。
select table_name, initial_extent
from user_tables
where initial_extent is not null
order by initial_extent desc
如果找不到原資料庫,可以使用
imp userid/userid@service_name file=dmp文件名 indexfile=index文件名 rows=n full=Y
命令將dmp文件中創建表的語句導入到indexfile文件中,查看indexfile如下:
REM CREATE TABLE "TEST"."DM_KJKM_COPY" ("KJZDMB_DM" VARCHAR2(100)
REM ENABLE, "KMID" NUMBER(20, 0), "KMBM" VARCHAR2(100), "KMMC"
REM VARCHAR2(500), "KMQC" VARCHAR2(1000), "KMLB_DM" VARCHAR2(100),
REM ...
使用文本編輯工具,查找INITIAL將過大的初始值改為65536後,將REM去除後,在資料庫中創建後再使用exp導入數據,導入時增加參數ignore=y。