logo
关于我们

技术分享

技术分享 oracle备份和还原数据库

oracle备份和还原数据库

2021-06-03

导出(备份)命令 使用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#' ;
                   
云祺备份软件,云祺容灾备份系统,虚拟机备份,数据库备份,文件备份,实时备份,勒索软件,美国,图书馆
  • 标签:
  • 容灾备份

您可能感兴趣的新闻 换一批

现在下载,可享30天免费试用

立即下载