Actually, I forgot it. I just thought without connection target and catalog databases. I knew this was waste our time. We should connect target database, Except we was using 11gR2 (just connect to catalog).
It was just my play, during I was testing some about RMAN. I used backupset from target database to restore new database (for standby database) then (graceful) failed over it.
On Target Database (ORCL):
SQL> select file#,name from v$datafile;
FILE# NAME
---------- ----------------------------------------------------------------------
1 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_7kzfbnwy_.dbf
2 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_7kzfbot8_.dbf
3 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_7kzfboym_.dbf
4 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_7kzfbp8p_.dbf
5 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_7kzfpwwg_.dbf
6 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs_apex_7l310vnk_.dbf
7 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs_apex_7l367j3l_.dbf
8 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs_demo_7lods738_.dbf
9 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_rcat_ts_7lrgnll6_.dbf
9 rows selected.
SQL> select name from v$tempfile;
NAME
----------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_7m5969gl_.tmp
SQL> select member from v$logfile;
MEMBER
------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_3_7m596119_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_3_7m5963pb_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_2_7m595wts_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_2_7m595yyc_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_1_7m595ps4_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_1_7m595t1m_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_4_7m2z44ts_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_4_7m2z45x3_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_5_7m2z4b5w_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_5_7m2z4cwv_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_6_7m2z4hop_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_6_7m2z4js9_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_7_7m2z4nnh_.log
/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_7_7m2z4p1t_.log
[oracle@chart01 ~]$ ps -aef | grep pmon
oracle 4589 1 0 Feb08 ? 00:00:09 ora_pmon_orcl
SQL> select name from v$database;
NAME
---------
ORCL
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dupdb.ctl' reuse;
Database altered.
For Duplicate Database (DUPDB): make sure all paths no affect with target database !!!
[oracle@chart01 ~]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initdupdb.ora
*.audit_file_dest='/u01/app/oracle/admin/dupdb/adump'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dupdb.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_name='orcl'
*.db_unique_name='dupdb'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=21474836480
*.diagnostic_dest='/u01/app/oracle'
*.job_queue_processes=1000
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_trace=1
*.sga_target=700M
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_retention=3600
*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert='orcl','dupdb','ORCL','DUPDB'
*.log_file_name_convert='orcl','dupdb','ORCL','DUPDB'
[oracle@chart01 ~]$ export ORACLE_SID=dupdb
[oracle@chart01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Feb 9 00:21:48 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 732352512 bytes
Fixed Size 1347456 bytes
Variable Size 205521024 bytes
Database Buffers 520093696 bytes
Redo Buffers 5390336 bytes
Database mounted.
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PHYSICAL STANDBY
SQL> select file#,name from v$datafile;
FILE# NAME
---------- ----------------------------------------------------------------------
1 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_system_7kzfbnwy_.dbf
2 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_sysaux_7kzfbot8_.dbf
3 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_undotbs1_7kzfboym_.dbf
4 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_users_7kzfbp8p_.dbf
5 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_example_7kzfpwwg_.dbf
6 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_apex_7l310vnk_.dbf
7 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_apex_7l367j3l_.dbf
8 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_demo_7lods738_.dbf
9 /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_rcat_ts_7lrgnll6_.dbf
9 rows selected.
SQL> select name from v$tempfile;
NAME
----------------------------------------------------------------------
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_temp_7m5969gl_.tmp
SQL> select member from v$logfile;
MEMBER
------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_3_7m596119_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_3_7m5963pb_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_2_7m595wts_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_2_7m595yyc_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_1_7m595ps4_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_1_7m595t1m_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_4_7m2z44ts_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_4_7m2z45x3_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_5_7m2z4b5w_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_5_7m2z4cwv_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_6_7m2z4hop_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_6_7m2z4js9_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_7_7m2z4nnh_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_7_7m2z4p1t_.log
[oracle@chart01 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Feb 9 01:45:12 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1301287541, not open)
RMAN> run{
restore database;
recover database;
}
Starting restore at 09-FEB-12
Starting implicit crosscheck backup at 09-FEB-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=25 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 09-FEB-12
Starting implicit crosscheck copy at 09-FEB-12
using channel ORA_DISK_1
Crosschecked 10 objects
Finished implicit crosscheck copy at 09-FEB-12
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/DUPDB/autobackup/2012_02_08/o1_mf_n_774745439_7m577k3l_.bkp
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_system_7kzfbnwy_.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_sysaux_7kzfbot8_.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_undotbs1_7kzfboym_.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_users_7kzfbp8p_.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_example_7kzfpwwg_.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_apex_7l310vnk_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_apex_7l367j3l_.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_demo_7lods738_.dbf
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/DUPDB/datafile/o1_mf_rcat_ts_7lrgnll6_.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/backupset/2012_02_09/o1_mf_nnnd0_TAG20120209T014117_7m5jgg70_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2012_02_09/o1_mf_nnnd0_TAG20120209T014117_7m5jgg70_.bkp tag=TAG20120209T014117
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:45
Finished restore at 09-FEB-12
Starting recover at 09-FEB-12
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=24
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/backupset/2012_02_09/o1_mf_annnn_TAG20120209T014323_7m5jlcv5_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2012_02_09/o1_mf_annnn_TAG20120209T014323_7m5jlcv5_.bkp tag=TAG20120209T014323
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/fast_recovery_area/DUPDB/archivelog/2012_02_09/o1_mf_1_24_7m5jvfqo_.arc thread=1 sequence=24
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/DUPDB/archivelog/2012_02_09/o1_mf_1_24_7m5jvfqo_.arc RECID=1 STAMP=774755293
unable to find archived log
archived log thread=1 sequence=25
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/09/2012 01:48:15
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 25 and starting SCN of 2045943
RMAN> exit
Recovery Manager complete.
[oracle@chart01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Feb 9 01:48:27 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PHYSICAL STANDBY
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH
*
ERROR at line 1:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1:
'/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_system_7m5jp64v_.dbf'
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
Database altered.
SQL> ALTER DATABASE ACTIVATE STANDBY DATABASE;
Database altered.
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PRIMARY
SQL> alter database open;
Database altered.
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_3_7m5jy095_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_3_7m5jy1fm_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_2_7m5jxtrl_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_2_7m5jxwhx_.log
/u01/app/oracle/oradata/DUPDB/onlinelog/o1_mf_1_7m5jxo0w_.log
/u01/app/oracle/fast_recovery_area/DUPDB/onlinelog/o1_mf_1_7m5jxprl_.log
/u01/app/oracle/fast_recovery_area/DUPDB/archivelog/2012_02_09/o1_mf_1_0_7m5jwzjs_.arc
7 rows selected.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_system_7m5jp64v_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_sysaux_7m5jp65h_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_undotbs1_7m5jp674_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_users_7m5jpcmm_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_example_7m5jp662_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_apex_7m5jp67p_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_apex_7m5jp6b2_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_tbs_demo_7m5jp6bn_.dbf
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_rcat_ts_7m5jp6cn_.dbf
9 rows selected.
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DUPDB/datafile/o1_mf_temp_7m5k1lvf_.tmp
[oracle@chart01 ~]$ ps -aef | grep pmon
oracle 4589 1 0 Feb08 ? 00:00:09 ora_pmon_orcl
oracle 8920 1 0 02:01 ? 00:00:00 ora_pmon_dupdb
Why I didn't restore from backupset? I tested this idea as well. But I had to rename redo log files. That was the bad idea to do on the same server with target database. How do you guarantee all commands no affect to target database?
So, this was just my play and no affect with target database in the same server also. Maybe, my steps was wrong. But just fun and it worked for my play.
***By the way, We should use "duplicate" command (just connect target database and catalog databases), It's safe***
Related Posts:
DUPLICATE Without Connection to Target Database (11gR2)
No comments:
Post a Comment