Oracle 12c利用数据泵DataPump进行Oracle数据库备份

时间:2023-03-09 06:35:08
Oracle 12c利用数据泵DataPump进行Oracle数据库备份

1、查看数据库版本

SQL> select version from v$instance;

VERSION
-----------------
12.1.0.2.0

2、sysdba用户登录sqlplus

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBCIS READ WRITE NO
4 PDBIDB READ WRITE NO
SQL> alter session set container=pdbcis; Session altered.

3、创建DataPump用户

SQL> grant dba to dp identified by dp;

Grant succeeded.

4、创建数据库备份目录

[oracle@cis ~]$ mkdir -p /home/oracle/pdbcis_bak

创建备份目录

SQL>  create or replace directory datapump_backup  as '/home/oracle/pdbcis_bak';

Directory created.

5、授权用户导出目录操作权限

SQL> grant read,write on directory datapump_backup to dp;

Grant succeeded.

6、导出

[oracle@cis ~]$ expdp dp/dp@pdbcis directory=datapump_backup  dumpfile=xxcis.dmp  logfile=xxcis.log  schemas=xxcis

打印的结果

[oracle@cis ~]$ expdp dp/dp@pdbcis directory=datapump_backup  dumpfile=xxcis.dmp  logfile=xxcis.log  schemas=xxcis

Export: Release 12.1.0.2.0 - Production on Tue Jan 5 11:51:27 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting "DP"."SYS_EXPORT_SCHEMA_01": dp/********@pdbcis directory=datapump_backup dumpfile=xxcis.dmp logfile=xxcis.log schemas=xxcis
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 21.56 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "XXCIS"."BRIEF" 5.249 MB 68245 rows
. . exported "XXCIS"."COREOPERATIONLOGS" 2.561 MB 10037 rows
. . exported "XXCIS"."CUSTOMSCOMPLEX" 1.666 MB 13171 rows
. . exported "XXCIS"."GTSCUSDATA" 1.442 MB 4940 rows
. . exported "XXCIS"."DECLAREELEMENTS" 13.09 KB 35 rows
. . exported "XXCIS"."TAXCODE" 455.9 KB 6524 rows
. . exported "XXCIS"."GBTOBIG" 204.3 KB 2609 rows
. . exported "XXCIS"."SAICCODE" 237.4 KB 3236 rows
. . exported "XXCIS"."STSCODE" 218.2 KB 3232 rows
. . exported "XXCIS"."PORTLIN" 165.5 KB 2679 rows
. . exported "XXCIS"."COREACLUSERPERMISSION" 90.63 KB 464 rows
. . exported "XXCIS"."CUSTOMS" 59.72 KB 1044 rows
. . exported "XXCIS"."DATAIMPORTFIELDSETUP" 54.57 KB 158 rows
. . exported "XXCIS"."DISTRICT" 55.17 KB 879 rows
. . exported "XXCIS"."RENDERCOLUMNDATA" 58.37 KB 258 rows
. . exported "XXCIS"."AGENTCORP" 0 KB 0 rows
. . exported "XXCIS"."APPLICATIONMODE" 7.046 KB 4 rows
. . exported "XXCIS"."BALANCEMODE" 7.242 KB 9 rows
. . exported "XXCIS"."BARGAINTYPE" 7.578 KB 5 rows
. . exported "XXCIS"."BROKERCORP" 24.33 KB 2 rows
. . exported "XXCIS"."CODRIVER" 0 KB 0 rows
. . exported "XXCIS"."COMPANY" 24.44 KB 1 rows
. . exported "XXCIS"."COMSGPARAM" 17.89 KB 10 rows
. . exported "XXCIS"."CONTAMODEL" 7.015 KB 4 rows
. . exported "XXCIS"."CONTASIZE" 6.906 KB 2 rows
. . exported "XXCIS"."COREACLGROUP" 0 KB 0 rows
. . exported "XXCIS"."COREACLGROUPUSER" 0 KB 0 rows
. . exported "XXCIS"."COREACLUSER" 15.12 KB 3 rows
. . exported "XXCIS"."COTYPE" 7.218 KB 9 rows
. . exported "XXCIS"."COUNTRY" 23.46 KB 243 rows
. . exported "XXCIS"."CURR" 8.609 KB 25 rows
. . exported "XXCIS"."CURRRATE" 0 KB 0 rows
. . exported "XXCIS"."CUSTOMSBASEVERSION" 14.32 KB 39 rows
. . exported "XXCIS"."DEDUC" 17.89 KB 103 rows
. . exported "XXCIS"."GTSAPPLYBILLHEAD" 0 KB 0 rows
. . exported "XXCIS"."GTSDECBASEPARAMETERS" 29.83 KB 1 rows
. . exported "XXCIS"."GTSDECHEAD" 62.75 KB 2 rows
. . exported "XXCIS"."GTSDECHEADPARAMETERS" 21.55 KB 3 rows
. . exported "XXCIS"."GTSDECITEM" 30.06 KB 2 rows
. . exported "XXCIS"."GTSDECRPTTEMPLATE" 12.58 KB 4 rows
. . exported "XXCIS"."INVCLASS" 7.171 KB 7 rows
. . exported "XXCIS"."LEVYKIND" 8.562 KB 35 rows
. . exported "XXCIS"."LEVYMODE" 7.242 KB 9 rows
. . exported "XXCIS"."LICENSEDOCU" 12.82 KB 42 rows
. . exported "XXCIS"."LICENSENOTE" 16.41 KB 87 rows
. . exported "XXCIS"."MACHININGTYPE" 8.859 KB 44 rows
. . exported "XXCIS"."MATERIAL" 0 KB 0 rows
. . exported "XXCIS"."PAYERTYPE" 6.921 KB 2 rows
. . exported "XXCIS"."PAYMODE" 7.023 KB 4 rows
. . exported "XXCIS"."PAYTYPE" 7.054 KB 5 rows
. . exported "XXCIS"."PISESPSERVER" 12.57 KB 2 rows
. . exported "XXCIS"."PISSYNCACLUSER" 15.42 KB 3 rows
. . exported "XXCIS"."PORTINTERNAL" 7.085 KB 5 rows
. . exported "XXCIS"."PREDOCK" 14.78 KB 99 rows
. . exported "XXCIS"."REDDEP" 30.07 KB 374 rows
. . exported "XXCIS"."SRTJZX" 8.515 KB 12 rows
. . exported "XXCIS"."SRTTJ" 12.96 KB 58 rows
. . exported "XXCIS"."TRADE" 15.74 KB 92 rows
. . exported "XXCIS"."TRADEMARK" 12.64 KB 39 rows
. . exported "XXCIS"."TRANSAC" 7.078 KB 6 rows
. . exported "XXCIS"."TRANSF" 7.5 KB 14 rows
. . exported "XXCIS"."UNIT" 13.61 KB 123 rows
. . exported "XXCIS"."USES" 7.367 KB 11 rows
. . exported "XXCIS"."WRAP" 7.125 KB 7 rows
. . exported "XXCIS"."COBOMEXG" 0 KB 0 rows
. . exported "XXCIS"."COBOMIMG" 0 KB 0 rows
. . exported "XXCIS"."COBOMVERSION" 0 KB 0 rows
. . exported "XXCIS"."COMPLEX" 0 KB 0 rows
. . exported "XXCIS"."CONTACTTYPE" 0 KB 0 rows
. . exported "XXCIS"."COREACLGROUPPERMISSION" 0 KB 0 rows
. . exported "XXCIS"."COUNIT" 0 KB 0 rows
. . exported "XXCIS"."CURRENCY" 0 KB 0 rows
. . exported "XXCIS"."CURRRATEMAINTAIN" 0 KB 0 rows
. . exported "XXCIS"."DECLARANT" 0 KB 0 rows
. . exported "XXCIS"."ESPAUTHORITYBROKERCORP" 0 KB 0 rows
. . exported "XXCIS"."ESPAUTHORITYBROKERCORPITEM" 0 KB 0 rows
. . exported "XXCIS"."EXPORTINVOICE" 0 KB 0 rows
. . exported "XXCIS"."FETCHINMODE" 0 KB 0 rows
. . exported "XXCIS"."GOODS" 0 KB 0 rows
. . exported "XXCIS"."GTSAPPLYBILLITEM" 0 KB 0 rows
. . exported "XXCIS"."GTSAPPLYBILLITEM2GTSDECITEM" 0 KB 0 rows
. . exported "XXCIS"."GTSDECATTACHBILL" 0 KB 0 rows
. . exported "XXCIS"."GTSDECCONTAINER" 0 KB 0 rows
. . exported "XXCIS"."GTSDECHEADDEL" 0 KB 0 rows
. . exported "XXCIS"."GTSDECMESSAGESEND" 0 KB 0 rows
. . exported "XXCIS"."GTSDECPRINTPARAMETERS" 0 KB 0 rows
. . exported "XXCIS"."GTSDECRECEIPTRESULT" 0 KB 0 rows
. . exported "XXCIS"."GTSDECSUPPLEMENTLIST" 0 KB 0 rows
. . exported "XXCIS"."GTSEXPORTINVOICE" 0 KB 0 rows
. . exported "XXCIS"."GTSMERGER" 0 KB 0 rows
. . exported "XXCIS"."INVESTMODE" 0 KB 0 rows
. . exported "XXCIS"."MERGERCOLUMNORDER" 0 KB 0 rows
. . exported "XXCIS"."OPINION" 0 KB 0 rows
. . exported "XXCIS"."PISSYNCAGENTCORP" 0 KB 0 rows
. . exported "XXCIS"."QUERYCONDITIONASSIST" 0 KB 0 rows
. . exported "XXCIS"."SCMCOC" 0 KB 0 rows
. . exported "XXCIS"."STOCK" 0 KB 0 rows
. . exported "XXCIS"."TAXREBATEREPORT" 0 KB 0 rows
. . exported "XXCIS"."TAXREFUNDRATE" 0 KB 0 rows
. . exported "XXCIS"."TOWNSHIP" 0 KB 0 rows
Master table "DP"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for DP.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/pdbcis_bak/xxcis.dmp
Job "DP"."SYS_EXPORT_SCHEMA_01" successfully completed at Tue Jan 5 11:52:31 2016 elapsed 0 00:00:52