How does oracle11g restore the primary database of dataguard to an oracle single-host instance?

Source: Internet
Author: User

How does oracle11g restore the primary database of dataguard to an oracle single-host instance?
You need to recover the primary database of dataguard to an oracle single-host instance. Therefore, record the detailed process 1, pull a new parameter file from the production environment, and copy it to the test environment.

SQL> create pfile='/oracle/pfile01.ora'from spfile;                                                                                                                                           File created.SQL> 

Then, create a spfile in the test database based on the copied parameter file.

create spfile frompfile='/data/pfile01.ora';SQL> create spfile frompfile='/data/impdp/pfile01.ora'; File created.SQL> 

Then start the test database to nomount.

 SQL> startup nomount ORA-00845: MEMORY_TARGET not supported onthis system SQL> 
2. Restore the control file

Restore controlfile to '/home/oradata/orcstu/control01.ctl' from '/data/impdp/c-3391761643-20151126-01'

RMAN> restore controlfile to '/home/oradata/orcstu/control01.ctl' from'/data/impdp/c-3391761643-20151126-01'                                                                                 2> ;                                                                                                                                                                                           Starting restore at 26-NOV-15using channel ORA_DISK_1channel ORA_DISK_1: restoring control file                                                                                                                                                     channel ORA_DISK_1: restore complete, elapsed time: 00:00:01                                                                                                                                   Finished restore at 26-NOV-15RMAN>      RMAN> restore controlfile to '/oracle/app/oracle/flash_recovery_area/orcstu/control02.ctl' from '/data/impdp/c-3391761643-20151126-01';                                                      Starting restore at 26-NOV-15using channel ORA_DISK_1channel ORA_DISK_1: restoring control file                                                                                                                                                     channel ORA_DISK_1: restore complete, elapsed time: 00:00:01                                                                                                                                   Finished restore at 26-NOV-15RMAN>   
3. Register for archiving

Change the database status to mount.

RMAN> alter database mount;                                                                                                                                                                    database mounted                                                                                                                                                                               released channel: ORA_DISK_1RMAN>  

Register data file backup and archive backup in the new control file

catalog start with'/data/impdp/2015-11-26/'; RMAN> catalog start with'/data/impdp/2015-11-26/'; Starting implicit crosscheck backup at 26-NOV-15 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=767 device type=DISKCrosschecked 97 objects Finished implicit crosscheck backup at 26-NOV-15Starting implicit crosscheck copy at 26-NOV-15using channel ORA_DISK_1Crosschecked 2 objects Finished implicit crosscheck copy at 26-NOV-15searching for all files in the recovery areacataloging files...no files cataloged searching for all files that match the pattern /data/impdp/2015-11-26/ List of Files Unknown to the Database=====================================File Name: /data/impdp/2015-11-26/rman_backup.logFile Name: /data/impdp/2015-11-26/arch_orcstu_20151126_5036.bakFile Name: /data/impdp/2015-11-26/full_orcstu_20151126_5037.bakFile Name: /data/impdp/2015-11-26/arch_orcstu_20151126_5038.bakDo you really want to catalog the above files (enter YES or NO)? YES cataloging files...cataloging done List of Cataloged Files=======================File Name: /data/impdp/2015-11-26/arch_orcstu_20151126_5036.bakFile Name: /data/impdp/2015-11-26/full_orcstu_20151126_5037.bakFile Name: /data/impdp/2015-11-26/arch_orcstu_20151126_5038.bakList of Files Which Where Not Cataloged=======================================File Name: /data/impdp/2015-11-26/rman_backup.log RMAN-07517: Reason: The file header is corruptedRMAN> 
4. start restoring the entire database.

Because the entire spfile has been recovered and controlfile has been recovered, you can recover the restore database directly without parameters;

RMAN> restore database;                                                                                                                                                                        Starting restore at 26-NOV-15                                                                                                                                                                  using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restore                                                                                                                                       channel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /home/oradata/orcstu/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /home/oradata/orcstu/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /home/oradata/orcstu/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /home/oradata/orcstu/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /home/oradata/orcstu/orcstuk01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /home/oradata/orcstu/plas01.dbfchannel ORA_DISK_1: restoring datafile 00007 to /home/oradata/orcstu/pl01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /home/oradata/orcstu/help01.dbfchannel ORA_DISK_1: restoring datafile 00009 to /home/oradata/orcstu/adobelc01.dbfchannel ORA_DISK_1: restoring datafile 00010 to /home/oradata/orcstu/sms01.dbfchannel ORA_DISK_1: restoring datafile 00011 to /home/oradata/orcstu/plcrm01.dbfchannel ORA_DISK_1: restoring datafile 00012 to /home/oradata/orcstu/orcstuk02.dbfchannel ORA_DISK_1: restoring datafile 00013 to /home/oradata/orcstu/datagm01.dbfchannel ORA_DISK_1: reading from backup piece /data/impdp/2015-11-26/full_orcstu_20151126_5037.bakchannel ORA_DISK_1: piece handle=/data/impdp/2015-11-26/full_orcstu_20151126_5037.bak tag=TAG20151126T030008                                                                                 channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:32:50Finished restore at 26-NOV-15RMAN>    
5. recover Database
RMAN> recover database; Starting recover at specified using channel available media recovery channel ORA_DISK_1: starting archived log restore to default destination channel ORA_DISK_1: restoring archived logarchived log thread = 1 sequence = 39674 channel ORA_DISK_1: reading from backup piece/data/impdp/2015-11-26/arch_orcstu_20151126_5038.bakchannel ORA_DISK_1: piece handle =/data/impdp/2015-11-26/tags tag = TAG20151126T032346 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00: 00: 03 archived log file name =/oracle/app/oracle/flash_recovery_area/stored thread = 1 sequence = 39674 unable to find archived log thread = 1 sequence = 10975rman-00571: ========================================================== ============================== RMAN-00569: ================ error message stack follows ============================ RMAN-00571: ========================================================== ============================== RMAN-03002: failure of recover command at 11/26/2015 21: 48: 13RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 39675 and starting SCN of 11688009482 RMAN> background alert log: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 Completed: alter database recover datafile list 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 alter database recover if needed start until cancel using backup controlfileMedia Recovery Start started logmerger processParallel Media reted started with 4 slavesORA-279 signalled: alter database recover if needed start until cancel using backup controlfile... alter database recover logfile '/oracle/app/oracle/flash_recovery_area/archivelog1_39674_821708334.dbf' Media Recovery Log/oracle/app/oracle/flash_recovery_area/archivelog1_39674_821708334.dbfORA-279 signalled: alter database recover logfile '/oracle/app/oracle/flash_recovery_area/archivelog1_39674_821708334.dbf '... thu Nov 26 21:48:13 2015 alter database recover cancelMedia Recovery CanceledCompleted: alter database recover cancel

It can be seen that the cause of this error is that the archive log records required for recovery cannot be found in the control file or recovery directory. There are two solutions:
1. If the related log exists and is available, add the log to the control file or recovery directory.
2. If the related logs have been deleted or are unavailable, follow the error message "scn" to restore the database to this scn, Which is 11688009482. That is to say, the database can only be recovered completely. You must use resetlogs to open the database.

Here, only the scn point 11688009482 is restored:

recover database until scn 11688009482;RMAN> recover database until scn 11688009482; Starting recover at 26-NOV-15 using channel ORA_DISK_1starting media recovery media recovery complete, elapsed time: 00:00:01 Finished recover at 26-NOV-15 RMAN> 
6. Open the database
RMAN> alter database open resetlogs;                                                                                                                                                           database opened                                                                                                                                                                                RMAN>        

Change Password

SQL> alter user orcstuk identified by "pd141287l118";                                                                                                                                            User altered.SQL> exit  
7. remote connection Error
C:\Users\Administrator>tnsping TEST2_180.60TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 26-NOV-2015 21:59:33Copyright (c) 1997, 2010, Oracle.  All rights reserved.Used parameter files:D:\app\Administrator\product\11.2.0\client_2\network\admin\sqlnet.oraUsed TNSNAMES adapter to resolve the aliasAttempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 12.18.10.6)(PORT = 1521))) (CONNECT_DATA = (SID = orcstu)))TNS-12535: TNS:operation timed outC:\Users\Administrator>

Solution: Disable the firewall of the oracle database.

8. Cancel configuring dg to a single-host oracle database.

The following error logs are displayed on the background:

Error 12154 received logging on to the standbyErrors in file /oracle/app/oracle/diag/rdbms/pdunq/orcstu/trace/orcstu_arc2_13889.trc:ORA-12154: TNS:could not resolve the connect identifier specifiedPING[ARC2]: Heartbeat failed to connect to standby 'PD_DG'. Error is 12154.Thu Nov 26 22:48:02 2015Error 12154 received logging on to the standbyErrors in file /oracle/app/oracle/diag/rdbms/pdunq/orcstu/trace/orcstu_arc2_13889.trc:ORA-12154: TNS:could not resolve the connect identifier specifiedPING[ARC2]: Heartbeat failed to connect to standby 'PD_DG'. Error is 12154.

After analysis, it is because my rman backup is obtained from the primary in the dg Environment. During the backup, it naturally takes the dg to transmit the archive log to the standby function, therefore, when the rman backup is restored to this single machine, an error will be reported when the dg archive log is transmitted, because the single machine. Solution: Disable archive log transmission as follows:

SQL> ALTER system SET log_archive_dest_state_2 ='defer';                                                                                                                                       System altered.SQL> 

In this way, the oracle dg archive log transmission is stopped, and no error is reported in the background.

At this point, the migration has been successfully completed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.