>>>oracle目录及expdp导出
1、创建DIRECTORY
create directory devdbdir as '/opt/temp/cssexp'; //该目录需oracle用户具有写权限
drop directory devdbdir; //删除
2、授权
Grant read,write on directory devdbdir to devdb;
--查看目录及权限
SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d
WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1;
3、执行导出
expdp devdb/devdb directory=devdbdir dumpfile =devdb20150331.dmp logfile=devdb.log;
>>>impdp导入
impdp scott/tiger@orcl directory=dump_dir dumpfile=expdp.dmp schemas=scott;
在服务器操作不加@数据库连接符
有时无法加schemas参数,为什么??
ORACLE使用EXPDP和IMPDP数据泵进行导出导入的方法
http://blog.youkuaiyun.com/haiross/article/details/27580199
>>>使用expdp和impdp时应该注重的事项:
1、exp和imp是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用。
2、expdp和impdp是服务端的工具程序,他们只能在oracle服务端使用,不能在客户端使用。
3、imp只适用于exp导出的文件,不适用于expdp导出文件;impdp只适用于expdp导出的文件,而不适用于exp导出文件。
4、对于10g以上的服务器,使用exp通常不能导出0行数据的空表,而此时必须使用expdp导出。
>>>expdp参数说明
??结尾加分号的问题
命令行方式单引、括号 都要加转义符
INCLUDE=TABLE:"IN \(select table_name from user_tables where table_name like\ 'EMP%\'\)"
推荐脚本方式:aaa.txt
USERID=admin/admin
DUMPFILE=t_table.dmp
DIRECTORY=thedir
LOGFILE=t_table.log
INCLUDE=TABLE:"IN (select t.table_name from USER_TABLES)"
放弃命令行的理由大概有这些:
① 操作系统对CLI字符数的限制
② 令人痛恨的转义符
③ 无法跨平台重用
④ 官方文档到处鼓吹用脚本方式
Oracle expdp 过滤和并行
http://www.linuxidc.com/Linux/2013-09/89695.htm
>>>oracle impdp的table_exists_action详解
1) skip:默认操作
2) replace:先drop表,然后创建表,最后插入数据
3) append:在原来数据的基础上增加数据
4) truncate:先truncate,然后再插入数据
http://blog.youkuaiyun.com/huang_xw/article/details/7182577
---------------------------------------------------------------------------------------------------------------------------------
exp imp
exp username/password tables=t_user file=/opt/temp/t_user.dmp
1、先创建命名管道
[ora10@ora12c ~]$ mknod /ora11_10/dumpfile/jinzypipe p
2、使用管道压缩的方法导出数据
[ora10@ora12c ~] exp jinzy/jinzy file=/ora11_10/dumpfile/jinzypipe tables=test & gzip < /ora11_10/dumpfile/jinzypipe > /ora11_10/dumpfile/jinzycompress.gz
3、使用管道导入文件
[ora10@ora12c ~]$imp jinzy/jinzy file=/ora11_10/dumpfile/jinzypipe tables=test & gunzip < /ora11_10/dumpfile/jinzycompress.gz > /ora11_10/dumpfile/jinzypipe