Posted on 2009-08-23 23:14
leekiang 閱讀(2814)
評論(1) 編輯 收藏 所屬分類:
oracle
轉自http://www.cublog.cn/u/30637/showart_481055.html
Oracle的imp/exp組件是我們常用的工具,它的一個操作原則就是向下兼容。下面是據此總結的幾個使用規則和相關測試:
?
規則1:低版本的exp/imp可以連接到高版本(或同版本)的數據庫服務器,但高版本的exp/imp不能連接到低版本的數據庫服務器
?
1.1 使用9i客戶端通過imp連接到10g數據庫
?
C:\Documents and Settings\yuechaotian>exp userid=hdtest/test@s67 tables=(ab01) rows=n file=d:\x.dmp
?
Export: Release 9.2.0.1.0
- Production on
星期三
2
月
20 10:09:55 2008
?
Copyright (c) 1982, 2002, Oracle Corporation.? 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
字符集
注
:
將不會導出表數據(行)
?
即將導出指定的表通過常規路徑
... . .
正在導出表
??????????????????????????? AB01
在沒有警告的情況下成功終止導出。
?
|
?
1.2 使用10g客戶端通過imp連接9i數據庫:連接失敗(而不是導出失敗)
?
C:\Documents and Settings\yuechaotian>exp userid=hbjb_kf_hd/test@s46 owner=hdtest file=d:\x.dmp
?
Export: Release 10.2.0.1.0 - Production on
星期三
2
月
20 09:57:22 2008
?
Copyright (c) 1982, 2005, Oracle.? All rights reserved.
?
EXP-00056:
遇到
ORACLE
錯誤
6550 ORA-06550:
第
1
行
,
第
41
列
: PLS-00302:
必須說明
'SET_NO_OUTLINES'
組件
ORA-06550:
第
1
行
,
第
15
列
: PL/SQL: Statement ignored EXP-00000:
導出終止失敗
?
|
?
?
規則2:高版本exp出的dmp文件,低版本無法imp(無法識別dmp文件)
?
2.1 使用10g客戶端exp出10g的數據
?
C:\Documents and Settings\yuechaotian>exp userid=test/test@orcl owner=test file=d:\10g.dmp
?
Export: Release 10.2.0.1.0 - Production on
星期三
2
月
20 11:16:39 2008
?
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
字符集
服務器使用
AL32UTF8
字符集
(
可能的字符集轉換
)
?
即將導出指定的用戶
...
……
導出成功終止
,
但出現警告。
?
C:\Documents and Settings\yuechaotian>
?
|
?
2.2 使用9i客戶端imp上面所導出的dmp文件到10g:可以連接到10g中,但無法識別文件
?
C:\Documents and Settings\yuechaotian>imp userid=test/test@s10g fromuser=test touser=test file=d:\10g.dmp
?
Import: Release 9.2.0.1.0 - Production on
星期三
2
月
20 11:20:33 2008
?
Copyright (c) 1982, 2002, Oracle Corporation.? All rights reserved.
?
連接到
: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options
?
IMP-00010:
不是有效的導出文件,標題驗證失敗
IMP-00000:
未成功終止導入
?
C:\Documents and Settings\yuechaotian>
?
|
?
?
規則3:低版本exp出的dmp文件,高版本可以imp(向下兼容)
3.1 使用9i客戶端exp出9i中的數據
?
C:\Documents and Settings\yuechaotian>exp userid=test/test@s9i owner=test file=d:\9i.dmp
?
Export: Release 9.2.0.1.0 - Production on
星期三
2
月
20 11:25:04 2008
?
Copyright (c) 1982, 2002, Oracle Corporation.? All rights reserved.
?
連接到
: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
已導出
ZHS16GBK
字符集和
AL16UTF16 NCHAR
字符集
?
即將導出指定的用戶
...
……
在沒有警告的情況下成功終止導出。
?
C:\Documents and Settings\yuechaotian>
?
|
?
3.2 使用10g客戶端imp到10g數據庫中
?
C:\Documents and Settings\yuechaotian>imp userid=test/test@orcl fromuser=test touser=test file=d:\9i.dmp
?
Import: Release 10.2.0.1.0 - Production on
星期三
2
月
20 11:28:46 2008
?
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:V09.02.00
創建的導出文件
已經完成
ZHS16GBK
字符集和
AL16UTF16 NCHAR
字符集中的導入
導入服務器使用
AL32UTF8
字符集
(
可能的字符集轉換
) . .
正在導入表
???????????????? "AUDIT_ACTIONS"
導入了
???????? 144
行
……
成功終止導入
,
但出現警告。
?
C:\Documents and Settings\yuechaotian>
?
|
?
?
規
則4:從Oracle 低版本的Export數據可以Import到Oracle高版本中,但限于Oracle的相鄰版本,如從Oracle 7 到
Oracle 8。對于兩個不相鄰版本間進行轉換,如從Oracle 6 到 Oracle 8,則應先將數據輸入到中間版本—Oracle
7,再從中間數據庫轉入更高版本。
?
?
C:\Documents and Settings\yuechaotian>imp userid=test/test fromuser=scott touser=test file=d:\tyc.dmp
?
Import: Release 10.2.0.1.0 - Production on
星期三
2
月
20 14:03:33 2008
?
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:V08.01.07
創建的導出文件
?
警告
:
這些對象由
SCOTT
導出
,
而不是當前用戶
?
已經完成
ZHS16GBK
字符集和
AL16UTF16 NCHAR
字符集中的導入
導入服務器使用
AL32UTF8
字符集
(
可能的字符集轉換
)
導出服務器使用
ZHS16GBK NCHAR
字符集
(
可能的
ncharset
轉換
) .
正在將
SCOTT
的對象導入到
TEST . .
正在導入表
?????????????????????? "ACCOUNT"
導入了
?????????? 5
行
. .
正在導入表
???????????????????????? "BONUS"
導入了
?????????? 0
行
. .
正在導入表
????????????????????????? "DEPT"
導入了
?????????? 4
行
. .
正在導入表
?????????????????????????? "EMP"
導入了
????????? 14
行
. .
正在導入表
?????????????????????? "RECEIPT"
導入了
?????????? 1
行
. .
正在導入表
????????????????????? "SALGRADE"
導入了
?????????? 5
行
即將啟用約束條件
...
成功終止導入
,
沒有出現警告。
?
C:\Documents and Settings\yuechaotian>
?
|
?
以上操作,對于OracleXE的10g版本同樣適用:
?
C:\Documents and Settings\yuechaotian>imp userid=test/test fromuser=scott touser=test file=d:\tyc.dmp
?
Import: Release 10.2.0.1.0 - Production on
星期三
2
月
20 14:15:51 2008
?
Copyright (c) 1982, 2005, Oracle.? All rights reserved.
?
連接到
: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
?
經由常規路徑由
EXPORT:V08.01.07
創建的導出文件
?
警告
:
這些對象由
SCOTT
導出
,
而不是當前用戶
?
已經完成
ZHS16GBK
字符集和
AL16UTF16 NCHAR
字符集中的導入
導出服務器使用
ZHS16GBK NCHAR
字符集
(
可能的
ncharset
轉換
) .
正在將
SCOTT
的對象導入到
TEST . .
正在導入表
?????????????????????? "ACCOUNT"
導入了
?????????? 5
行
. .
正在導入表
???????????????????????? "BONUS"
導入了
?????????? 0
行
. .
正在導入表
????????????????????????? "DEPT"
導入了
?????????? 4
行
. .
正在導入表
?????????????????????????? "EMP"
導入了
????????? 14
行
. .
正在導入表
?????????????????????? "RECEIPT"
導入了
?????????? 1
行
. .
正在導入表
????????????????????? "SALGRADE"
導入了
?????????? 5
行
即將啟用約束條件
...
成功終止導入
,
沒有出現警告。
?
C:\Documents and Settings\yuechaotian>
?
|