oracle 常用命令

lsnrctl status

1.  将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中
  exp system/manager@TEST file=d:\daochu.dmp full=y

  2. 将数据库中system用户与sys用户的表导出
  exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)

  3. 将数据库中的表table1 、table2导出
  exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)

  4. 将数据库中的表table1中的字段filed1以"00"打头的数据导出
  exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"

以下内容转自  https://blog.csdn.net/xiaoyiaoyou/article/details/79223423 

如果想导入的用户已经存在:
1. 导出用户 expdp user1/pass1 directory=dumpdir dumpfile=user1.dmp
2. 导入用户 impdp user2/pass2 directory=dumpdir dumpfile=user1.dmp REMAP_SCHEMA=user1:user2 EXCLUDE=USER

如果想导入的用户不存在:
1. 导出用户 expdp user1/pass1 directory=dumpdir dumpfile=user1.dmp
2. 导入用户 impdp system/passsystem directory=dumpdir dumpfile=user1.dmp REMAP_SCHEMA=user1:user2
3. user2会自动建立,其权限和使用的表空间与user1相同,但此时用user2无法登录,必须修改user2的密码

当需要另一个数据库的用户表导入到当前库中,但用户名不相同,使用exp/imp时,可以指定fromuser和touser来解决,在expdp中也提供了类似的解决方法

impdp system/zlsoft dumpfile=expdp:EXPDP_ZLHIS.DMP nologfile=y tables=zlhis.dept remap_schema=zlhis:scott remap_tablespace=ZL9BASEITEM:users,zl9indexhis
:users,zl9indexmtl:users table_exists_action=truncate exclude=object_grant

参数说明:

1、remap_user 重新映射用户,格式:

source_user1:target_user1,source_user2:target_user2

2、remap_tablespace 重新映射表空间,数据库对象本来存在于tbs_a表空间,现在你不想放那儿了,想换到tbs_b,就用这个,如:remap_tablespace=tbs_a:tbs_b 结果是所有tbs_a中的对象都会建在tbs_b表空间中,前提是目标用户B和目标表空间tbs_b存在
3、remap_schema当你从A用户导出的数据,想要导入到B用户中去,就使用这个:remap_schema=A:B

4、 table_exists_action 表已经存在的动作 有效关键字: (SKIP), APPEND, REPLACE 和 TRUNCATE。

5、exclude=object_grant 跳过对象授权
---------------------

原文:https://blog.csdn.net/xiaoyiaoyou/article/details/79223423

posted @ 2018-11-15 13:04  Andy.gbhu  阅读(164)  评论(0)    收藏  举报