Exporting and Importing Objects Using Oracle Data Pump(1.expdp)

2024-01-15 10:32

本文主要是介绍Exporting and Importing Objects Using Oracle Data Pump(1.expdp),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.查看数据泵的目录对象,目录对象是数据泵导出数据时存放的文件路径:

SQL> SELECT * FROM dba_directories;OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH
------------------------------ ------------------------------ --------------------------------------------------------------------------------
SYS                            ADMIN_DIR                          /ade/aime_10.2_lnx_push/oracle/md/admin
SYS                            DATA_PUMP_DIR                   /home/oracle/oracle/product/10.2.0/db_1/rdbms/log/
SYS                            WORK_DIR                            /ade/aime_10.2_lnx_push/oracle/work

只有SYS或者SYSTEM用户才能使用默认DATA_PUMP_DIR目录对象
所以SYSTEM用户可以启用数据泵导出作业,而不需要提供目录名。
[oracle@localhost ~]$ expdp system/lubinsuExport: Release 10.2.0.1.0 - Production on Wednesday, 01 May, 2013 17:04:18Copyright (c) 2003, 2005, Oracle.  All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 320 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/DB_LINK
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/PRE_TABLE_ACTION
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/GRANT/CROSS_SCHEMA/OBJECT_GRANT
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/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/VIEW/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/VIEW/GRANT/CROSS_SCHEMA/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/VIEW/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/POST_TABLE_ACTION
Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
. . exported "SYSTEM"."REPCAT$_AUDIT_ATTRIBUTE"          5.953 KB       2 rows
. . exported "SYSTEM"."REPCAT$_OBJECT_TYPES"             6.507 KB      28 rows
. . exported "SYSTEM"."REPCAT$_RESOLUTION_METHOD"        5.648 KB      19 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_STATUS"          5.296 KB       3 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_TYPES"           5.914 KB       2 rows
. . exported "SYSTEM"."DEF$_AQCALL"                          0 KB       0 rows
. . exported "SYSTEM"."DEF$_AQERROR"                         0 KB       0 rows
. . exported "SYSTEM"."DEF$_CALLDEST"                        0 KB       0 rows
. . exported "SYSTEM"."DEF$_DEFAULTDEST"                     0 KB       0 rows
. . exported "SYSTEM"."DEF$_DESTINATION"                     0 KB       0 rows
. . exported "SYSTEM"."DEF$_ERROR"                           0 KB       0 rows
. . exported "SYSTEM"."DEF$_LOB"                             0 KB       0 rows
. . exported "SYSTEM"."DEF$_ORIGIN"                          0 KB       0 rows
. . exported "SYSTEM"."DEF$_PROPAGATOR"                      0 KB       0 rows
. . exported "SYSTEM"."DEF$_PUSHED_TRANSACTIONS"             0 KB       0 rows
. . exported "SYSTEM"."DEF$_TEMP$LOB"                        0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$APPLY_MILESTONE"             0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$APPLY_PROGRESS":"P0"         0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$EVENTS"                      0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$HISTORY"                     0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$PARAMETERS"                  0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$PLSQL"                       0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$SCN"                         0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$SKIP"                        0 KB       0 rows
. . exported "SYSTEM"."LOGSTDBY$SKIP_TRANSACTION"            0 KB       0 rows
. . exported "SYSTEM"."MVIEW$_ADV_INDEX"                     0 KB       0 rows
. . exported "SYSTEM"."MVIEW$_ADV_PARTITION"                 0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_AUDIT_COLUMN"                 0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_COLUMN_GROUP"                 0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_CONFLICT"                     0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_DDL"                          0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_EXCEPTIONS"                   0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_EXTENSION"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_FLAVORS"                      0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_FLAVOR_OBJECTS"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_GENERATED"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_GROUPED_COLUMN"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_INSTANTIATION_DDL"            0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_KEY_COLUMNS"                  0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_OBJECT_PARMS"                 0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_PARAMETER_COLUMN"             0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_PRIORITY"                     0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_PRIORITY_GROUP"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REFRESH_TEMPLATES"            0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPCAT"                       0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPCATLOG"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPCOLUMN"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPGROUP_PRIVS"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPOBJECT"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPPROP"                      0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_REPSCHEMA"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_RESOLUTION"                   0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_RESOLUTION_STATISTICS"        0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_RESOL_STATS_CONTROL"          0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_RUNTIME_PARMS"                0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_SITES_NEW"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_SITE_OBJECTS"                 0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_SNAPGROUP"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_OBJECTS"             0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_PARMS"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_REFGROUPS"           0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_SITES"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_TARGETS"             0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_USER_AUTHORIZATIONS"          0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_USER_PARM_VALUES"             0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_CZ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_HA"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_LYG"                     0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_NJ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_NT"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_PROVICE"                 0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_SQ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_SZ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_TZ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_WX"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_XZ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_YC"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_YZ"                      0 KB       0 rows
. . exported "SYSTEM"."SERV_MSG":"P_ZJ"                      0 KB       0 rows
. . exported "SYSTEM"."SQLPLUS_PRODUCT_PROFILE"              0 KB       0 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:/home/oracle/oracle/product/10.2.0/db_1/rdbms/log/expdat.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at 17:04:57

其他用户需要授权使用目录对象:
1.创建目录对象:

[oracle@localhost ~]$ sqlplus system/lubinsuSQL*Plus: Release 10.2.0.1.0 - Production on Wed May 1 17:07:28 2013Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining optionsSQL> create directory dpump_dir01 as '/home/lubinsu/dpump';                   Directory created.

2.授权:

SQL> grant read,write on directory dpump_dir01 to lubinsu;Grant succeeded.

3.导出:

[lubinsu@localhost oracle]$ expdp lubinsu/lubinsu DIRECTORY=dpump_dir01 dumpfile=lubinsu.dmpExport: Release 10.2.0.1.0 - Production on Wednesday, 01 May, 2013 17:12:38Copyright (c) 2003, 2005, Oracle.  All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation

4.真实路径下的目录实际上并未创建,而oracle也不会自动创建该目录
创建真是目录并修改权限:
chmod 777 lubinsu
chmod 777 dpump
将lubinsu用户下的dpump开放给其他用户

重新执行刚才的操作:
[lubinsu@localhost oracle]$ expdp lubinsu/lubinsu dumpfile=lubinsu.dmp directory=DPUMP_DIR05Export: Release 10.2.0.1.0 - Production on Wednesday, 01 May, 2013 22:24:43Copyright (c) 2003, 2005, Oracle.  All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "LUBINSU"."SYS_EXPORT_SCHEMA_01":  lubinsu/******** dumpfile=lubinsu.dmp directory=DPUMP_DIR05 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128.6 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/DB_LINK
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/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "LUBINSU"."T_TEST"                          36.69 MB  393800 rows
. . exported "LUBINSU"."GRID_MSG"                        20.79 MB  156588 rows
. . exported "LUBINSU"."BSS_PO_SPEC_D"                   6.229 MB   26570 rows
. . exported "LUBINSU"."MANAGER_TM"                      3.885 MB   65099 rows
. . exported "LUBINSU"."MANAGER_TM_T"                    3.937 MB   65994 rows
. . exported "LUBINSU"."AREA_TM"                         1.786 MB   33105 rows
. . exported "LUBINSU"."SERV_MSG":"P_CZ"                 2.055 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_HA"                 2.041 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_LYG"                1.991 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_NJ"                 2.011 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_NT"                 2.197 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_SQ"                 1.996 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_SZ"                 2.084 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_TZ"                 1.951 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_WX"                 2.059 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_XZ"                 2.038 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_YC"                 1.935 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_YZ"                 1.819 MB   10008 rows
. . exported "LUBINSU"."SERV_MSG":"P_ZJ"                 1.927 MB   10008 rows
. . exported "LUBINSU"."PROCEDURE_RESULT"                6.335 KB      15 rows
. . exported "LUBINSU"."STAT_PROCEDURE"                  46.99 KB     163 rows
. . exported "LUBINSU"."TEACHER_VPN_STAT_DAILY"          80.25 KB    2377 rows
. . exported "LUBINSU"."DEPT"                            5.656 KB       4 rows
. . exported "LUBINSU"."EMP"                             7.820 KB      14 rows
. . exported "LUBINSU"."LATN_AREA_INFO"                  16.11 KB      14 rows
. . exported "LUBINSU"."PO_SPEC_CATE_TREE_RELA"          24.95 KB     578 rows
. . exported "LUBINSU"."TEACHER_VPN_STAT_DAILY_T"        9.937 KB      65 rows
. . exported "LUBINSU"."SERV_MSG":"P_PROVINCE"               0 KB       0 rows
Master table "LUBINSU"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for LUBINSU.SYS_EXPORT_SCHEMA_01 is:/home/lubinsu/dpump/lubinsu.dmp
Job "LUBINSU"."SYS_EXPORT_SCHEMA_01" successfully completed at 22:24:58

成功导出

这篇关于Exporting and Importing Objects Using Oracle Data Pump(1.expdp)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/608586

相关文章

java之Objects.nonNull用法代码解读

《java之Objects.nonNull用法代码解读》:本文主要介绍java之Objects.nonNull用法代码,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录Java之Objects.nonwww.chinasem.cnNull用法代码Objects.nonN

Oracle存储过程里操作BLOB的字节数据的办法

《Oracle存储过程里操作BLOB的字节数据的办法》该篇文章介绍了如何在Oracle存储过程中操作BLOB的字节数据,作者研究了如何获取BLOB的字节长度、如何使用DBMS_LOB包进行BLOB操作... 目录一、缘由二、办法2.1 基本操作2.2 DBMS_LOB包2.3 字节级操作与RAW数据类型2.

查看Oracle数据库中UNDO表空间的使用情况(最新推荐)

《查看Oracle数据库中UNDO表空间的使用情况(最新推荐)》Oracle数据库中查看UNDO表空间使用情况的4种方法:DBA_TABLESPACES和DBA_DATA_FILES提供基本信息,V$... 目录1. 通过 DBjavascriptA_TABLESPACES 和 DBA_DATA_FILES

HTML5 data-*自定义数据属性的示例代码

《HTML5data-*自定义数据属性的示例代码》HTML5的自定义数据属性(data-*)提供了一种标准化的方法在HTML元素上存储额外信息,可以通过JavaScript访问、修改和在CSS中使用... 目录引言基本概念使用自定义数据属性1. 在 html 中定义2. 通过 JavaScript 访问3.

Oracle登录时忘记用户名或密码该如何解决

《Oracle登录时忘记用户名或密码该如何解决》:本文主要介绍如何在Oracle12c中忘记用户名和密码时找回或重置用户账户信息,文中通过代码介绍的非常详细,对同样遇到这个问题的同学具有一定的参... 目录一、忘记账户:二、忘记密码:三、详细情况情况 1:1.1. 登录到数据库1.2. 查看当前用户信息1.

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

PLsql Oracle 下载安装图文过程详解

《PLsqlOracle下载安装图文过程详解》PL/SQLDeveloper是一款用于开发Oracle数据库的集成开发环境,可以通过官网下载安装配置,并通过配置tnsnames.ora文件及环境变... 目录一、PL/SQL Developer 简介二、PL/SQL Developer 安装及配置详解1.下

oracle如何连接登陆SYS账号

《oracle如何连接登陆SYS账号》在Navicat12中连接Oracle11g的SYS用户时,如果设置了新密码但连接失败,可能是因为需要以SYSDBA或SYSOPER角色连接,解决方法是确保在连接... 目录oracle连接登陆NmOtMSYS账号工具问题解决SYS用户总结oracle连接登陆SYS账号

Oracle数据库如何切换登录用户(system和sys)

《Oracle数据库如何切换登录用户(system和sys)》文章介绍了如何使用SQL*Plus工具登录Oracle数据库的system用户,包括打开登录入口、输入用户名和口令、以及切换到sys用户的... 目录打开登录入口登录system用户总结打开登录入口win+R打开运行对话框,输php入:sqlp

查询Oracle数据库表是否被锁的实现方式

《查询Oracle数据库表是否被锁的实现方式》本文介绍了查询Oracle数据库表是否被锁的方法,包括查询锁表的会话、人员信息,根据object_id查询表名,以及根据会话ID查询和停止本地进程,同时,... 目录查询oracle数据库表是否被锁1、查询锁表的会话、人员等信息2、根据 object_id查询被