[20160803]exp/imp語法問題.txt

lfree發表於2016-08-03

[20160803]exp/imp語法問題.txt


--那個給我解析exp這種語法:

1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create table t as select * from dba_objects ;
Table created.

SCOTT@book> select count(1) from t;
  COUNT(1)
----------
     87047


2.使用exp:

$ exp scott/book tables=t  file=>(gzip >t.dmp.gz)
Export: Release 11.2.0.4.0 - Production on Wed Aug 3 10:42:12 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit 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                              T      87047 rows exported
Export terminated successfully without warnings.

$ ls -l t.dmp.gz
-rw-r--r-- 1 oracle oinstall 1008545 2016-08-03 10:42:15 t.dmp.gz
$ file t.dmp.gz
t.dmp.gz: gzip compressed data, from Unix, last modified: Wed Aug  3 10:42:12 2016

--這樣確實建立1個壓縮檔案。

3.匯入imp:
SCOTT@book> rename t to t_old;
Table renamed.

--//注意要使用小於號。
$ imp scott/book full=y  file=<(gunzip <t.dmp.gz)
Import: Release 11.2.0.4.0 - Production on Wed Aug 3 10:46:42 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into SCOTT
. importing SCOTT's objects into SCOTT
. . importing table                            "T"      87047 rows imported
Import terminated successfully without warnings.

SCOTT@book> select count(1) from t;

  COUNT(1)
----------
     87047

SCOTT@book> select count(1) from t_old;
  COUNT(1)
----------
     87047

--expdp不行。

$ expdp scott/book tables=t DUMPFILE=>(gzip >t1.dmp.gz) directory=DATA_PUMP_DIR
Export: Release 11.2.0.4.0 - Production on Wed Aug 3 10:51:28 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-39088: file name cannot contain a path specification

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