如何用exp 匯出 某個表的某幾列資料

paulyibinyi發表於2008-05-26

透過查詢exp  help=y  的命令幫助資訊,確實還沒這項功能 10g好像也沒有這功能

不過我們可以變通一下 達到我們的需要 透過create table  tablename as select 方法

測試如下:

C:\Documents and Settings\Paul Yi>sqlplus paul/paul

SQL*Plus: Release 9.2.0.4.0 - Production on Mon May 26 10:14:51 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> create table test as select * from user_objects;

Table created.

SQL> desc test;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 OBJECT_NAME                                        VARCHAR2(128)
 SUBOBJECT_NAME                                     VARCHAR2(30)
 OBJECT_ID                                          NUMBER
 DATA_OBJECT_ID                                     NUMBER
 OBJECT_TYPE                                        VARCHAR2(18)
 CREATED                                            DATE
 LAST_DDL_TIME                                      DATE
 TIMESTAMP                                          VARCHAR2(19)
 STATUS                                             VARCHAR2(7)
 TEMPORARY                                          VARCHAR2(1)
 GENERATED                                          VARCHAR2(1)
 SECONDARY                                          VARCHAR2(1)

SQL> select count(*) from test;

  COUNT(*)
----------
        25

假設我們匯出只需要object_id,object_name 兩個欄位的資料

SQL> create table test_column as select object_id,object_name from test;

Table created.

SQL>

C:\Documents and Settings\Paul Yi>exp paul/paul tables=(test_column) file=c:\tes
t.dmp log=c:\test.log buffer=10240000

Export: Release 9.2.0.4.0 - Production on Mon May 26 10:19:54 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table                    TEST_COLUMN         25 rows exported
Export terminated successfully without warnings.

C:\Documents and Settings\Paul Yi>

 

 

 

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

相關文章