這篇文章給大家分享的是有關(guān)expdp如何導(dǎo)出表空間的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
在大同等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作按需求定制開發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站設(shè)計(jì),成都營銷網(wǎng)站建設(shè),成都外貿(mào)網(wǎng)站建設(shè)公司,大同網(wǎng)站建設(shè)費(fèi)用合理。
下面我們來測試一下:
創(chuàng)建一個(gè)表空間,此處省略。 我創(chuàng)建幾張表,并且創(chuàng)建一個(gè)分區(qū)表
,語句如下: 分區(qū)使用了兩個(gè)表空間,TEST 和USERS
點(diǎn)擊(此處)折疊或打開
CREATE TABLE scott.obj_part
PARTITION BY RANGE (created)
(
PARTITION p20101231 VALUES LESS THAN (to_date('20101231','yyyymmdd')) tablespace test,
PARTITION p20111231 VALUES LESS THAN (to_date('20111231','yyyymmdd')) tablespace test,
PARTITION p20121231 VALUES LESS THAN (to_date('20121231','yyyymmdd')) tablespace users,
PARTITION p20131231 VALUES LESS THAN (to_date('20131231','yyyymmdd')) tablespace users,
PARTITION p20141231 VALUES LESS THAN (to_date('20141231','yyyymmdd')) tablespace users,
PARTITION p20151231 VALUES LESS THAN (to_date('20151231','yyyymmdd')) tablespace users,
PARTITION p20161231 VALUES LESS THAN (to_date('20161231','yyyymmdd')) tablespace users,
PARTITION p20171231 VALUES LESS THAN (to_date('20171231','yyyymmdd')) tablespace users
)
as select * from dba_objects where 1=0
插入數(shù)據(jù):
點(diǎn)擊(此處)折疊或打開
SQL> insert into scott.obj_part select * from dba_objects;
86383 rows created.
SQL> commit;
Commit complete.
SQL> conn test/test
Connected.
SQL> insert into scott.obj_part select OWNER,OBJECT_NAME,SUBOBJECT_NAME,OBJECT_ID,DATA_OBJECT_ID,OBJECT_TYPE,to_date('2017-5-12','yyyy-mm-dd'),LAST_DDL_TIME,TIMESTAMP,STATUS,TEMPORARY,GENERATED,SECONDARY,NAMESPACE,EDITION_NAME from dba_objects;
86383 rows created.
SQL> commit;
Commit complete.
SQL> create index scott.objpart_id on scott.obj_part(object_id) tablespace test;
Index created.
SQL> commit;
Commit complete.
執(zhí)行導(dǎo)出
點(diǎn)擊(此處)折疊或打開
[oracle@mystandby dump]$ expdp \' / as sysdba\' directory=sh_dmp dumpfile=exp_tablespace01.dmp logfile=exptablesp01.log tablespaces=test
Export: Release 11.2.0.4.0 - Production on Thu Aug 10 20:40:29 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, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLESPACE_01": "/******** AS SYSDBA" directory=sh_dmp dumpfile=exp_tablespace01.dmp logfile=exptablesp01.log tablespaces=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 36.12 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."OBJ_PART":"P20131231" 8.358 MB 86200 rows
. . exported "SCOTT"."OBJ_PART":"P20171231" 8.394 MB 86566 rows --注意此表表空間為USERS表空間
. . exported "TEST"."TEST" 8.435 MB 87003 rows
. . exported "TEST"."T_C" 3.035 MB 84748 rows
. . exported "TEST"."T_ADV" 873.0 KB 100000 rows
. . exported "TEST"."T_P" 83.70 KB 2870 rows
. . exported "SCOTT"."OBJ_PART":"P20101231" 0 KB 0 rows
. . exported "SCOTT"."OBJ_PART":"P20111231" 0 KB 0 rows
. . exported "SCOTT"."OBJ_PART":"P20121231" 0 KB 0 rows
. . exported "SCOTT"."OBJ_PART":"P20141231" 0 KB 0 rows
. . exported "SCOTT"."OBJ_PART":"P20151231" 0 KB 0 rows
. . exported "SCOTT"."OBJ_PART":"P20161231" 0 KB 0 rows
Master table "SYS"."SYS_EXPORT_TABLESPACE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TABLESPACE_01 is:
/backup/dump/exp_tablespace01.dmp
Job "SYS"."SYS_EXPORT_TABLESPACE_01" successfully completed at Thu Aug 10 20:40:42 2017 elapsed 0 00:00:12
也就是使用expdp導(dǎo)出表空間時(shí),并不是只導(dǎo)出該表空間所有數(shù)據(jù),也會(huì)將相關(guān)聯(lián)的相關(guān)對象數(shù)據(jù)導(dǎo)出。
下面貼出官方解釋:
點(diǎn)擊(此處)折疊或打開
TABLESPACES
Default: There is no default
Purpose
Specifies a list of tablespace names to be exported in tablespace mode.
Syntax and Description
TABLESPACES=tablespace_name [, ...]
In tablespace mode, only the tables contained in a specified set of tablespaces are unloaded. If a table is unloaded, then its dependent objects are also unloaded. Both object metadata and data are unloaded. If any part of a table resides in the specified set, then that table and all of its dependent objects are exported. Privileged users get all tables. Unprivileged users get only the tables in their own schemas
---大體意思
在表空間模式中, 只導(dǎo)出指定表空間中所包含的表。如果導(dǎo)出了表, 則它的從屬對象也將被導(dǎo)出。對象元數(shù)據(jù)和數(shù)據(jù)都將被導(dǎo)出。如果表的任何部分保存在在指定的表空間中, 則導(dǎo)出該表及其所有從屬對象。特權(quán)用戶獲取所有表,沒有特權(quán)的用戶只能在自己的權(quán)限內(nèi)獲取表。
Filtering can restrict what is exported using this mode (see "Filtering During Export Operations").
Restrictions
The length of the tablespace name list specified for the TABLESPACES parameter is limited to a maximum of 4 MB, unless you are using the NETWORK_LINK to an Oracle Database release 10.2.0.3 or earlier or to a read-only database. In such cases, the limit is 4 KB.
Example
The following is an example of using the TABLESPACES parameter. The example assumes that tablespaces tbs_4, tbs_5, and tbs_6 already exist.
> expdp hr DIRECTORY=dpump_dir1 DUMPFILE=tbs.dmp
TABLESPACES=tbs_4, tbs_5, tbs_6
This results in a tablespace export in which tables (and their dependent objects) from the specified tablespaces (tbs_4, tbs_5, and tbs_6) will be unloaded.
感謝各位的閱讀!關(guān)于“expdp如何導(dǎo)出表空間”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!