oracle10g_expdp工具测试学习_之一

Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 1,  术语简解

Expdporacle10g新引入的仅用于服务器端的逻辑导出工具,其功能相当强大

Expdp help=y  可以查看其详细用法,更多信息,请参看oracle官方文档

Expdp导出的文件是以二进制方式存储,和exp工具的文件不能混用

 

Expdp不同于exp,他是以服务器端执行,所以在执行操作前先要在oracle在构建一个directory的对象,可以理解为:存储导出文件的目录(这个目录先要在操作系统上建好)

2,  测试步骤

Expdp可以以下几种模式进行数据导出

 

Full Export Mode---全库导出,类似于9iexp full=y

   执行操作的用户必须要具备exp_full_database权限

  关键字为:full=y

Schema Mode—导出某个用户或多个用户(如导出多个用户,以,分隔),这是默认的导出模式

   关键字为:schemas=导出的用户

 

Table Mode  ---导出某些表或特定表

    关键字为:tables

Tablespace Mode  ---导出某些表空间或某个表空间

    必须具备exp_full_database角色

    关键字为:tablespaces

Transportable Tablespace Mode  --这个用于跨数据库表空间迁移,其实就是把表空间从一个数据库迁移到另一个数据库

   关键字为:transfort_tablespaces=要导出的表空间

             Transfort_full_check   -- 用于在导出时是否验证导出对象存在引用性,通俗点就是说:比如表在存储在一个表空间,但表上的索引在另一个表空间,像这种引用性对象是不可以导出的,除非你把所有的对象全部导出

另外:必须具有exp_full_database角色

      仅导出表空间的元数据(可以理解为数据库底层的创建对象的ddl语句之类)

      导出的数据集必须是自包含的,就是说导出的对象必须只能在一个表空间

中,不能跨多个表空间存在

              此模式下导出job一旦停止,不能重新开始运行

              此模式并行度(parallel)不能>1

 

 

各导出模式示例如下:

expdp system/system full=y dumpfile=test_expdp:fulldb_new.dmp  ---全库导出

 

expdp zxy/system tablespaces=sysaux dumpfile=test_expdp:exp_sysaux.dmp  ---导出表空间

 

expdp zxy/system schemas=zxy,fs1,trans dumpfile=test_expdp:exp_multi_user.dmp –导出用户(模式)

 

expdp zxy/system tables=mv dumpfile=test_expdp:exp_table.dmp  ---导出表

 

 

SAMPLE                Percentage of data to be exported;

详细请参下

expdp zxy/system tables=mv sample=30 dumpfile=test_expdp:test_per.dmp –导出部分数据子集

 

 

 

 

这个参数唯一的用处就是压缩导出文件集的大小,可以节省存储, 呵呵

COMPRESSION           Reduce size of dumpfile contents where valid

                      keyword values are: (METADATA_ONLY) and NONE.

 

expdp zxy/system compression=metadata_only  dumpfile=test_expdp:test_com_meta.dmp

expdp zxy/system compression=none  dumpfile=test_expdp:test_com.dmp

 

 

 

CONTENT               Specifies data to unload where the valid keywords are:

                      ALL  ---导出数据和元数据

                      DATA_ONLY, --仅导出数据

METADATA_ONLY.  –仅导出元数据

 

 

expdp zxy/system dumpfile=test_expdp:test_content_data.dmp content=data_only

 

 

 

这个estimate就是查看导出表数据到底占多大的存储空间

Specifies the method that Export will use to estimate how much disk space each table in the export job will consume (in bytes). The estimate is for table row data only; it does not include metadata

 

ESTIMATE              Calculate job estimates where the valid keywords are:

                      (BLOCKS) and STATISTICS.

 

expdp zxy/system estimate=blocks dumpfile=test_expdp:test_estimate_blocks.dmp

如果estimate等于statistics,得到的值更为精确,但一定要先用dbms_stats进行对应的分析

 

 

 

这个参数用于不实际执行导出操作,评估下到底以表模式导出要占用多大的存储空间

ESTIMATE_ONLY         Calculate job estimates without performing the export.

expdp zxy/system  tables=mv,sex estimate_only=y estimate=statistics

 

 

 

 

这个参数用于在job在开启多少个并行进程,oracle建议开启并行进程数量和导出文件一样,这样性能最佳

Parallel

Enables you to increase or decrease the number of active worker processes for the current job.

 

 

这个参数用于控制每个导出文件集的大小,说白了就是克服操作系统的文件系统限制

FILESIZE=number 

The file size can be followed by B, K, M, or G to indicate that the size is expressed in bytes, kilobytes, megabytes, or gigabytes, respectively. The default is B.

A file size of 0 indicates that there will not be any size restrictions on new dump files. They will be extended as needed until the limits of the containing device are reached

 

expdp zxy/system  dumpfile=test_expdp:test_p%U filesize=2m  parallel=10

 

 

logfile ---此参数类同于exp中的log,就是记录导出操作的日志,另:logfile一定在存储在预先创建的directory对象中

expdp zxy/system dumpfile=test_expdp:test_sch.dmp logfile=other:test_log.log

 

 include –这个参数就是控制只导出什么对象,注意涂黄部分一定要大写,不然会报错,

        此参数与exclude参数不能同时使用

expdp zxy/system dumpfile=other:test_part.dmp include=TABLE:"IN('MV')"

 

query ---只导出表数据部分子集,其实就是select中的where子句,单引号里含双引号,且命令谓语一定要大写,不然会报错

expdp zxy/system dumpfile=other:test_part_query.dmp tables=mv query=mv:'"WHERE a=3"'

 

expdp zxy/system dumpfile=other:test_full_db.dmp full=y job_name=exp_full_db

 --也可以从dba_datapump_jobs查看数据导出job的相关信息

ctrl+c进入交互导出模式

Export>stop_job   ---此时job状态为not running

 

expdp zxy/system attach=exp_full_job ---重新附加这个停止的job,同时进入export交互模式

Export> start_job  --此时job状态为executing

Export>kill_job   ---杀掉这个job,再想恢复就不行了哟

Export>continue_client  ---退出交互导出模式,进入记录导出操作日志状态

Export>exit_client   ---退出交互导出模式,但导出操作job仍在操作中

 

利用参数文件导出,这个一般用于为了规避麻烦的在命令行模式出现一些特殊字符

more test.par

dumpfile=other:test_schema.dmp

logfile=test_expdp:test_log2.log

 

expdp zxy/system parfile=/oracle/test.par



---连接字符串@和network_link的学习

ora-02085  构建数据库链接
 处理:alter system set db_domain='' scope=spfile;startup force
      alter system set

ORA-31631: 需要权限
ORA-39149: 无法将授权用户链接到非授权用户

create user test identified by test
default tablespace users

grant connect to test;
grant create table, create database link to test;
grant read, write on directory windir to test;

conn test/test
create database link test113 connect to lk identified by system
using 'vm'; --vm是客户端中构建连接目标数据库的链接字符串

expdp中的network_link就是在源数据库(本地数据库),通过link 把远端数据库的转储文件(dumpfile)存储在本地数据库
expdp user/password@链接字符串 --这个和上面的network_link又不同,它是通过本地数据库连接到远端数据库,
                               --转储文件还是生成在远端数据库中

 

 

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

转载于:http://blog.itpub.net/9240380/viewspace-614235/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值