Oracle导入指令

打开sqlplus
创建用户:create user mingzi identified by 123456;
用户授权:grant connect, resource,dba to mingzi;
导入:imp mingzi/123456@orcl file=d:\file.dmp full=y
(其中mingzi是你的用户名,123456是密码,@是必须要写的命令,orcl是你的数据库实例,d:\file.dmp是你的导入的数据库文件,full=y是必须要写的参数

三种登录方法

方式1:
sqlplus / as sysdba
方式2:
sqlplus username/password@ip:port/sid
sqlplus username/password@orcl – 简写(前提:配置了 TNS),以下同
方式3:(推荐)
sqlplus /nolog
conn username/password@ip:port/sid

IMP导入的时候 :如果已经存在此表, 会告诉你无法创建此表,因为表已经存在。同时使用参数 full=y ignore=y 那就是全部导入,把dmp里的所有数据插入到表里面。换句话说会有重复,如果该表有主键,重复的会因为违反约束,导入不成功,但不重复的能够进去,这种情况是追加覆盖进去了。
数据备份,使用命令:
exp user/user file=d:\user.dmp full=y
恢复时,使用命令:
imp user/user FILE=d:\user.dmp fromuser=user touser=user full=y ignore=y

IMPDP导入的时候 :用参数table_exists_action=replace 进行删除后覆盖;
table_exists_action选项:{skip 是如果已存在表,则跳过并处理下一个对象;append是为表增加数据;truncate是截断表,然后为其增加新数据;replace是删除已存在表,重新建表并追加数据}
数据备份,使用命令:
expdp user/user directory=dump_dir dumpfile=schema.dmp logfile=schema.log schemas=user job_name=exp_user_schema
恢复时,使用命令:impdp user/user directory=dump_dir dumpfile=schema.dmp logfile=schema.log table_exists_action=replace schemas=user content=all job_name=imp_schema

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值