p; add constraint SALES_TEST_CUSTOMER_FK foreign key (CUST_ID)
references SH.CUSTOMERS (CUST_ID)
novalidate;
alter table SH.SALES_TEST
add constraint SALES_TEST_PRODUCT_FK foreign key (PROD_ID)
references SH.PRODUCTS (PROD_ID)
novalidate;
alter table SH.SALES_TEST
add constraint SALES_TEST_PROMO_FK foreign key (PROMO_ID)
references SH.PROMOTIONS (PROMO_ID)
novalidate;
alter table SH.SALES_TEST
add constraint SALES_TEST_TIME_FK foreign key (TIME_ID)
references SH.TIMES (TIME_ID)
novalidate;
2.登录到源数据库,将表sh.sales_test所在的表空间设置为只读状态
SQL> alter tablespace sales_test read only;
Tablespace altered
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
UNDOTBS2 ONLINE
EXAMPLE ONLINE
TEST ONLINE
SALES_TEST READ ONLY
9 rows selected
3.导出dump文件
SQL> create or replace directory tts_dump as '/tts';
Directory created
SQL> grant execute,read,write on directory tts_dump to public;
Grant succeeded
[root@jyrac1 ~]# su - oracle
[oracle@jyrac1 ~]$ expdp system/xxzx7817600 dumpfile=sales_test.dmp directory=tts_dump tables=sh.sales_test:sales_test_q1_2000,sh.sales_test:sales_test_q2_2000 transportable=always logfile=sales_test.log
Export: Release 11.2.0.4.0 - Production on Tue Jun 6 11:21:02 2017
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** dumpfile=sales_test.dmp directory=tts_dump tables=sh.sales_test:sales_test_q1_2000,sh.sales_test:sales_test_q2_2000 transportable=always logfile=sales_test.log
Processing object type TABLE_EXPORT/TABLE/PLUGTS_BLK
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/BITMAP_INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/BITMAP_INDEX/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/END_PLUGTS_BLK
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
********************************************