Oracle中exp的使用2

2023-05-16,,,,,,

在使exp的时候,需要注意以下几点

前客户端版本、目标客户端的版本、注意需要设置字符集,也就是NLS_LANG 

参考oracle字符集的设置

NLS_LANG格式为:

[NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET].

NLS_LANGUAGE指的是Oracle消息使用的语言,日期中月分和日显示

NLS_TERRITORY指的是货比和数字格式,地区和计算星期及日期的习惯

NLS_CHARACTERSET指的是控制客户端应用程序使用的字符集

select* from nls_database_parameters ;

如:NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

SQL>SELECT USERENV ('language') FROM DUAL; 

USERENV('LANGUAGE')

----------------------------------------------------

AMERICAN_AMERICA.ZHS16GBK

http://docs.oracle.com/cd/E12102_01/books/AnyInstAdm784/AnyInstAdmPreInstall18.html


逻辑导出

exp user1/password@db1 file=TABLE1.dmp log=TABLE1.log 

tables=table1 buffer=10485760 constraints=n compress=n statistics=none 

indexes=n triggers=n grants=n

1.表模式导出

exp hr/hr file=hr.dmp tables=employees,locations log=hr.log

exp hr/hr file=hr.dmp tables=\(employees,locations\) log=hr.log

exp hr/hr file=hr.dmp tables=scott.emp log=scott.log

(需要exp_full_database权限)

grant exp_full_database to hr ;

2.用户模式导出

exp hr/hr file=hr_all.dmp owner=hr log=hr_all.log

exp hr/hr file=hr_scott.dmp owner=\(hr,scott\) log=hr_scott.log

3.数据库模式导出

需要exp_full_database权限)

exp hr/hr file=full.dmp full=y log=full.log

4.可传输表空间模式

待补充

其他参数使用:

不导出索引、约束、授权和触发器

exp hr/hr file=all.dmp indexes=n constraints=n grants=n triggers=n


文件大小限制 估算导出数据大小

select sum(bytes)/1024/1024 from user_segments;

预计导出的dmp文件大小,不能超出系统限制(fat32单个文件不能超过4G,ntfs单个文件不能超过2T,ext3理想情况下不能超过2T)

exp hr/hr file=limits1.dmp,limits2.dmp filesize=2048M log=limits.log

exp hr/hr file=limits1.dmp,limits2.dmp filesize=130K log=limits.log

如果指定filesize的大小,必须为file参数指定文件名,多个之间使用逗号分隔,如果指定的文件多于实际产生的文件,多余指定的文件不会生成。如果少于实际产生的文件,那么在导出的过程中会提示输入新的文件名,如Export file: expdat.dmp >


参数文件使用

cat parameter.txt

userid=scott/tiger

file=scott.dmp

tables=emp

log=scott.log

exp parfile=parameter.txt


按照条件导出

cat parameter.txt

userid=scott/tiger

file=scott.dmp

tables=emp

query='whereempno = 7369'

log=scott.log

exp parfile=parameter.txt

或者

exp scott/tiger file=scott.dmp tables=emp query="'where empno=7369'" log=scott.log

条件中存在字符串

cat parameter.txt

userid=scott/tiger

file=scott.dmp

tables=emp

query='wheresal < 8000 and job = ''SALESMAN'''

log=scott.log

exp parfile=parameter.txt

只导出表结构

expscott/tiger file=scott.dmp rows=n owner=scott log=scott.log

direct参数

如果导出的对象中存在blob,clob,采用直接路径导出会报错

8i,9i中特别注意,一般单个表加direct=y,按照用户或数据库一般不使用直接方式

个人在使用的使用一般常用system进行操作。

《Oracle中exp的使用2.doc》

下载本文的Word格式文档,以方便收藏与打印。