There is now a set of ADG libraries, namely PROD1 and Prod1s
Plan to copy a level 0 Rman from the Pord ADG Repository (PROD1S) to a new server, after the restoration, built a new adg,sid called PROD2S, after activation as a test library
Settings on the new server
Export ORACLE_SID=PORD2S
Generate a pfile from the source library porddb1s, copy the pfile to the target library
After modifying the relevant path parameters, then convert to SPFile
*.audit_file_dest= '/pordtestdata/dump/adump '
*.audit_trail= ' NONE '
*.cluster_database=false
*.compatible= ' 11.2.0.3.0 '
*.control_files= '/pordtestdata/oradata/control01.ctl ', '/pordtestdata/oradata/control02.ctl ' #Restore Controlfile
*.db_block_size=8192
*.db_create_online_log_dest_1= '/pordtestdata/oradata '
*.db_domain= "
*.db_file_name_convert= '/porddata/oradata/', '/pordtestdata/oradata/'
*.db_files=2048
*.db_name= ' Pord '
*.db_recovery_file_dest= '/pordtestdata/fast_recovery_area '
*.db_recovery_file_dest_size=1048576000000
*.db_unique_name= ' Pord2s '
*.diagnostic_dest= '/u01/app/oracle '
*.dispatchers= ' (protocol=tcp) (SERVICE=PORDXDB) '
*.event= ' 10949 Trace name Context forever, Level 1 '
*.fal_client= ' Pord '
*.fal_server= ' Porddb1s '
*.log_archive_config= ' dg_config= (pord,porddb1,porddb1s) '
*.log_archive_dest_1= ' Location=use_db_recovery_file_dest valid_for= (all_logfiles,all_roles) DB_UNIQUE_NAME=pord '
#*.log_archive_dest_2= ' service=porddb1s lgwr SYNC affirm valid_for= (online_logfiles,primary_role) DB_UNIQUE_NAME= Porddb1s '
*.log_archive_dest_state_1= ' ENABLE '
#*.log_archive_dest_state_2= ' ENABLE '
*.log_file_name_convert= '/porddata/oradata/', '/pordtestdata/oradata/'
*.open_cursors=900
*.optimizer_mode= ' All_rows '
*.pga_aggregate_target=10g
*.processes=1000
*.remote_login_passwordfile= ' Exclusive '
*.resource_manager_plan= "
*.service_names= ' Pord '
*.session_cached_cursors=2000
*.sessions=1200
*.sga_target=50g
*.standby_file_management= ' AUTO '
*.star_transformation_enabled= ' TRUE '
*.undo_retention=10800
*.undo_tablespace= ' UNDOTBS1 '
#*.use_large_pages= ' only '
*.utl_file_dir= '/home/oracle '
Sql> create SPFile from pfile= '/pordtestdata/software/pfilepord.ora ';
Recovery control files
rman> shutdown immediate;
rman> startup Nomount;
rman> restore standby controlfile from '/PORDTESTDATA/ARCH/O1_MF_S_883643262_BS15SQ11_.BKP ';
rman> shutdown immediate;
rman> startup Mount;
The catalog command re-registers the backup set;
rman> catalog start with '/pordtestdata/arch ';
4. Start the recovery, in the Rman backup Source Library (cascaded standby), in this case the PROD1S library
Rman> Report schema;
More relevant information organized into the following format
Get into shell script background execution
$ cat rman1.sh
#!/bin/bash
source. bash_profile
/u01/app/oracle/product/11.2.0/db_1/bin/rman Target/<<eof
Run {
Set newname for datafile 1 to '/pordtestdata/oradata/system.259.819420143 ';
Set newname for datafile 2 to '/pordtestdata/oradata/sysaux.260.819420151 ';
Set newname for DataFile 3 to '/pordtestdata/oradata/undotbs1.261.819420153 ';
Set newname for datafile 4 to '/pordtestdata/oradata/undotbs2.263.819420163 ';
Set newname for datafile 5 to '/pordtestdata/oradata/users.264.819420163 ';
Set newname for datafile 6 to '/pordtestdata/oradata/pord.295.819889851 ';
... Omit n rows
Set newname for datafile 133 to '/pordtestdata/oradata/pord_idx08.dbf ';
Set newname for datafile 134 to '/pordtestdata/oradata/pord_idx09.dbf ';
Set newname for datafile 135 to '/pordtestdata/oradata/pord_idx10.dbf ';
Set newname for datafile 136 to '/pordtestdata/oradata/pord_idx11.dbf ';
Set newname for datafile 137 to '/pordtestdata/oradata/pord_idx12.dbf ';
Set newname for datafile 138 to '/pordtestdata/oradata/pord_idx13.dbf ';
Set newname for datafile 139 to '/pordtestdata/oradata/tbs_sysaux03.dbf ';
Restore database;
Switch datafile all;
}
Eof
Exit;
By viewing the view V$session_longops This view is a long-duration session that can be roughly analyzed to complete the progress,
Can be used not only for Rman but also for IMPDP/EXPDP
Set Linesize 200;
Select Sid,opname,serial#,context,sofar,totalwork,round (sofar/totalwork*100,2) "%_complete"
From V$session_longops
where opname like ' rman% '
and opname not like '%aggregate% '
and totalwork! = 0
and Sofar <> totalwork
ORDER BY "%_complete" DESC;
Modify TNS on the Pord1s library to point to the new target library
Increase
PORD2S =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = prod2s.test.com) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = pord2s)
)
)
Handling Tempfile
ALTER DATABASE Tempfile '/porddata/oradata/temp.262.819420155 ' drop;
sql> Alter tablespace temp add tempfile '/pordtestdata/oradata/temp1.dbf ' size 10G;
--alter system set log_archive_config= ' dg_config= (pord1,pord1s,pord2s) ';
Back up the original parameters:
Modified to the following:
Alter system set log_archive_dest_2= ' Service=prod2s lgwr ASYNC valid_for= (online_logfiles,primary_role) DB_UNIQUE_ Name=pord2s ';
Add some new standby log
ALTER DATABASE ADD STANDBY LOGFILE GROUP "/tmpdata/pordredo/redo_21.log ' size 1G;
ALTER DATABASE ADD STANDBY LOGFILE GROUP of '/tmpdata/pordredo/redo_22.log ' size 1G;
ALTER DATABASE ADD STANDBY LOGFILE GROUP/tmpdata/pordredo/redo_23.log ' size 1G;
ALTER DATABASE ADD STANDBY LOGFILE GROUP of '/tmpdata/pordredo/redo_24.log ' size 1G;
ALTER DATABASE ADD STANDBY LOGFILE GROUP '/tmpdata/pordredo/redo_25.log ' size 1G;
Clean up the old
ALTER DATABASE clear logfile Group 6;
ALTER DATABASE clear logfile Group 7;
ALTER DATABASE clear logfile Group 8;
ALTER DATABASE clear logfile Group 9;
ALTER DATABASE clear logfile Group 10;
ALTER DATABASE clear logfile Group 16;
ALTER DATABASE clear logfile Group 17;
ALTER DATABASE clear logfile Group 18;
ALTER DATABASE clear logfile Group 19;
ALTER DATABASE clear logfile Group 20;
ALTER DATABASE recover managed standby database cancel;
ALTER DATABASE recover managed standby database disconnect from session;
Solve gap, from the main library or Cascade standby library to find, if found from the main library, you need to register in the standby, because the log is sent from the standby library (cascade standby) to the target library
rman> list Archivelog from sequence 74227 until sequence 74231;
SCP O1_mf_1_74227_bs0rc32g_.arc 10.45.26.102:/porddata/fast_recovery_area/porddb1s/archivelog/2015_06_29/
SCP O1_mf_1_74228_bs0zvxss_.arc 10.45.26.102:/porddata/fast_recovery_area/porddb1s/archivelog/2015_06_29/
SCP O1_mf_1_74229_bs11pq4p_.arc 10.45.26.102:/porddata/fast_recovery_area/porddb1s/archivelog/2015_06_29/
SCP O1_mf_1_74230_bs1305mk_.arc 10.45.26.102:/porddata/fast_recovery_area/porddb1s/archivelog/2015_06_29/
SCP O1_mf_1_74231_bs147yyl_.arc 10.45.26.102:/porddata/fast_recovery_area/porddb1s/archivelog/2015_06_29/
rman> catalog start with '/porddata/fast_recovery_area/porddb1s/archivelog/2015_06_30/';
Log chase of the same time, you can do failover switch
Main Library or Cascade standby library
alter system set Log_archive_dest_state_2=defer;
The standby to activate
Alter system set AQ_TM_PROCESSES=0 scope=memory;
ALTER DATABASE recover managed standby database cancel;
ALTER DATABASE activate physical standby database;
Shutdown immediate
Startup
Select Open_mode,switchover_status,database_role,protection_mode
From V$database;
After activation, restore the log_archive settings of the production library PORDADG
Alter system set log_archive_dest_2= ' Service=pord1 lgwr SYNC affirm valid_for= (online_logfiles,primary_role) DB_UNIQUE _name=pord1 ';
alter system set log_archive_dest_state_2=enable;
Rman Recovery increased ADG (Cascade ADG)