oracle还原数据库用建库吗,oracle备份和还原数据库

导出(备份)命令 使用expdp/impdp命令需要先创建逻辑目录

使用命令登录oracle:sqlplus 用户名/密码@XXXX

例如:sqlplus www/www@orcl

创建逻辑目录,该命令不会在操作系统创建真正的目录,最好以system等管理员创建。

create directory dpdata1 as 'd:\test\dump';

按用户导

expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=dpdata1

还原数据

1)导到指定用户下

impdp scott/tiger DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=scott

impdp user/password directory=dpdir dumpfile=Logontab.dmp table_exists_action=replace

logfile=implogontab.log

able_exists_action选项:{skip 是如果已存在表,则跳过并处理下一个对象;append是为表增加数据;truncate是截断表,然后为其增加新数据;replace是删除已存在表,重新建表并追加数据}

创建表空间

create tablespace TBS_OTHERS datafile 'G:\APP\ORCL\ORADATA\ORCL\TBS_OTHERS01.dbf' size 1000m;

-- 创建用户

create user C##JHGL identified by jhgl default tablespace TBS_OTHERS

create user C##YJYJHGL identified by jhgl default tablespace TBS_OTHERS

create user C##WCJHGL identified by jhgl default tablespace TBS_OTHERS

grant dba,resource,connect to C##JHGL,C##YJYJHGL,C##WCJHGL

grant dba,resource,connect to C##WCJHGL

--删除session

--查询session对应的sid,serial#

select saddr,sid,serial#,paddr,username,status from v$session where username is not null;

--kill session

alter system kill session 'sid,serial#' ;

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值