匯入一個有lob型別欄位的表且存在與匯入表同名的同義詞會報ora-01403錯誤
如果你一表包含一個lob型別的列如果存在一個與這個表同名的同義詞那麼在匯入這個表的資料時會報ora-01403錯:
在oracle10g中的測試情況如下:
1.建立兩個使用者test和cs
idle> conn sys/zzh_2046@jy_1 as sysdba 已連線。 sys@JINGYONG> grant dba to test identified by test; 授權成功。 sys@JINGYONG> grant dba to cs identified by cs; 授權成功。
2.在使用者test中建立一個有clob型別的列的表emp並向表中插入幾行記錄
sys@JINGYONG> conn test/test@jy_1 已連線。 test@JINGYONG> create table emp (col_a number, col_b varchar2(3), c_lob clob); 表已建立。 test@JINGYONG> test@JINGYONG> INSERT INTO EMP VALUES (180, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (181, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (182, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (183, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (184, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (185, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> commit; 提交完成。
連線到使用者cs並建立一個同義詞叫EMP
1.建立同義詞EMP是使用test.emp表來建立(也可以用任意表來建立同義詞EMP,只要保證同義詞的名字與要匯入表的名字相同就行)
test@JINGYONG> conn cs/cs@jy_1 已連線。 cs@JINGYONG> create synonym EMP for test.EMP; 同義詞已建立。 cs@JINGYONG> commit; 提交完成。 cs@JINGYONG> C:\Documents and Settings\Administrator>exp test/test@jy_1 file=f:\emp.dmp table s=EMP Export: Release 10.2.0.1.0 - Production on 星期四 12月 19 22:00:15 2013 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 字符集 即將匯出指定的表透過常規路徑... . . 正在匯出表 EMP匯出了 6 行 成功終止匯出, 沒有出現警告。 C:\Documents and Settings\Administrator>imp cs/cs@jy_1 file=f:\emp.dmp tables=EM P ignore=y Import: Release 10.2.0.1.0 - Production on 星期四 12月 19 22:01:48 2013 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 建立的匯出檔案 警告: 這些物件由 TEST 匯出, 而不是當前使用者 已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入 . 正在將 TEST 的物件匯入到 CS . 正在將 TEST 的物件匯入到 CS . . 正在匯入表 "EMP" IMP-00058: 遇到 ORACLE 錯誤 1403 ORA-01403: no data found匯入了 6 行 成功終止匯入, 但出現警告。
2.使用表t1來建立同義詞EMP
cs@JINGYONG> create synonym EMP for sys.t1; 同義詞已建立。 cs@JINGYONG> drop table emp; drop table emp * 第 1 行出現錯誤: ORA-00942: 表或檢視不存在 C:\Documents and Settings\Administrator>imp cs/cs@jy_201 file=f:\emp.dmp tables= EMP ignore=y Import: Release 10.2.0.1.0 - Production on 星期五 12月 20 08:13:07 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. 連線到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案 警告: 這些物件由 TEST 匯出, 而不是當前使用者 已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入 . 正在將 TEST 的物件匯入到 CS . 正在將 TEST 的物件匯入到 CS . . 正在匯入表 "EMP" IMP-00058: 遇到 ORACLE 錯誤 1403 ORA-01403: 未找到任何資料 IMP-00058: 遇到 ORACLE 錯誤 904 ORA-00904: "C_LOB": 識別符號無效 成功終止匯入, 但出現警告。
11g的測試
1.建立兩個使用者test和cs
idle> conn sys/zzh_2046@jy_201 as sysdba 已連線。 sys@JINGYONG> grant dba to test identified by test; 授權成功。 sys@JINGYONG> grant dba to cs identified by cs;
2.在使用者test中建立一個有clob型別的列的表emp並向表中插入幾行記錄
sys@JINGYONG> conn test/test@jy_201 已連線。 test@JINGYONG> create table emp (col_a number, col_b varchar2(3), c_lob clob); 表已建立。 test@JINGYONG> test@JINGYONG> INSERT INTO EMP VALUES (180, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (181, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (182, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (183, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (184, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> INSERT INTO EMP VALUES (185, 'a', '01010101010101'); 已建立 1 行。 test@JINGYONG> commit; 提交完成。
連線到使用者cs並建立一個同義詞叫EMP
1.建立同義詞EMP是使用test.emp表來建立(也可以用任意表來建立同義詞EMP,只要保證同義詞的名字與要匯入表的名字相同就行)
test@JINGYONG> conn cs/cs@jy_201 已連線。 cs@JINGYONG> create synonym EMP for test.EMP; 同義詞已建立。 cs@JINGYONG> commit; 提交完成。 cs@JINGYONG>
使用10g的客戶端連線到11g的資料庫進行匯出操作
C:\Documents and Settings\Administrator>exp test/test@jy_201 file=f:\emp.dmp tab les=EMP Export: Release 10.2.0.1.0 - Production on 星期四 12月 19 22:10:28 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. 連線到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 已匯出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集 即將匯出指定的表透過常規路徑... . . 正在匯出表 EMP匯出了 6 行 成功終止匯出, 沒有出現警告。
使用10g的客戶端連線到11g的資料庫進行匯入操作也會報ora-01403錯誤
C:\Documents and Settings\Administrator>imp cs/cs@jy_201 file=f:\emp.dmp tables= EMP ignore=y Import: Release 10.2.0.1.0 - Production on 星期四 12月 19 22:11:27 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. 連線到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案 警告: 這些物件由 TEST 匯出, 而不是當前使用者 已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入 . 正在將 TEST 的物件匯入到 CS . 正在將 TEST 的物件匯入到 CS . . 正在匯入表 "EMP" IMP-00058: 遇到 ORACLE 錯誤 1403 ORA-01403: 未找到任何資料匯入了 6 行 成功終止匯入, 但出現警告。
使用11g的客戶端連線到11g的資料庫進行匯出操作
[oracle@jingyong ~]$ exp test/test file=/home/oracle/emp.dmp tables=EMP Export: Release 11.2.0.1.0 - Production on Sat Dec 7 01:41:44 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set About to export specified tables via Conventional Path ... . . exporting table EMP 12 rows exported Export terminated successfully without warnings.
使用11g的客戶端連線到11g的資料庫進行匯出操作在有與匯入表同名的同義詞的情況下不會報ora-01403錯誤.
[oracle@jingyong ~]$ imp cs/cs file=/home/oracle/emp.dmp tables=EMP ignore=y Import: Release 11.2.0.1.0 - Production on Sat Dec 7 01:42:20 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Export file created by EXPORT:V11.02.00 via conventional path Warning: the objects were exported by TEST, not by you import done in ZHS16GBK character set and AL16UTF16 NCHAR character set . importing TEST's objects into CS . importing TEST's objects into CS . . importing table "EMP" 12 rows imported Import terminated successfully without warnings. [oracle@jingyong ~]$
下面刪除與表同名的同義詞而且使用10g的客戶端連線11g資料庫進行匯入操作也是不會報ora-01403錯誤的
C:\Documents and Settings\Administrator>sqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 12月 20 07:51:34 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. idle> conn cs/cs@jy_1 已連線。 cs@JINGYONG> drop synonym EMP; 同義詞已刪除。 C:\Documents and Settings\Administrator>imp cs/cs@jy_201 file=f:\emp.dmp tables= EMP ignore=y Import: Release 10.2.0.1.0 - Production on 星期五 12月 20 09:02:40 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. 連線到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案 警告: 這些物件由 TEST 匯出, 而不是當前使用者 已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入 . 正在將 TEST 的物件匯入到 CS . 正在將 TEST 的物件匯入到 CS . . 正在匯入表 "EMP"匯入了 6 行 成功終止匯入, 沒有出現警告。
出現這個問題的原因:
是因為bug 7422758 IMPORTING A TABLE WITH A BLOB OR CLOB USING A SYNONYM CAUSES ORA-1403, fixed with 11.2.
解決方法:
1. 升級到11.2.
2. 打7422758補釘
注意:
在oracle11gr2版本中如果在對某個使用者匯入某個表時,而這個表有一個lob型別的列且這個使用者存一個與要匯入表同名的同義詞,在這種情況下使用oracle11gr2版本的客戶端進行匯出再匯入是不會報ora-01403錯誤.如果使用oracle11gr2版本以下的客戶端進行匯出和匯入也是會報ora-01403錯誤的.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-1063849/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 匯入sql時報日期型別錯誤SQL型別
- 【ORA-01555】Oracle LOB欄位匯出 報錯 ORA-01555Oracle
- Oracle如何把一個表匯出匯入到另一個伺服器上的另一個表裡Oracle伺服器
- 分享:一個基於NPOI的excel匯入匯出元件(強型別)Excel元件型別
- Python匯入包報錯(沒有這個包)Python
- ThinkPHP5.1 Excel 表的匯入匯出操作 (PHPExcel)PHPExcel
- 匯出oracle公有同義詞Oracle
- OracleDatabase——資料庫表空間dmp匯出與匯入OracleDatabase資料庫
- fdw批次匯入外部表
- Excel 表匯入資料Excel
- postgresql怎麼匯入表SQL
- ORACLE 資料匯出LOB欄位報錯ORA-31693,ORA-02354,ORA-22924Oracle
- 一個通用的匯入匯出excel的思路Excel
- mysqldump匯出匯入所有庫、某些庫、某些表的例子MySql
- 【oracle 多種形式的外部表匯入、匯出】實驗Oracle
- Java之POI操作Excel表-匯入匯出JavaExcel
- ClickHouse 資料表匯出和匯入(qbit)
- imp-匯入小寫字母的表
- Sql查詢 一個表中某欄位的資料在另一個表中某欄位中不存在的SQL
- impdp匯入報ORA-00001 ORA-04088錯誤
- MySQL 更新一個表裡的欄位等於另一個表某欄位的值MySql
- 將資料匯入kudu表(建立臨時hive表,從hive匯入kudu)步驟Hive
- 故障分析 | MySQL 使用 load data 匯入資料錯誤的一個場景MySql
- 多個報表匯出到一個 excel 的多 sheet 頁Excel
- 只匯入表結構及索引的方法索引
- Excel匯入null錯誤解決方式ExcelNull
- Mongodb資料的匯出與匯入MongoDB
- Oracle 12c expdp和impdp匯出匯入表Oracle
- JavaScript中的模組匯入有一個缺點JavaScript
- mysql表操作(alter)/mysql欄位型別MySql型別
- vue2匯入專案遇到錯誤Vue
- PPT匯入3D模型匯入出現錯誤或者模型紋理消失的解決方法3D模型
- excel的匯入與匯出---通用版Excel
- vue匯入錯誤 eslintrc.js語法的問題VueEsLintJS
- 匯入自定義板塊的方法
- Angular Excel 匯入與匯出AngularExcel
- 匯入地址表鉤取技術解析
- laravel-admin模型表單json元件且欄位型別為image,重新提交表單時未修改的資料會被置空Laravel模型JSON元件型別
- Sql多個表部分資料匯入匯出(臨時想的,暫沒想到其他辦法)SQL