1. cdb全库导出:
expdp system/sky directory=exp_cdb dumpfile=sky_full.dmp logfile=sky_full.log full=y
操作如下:
C:\Users\v074>sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on 星期四 6月 6 13:42:32 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> create directory exp_cdb as 'e:\app\exp_cdb';
目录已创建。
SQL> exit
从 Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 断开
C:\Users\v074>expdp system/sky directory=exp_cdb dumpfile=sky_full.dmp logfile=sky_full.log full=y
Export: Release 12.1.0.2.0 - Production on 星期四 6月 6 13:46:01 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
警告: 连接到容器数据库的根或种子时通常不需要 Oracle Data Pump 操作。
启动 "SYSTEM"."SYS_EXPORT_FULL_01": system/******** directory=exp_cdb dumpfile=sky_full.dmp logfile=sky_full.log full=y
正在使用 BLOCKS 方法进行估计...
处理对象类型 DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
处理对象类型 DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA
处理对象类型 DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
...(省略)
处理对象类型 DATABASE_EXPORT/POST_SYSTEM_IMPCALLOUT/MARKER
. . 导出了 "SYS"."KU$_USER_MAPPING_VIEW" 6.085 KB 36 行
. . 导出了 "ORDDATA"."ORDDCM_DOCS" 252.9 KB 9 行
. . 导出了 "WMSYS"."WM$CONSTRAINTS_TABLE$" 0 KB 0 行
...(省略)
. . 导出了 "SYS"."NACL$_WALLET_EXP" 0 KB 0 行
. . 导出了 "WMSYS"."WM$EXP_MAP" 7.718 KB 3 行
已成功加载/卸载了主表 "SYSTEM"."SYS_EXPORT_FULL_01"
******************************************************************************
SYSTEM.SYS_EXPORT_FULL_01 的转储文件集为:
E:\APP\EXP_CDB\SKY_FULL.DMP
作业 "SYSTEM"."SYS_EXPORT_FULL_01" 已于 星期四 6月 6 13:48:20 2019 elapsed 0 00:02:18 成功完成
C:\Users\v074>
2. 导出整个pdb(pdb管理员用户为pdbcloud):
expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=pdbcloud.dmp logfile=pdbcloud.log schemas=pdbcloud
操作如下:
C:\Users\v074>sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on 星期四 6月 6 13:53:16 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter session set container=pdbcloud;
会话已更改。
SQL> grant dba to pdbcloud;
授权成功。
SQL> create directory exp_pdb as 'e:\app\exp_pdb';
目录已创建。
SQL> grant read ,write on directory exp_pdb to pdbcloud;
授权成功。
SQL> exit
从 Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 断开
C:\Users\v074>expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=pdbcloud.dmp logfile=pdbcl
oud.log schemas=pdbcloud
Export: Release 12.1.0.2.0 - Production on 星期四 6月 6 13:57:11 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
启动 "PDBCLOUD"."SYS_EXPORT_SCHEMA_01": pdbcloud/********@pdbcloud directory=exp_pdb dumpfile=pdbcloud.dmp logfile=pdbcloud.log schemas=pdbcloud
正在使用 BLOCKS 方法进行估计...
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 0 KB
处理对象类型 SCHEMA_EXPORT/USER
处理对象类型 SCHEMA_EXPORT/SYSTEM_GRANT
处理对象类型 SCHEMA_EXPORT/ROLE_GRANT
处理对象类型 SCHEMA_EXPORT/DEFAULT_ROLE
处理对象类型 SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE
处理对象类型 SCHEMA_EXPORT/TABLE/COMMENT
处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/INDEX
处理对象类型 SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
处理对象类型 SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
处理对象类型 SCHEMA_EXPORT/STATISTICS/MARKER
已成功加载/卸载了主表 "PDBCLOUD"."SYS_EXPORT_SCHEMA_01"
******************************************************************************
PDBCLOUD.SYS_EXPORT_SCHEMA_01 的转储文件集为:
E:\APP\EXP_PDB\PDBCLOUD.DMP
作业 "PDBCLOUD"."SYS_EXPORT_SCHEMA_01" 已于 星期四 6月 6 13:57:41 2019 elapsed 0 00:00:27 成功完成
C:\Users\v074>
3. 导出pdb下普通用户cloud:
(1) expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=cloud.dmp logfile=cloud.log schemas=cloud
(2) expdp system/oracle@pdbcloud directory=exp_pdb dumpfile=cloud.dmp logfile=cloud.log schemas=cloud
操作如下:
C:\Users\v074>expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=cloud.dmp logfile=cloud.log schemas=cloud
Export: Release 12.1.0.2.0 - Production on 星期四 6月 6 14:01:13 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
启动 "PDBCLOUD"."SYS_EXPORT_SCHEMA_01": pdbcloud/********@pdbcloud directory=exp_pdb dumpfile=cloud
.dmp logfile=cloud.log schemas=cloud
正在使用 BLOCKS 方法进行估计...
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 240 MB
处理对象类型 SCHEMA_EXPORT/USER
处理对象类型 SCHEMA_EXPORT/SYSTEM_GRANT
处理对象类型 SCHEMA_EXPORT/DEFAULT_ROLE
处理对象类型 SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE
处理对象类型 SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
处理对象类型 SCHEMA_EXPORT/STATISTICS/MARKER
. . 导出了 "CLOUD"."CLOUD" 5.554 KB 3 行
已成功加载/卸载了主表 "PDBCLOUD"."SYS_EXPORT_SCHEMA_01"
******************************************************************************
PDBCLOUD.SYS_EXPORT_SCHEMA_01 的转储文件集为:
E:\APP\EXP_PDB\CLOUD.DMP
作业 "PDBCLOUD"."SYS_EXPORT_SCHEMA_01" 已于 星期四 6月 6 14:01:45 2019 elapsed 0 00:00:31 成功完成
C:\Users\v074>
4. 导出pdb普通用户cloud下的表cloud
expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=cloud_t_cloud.dmp logfile=cloud_t_cloud.log table=cloud.cloud
操作如下:
C:\Users\v074>expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=cloud_t_cloud.dmp logfile=cloud_t_cloud.log tables=cloud.cloud
Export: Release 12.1.0.2.0 - Production on 星期四 6月 6 14:06:24 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
启动 "PDBCLOUD"."SYS_EXPORT_TABLE_01": pdbcloud/********@pdbcloud directory=exp_pdb dumpfile=cloud_
t_cloud.dmp logfile=cloud_t_cloud.log tables=cloud.cloud
正在使用 BLOCKS 方法进行估计...
处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 240 MB
处理对象类型 TABLE_EXPORT/TABLE/TABLE
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/MARKER
. . 导出了 "CLOUD"."CLOUD" 5.554 KB 3 行
已成功加载/卸载了主表 "PDBCLOUD"."SYS_EXPORT_TABLE_01"
******************************************************************************
PDBCLOUD.SYS_EXPORT_TABLE_01 的转储文件集为:
E:\APP\EXP_PDB\CLOUD_T_CLOUD.DMP
作业 "PDBCLOUD"."SYS_EXPORT_TABLE_01" 已于 星期四 6月 6 14:06:33 2019 elapsed 0 00:00:09 成功完成
C:\Users\v074>
5. 导出pdb表空间users:
expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=pc_ts_user.dmp logfile=pc_ts_user.log tablespaces=users
操作如下:
C:\Users\v074>expdp pdbcloud/pdbcloud@pdbcloud directory=exp_pdb dumpfile=pc_ts_user.dmp logfile=pc_ts_user.log tablespaces=users
Export: Release 12.1.0.2.0 - Production on 星期四 6月 6 14:44:00 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
启动 "PDBCLOUD"."SYS_EXPORT_TABLESPACE_01": pdbcloud/********@pdbcloud directory=exp_pdb dumpfile=p
c_ts_user.dmp logfile=pc_ts_user.log tablespaces=users
正在使用 BLOCKS 方法进行估计...
处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 240 MB
处理对象类型 TABLE_EXPORT/TABLE/TABLE
处理对象类型 TABLE_EXPORT/TABLE/COMMENT
处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/MARKER
. . 导出了 "CLOUD"."CLOUD" 5.554 KB 3 行
已成功加载/卸载了主表 "PDBCLOUD"."SYS_EXPORT_TABLESPACE_01"
******************************************************************************
PDBCLOUD.SYS_EXPORT_TABLESPACE_01 的转储文件集为:
E:\APP\EXP_PDB\PC_TS_USER.DMP
作业 "PDBCLOUD"."SYS_EXPORT_TABLESPACE_01" 已于 星期四 6月 6 14:44:28 2019 elapsed 0 00:00:27 成功完
成
C:\Users\v074>
二、导入impdp:
导入impdp的用法和基本expdp一致,只需要确定要导入的位置,将相应的关键字和用户内容替换即可。