PDM測試資料庫恢復

hd_system發表於2016-10-13

alter database flashback on;

---------------------------------------------------備份資料庫-----------------------------------------------------------------
backup incremental level 0 database format '/backupfs/back_rman/database/full_0_%T_%U' plus archivelog format '/backupfs/back_rman/database/full_arc_0_%T_%U';
------------------------------------------------------------------------------------------------------------------------------



------------------------------------------修改控制檔案恢復目標路徑------------------------------------------------------
*.control_files='/oracle/ptc/Windchill91/ocu/oradata/wind/control01_wind.ctl','/oracle/ptc/Windchill91/ocu/oradata/wind/control02_wind.ctl','/oracle/ptc/Windchill91/ocu/oradata/wind/control03_wind.ctl'
------------------------------------------修改控制檔案RMAN恢復片源路徑------------------------------------------------------
catalog backuppiece '/appfs/rman_back/full_0_20151105_djqlgohh_1_1';
catalog backuppiece '/appfs/rman_back/full_arc_0_20151105_diqlgogm_1_1';
catalog backuppiece '/appfs/rman_back/full_arc_0_20151105_dkqlgq53_1_1';
------------------------------------------恢復控制檔案-----------------------------------------------------
startup nomount
restore controlfile from '/appfs/rman_back/c-615400428-20151105-02';
alter database mount;    
------------------------------------------恢復資料庫-----------------------------------------------------  

***********  

select 'set newname for datafile '||a.file_id|| ' to '||''''||a.file_name||''''||';' from dba_data_files a

***********
run{    
set newname for datafile 1 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windsystem01.dbf';
set newname for datafile 2 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windundotbs01.dbf';
set newname for datafile 3 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windsysaux01.dbf';
set newname for datafile 4 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windblobs01.dbf';
set newname for datafile 5 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windindex01.dbf';
set newname for datafile 6 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windusers01.dbf';
set newname for datafile 7 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windwcaudit01.dbf';
set newname for datafile 8 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windwcaudit02.dbf';
set newname for datafile 9 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windindex02.dbf';
set newname for datafile 10 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windwcaudit03.dbf';
set newname for datafile 11 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windwcaudit04.dbf';
set newname for datafile 12 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windusers02.dbf';
set newname for datafile 13 to '/oracle/ptc/Windchill91/ocu/oradata/wind/windblobs02.dbf';
restore database;
switch datafile all;
recover database;
}
------------------------------------------------------------------------------------------------------------------
alter database open resetlogs;
忘記把redo set newname for;
alter system set "_allow_resetlogs_corruption"=true scope=spfile;
----------------------------------------------修改redo路徑--------------------------------------------------------------------
alter database rename file '/dbfs/ptc/Windchill91/ocu/oradata/wind/windredo01.log' to '/oracle/ptc/Windchill91/ocu/oradata/wind/windredo01.log';
alter database rename file '/dbfs/ptc/Windchill91/ocu/oradata/wind/windredo02.log' to '/oracle/ptc/Windchill91/ocu/oradata/wind/windredo02.log';
alter database rename file '/dbfs/ptc/Windchill91/ocu/oradata/wind/windredo03.log' to '/oracle/ptc/Windchill91/ocu/oradata/wind/windredo03.log';
----------------------------------------------資料字典及動態效能檢視檢視--------------------------------------------------------------------
select * from dict

select * from v$fixed_table
----------------------------------------------修改temp表空間----------------------------------------------------------------
drop tablespace temp including contents and datafiles cascade constraints;

alter database tempfile '/dbfs/ptc/Windchill91/ocu/oradata/wind/windtemp01.dbf' drop;

alter tablespace temp add tempfile '/oracle/ptc/Windchill91/ocu/oradata/wind/windtemp01.dbf' size 1024M;

alter database tempfile '/oracle/ptc/Windchill91/ocu/oradata/wind/windtemp01.dbf' autoextend on next 5m maxsize unlimited;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29209863/viewspace-2126284/,如需轉載,請註明出處,否則將追究法律責任。

相關文章