oracle数据库还原步骤

RMAN> list archivelog all;
gwamqa
drop user gwamqa cascade;
alter user system identified by Abc12345;
alter user gwamqa identified by Abc12345;

drop tablespace GWAM_Test_temptablespace including contents and datafiles cascade constraint;
drop tablespace GWTS01 including contents and datafiles cascade constraint;
------------------------------------------ 恢复DB -----------------------
1.  创建数据库实例  GWAMRTHB
创建成功之后,启动sqlplus(如下):
sqlplus
system/Abc12345@GWAMRTHB   (假设system的密码为Abc12345  )

2.创建表空间
   表空间名为GWTS01
  create tablespace GWTS01
  datafile 'D:\大气预警\DataBase\GWTS01.dbf' size 500M
  AUTOEXTEND ON NEXT 20M
  extent management local autoallocate;

3. 创建临时表空间GWAM_Test_temptablespace
create temporary tablespace GWAM_Test_temptablespace
tempfile 'D:\大气预警\DataBase\GWAM_temp.dbf' 
size 50m  
autoextend on  
next 10m maxsize 20480m  
extent management local;

4.创建用户
create user gwamqa identified by Abc12345
  default tablespace GWTS01
  temporary tablespace GWAM_Test_temptablespace;
 
5. 
alter tablespace GWTS01  add datafile 'D:\大气预警\DataBase\GWTS02.dbf'size 500M AUTOEXTEND ON NEXT 20M;
alter tablespace GWTS01  add datafile 'D:\大气预警\DataBase\GWTS03.dbf'size 500M AUTOEXTEND ON NEXT 20M;
alter tablespace GWTS01  add datafile 'D:\大气预警\DataBase\GWTS04.dbf'size 500M AUTOEXTEND ON NEXT 20M;
alter tablespace GWTS01  add datafile 'D:\大气预警\DataBase\GWTS05.dbf'size 500M AUTOEXTEND ON NEXT 20M;
alter tablespace GWTS01  add datafile 'D:\大气预警\DataBase\GWTS06.dbf'size 500M AUTOEXTEND ON NEXT 20M;
alter tablespace GWTS01  add datafile 'D:\大气预警\DataBase\GWTS07.dbf'size 500M AUTOEXTEND ON NEXT 20M;

6.给用户分配权限
grant connect,resource,dba to gwamqa;
grant exp_full_database to gwamqa;
grant imp_full_database to gwamqa;
grant dba to gwamqa;
退出sqlplus

7.恢复数据库 (注意:下面的语句有时会被自动截断,在执行前务必检查下)
在DOS界面下:
imp system/Abc12345@GWAMRTHB fromuser=gwamqa touser=gwamqa file=H:\20180614db\20181121db.dmp ignore=y  buffer=10000000 STATISTICS=NONE constraints =n;'
impdp system/Abc12345 DIRECTORY=ora_dir DUMPFILE=GWAM2018121301.DMP table_exists_action=replace REMAP_SCHEMA=gwamqa:gwamqa;
imp system/Abc12345@GWAMRTHB fromuser=gwamqa touser=gwamqa tables=(gwm_fact_alarms_2018) file=H:\20180614db\gwamqa2018103001.dmp ignore=y  buffer=10000000 STATISTICS=NONE constraints =n;'
exp system/Abc12345@GWAMRTHB file=H:\20180902db.dmp owner=(gwamqa);
exp gwamqa/Abc12345@GWAMRTHB file=H:\GWAM2018122101.dmp tables=(gw_if_tempstation);
expdp system/Abc12345@GWAMRTHB schemas=gwamqa dumpfile=GWAM2018122501.dmp DIRECTORY=ora_dir tables=(emp,dept)

expdp system/Abc12345@GWAMRTHB schemas=gwamqa dumpfile=GWAM20190102.dmp DIRECTORY=ora_dir

create directory ora_dir as 'd:\ora_dir';
grant read,write on directory ora_dir to system;


8. 删掉DBMS_Jobs中的所有job  (这非常关键) 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值