码迷,mamicode.com
首页 > 其他好文 > 详细

一级恢复

时间:2020-03-18 23:19:42      阅读:70      评论:0      收藏:0      [点我收藏+]

标签:select   alt   文件   级别   recover   通过   over   first   base   

export ORACLE_SID=h5

scp 原机器考过来一个参数文件的。

然后通过参数文件到nomount

restore controlfile from ‘‘;
alter database mount;

把控制文件恢复到mount

在mount下改名

select FILE#,name from v$datafile;

catalog start with ‘/oradata/ora11/‘;

run {
set newname for datafile 1   to ‘/oradata/ora11/system_ts_01.dbf ‘;
set newname for datafile 2   to ‘/oradata/ora11/sysaux_ts_01.dbf ‘;
set newname for datafile 3   to ‘/oradata/ora11/undotbs_01.dbf ‘;
set newname for datafile 4   to ‘/oradata/ora11/entrance_card_ts_01.dbf ‘;
set newname for datafile 5   to ‘/oradata/ora11/report_ts_10.dbf ‘;
set newname for datafile 6   to ‘/oradata/ora11/amarket_ts_01.dbf ‘;
set newname for datafile 7   to ‘/oradata/ora11/DANALY_ts_01.dbf ‘;
set newname for datafile 8   to ‘/oradata/ora11/report_ts_11.dbf ‘;
set newname for datafile 9   to ‘/oradata/ora11/report_ts_12.dbf ‘;
set newname for datafile 10   to ‘/oradata/ora11/sxitkfxt_ts_01.dbf ‘;
set newname for datafile 11   to ‘/oradata/ora11/report_ts_05.dbf ‘;
set newname for datafile 12   to ‘/oradata/ora11/report_ts_18.dbf ‘;
set newname for datafile 13   to ‘/oradata/ora11/kfcomprpt_ts_05.dbf ‘;
set newname for datafile 14   to ‘/oradata/ora11/neusoft_ts_01.dbf ‘;
set newname for datafile 15   to ‘/oradata/ora11/neusoft_ts_03.dbf ‘;
set newname for datafile 16   to ‘/oradata/ora11/neusoft_ts_02.dbf ‘;
set newname for datafile 17   to ‘/oradata/ora11/report_ts_19.dbf ‘;
set newname for datafile 18   to ‘/oradata/ora11/report_ts_01.dbf ‘;
set newname for datafile 19   to ‘/oradata/ora11/report_ts_20.dbf ‘;
set newname for datafile 20   to ‘/oradata/ora11/sysaux_ts_02.dbf ‘;
set newname for datafile 21   to ‘/oradata/ora11/report_ts_13.dbf ‘;
set newname for datafile 23   to ‘/oradata/ora11/report_ts_04.dbf ‘;
set newname for datafile 27   to ‘/oradata/ora11/report_ts_06.dbf ‘;
set newname for datafile 28   to ‘/oradata/ora11/report_ts_07.dbf ‘;
set newname for datafile 29   to ‘/oradata/ora11/report_ts_02.dbf ‘;
set newname for datafile 30   to ‘/oradata/ora11/report_ts_03.dbf ‘;
set newname for datafile 31   to ‘/oradata/ora11/report_ts_08.dbf ‘;
set newname for datafile 33   to ‘/oradata/ora11/kfcomprpt_ts_01.dbf ‘;
set newname for datafile 34   to ‘/oradata/ora11/report_ts_09.dbf ‘;
set newname for datafile 35   to ‘/oradata/ora11/ustc_ts_01.dbf ‘;
set newname for datafile 36   to ‘/oradata/ora11/work_dat_ts_01.dbf ‘;
set newname for datafile 37   to ‘/oradata/ora11/audit_ts_01.dbf ‘;
set newname for datafile 38   to ‘/oradata/ora11/audit_ts_02.dbf ‘;
set newname for datafile 39   to ‘/oradata/ora11/audit_ts_03.dbf ‘;
set newname for datafile 40   to ‘/oradata/ora11/report_ts_14.dbf ‘;
set newname for datafile 41   to ‘/oradata/ora11/kfcomprpt_ts_02.dbf ‘;
set newname for datafile 42   to ‘/oradata/ora11/kfcomprpt_ts_03.dbf ‘;
set newname for datafile 43   to ‘/oradata/ora11/kfcomprpt_ts_04.dbf ‘;
set newname for datafile 44   to ‘/oradata/ora11/report_ts_15.dbf ‘;
set newname for datafile 45   to ‘/oradata/ora11/report_ts_16.dbf ‘;
set newname for datafile 46   to ‘/oradata/ora11/report_ts_17.dbf ‘;

restore database;
}



alter database rename file‘/home/oracle/oradata/ORA11/datafile/system_ts_01.dbf‘    to ‘/oradata/ora11/system_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/sysaux_ts_01.dbf‘    to ‘/oradata/ora11/sysaux_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/undotbs_01.dbf‘      to ‘/oradata/ora11/undotbs_01.dbf ‘;   

alter database rename file‘/home/oracle/oradata/ORA11/datafile/entrance_card_ts_01.dbf‘   to   ‘/oradata/ora11/entrance_card_ts_01.dbf ‘;

alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_10.dbf‘    to ‘/oradata/ora11/report_ts_10.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/amarket_ts_01.dbf‘   to ‘/oradata/ora11/amarket_ts_01.dbf ‘;   
alter database rename file‘/home/oracle/oradata/ORA11/datafile/DANALY_ts_01.dbf‘    to ‘/oradata/ora11/DANALY_ts_01.dbf ‘;    
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_11.dbf‘    to ‘/oradata/ora11/report_ts_11.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_12.dbf‘    to ‘/oradata/ora11/report_ts_12.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/sxitkfxt_ts_01.dbf‘   to ‘/oradata/ora11/sxitkfxt_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_05.dbf‘     to ‘/oradata/ora11/report_ts_05.dbf ‘;

alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_18.dbf‘      to ‘/oradata/ora11/report_ts_18.dbf ‘;    
alter database rename file‘/home/oracle/oradata/ORA11/datafile/kfcomprpt_ts_05.dbf‘      to ‘/oradata/ora11/kfcomprpt_ts_05.dbf ‘;    
alter database rename file‘/home/oracle/oradata/ORA11/datafile/neusoft_ts_01.dbf‘    to ‘/oradata/ora11/neusoft_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/neusoft_ts_03.dbf‘    to ‘/oradata/ora11/neusoft_ts_03.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/neusoft_ts_02.dbf‘    to ‘/oradata/ora11/neusoft_ts_02.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_19.dbf‘      to ‘/oradata/ora11/report_ts_19.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_01.dbf‘     to ‘/oradata/ora11/report_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_20.dbf‘      to ‘/oradata/ora11/report_ts_20.dbf ‘;    
alter database rename file‘/home/oracle/oradata/ORA11/datafile/sysaux_ts_02.dbf‘     to ‘/oradata/ora11/sysaux_ts_02.dbf ‘;  
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_13.dbf‘     to ‘/oradata/ora11/report_ts_13.dbf ‘;  

alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_04.dbf‘     to ‘/oradata/ora11/report_ts_04.dbf ‘;    
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_06.dbf‘     to ‘/oradata/ora11/report_ts_06.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_07.dbf‘     to ‘/oradata/ora11/report_ts_07.dbf ‘;  
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_02.dbf‘     to ‘/oradata/ora11/report_ts_02.dbf ‘;  
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_03.dbf‘     to ‘/oradata/ora11/report_ts_03.dbf ‘;  
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_08.dbf‘     to ‘/oradata/ora11/report_ts_08.dbf ‘;    
alter database rename file‘/home/oracle/oradata/ORA11/datafile/kfcomprpt_ts_01.dbf‘  to ‘/oradata/ora11/kfcomprpt_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_09.dbf‘     to ‘/oradata/ora11/report_ts_09.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/ustc_ts_01.dbf‘       to ‘/oradata/ora11/ustc_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/work_dat_ts_01.dbf‘   to ‘/oradata/ora11/work_dat_ts_01.dbf ‘;

alter database rename file‘/home/oracle/oradata/ORA11/datafile/audit_ts_01.dbf‘      to ‘/oradata/ora11/audit_ts_01.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/audit_ts_02.dbf‘      to ‘/oradata/ora11/audit_ts_02.dbf ‘;   
alter database rename file‘/home/oracle/oradata/ORA11/datafile/audit_ts_03.dbf‘      to ‘/oradata/ora11/audit_ts_03.dbf ‘;   
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_14.dbf‘     to ‘/oradata/ora11/report_ts_14.dbf ‘;   
alter database rename file‘/home/oracle/oradata/ORA11/datafile/kfcomprpt_ts_02.dbf‘  to ‘/oradata/ora11/kfcomprpt_ts_02.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/kfcomprpt_ts_03.dbf‘  to ‘/oradata/ora11/kfcomprpt_ts_03.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/kfcomprpt_ts_04.dbf‘  to ‘/oradata/ora11/kfcomprpt_ts_04.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_15.dbf‘     to ‘/oradata/ora11/report_ts_15.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_16.dbf‘     to ‘/oradata/ora11/report_ts_16.dbf ‘;
alter database rename file‘/home/oracle/oradata/ORA11/datafile/report_ts_17.dbf‘     to ‘/oradata/ora11/report_ts_17.dbf ‘;



alter session set nls_date_format=‘yyyy/mm/dd hh24:mi:ss‘;

recover database using backup controlfile  until time‘2019/01/04 04:27:18‘;




 SEQUENCE# FIRST_TIME          NEXT_TIME           NAME
---------- ------------------- ------------------- -------------------------------------------------------------------------------
     38720 2018/11/12 22:00:04 2018/11/13 00:00:08 ora11dg
     38721 2018/11/13 00:00:08 2018/11/13 00:22:32
     38721 2018/11/13 00:00:08 2018/11/13 00:22:32 ora11dg
     38722 2018/11/13 00:22:32 2018/11/13 01:27:18 ora11dg
     38722 2018/11/13 00:22:32 2018/11/13 01:27:18
     38723 2018/11/13 01:27:18 2018/11/13 08:49:34
     38723 2018/11/13 01:27:18 2018/11/13 08:49:34 ora11dg
     38724 2018/11/13 08:49:34 2018/11/13 09:17:37
  去备库找 序列号  归档日志文件    scp到这个服务器,需要那个序列给那个
 
scp 1_3872* IP地址:/oradata/ora11/archivelog/

alter database open resetlogs;






//模式级别
expdp 用户名/密码 directory=pump_dir dumpfile=NEUSOFT_system.dmp schemas=NEUSOFT   营销数据库

impdp 用户名/密码  directory=pump_dir dumpfile=NEUSOFT_system.dmp schemas=NEUSOFT   h5数据库      

select * from session_privs;

一级恢复

标签:select   alt   文件   级别   recover   通过   over   first   base   

原文地址:https://www.cnblogs.com/dataroot123/p/12521161.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!