[oracle@ocm1 ~]$ ll
total 32
-rw-r--r-- 1 oracle oinstall 24576 Mar 27 15:26 COUNTRIES.dmp
drwxr-xr-x 2 oracle oinstall 4096 Mar 27 12:39 script
drwxr-xr-x 2 oracle oinstall 4096 Mar 19 14:51 temp
下面是導入:
[oracle@ocm1 ~]$ imp
Import: Release 10.2.0.1.0 - Production on Thu Mar 27 15:31:30 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: sh
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Import file: expdat.dmp > /home/oracle/COUNTRIES.dmp
Enter insert buffer size (minimum is 8192) 30720>
IMP-00010: not a valid export file, header failed verification
IMP-00000: Import terminated unsuccessfully
[oracle@ocm1 ~]$
頭部驗證失敗是由於版本號不同所致,經試驗可以通過如下方法進行修改:
可以看到頭部信息 -TEXPORT:V11.01.00,即為源數據庫的版本號,將其修改為目的數據庫的版本號,
如本機為10.02.01,再次進行導入操作,導入成功
[oracle@ocm1 ~]$ vi COUNTRIES.dmp --直接使用vi修改下頭部的版本號即可
^C^CiEXPORT:V10.02.00--之前是EXPORT:V11.02.00
USH
再次導入,成功:
[oracle@ocm1 ~]$ imp
Import: Release 10.2.0.1.0 - Production on Thu Mar 27 15:36:22 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: sh
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Import file: expdat.dmp > /home/oracle/COUNTRIES.dmp
Enter insert buffer size (minimum is 8192) 30720>
Export file created by EXPORT:V10.02.00 via conventional path
import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
List contents of import file only (yes/no): no >
Ignore create error due to object existence (yes/no): no >
Import grants (yes/no): yes >
Import table data (yes/no): yes >
Import entire export file (yes/no): no >
Username: sh
Enter table(T) or partition(T:P) names. Null list means all tables for user
Enter table(T) or partition(T:P) name or . if done:
. importing SH's objects into SH
IMP-00008: unrecognized statement in the export file:
. importing SH's objects into SH
. . importing table "COUNTRIES" 23 rows imported
Import terminated successfully with warnings.
[oracle@ocm1 ~]$
SYS@PROD> conn sh/sh
Connected.
SH@PROD> desc COUNTRIES
Name Null? Type
----------------------------------------- -------- ----------------------------
COUNTRY_ID NOT NULL NUMBER
COUNTRY_ISO_CODE NOT NULL CHAR(2)
COUNTRY_NAME NOT NULL VARCHAR2(40)
COUNTRY_SUBREGION NOT NULL VARCHAR2(30)
COUNTRY_SUBREGION_ID NOT NULL NUMBER
COUNTRY_REGION NOT NULL VARCHAR2(20)
COUNTRY_REGION_ID NOT NULL NUMBER
COUNTRY_TOTAL NOT NULL VARCHAR2(11)
COUNTRY_TOTAL_ID NOT NULL NUMBER
COUNTRY_NAME_HIST VARCHAR2(40)
SH@PROD>
SH@PROD> select count(*) from COUNTRIES;
COUNT(*)
----------
23
備注:隨筆中內容來源於網上資料整理,僅供參考。