Friday, 14 May 2021

Rebuild Physical Standby using RMAN full backup



Primary:

rman target / 

run

{

backup AS COMPRESSED BACKUPSET  database tag="FORSTDBY" format '/u02/backup/RMANBKP_klfcdb/standby/FORSTDBY_%U';

}


rman> backup current controlfile for standby format '/u02/backup/RMANBKP_klfcdb/standby/stby_ctl';


Copy pieces to standby: 




Standdy server:

 

sqlplus> shutdown abort;

sqlplus> startup nomount;


rman> restore standby controlfile from '/u02/backup/RMANBKP_klfcdb/standby/stby_ctl';


sqlplus> alter database mount;


rman> catalog start with '/u02/backup/RMANBKP_klfcdb/standby/';


rman> restore database;


sqlplus> shutdown immediate;

sqlplus> startup mount;


alter system set standby_file_management=manual;

alter database recover managed standby database cancel;



select GROUP#  from  v$logfile where type='STANDBY';

select 'alter database clear logfile group '||GROUP# ||';' from  v$logfile where type='STANDBY';

alter database clear logfile group 8;

alter database clear logfile group 9;

alter database clear logfile group 10;

alter database clear logfile group 11;

alter database clear logfile group 4;

alter database clear logfile group 5;

alter database clear logfile group 6;

alter database clear logfile group 7;



select 'alter database drop standby logfile group '||GROUP# ||';' from  v$logfile where type='STANDBY';

alter database drop standby logfile group 8;

alter database drop standby logfile group 9;

alter database drop standby logfile group 10;

alter database drop standby logfile group 11;

alter database drop standby logfile group 4;

alter database drop standby logfile group 5;

alter database drop standby logfile group 6;

alter database drop standby logfile group 7;




rm -rf /u01/app/oracle/oradata/KLFCDB/klfcdb_srl0.f

rm -rf /u01/app/oracle/oradata/KLFCDB/klfcdb_srl1.f

rm -rf /u01/app/oracle/oradata/KLFCDB/klfcdb_srl2.f

rm -rf /u01/app/oracle/oradata/KLFCDB/klfcdb_srl3.f

rm -rf /u01/app/oracle/oradata/KLFCDB/stb_redo1.log

rm -rf /u01/app/oracle/oradata/KLFCDB/stb_redo2.log

rm -rf /u01/app/oracle/oradata/KLFCDB/stb_redo3.log

rm -rf /u01/app/oracle/oradata/KLFCDB/stb_redo4.log



select 'ALTER DATABASE ADD STANDBY LOGFILE group '||GROUP# ||'('''||member||''') SIZE 200M;' from  v$logfile where type='STANDBY';


ALTER DATABASE ADD STANDBY LOGFILE group 8('/u01/app/oracle/oradata/KLFCDB/klfcdb_srl0.f') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 9('/u01/app/oracle/oradata/KLFCDB/klfcdb_srl1.f') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 10('/u01/app/oracle/oradata/KLFCDB/klfcdb_srl2.f') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 11('/u01/app/oracle/oradata/KLFCDB/klfcdb_srl3.f') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 4('/u01/app/oracle/oradata/KLFCDB/stb_redo1.log') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 5('/u01/app/oracle/oradata/KLFCDB/stb_redo2.log') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 6('/u01/app/oracle/oradata/KLFCDB/stb_redo3.log') SIZE 200M;

ALTER DATABASE ADD STANDBY LOGFILE group 7('/u01/app/oracle/oradata/KLFCDB/stb_redo4.log') SIZE 200M;


alter system set standby_file_management=auto;

alter database recover managed standby database disconnect;

 


 

 


No comments:

Post a Comment

Number of Visitors