1. Find the Repository control file path First
Find the path to the control file on the repository first, as in the main library, but just in case, check is OK.
Sql> select name from V$controlfile; NAME -------------------------------------------------------------------------------- /oracle/app/oracle/oradata/powerdes/control01.ctl /oracle/app/oracle/fast_recovery/powerdes/control02.ctl Sql> |
2. Prepare to control file backup files
Back up the current control file on the main library, remember that the generated backup file is to be generated before execution is complete, and the command line is also a backup controlfile for standby format '/home/oracle/with a for standby typeface. Ctlfile.bak ' is OK, or it can be manually generated in advance.
Rman> Backup current controlfile for standby format '/home/oracle/ctlfile.bak '; Starting backup at 2016-11-23 21:20:41 Using channel Ora_disk_1 Channel ora_disk_1:starting full DataFile backup set Channel ora_disk_1:specifying DataFile (s) in backup set including standby control file in backup set Channel ora_disk_1:starting piece 1 at 2016-11-23 21:20:42 Channel ora_disk_1:finished piece 1 at 2016-11-23 21:20:43 Piece Handle=/home/oracle/ctlfile.bak tag=tag20161123t212041 comment=none Channel Ora_disk_1:backup set complete, elapsed time:00:00:01 Finished backup at 2016-11-23 21:20:43 Rman> |
Then, when the backup task is finished, on the main library, the control file generated before the backup, the most recent backup file to the same directory as the standby repository:
Scp/oracle/app/oracle/oradata/powerdes/control01.ctl 192.168. 3.112:/home/oracle/ Scp-r/data/backup/data/2016-11-23 192.168. 3.112:/home/oracle/ |
3, check the main library standby environment
Get a backup of TNS: (Mine is earth_m2)
Cat $ORACLE _home/network/admin/tnsnames.ora
EARTH_M2 = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168. 3.112) (PORT = 1521)) ) (Connect_data = (service_name = powerdes) ) ) |
(1) Check the master repository Sid name is unified, this is very important
# Standby Library: [email protected]T1_dbm1_3_112 data]$ echo $ORACLE _sid Powerdes [email protected]T1_dbm1_3_112 data]$ # Main Library: [email protected]T1_dbm1_3_111 ~]$ echo $ORACLE _sid Powerdes [email protected]T1_dbm1_3_111 ~]$ |
(2) Check whether the main library backup transfer password is consistent:
# Standby Library: [email protected]T1_dbm1_3_112 dbs]$ cd $ORACLE _home/dbs [email protected]T1_dbm1_3_112 dbs]$ strings Orapwpowerdes ]\[z ORACLE Remote Password File INTERNAL 89f7167638478f13 0cv# B6e56cbca47429e2 [email protected]T1_dbm1_3_112 dbs]$ # Main Library: [email protected]T1_dbm1_3_111 ~]$ cd $ORACLE _home/dbs [email protected]T1_dbm1_3_111 dbs]$ strings Orapwpowerdes ]\[z ORACLE Remote Password File INTERNAL 89f7167638478f13 0cv# B6e56cbca47429e2 [email protected]T1_dbm1_3_111 dbs]$ |
4. Start Standby to Nomount status
On the standby, direct copy overrides the control file
Cp/home/oracle/ctlfile.bak/oracle/app/oracle/oradata/powerdes/control01.ctl Cp/home/oracle/ctlfile.bak/oracle/app/oracle/fast_recovery/powerdes/control02.ctl |
Then boot to the Nomount state
Sql> Startup Nomount ORACLE instance started. Total System Global area 8551575552 bytes Fixed Size 2270360 bytes Variable Size 7247760232 bytes Database buffers 1291845632 bytes Redo buffers 9699328 bytes Sql> |
5. Use duplicate to restore the library
On the main library, use Rman to log in to the remote standby earth_m2
[email protected]T1_dbm1_3_111 ~]$ rlwrap rman target/auxiliary sys/04181123@earth_m2 Recovery manager:release 11.2.0.4.0-production on Wed Nov 23 20:05:54 2016 Copyright (c) 1982, Oracle and/or its affiliates. All rights reserved. Connected to target Database:powerdes (dbid=3481287162) Connected to auxiliary database:powerdes (not mounted) Rman> |
Execute the recovery command on the Rman command line:
Run {
Allocate auxiliary channel C1 DeviceType disk;
Allocate auxiliary channel C2 DeviceType disk;
Duplicate target database for Standbynofilenamecheck dorecover;
Release channel C1;
Release channel C2;
}
#nofilenamecheck: You must specify the Nofilenamecheck parameter to avoid overwriting the current data file of the primary database. In addition, the master-slave path is consistent and does not need to execute file path and check
#release: This is the channel to turn off the first two lines
The execution process is long, the screen scrolling information is more, here is not posted out, omitted ...
After executing the command, it takes a long time to wait, because you need to write the file to the repository's data file directory, find a time, in the Standby library alert log background has the following log, indicating that the data file is being written:
Full restore complete of datafile 4/oracle/app/oracle/oradata/powerdes/users01.dbf. Elapsed time:0:00:00 Checkpoint is 32945676 Last deallocation SCN is 3 Wed Nov 23 20:14:42 2016 Full restore complete of datafile 3/oracle/app/oracle/oradata/powerdes/undotbs01.dbf. Elapsed time:0:00:05 Checkpoint is 32945676 Last deallocation SCN is 32897307 Undo optimization current SCN is 32934775 Wed Nov 23 20:15:50 2016 Full restore complete of datafile 5/oracle/app/oracle/oradata/powerdes/example01.dbf. Elapsed time:0:01:18 Checkpoint is 32945676 Last deallocation SCN is 32806636 ............ |
6, ORA-01152: Problem
Finally, the Rman command line inside the duplicate command executes, the window interface has the following error message:
Signalling error 1152 for DataFile 1! Errors in FILE/ORACLE/APP/ORACLE/DIAG/RDBMS/EARTH_M2/POWERDES/TRACE/POWERDES_PR00_4069.TRC: Ora-01547:warning:recover succeeded but OPEN Resetlogs would get error below Ora-01152:file 1 was wasn't restored from a sufficiently old backup Ora-01110:data file 1: '/ORACLE/APP/ORACLE/ORADATA/POWERDES/SYSTEM01.DBF ' ORA-1547 signalled During:alter database recover cancel ... ^c |
It doesn't matter if there is an error, the next step is to apply the log, start the archive log transfer, and apply the archive log to ensure the consistency of the primary and standby data:
# Start the transfer Start Application log first sql> ALTER DATABASE recover managed standby database using current logfile disconnect from session; Database altered. sql># real-time observation of application log status Sql> Select sequence#,applied from V$archived_log order by sequence# ASC; ...... sequence# applied ---------- --------- 2334 YES 2335 YES 2301 rows selected. Sql> # Wait until the application log is finished, exit log transfer sql> ALTER DATABASE recover managed standby database cancel; Database altered. Sql> # booting the standby from Mount to the open state sql> ALTER DATABASE open; Database altered. Sql> # to view the standby status, it will become read only Sql> select Database_role,open_mode from V$database; Database_role Open_mode ---------------- -------------------- Physical STANDBY READ only Sql> # Then start the log app again sql> ALTER DATABASE recover managed standby database using current logfile disconnect from session; Database altered. Sql> # View Open_mode, with the read only with apply word, OK Sql> select Database_role,open_mode from V$database; Database_role Open_mode ---------------- -------------------- Physical STANDBY READ only with APPLY Sql> |
At this point, the data guard repository repair completed, if encountered ORA-01152 problem, do not need to panic, you can try to apply the log to recover data.
ORACLE 11g Recovery Data Guard repository detail process with duplicate