expdp/impdp

1. 如何起步
前面介绍了一些基本知识,现在我们来试试如何操作吧。
举例如下:从10.1.133.98服务器上,将除数据之外的所有信息导入到10.1.133.88数据库中。
1) 创建一个Directory对象,并授予用户读写权限。
SQL> create directory dump_file as ‘/home/oracle/backup’;

Directory created.

SQL> grant read,write on directory dump_file to bam;

Grant succeeded.
如上,生成的DMP文件将会放在/home/oracle/backup目录下。

2) 编写一个导出的参数文件。
-bash-3.00$ vi expdp_tbs.par
DIRECTORY=DUMP_FILE
DUMPFILE=expdp_bamdb2bamtest.dmp
LOGFILE=expdp_bamdb2bamtest.log
CONTENT=METADATA_ONLY
如上,指定了生成的dmp文件名以及日志名(这些都会被放在/home/oracle/backup下),以及导出模式为:metadata_only–只导出结构,不包含数据。

3) 执行导出命令
-bash-3.00$ expdp bam/bam parfile=expdp_tbs.par

Export: Release 10.2.0.4.0 – 64bit Production on Friday, 13 August, 2010 16:35:18

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting “BAM”.”SYS_EXPORT_SCHEMA_01″:  bam/******** parfile=expdp_tbs.par
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/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
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/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/FUNCTIONAL_AND_BITMAP/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_AND_BITMAP/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/JOB
Master table “BAM”.”SYS_EXPORT_SCHEMA_01″ successfully loaded/unloaded
******************************************************************************
Dump file set for BAM.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/backup/expdp_bamdb2bamtest.dmp
Job “BAM”.”SYS_EXPORT_SCHEMA_01″ successfully completed at 16:41:26

4) 将文件传输到10.1.133.88机器上。
-bash-3.00$ ftp 10.1.133.88
Connected to 10.1.133.88.
220 BNM-TEST2 FTPserverready.
Name (10.1.133.88:oracle): oracle
331 Password required for oracle.
Password:
230 User oracle logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bin
200 Type set to I.
ftp> put /home/oracle/backup/expdp_bamdb2bamtest.dmp /export/app22/backup/expdp_bamdb2bamtest.dmp
200 PORT command successful.
150 Opening BINARY mode data connection for /export/app22/backup/expdp_bamdb2bamtest.dmp.
226 Transfer complete.
local: /home/oracle/backup/expdp_bamdb2bamtest.dmp remote: /export/app22/backup/expdp_bamdb2bamtest.dmp
125329408 bytes sent in 1.4 seconds (89551.55 Kbytes/s)
ftp> bye
221-You have transferred 125329408 bytes in 1 files.
221-Total traffic for this session was 125329890 bytes in 1 transfers.
221-Thank you for using the FTP service on BNM-TEST2.
221 Goodbye.

5) 执行导入
-bash-3.00$ impdp bam/bam directory=dump_file dumpfile=expdp_bamdb2bamtest.dmp logfile=expdp_bamdb2bamtest.log table_exists_action=replace

Import: Release 10.2.0.4.0 – 64bit Production on Friday, 13 August, 2010 16:44:51

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table “BAM”.”SYS_IMPORT_FULL_01″ successfully loaded/unloaded
Starting “BAM”.”SYS_IMPORT_FULL_01″:  bam/******** directory=dump_file dumpfile=expdp_bamdb2bamtest.dmp logfile=expdp_bamdb2bamtest.log table_exists_action=replace
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:”BAM” already exists
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/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27776156/viewspace-751636/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/27776156/viewspace-751636/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值