Duplicate standby database from active database

11g Release1 中引入了新的RMAN duplicate命令,即duplicate from active database命令。利用该命令可以更加便捷地创建Data Guard环境,你甚至不需要将Primary Database shutdown(整个过程中主库都可以处于打开状态下),也不需要在配置前做一些额外的备份操作,仅需要配置起auxiliary辅助实例,同时创建密码文件,并在监听(LISTENER)中加入静态注册信息后就可以开始工作了!

以下示例中我们会在Primary Database所在的同一台服务器上部署一套物理备库(Physical Standby),实际上这样比在不同的2台服务器上配置Data Guard要复杂些,原因是那样的话我们无需做File Name的转换,具体的环境:

Database Role DB_UNIQUE_NAME
Primary Database PROD
Standby Database SBDB

 

/* 需要注意的是DG环境中force logging,不要用了新特性就将这个基本的要求忘记了 ! */

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE	11.2.0.2.0	Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

/* 显然PROD主库应当处于归档模式并且是FORCE LOGGING状态下 */

SQL> alter database force logging;
Database altered.

同时在Primary Database上创建必要的standby logfile:

SQL> alter database add standby logfile group 7 size 50M;
Database altered.

SQL> alter database add standby logfile group 8 size 50M;
Database altered.
 ..............

/* standby实例只需要db_name参数就可以启动到nomount模式了,
   并为standby数据库创建密码文件 */

[maclean@rh6 ~]$ echo "db_name=PROD" >$ORACLE_HOME/dbs/initSBDB.ora

[maclean@rh6 ~]$ orapwd file=$ORACLE_HOME/dbs/orapwSBDB password=XXXX entries=10

[maclean@rh6 ~]$ cd $ORACLE_HOME/network/admin

我们需要保证PROD和SBDB实例在监听器Listener中被静态注册,同时也包括DGMGRL需要用到的*_DGMGRL服务名

[maclean@rh6 admin]$ cat listener.ora
# listener23920.ora Network Configuration File: /tmp/listener23920.ora
# Generated by Oracle configuration tools.

DGLSN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rh6.oracle.com)(PORT = 1588))
  )

SID_LIST_DGLSN =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = PROD)
      (ORACLE_HOME = /s01/product/11.2.0/dbhome_2)
      (SID_NAME = PROD)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = SBDB)
      (ORACLE_HOME = /s01/product/11.2.0/dbhome_2)
      (SID_NAME = SBDB)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = PROD_DGMGRL)
      (ORACLE_HOME = /s01/product/11.2.0/dbhome_2)
      (SID_NAME = PROD)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = SBDB_DGMGRL)
      (ORACLE_HOME = /s01/product/11.2.0/dbhome_2)
      (SID_NAME = SBDB)
    )
  )

/* 并在tnsnames.ora文件中加入必要的服务别名 */

[maclean@rh6 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /s01/product/11.2.0/dbhome_2/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

PROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rh6.oracle.com)(PORT = 1588))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PROD)
    )
  )

SBDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rh6.oracle.com)(PORT = 1588))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = SBDB)
    )
  )

DGLSN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rh6.oracle.com)(PORT = 1588))
  )

接着我们来启动辅助实例

[maclean@rh6 ~]$ export ORACLE_SID=SBDB
[maclean@rh6 ~]$ sqlplus  / as sysdba
SQL> startup  nomount;
ORACLE instance started.

/* 使用远程登录测试是否可以以SYSDBA登录SBDB实例 */

[maclean@rh6 ~]$ sqlplus  sys/XXXXXX@SBDB as sysdba

下面我们需要准备一份duplicate standby database的脚本,
因为我们是在同一台主机上配置Data Guard所以这里要用到db_file_name_convert和log_file_name_convert,
如果你的环境中不需要这么做那么你可以指定NOFILENAMECHECK;

以下为示例的脚本,可以看到它并不复杂只是指定了必要的初始化参数,十分易于记忆。

[maclean@rh6 ~]$ cat duplicate_act_standby.rcv 

duplicate target database
for standby
from active database
DORECOVER
spfile
set db_unique_name='SBDB'
set log_archive_dest_1='location=/standby/arch02'
set log_archive_dest_2='service=PROD async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=PROD'
set standby_file_management='AUTO'
set fal_server='PROD'
set fal_client='SBDB'
set control_files='/standby/oradata/SBDB/controlfile/control1.ctl','/standby/oradata/SBDB/controlfile/control2.ctl'
set db_file_name_convert='PROD','SBDB'
set log_file_name_convert='PROD','SBDB'
set memory_target='0'
set sga_target='400M';

具体执行以上脚本,我们需要同时登录target database PROD和auxiliary instance辅助实例SBDB:

[maclean@rh6 ~]$ echo $ORACLE_SID
PROD

[maclean@rh6 ~]$ rman target / auxiliary sys/oracle@SBDB cmdfile=duplicate_act_standby.rcv log=das.log

connected to target database: PROD (DBID=158660885)
connected to auxiliary database: PROD (not mounted)

RMAN> duplicate target database
2> for standby
3> from active database
4> DORECOVER
5> spfile
6> set db_unique_name='SBDB'
7> set log_archive_dest_1='location=/standby/arch02'
8> set log_archive_dest_2='service=PROD async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=PROD'
9> set standby_file_management='AUTO'
10> set fal_server='PROD'
11> set fal_client='SBDB'
12> set control_files='/standby/oradata/SBDB/controlfile/control1.ctl','/standby/oradata/SBDB/controlfile/control2.ctl'
13> set db_file_name_convert='PROD','SBDB'
14> set log_file_name_convert='PROD','SBDB'
15> set memory_target='0'
16> set sga_target='400M';
17>
Starting Duplicate Db at 26-MAR-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=96 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/s01/product/11.2.0/dbhome_2/dbs/orapwPROD' auxiliary format
 '/s01/product/11.2.0/dbhome_2/dbs/orapwSBDB'   targetfile
 '/s01/product/11.2.0/dbhome_2/dbs/spfilePROD.ora' auxiliary format
 '/s01/product/11.2.0/dbhome_2/dbs/spfileSBDB.ora'   ;
   sql clone "alter system set spfile= ''/s01/product/11.2.0/dbhome_2/dbs/spfileSBDB.ora''";
}
executing Memory Script

Starting backup at 26-MAR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
Finished backup at 26-MAR-11

sql statement: alter system set spfile= ''/s01/product/11.2.0/dbhome_2/dbs/spfileSBDB.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_unique_name =
 ''SBDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
 ''location=/standby/arch02'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_2 =
 ''service=PROD async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=PROD'' comment=
 '''' scope=spfile";
   sql clone "alter system set  standby_file_management =
 ''AUTO'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_server =
 ''PROD'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_client =
 ''SBDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/standby/oradata/SBDB/controlfile/control1.ctl'', ''/standby/oradata/SBDB/controlfile/control2.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''PROD'', ''SBDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''PROD'', ''SBDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  memory_target =
 0 comment=
 '''' scope=spfile";
   sql clone "alter system set  sga_target =
 400M comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_unique_name =  ''SBDB'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''location=/standby/arch02'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_2 =  
''service=PROD async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=PROD'' 
comment= '''' scope=spfile

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''PROD'' comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''SBDB'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/standby/oradata/SBDB/controlfile/control1.ctl'',
''/standby/oradata/SBDB/controlfile/control2.ctl''
comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''PROD'', ''SBDB'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''PROD'', ''SBDB'' comment= '''' scope=spfile

sql statement: alter system set  memory_target =  0 comment= '''' scope=spfile

sql statement: alter system set  sga_target =  400M comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     417546240 bytes

Fixed Size                     2227072 bytes
Variable Size                134218880 bytes
Database Buffers             272629760 bytes
Redo Buffers                   8470528 bytes

contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/standby/oradata/SBDB/controlfile/control1.ctl';
   restore clone controlfile to  '/standby/oradata/SBDB/controlfile/control2.ctl' from
 '/standby/oradata/SBDB/controlfile/control1.ctl';
}
executing Memory Script

Starting backup at 26-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/s01/product/11.2.0/dbhome_2/dbs/snapcf_PROD.f tag=TAG20110326T195144 RECID=2 STAMP=746826704
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 26-MAR-11

Starting restore at 26-MAR-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 26-MAR-11

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/standby/oradata/SBDB/datafile/o1_mf_temp_6rvjsmr4_.tmp";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/standby/oradata/SBDB/datafile/o1_mf_system_6rvjrtxh_.dbf";
   set newname for datafile  2 to
 "/standby/oradata/SBDB/datafile/o1_mf_sysaux_6rvjs6vh_.dbf";
   set newname for datafile  3 to
 "/standby/oradata/SBDB/datafile/o1_mf_undotbs1_6rvjsjjg_.dbf";
   set newname for datafile  4 to
 "/standby/oradata/SBDB/datafile/o1_mf_users_6rvjsy5q_.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/standby/oradata/SBDB/datafile/o1_mf_system_6rvjrtxh_.dbf"   datafile
 2 auxiliary format
 "/standby/oradata/SBDB/datafile/o1_mf_sysaux_6rvjs6vh_.dbf"   datafile
 3 auxiliary format
 "/standby/oradata/SBDB/datafile/o1_mf_undotbs1_6rvjsjjg_.dbf"   datafile
 4 auxiliary format
 "/standby/oradata/SBDB/datafile/o1_mf_users_6rvjsy5q_.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /standby/oradata/SBDB/datafile/o1_mf_temp_6rvjsmr4_.tmp in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 26-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/standby/oradata/PROD/datafile/o1_mf_system_6rvjrtxh_.dbf
output file name=/standby/oradata/SBDB/datafile/o1_mf_system_6rvjrtxh_.dbf tag=TAG20110326T195152
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/standby/oradata/PROD/datafile/o1_mf_sysaux_6rvjs6vh_.dbf
output file name=/standby/oradata/SBDB/datafile/o1_mf_sysaux_6rvjs6vh_.dbf tag=TAG20110326T195152
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/standby/oradata/PROD/datafile/o1_mf_undotbs1_6rvjsjjg_.dbf
output file name=/standby/oradata/SBDB/datafile/o1_mf_undotbs1_6rvjsjjg_.dbf tag=TAG20110326T195152
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/standby/oradata/PROD/datafile/o1_mf_users_6rvjsy5q_.dbf
output file name=/standby/oradata/SBDB/datafile/o1_mf_users_6rvjsy5q_.dbf tag=TAG20110326T195152
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 26-MAR-11

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/standby/arch01/1_17_746822549.dbf" auxiliary format
 "/standby/arch02/1_17_746822549.dbf"   ;
   catalog clone archivelog  "/standby/arch02/1_17_746822549.dbf";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 26-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=17 RECID=3 STAMP=746826751
output file name=/standby/arch02/1_17_746822549.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 26-MAR-11

cataloged archived log
archived log file name=/standby/arch02/1_17_746822549.dbf RECID=1 STAMP=746826752

datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=746826752 file name=/standby/oradata/SBDB/datafile/o1_mf_system_6rvjrtxh_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=746826752 file name=/standby/oradata/SBDB/datafile/o1_mf_sysaux_6rvjs6vh_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=746826752 file name=/standby/oradata/SBDB/datafile/o1_mf_undotbs1_6rvjsjjg_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=746826752 file name=/standby/oradata/SBDB/datafile/o1_mf_users_6rvjsy5q_.dbf

contents of Memory Script:
{
   set until scn  242517;
   recover
   standby
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 26-MAR-11
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 17 is already on disk as file /standby/arch02/1_17_746822549.dbf
archived log file name=/standby/arch02/1_17_746822549.dbf thread=1 sequence=17
media recovery complete, elapsed time: 00:00:00
Finished recover at 26-MAR-11
Finished Duplicate Db at 26-MAR-11

Recovery Manager complete.

[maclean@rh6 ~]$ export ORACLE_SID=PROD
[maclean@rh6 ~]$ sqlplus  / as sysdba

/* 在主库PROD上设置到物理备库SBDB的归档目的地 */

SQL> alter system set log_archive_dest_2='service=sbdb lgwr async  
valid_for=(online_logfiles,primary_role) db_unique_name=SBDB';
System altered.

以上完成了对物理备库Physical Standby的配置,紧接着我们来配合Data Broker:

SQL> alter system set dg_broker_start=true;
System altered.

[maclean@rh6 ~]$ export ORACLE_SID=SBDB
[maclean@rh6 ~]$ sqlplus  / as sysdba

SQL>  alter system set dg_broker_start=true;
System altered.

[maclean@rh6 ~]$ dgmgrl sys/oracle@PROD
DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.

DGMGRL>  create CONFIGURATION PROD as PRIMARY DATABASE IS PROD  CONNECT IDENTIFIER IS PROD;
Configuration "prod" created with primary database "prod"

DGMGRL> add database sbdb  AS CONNECT IDENTIFIER IS sbdb MAINTAINED AS PHYSICAL;
Database "sbdb" added

DGMGRL> enable configuration;
Enabled.

DGMGRL> edit database prod set property LogXptMode='sync';
Property "logxptmode" updated
DGMGRL> edit database sbdb set property LogXptMode='sync';
Property "logxptmode" updated

/* 修改当前DG的保护模式为最大可用模式MaxAvailability */

DGMGRL> edit CONFIGURATION SET PROTECTION MODE  as MaxAvailability;
Succeeded.

DGMGRL> show configuration;

Configuration - prod

  Protection Mode: MaxAvailability
  Databases:
    prod - Primary database
    sbdb - Physical standby database
      Error: ORA-16766: Redo Apply is stopped

Fast-Start Failover: DISABLED

Configuration Status:
ERROR

/* 以上可以看到物理备库SBDB上的REDO APPLY被停止了,我们可以在DGMGRL中启动其REDO APPLY */

DGMGRL> edit database sbdb set state='APPLY-ON';
Succeeded.

DGMGRL> show configuration;

Configuration - prod

  Protection Mode: MaxAvailability
  Databases:
    prod - Primary database
    sbdb - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

/* 以下使用DGMGRL来回切换主备库角色,十分方便 */

DGMGRL> switchover to sbdb;
Performing switchover NOW, please wait...
New primary database "sbdb" is opening...
Operation requires shutdown of instance "PROD" on database "prod"
Shutting down instance "PROD"...
ORACLE instance shut down.
Operation requires startup of instance "PROD" on database "prod"
Starting instance "PROD"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "sbdb"

DGMGRL> switchover to prod;
Performing switchover NOW, please wait...
New primary database "prod" is opening...
Operation requires shutdown of instance "SBDB" on database "sbdb"
Shutting down instance "SBDB"...
ORACLE instance shut down.
Operation requires startup of instance "SBDB" on database "sbdb"
Starting instance "SBDB"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "prod"

Posted

in

by

Tags:

Comments

6 responses to “Duplicate standby database from active database”

  1. maclean Avatar

    duplicate target database
    for standby
    from active database
    NOFILENAMECHECK
    DORECOVER
    spfile
    set db_unique_name=’SBDB’
    set log_archive_dest_1=’location=/s01/orabase/stdby’
    set log_archive_dest_2=’service=DGOGG async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=DGOGG’
    set standby_file_management=’AUTO’
    set fal_server=’DGOGG’
    set fal_client=’SBDB’
    set control_files=’/s01/orabase/oradata/SBDB/controlfile/control1.ctl’,’/s01/orabase/oradata/SBDB/controlfile/control2.ctl’
    set db_file_name_convert=’DGOGG’,’SBDB’
    set log_file_name_convert=’DGOGG’,’SBDB’
    set memory_target=’0′
    set sga_target=’400M’;

    [oracle@vrh3 ~]$ rman target / auxiliary sys/oracle@SBDB cmdfile=das.rcv

    Recovery Manager: Release 11.2.0.2.0 – Production on Tue Sep 20 21:11:35 2011

    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

    connected to target database: DGOGG (DBID=2958116012)
    connected to auxiliary database: DGOGG (not mounted)

    RMAN> duplicate target database
    2> for standby
    3> from active database
    4> NOFILENAMECHECK
    5> DORECOVER
    6> spfile
    7> set db_unique_name=’SBDB’
    8> set log_archive_dest_1=’location=/s01/orabase/stdby’
    9> set log_archive_dest_2=’service=DGOGG async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=DGOGG’
    10> set standby_file_management=’AUTO’
    11> set fal_server=’DGOGG’
    12> set fal_client=’SBDB’
    13> set control_files=’/s01/orabase/oradata/SBDB/controlfile/control1.ctl’,’/s01/orabase/oradata/SBDB/controlfile/control2.ctl’
    14> set db_file_name_convert=’DGOGG’,’SBDB’
    15> set log_file_name_convert=’DGOGG’,’SBDB’
    16> set memory_target=’0′
    17> set sga_target=’400M’;
    18>
    19>
    Starting Duplicate Db at 20-SEP-11
    using target database control file instead of recovery catalog
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=10 device type=DISK

    contents of Memory Script:
    {
    backup as copy reuse
    targetfile ‘/s01/orabase/product/11.2.0/dbhome_1/dbs/orapwDGOGG’ auxiliary format
    ‘/s01/orabase/product/11.2.0/dbhome_1/dbs/orapwSBDB’ targetfile
    ‘/s01/orabase/product/11.2.0/dbhome_1/dbs/spfileDGOGG.ora’ auxiliary format
    ‘/s01/orabase/product/11.2.0/dbhome_1/dbs/spfileSBDB.ora’ ;
    sql clone “alter system set spfile= ”/s01/orabase/product/11.2.0/dbhome_1/dbs/spfileSBDB.ora””;
    }
    executing Memory Script

    Starting backup at 20-SEP-11
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=144 device type=DISK
    Finished backup at 20-SEP-11

    sql statement: alter system set spfile= ”/s01/orabase/product/11.2.0/dbhome_1/dbs/spfileSBDB.ora”

    contents of Memory Script:
    {
    sql clone “alter system set db_unique_name =
    ”SBDB” comment=
    ”” scope=spfile”;
    sql clone “alter system set log_archive_dest_1 =
    ”location=/s01/orabase/stdby” comment=
    ”” scope=spfile”;
    sql clone “alter system set log_archive_dest_2 =
    ”service=DGOGG async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=DGOGG” comment=
    ”” scope=spfile”;
    sql clone “alter system set standby_file_management =
    ”AUTO” comment=
    ”” scope=spfile”;
    sql clone “alter system set fal_server =
    ”DGOGG” comment=
    ”” scope=spfile”;
    sql clone “alter system set fal_client =
    ”SBDB” comment=
    ”” scope=spfile”;
    sql clone “alter system set control_files =
    ”/s01/orabase/oradata/SBDB/controlfile/control1.ctl”, ”/s01/orabase/oradata/SBDB/controlfile/control2.ctl” comment=
    ”” scope=spfile”;
    sql clone “alter system set db_file_name_convert =
    ”DGOGG”, ”SBDB” comment=
    ”” scope=spfile”;
    sql clone “alter system set log_file_name_convert =
    ”DGOGG”, ”SBDB” comment=
    ”” scope=spfile”;
    sql clone “alter system set memory_target =
    0 comment=
    ”” scope=spfile”;
    sql clone “alter system set sga_target =
    400M comment=
    ”” scope=spfile”;
    shutdown clone immediate;
    startup clone nomount;
    }
    executing Memory Script

    sql statement: alter system set db_unique_name = ”SBDB” comment= ”” scope=spfile

    sql statement: alter system set log_archive_dest_1 = ”location=/s01/orabase/stdby” comment= ”” scope=spfile

    sql statement: alter system set log_archive_dest_2 = ”service=DGOGG async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=DGOGG” comment= ”” scope=spfile

    sql statement: alter system set standby_file_management = ”AUTO” comment= ”” scope=spfile

    sql statement: alter system set fal_server = ”DGOGG” comment= ”” scope=spfile

    sql statement: alter system set fal_client = ”SBDB” comment= ”” scope=spfile

    sql statement: alter system set control_files = ”/s01/orabase/oradata/SBDB/controlfile/control1.ctl”, ”/s01/orabase/oradata/SBDB/controlfile/control2.ctl” comment= ”” scope=spfile

    sql statement: alter system set db_file_name_convert = ”DGOGG”, ”SBDB” comment= ”” scope=spfile

    sql statement: alter system set log_file_name_convert = ”DGOGG”, ”SBDB” comment= ”” scope=spfile

    sql statement: alter system set memory_target = 0 comment= ”” scope=spfile

    sql statement: alter system set sga_target = 400M comment= ”” scope=spfile

    Oracle instance shut down

    connected to auxiliary database (not started)
    Oracle instance started

    Total System Global Area 417546240 bytes

    Fixed Size 2227072 bytes
    Variable Size 134218880 bytes
    Database Buffers 272629760 bytes
    Redo Buffers 8470528 bytes

    contents of Memory Script:
    {
    backup as copy current controlfile for standby auxiliary format ‘/s01/orabase/oradata/SBDB/controlfile/control1.ctl’;
    restore clone controlfile to ‘/s01/orabase/oradata/SBDB/controlfile/control2.ctl’ from
    ‘/s01/orabase/oradata/SBDB/controlfile/control1.ctl’;
    }
    executing Memory Script

    Starting backup at 20-SEP-11
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting datafile copy
    copying standby control file
    output file name=/s01/orabase/product/11.2.0/dbhome_1/dbs/snapcf_DGOGG.f tag=TAG20110920T211146 RECID=4 STAMP=762383506
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
    Finished backup at 20-SEP-11

    Starting restore at 20-SEP-11
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=134 device type=DISK

    channel ORA_AUX_DISK_1: copied control file copy
    Finished restore at 20-SEP-11

    contents of Memory Script:
    {
    sql clone ‘alter database mount standby database’;
    }
    executing Memory Script

    sql statement: alter database mount standby database

    contents of Memory Script:
    {
    set newname for tempfile 1 to
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_temp_77jxvyts_.tmp”;
    switch clone tempfile all;
    set newname for datafile 1 to
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_system_77jxvgsr_.dbf”;
    set newname for datafile 2 to
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_sysaux_77jxvrly_.dbf”;
    set newname for datafile 3 to
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_undotbs1_77jxvtng_.dbf”;
    set newname for datafile 4 to
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_users_77jxw3xj_.dbf”;
    backup as copy reuse
    datafile 1 auxiliary format
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_system_77jxvgsr_.dbf” datafile
    2 auxiliary format
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_sysaux_77jxvrly_.dbf” datafile
    3 auxiliary format
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_undotbs1_77jxvtng_.dbf” datafile
    4 auxiliary format
    “/s01/orabase/oradata/SBDB/datafile/o1_mf_users_77jxw3xj_.dbf” ;
    sql ‘alter system archive log current’;
    }
    executing Memory Script

    executing command: SET NEWNAME

    renamed tempfile 1 to /s01/orabase/oradata/SBDB/datafile/o1_mf_temp_77jxvyts_.tmp in control file

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    Starting backup at 20-SEP-11
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00001 name=/s01/orabase/oradata/DGOGG/datafile/o1_mf_system_77jxvgsr_.dbf
    output file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_system_77jxvgsr_.dbf tag=TAG20110920T211208
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00002 name=/s01/orabase/oradata/DGOGG/datafile/o1_mf_sysaux_77jxvrly_.dbf
    output file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_sysaux_77jxvrly_.dbf tag=TAG20110920T211208
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00003 name=/s01/orabase/oradata/DGOGG/datafile/o1_mf_undotbs1_77jxvtng_.dbf
    output file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_undotbs1_77jxvtng_.dbf tag=TAG20110920T211208
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00004 name=/s01/orabase/oradata/DGOGG/datafile/o1_mf_users_77jxw3xj_.dbf
    output file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_users_77jxw3xj_.dbf tag=TAG20110920T211208
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
    Finished backup at 20-SEP-11

    sql statement: alter system archive log current

    contents of Memory Script:
    {
    backup as copy reuse
    archivelog like “/s01/orabase/arch/1_20_762376940.dbf” auxiliary format
    “/s01/orabase/stdby/1_20_762376940.dbf” ;
    catalog clone archivelog “/s01/orabase/stdby/1_20_762376940.dbf”;
    switch clone datafile all;
    }
    executing Memory Script

    Starting backup at 20-SEP-11
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting archived log copy
    input archived log thread=1 sequence=20 RECID=7 STAMP=762383620
    output file name=/s01/orabase/stdby/1_20_762376940.dbf RECID=0 STAMP=0
    channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
    Finished backup at 20-SEP-11

    cataloged archived log
    archived log file name=/s01/orabase/stdby/1_20_762376940.dbf RECID=1 STAMP=762383622

    datafile 1 switched to datafile copy
    input datafile copy RECID=4 STAMP=762383622 file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_system_77jxvgsr_.dbf
    datafile 2 switched to datafile copy
    input datafile copy RECID=5 STAMP=762383622 file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_sysaux_77jxvrly_.dbf
    datafile 3 switched to datafile copy
    input datafile copy RECID=6 STAMP=762383622 file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_undotbs1_77jxvtng_.dbf
    datafile 4 switched to datafile copy
    input datafile copy RECID=7 STAMP=762383622 file name=/s01/orabase/oradata/SBDB/datafile/o1_mf_users_77jxw3xj_.dbf

    contents of Memory Script:
    {
    set until scn 267903;
    recover
    standby
    clone database
    delete archivelog
    ;
    }
    executing Memory Script

    executing command: SET until clause

    Starting recover at 20-SEP-11
    using channel ORA_AUX_DISK_1

    starting media recovery

    archived log for thread 1 with sequence 20 is already on disk as file /s01/orabase/stdby/1_20_762376940.dbf
    archived log file name=/s01/orabase/stdby/1_20_762376940.dbf thread=1 sequence=20
    media recovery complete, elapsed time: 00:00:01
    Finished recover at 20-SEP-11

    Finished Duplicate Db at 20-SEP-11

    Recovery Manager complete.

  2. maclean Avatar
    maclean

    11.2 RAC => Single instance physical standby 配置 active data guard时需要注意

    创建orapwd 最好加ignorecase=Y

    db_file_name_convert和log_file_name_convert在 DUPLICATE脚本里不要加
    因为是RAC到单机 需要注意
    remote_listener=”
    cluster_database=’false’
    db_recovery_file_dest=’+FRA’ =》选择standby上有的DISKGROUP

    duplicate target database
    for standby
    from active database
    DORECOVER
    spfile
    set db_unique_name=’SBDB’
    set db_recovery_file_dest=’+FRA’
    set standby_file_management=’AUTO’
    set fal_server=’VRAC’
    set fal_client=’SBDB’
    set control_files=’+DATA’
    set memory_target=’0′
    set remote_listener=”
    set cluster_database=’false’
    set sga_target=’600M’;

    Recovery Manager: Release 11.2.0.3.0 – Production on Wed Nov 21 07:16:46 2012

    Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

    connected to target database: VRAC (DBID=1122683124)
    connected to auxiliary database: SBDB (not mounted)

    RMAN> duplicate target database
    2> for standby
    3> from active database
    4> DORECOVER
    5> spfile
    6> set db_unique_name=’SBDB’
    7> set db_recovery_file_dest=’+FRA’
    8> set standby_file_management=’AUTO’
    9> set fal_server=’VRAC’
    10> set fal_client=’SBDB’
    11> set control_files=’+DATA’
    12> set memory_target=’0′
    13> set remote_listener=”
    14> set cluster_database=’false’
    15> set sga_target=’600M’;

    Starting Duplicate Db at 21-NOV-12
    using target database control file instead of recovery catalog
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=13 device type=DISK

    contents of Memory Script:
    {
    backup as copy reuse
    targetfile ‘/s01/orabase/product/11.2.0/dbhome_1/dbs/orapwVRAC1’ auxiliary format
    ‘/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwSBDB’ targetfile
    ‘+DATA/vrac/spfilevrac.ora’ auxiliary format
    ‘/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileSBDB.ora’ ;
    sql clone “alter system set spfile= ”/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileSBDB.ora””;
    }
    executing Memory Script

    Starting backup at 21-NOV-12
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=141 instance=VRAC1 device type=DISK
    Finished backup at 21-NOV-12

    sql statement: alter system set spfile= ”/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileSBDB.ora”

    contents of Memory Script:
    {
    sql clone “alter system set db_unique_name =
    ”SBDB” comment=
    ”” scope=spfile”;
    sql clone “alter system set db_recovery_file_dest =
    ”+FRA” comment=
    ”” scope=spfile”;
    sql clone “alter system set standby_file_management =
    ”AUTO” comment=
    ”” scope=spfile”;
    sql clone “alter system set fal_server =
    ”VRAC” comment=
    ”” scope=spfile”;
    sql clone “alter system set fal_client =
    ”SBDB” comment=
    ”” scope=spfile”;
    sql clone “alter system set control_files =
    ”+DATA” comment=
    ”” scope=spfile”;
    sql clone “alter system set memory_target =
    0 comment=
    ”” scope=spfile”;
    sql clone “alter system set remote_listener =
    ”” comment=
    ”” scope=spfile”;
    sql clone “alter system set cluster_database =
    false comment=
    ”” scope=spfile”;
    sql clone “alter system set sga_target =
    600M comment=
    ”” scope=spfile”;
    shutdown clone immediate;
    startup clone nomount;
    }
    executing Memory Script

    sql statement: alter system set db_unique_name = ”SBDB” comment= ”” scope=spfile

    sql statement: alter system set db_recovery_file_dest = ”+FRA” comment= ”” scope=spfile

    sql statement: alter system set standby_file_management = ”AUTO” comment= ”” scope=spfile

    sql statement: alter system set fal_server = ”VRAC” comment= ”” scope=spfile

    sql statement: alter system set fal_client = ”SBDB” comment= ”” scope=spfile

    sql statement: alter system set control_files = ”+DATA” comment= ”” scope=spfile

    sql statement: alter system set memory_target = 0 comment= ”” scope=spfile

    sql statement: alter system set remote_listener = ”” comment= ”” scope=spfile

    sql statement: alter system set cluster_database = false comment= ”” scope=spfile

    sql statement: alter system set sga_target = 600M comment= ”” scope=spfile

    Oracle instance shut down

    connected to auxiliary database (not started)
    Oracle instance started

    Total System Global Area 626327552 bytes

    Fixed Size 2230952 bytes
    Variable Size 184550744 bytes
    Database Buffers 432013312 bytes
    Redo Buffers 7532544 bytes

    contents of Memory Script:
    {
    sql clone “alter system set control_files =
    ”+DATA/sbdb/controlfile/current.278.705097041” comment=
    ”Set by RMAN” scope=spfile”;
    backup as copy current controlfile for standby auxiliary format ‘+DATA/sbdb/controlfile/current.277.705097041’;
    sql clone “alter system set control_files =
    ”+DATA/sbdb/controlfile/current.277.705097041” comment=
    ”Set by RMAN” scope=spfile”;
    shutdown clone immediate;
    startup clone nomount;
    }
    executing Memory Script

    sql statement: alter system set control_files = ”+DATA/sbdb/controlfile/current.278.705097041” comment= ”Set by RMAN” scope=spfile

    Starting backup at 21-NOV-12
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting datafile copy
    copying standby control file
    output file name=/s01/orabase/product/11.2.0/dbhome_1/dbs/snapcf_VRAC1.f tag=TAG20121121T071708 RECID=3 STAMP=799917428
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
    Finished backup at 21-NOV-12

    sql statement: alter system set control_files = ”+DATA/sbdb/controlfile/current.277.705097041” comment= ”Set by RMAN” scope=spfile

    Oracle instance shut down

    connected to auxiliary database (not started)
    Oracle instance started

    Total System Global Area 626327552 bytes

    Fixed Size 2230952 bytes
    Variable Size 184550744 bytes
    Database Buffers 432013312 bytes
    Redo Buffers 7532544 bytes

    contents of Memory Script:
    {
    sql clone ‘alter database mount standby database’;
    }
    executing Memory Script

    sql statement: alter database mount standby database
    Using previous duplicated file +DATA/sbdb/datafile/system.285.705096825 for datafile 1 with checkpoint SCN of 388489
    Using previous duplicated file +DATA/sbdb/datafile/sysaux.289.705096851 for datafile 2 with checkpoint SCN of 388517
    Using previous duplicated file +DATA/sbdb/datafile/undotbs1.283.705096875 for datafile 3 with checkpoint SCN of 388568
    Using previous duplicated file +DATA/sbdb/datafile/undotbs2.282.705096891 for datafile 4 with checkpoint SCN of 388591
    Using previous duplicated file +DATA/sbdb/datafile/users.261.794687965 for datafile 5 with checkpoint SCN of 388613

    contents of Memory Script:
    {
    set newname for clone tempfile 1 to new;
    switch clone tempfile all;
    set newname for datafile 1 to
    “+DATA/sbdb/datafile/system.285.705096825”;
    set newname for datafile 2 to
    “+DATA/sbdb/datafile/sysaux.289.705096851”;
    set newname for datafile 3 to
    “+DATA/sbdb/datafile/undotbs1.283.705096875”;
    set newname for datafile 4 to
    “+DATA/sbdb/datafile/undotbs2.282.705096891”;
    set newname for datafile 5 to
    “+DATA/sbdb/datafile/users.261.794687965”;
    sql ‘alter system archive log current’;
    }
    executing Memory Script

    executing command: SET NEWNAME

    renamed tempfile 1 to +DATA in control file

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    sql statement: alter system archive log current

    contents of Memory Script:
    {
    backup as copy reuse
    archivelog like “+BACKUPDG/vrac/archivelog/2012_11_21/thread_1_seq_24.327.799917293” auxiliary format
    “+FRA” archivelog like
    “+BACKUPDG/vrac/archivelog/2012_11_21/thread_2_seq_8.331.799917351” auxiliary format
    “+FRA” archivelog like
    “+BACKUPDG/vrac/archivelog/2012_11_21/thread_1_seq_25.330.799917449” auxiliary format
    “+FRA” archivelog like
    “+BACKUPDG/vrac/archivelog/2012_11_21/thread_2_seq_9.339.799917505” auxiliary format
    “+FRA” ;
    catalog clone start with “+FRA”;
    catalog clone datafilecopy “+DATA/sbdb/datafile/system.285.705096825”,
    “+DATA/sbdb/datafile/sysaux.289.705096851”,
    “+DATA/sbdb/datafile/undotbs1.283.705096875”,
    “+DATA/sbdb/datafile/undotbs2.282.705096891”,
    “+DATA/sbdb/datafile/users.261.794687965”;
    switch clone datafile 1 to datafilecopy
    “+DATA/sbdb/datafile/system.285.705096825”;
    switch clone datafile 2 to datafilecopy
    “+DATA/sbdb/datafile/sysaux.289.705096851”;
    switch clone datafile 3 to datafilecopy
    “+DATA/sbdb/datafile/undotbs1.283.705096875”;
    switch clone datafile 4 to datafilecopy
    “+DATA/sbdb/datafile/undotbs2.282.705096891”;
    switch clone datafile 5 to datafilecopy
    “+DATA/sbdb/datafile/users.261.794687965”;
    }
    executing Memory Script

    Starting backup at 21-NOV-12
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting archived log copy
    input archived log thread=1 sequence=24 RECID=25 STAMP=799917293
    output file name=+FRA/sbdb/archivelog/2012_11_21/thread_1_seq_24.287.705097065 RECID=0 STAMP=0
    channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting archived log copy
    input archived log thread=2 sequence=8 RECID=26 STAMP=799917352
    output file name=+FRA/sbdb/archivelog/2012_11_21/thread_2_seq_8.288.705097067 RECID=0 STAMP=0
    channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting archived log copy
    input archived log thread=1 sequence=25 RECID=27 STAMP=799917448
    output file name=+FRA/sbdb/archivelog/2012_11_21/thread_1_seq_25.289.705097067 RECID=0 STAMP=0
    channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting archived log copy
    input archived log thread=2 sequence=9 RECID=28 STAMP=799917505
    output file name=+FRA/sbdb/archivelog/2012_11_21/thread_2_seq_9.290.705097069 RECID=0 STAMP=0
    channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
    Finished backup at 21-NOV-12

    searching for all files that match the pattern +FRA

    List of Files Unknown to the Database
    =====================================
    File Name: +fra/SBDB/ONLINELOG/group_7.275.705024307
    File Name: +fra/SBDB/ONLINELOG/group_12.276.705024307
    File Name: +fra/SBDB/ONLINELOG/group_8.277.705024313
    File Name: +fra/SBDB/ONLINELOG/group_9.278.705024315
    File Name: +fra/SBDB/ONLINELOG/group_11.279.705024321
    File Name: +fra/SBDB/ONLINELOG/group_10.280.705024321
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_1_seq_24.287.705097065
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_2_seq_8.288.705097067
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_1_seq_25.289.705097067
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_2_seq_9.290.705097069
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_16.274.705024303
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_18.281.705024325
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_17.282.705024327
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_19.283.705024845
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_20.284.705024969
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_21.285.705063713
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_22.286.705095771
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_20/thread_1_seq_14.271.705024087
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_20/thread_1_seq_15.272.705024089
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_20/thread_2_seq_2.273.705024089
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_24/thread_1_seq_14.268.703805885
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_24/thread_1_seq_15.269.703807669
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_10.257.794687963
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_11.265.703540201
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_12.266.703541897
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_13.267.703541899
    File Name: +fra/PRODB/FLASHBACK/log_1.259.794687969
    File Name: +fra/PRODB/FLASHBACK/log_2.258.794687965
    File Name: +fra/PRODB/FLASHBACK/log_3.270.704167251
    File Name: +fra/PRODB/ONLINELOG/group_4.260.700172807
    File Name: +fra/PRODB/ONLINELOG/group_5.261.700172883
    File Name: +fra/PRODB/ONLINELOG/group_6.262.700173025
    File Name: +fra/PRODB/ONLINELOG/group_7.263.700173121
    File Name: +fra/PRODB/ONLINELOG/group_8.264.700173211
    File Name: +fra/PRODB/CONTROLFILE/Current.256.794687955
    cataloging files…
    cataloging done

    List of Cataloged Files
    =======================
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_1_seq_24.287.705097065
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_2_seq_8.288.705097067
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_1_seq_25.289.705097067
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_21/thread_2_seq_9.290.705097069
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_16.274.705024303
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_18.281.705024325
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_17.282.705024327
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_19.283.705024845
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_20.284.705024969
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_21.285.705063713
    File Name: +fra/SBDB/ARCHIVELOG/2009_12_08/thread_1_seq_22.286.705095771
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_20/thread_1_seq_14.271.705024087
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_20/thread_1_seq_15.272.705024089
    File Name: +fra/SBDB/ARCHIVELOG/2012_11_20/thread_2_seq_2.273.705024089

    List of Files Which Where Not Cataloged
    =======================================
    File Name: +fra/SBDB/ONLINELOG/group_7.275.705024307
    RMAN-07529: Reason: catalog is not supported for this file type
    File Name: +fra/SBDB/ONLINELOG/group_12.276.705024307
    RMAN-07529: Reason: catalog is not supported for this file type
    File Name: +fra/SBDB/ONLINELOG/group_8.277.705024313
    RMAN-07529: Reason: catalog is not supported for this file type
    File Name: +fra/SBDB/ONLINELOG/group_9.278.705024315
    RMAN-07529: Reason: catalog is not supported for this file type
    File Name: +fra/SBDB/ONLINELOG/group_11.279.705024321
    RMAN-07529: Reason: catalog is not supported for this file type
    File Name: +fra/SBDB/ONLINELOG/group_10.280.705024321
    RMAN-07529: Reason: catalog is not supported for this file type
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_24/thread_1_seq_14.268.703805885
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_24/thread_1_seq_15.269.703807669
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_10.257.794687963
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_11.265.703540201
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_12.266.703541897
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ARCHIVELOG/2009_11_21/thread_1_seq_13.267.703541899
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/FLASHBACK/log_1.259.794687969
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/FLASHBACK/log_2.258.794687965
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/FLASHBACK/log_3.270.704167251
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ONLINELOG/group_4.260.700172807
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ONLINELOG/group_5.261.700172883
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ONLINELOG/group_6.262.700173025
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ONLINELOG/group_7.263.700173121
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/ONLINELOG/group_8.264.700173211
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB
    File Name: +fra/PRODB/CONTROLFILE/Current.256.794687955
    RMAN-07518: Reason: Foreign database file DBID: 2198009426 Database Name: PRODB

    cataloged datafile copy
    datafile copy file name=+DATA/sbdb/datafile/system.285.705096825 RECID=3 STAMP=705097071
    cataloged datafile copy
    datafile copy file name=+DATA/sbdb/datafile/sysaux.289.705096851 RECID=4 STAMP=705097071
    cataloged datafile copy
    datafile copy file name=+DATA/sbdb/datafile/undotbs1.283.705096875 RECID=5 STAMP=705097071
    cataloged datafile copy
    datafile copy file name=+DATA/sbdb/datafile/undotbs2.282.705096891 RECID=6 STAMP=705097071
    cataloged datafile copy
    datafile copy file name=+DATA/sbdb/datafile/users.261.794687965 RECID=7 STAMP=705097071

    datafile 1 switched to datafile copy
    input datafile copy RECID=3 STAMP=705097071 file name=+DATA/sbdb/datafile/system.285.705096825

    datafile 2 switched to datafile copy
    input datafile copy RECID=4 STAMP=705097071 file name=+DATA/sbdb/datafile/sysaux.289.705096851

    datafile 3 switched to datafile copy
    input datafile copy RECID=5 STAMP=705097071 file name=+DATA/sbdb/datafile/undotbs1.283.705096875

    datafile 4 switched to datafile copy
    input datafile copy RECID=6 STAMP=705097071 file name=+DATA/sbdb/datafile/undotbs2.282.705096891

    datafile 5 switched to datafile copy
    input datafile copy RECID=7 STAMP=705097071 file name=+DATA/sbdb/datafile/users.261.794687965

    contents of Memory Script:
    {
    set until scn 389059;
    recover
    standby
    clone database
    delete archivelog
    ;
    }
    executing Memory Script

    executing command: SET until clause

    Starting recover at 21-NOV-12
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=134 device type=DISK

    starting media recovery

    archived log for thread 1 with sequence 24 is already on disk as file +FRA/sbdb/archivelog/2012_11_21/thread_1_seq_24.287.705097065
    archived log for thread 1 with sequence 25 is already on disk as file +FRA/sbdb/archivelog/2012_11_21/thread_1_seq_25.289.705097067
    archived log for thread 2 with sequence 8 is already on disk as file +FRA/sbdb/archivelog/2012_11_21/thread_2_seq_8.288.705097067
    archived log for thread 2 with sequence 9 is already on disk as file +FRA/sbdb/archivelog/2012_11_21/thread_2_seq_9.290.705097069
    archived log file name=+FRA/sbdb/archivelog/2012_11_21/thread_1_seq_24.287.705097065 thread=1 sequence=24
    archived log file name=+FRA/sbdb/archivelog/2012_11_21/thread_2_seq_8.288.705097067 thread=2 sequence=8
    archived log file name=+FRA/sbdb/archivelog/2012_11_21/thread_1_seq_25.289.705097067 thread=1 sequence=25
    archived log file name=+FRA/sbdb/archivelog/2012_11_21/thread_2_seq_9.290.705097069 thread=2 sequence=9
    media recovery complete, elapsed time: 00:00:01
    Finished recover at 21-NOV-12

    SQL> select name from v$datafile;

    NAME
    ——————————————————————————————————————————————–
    +DATA/sbdb/datafile/system.285.705096825
    +DATA/sbdb/datafile/sysaux.289.705096851
    +DATA/sbdb/datafile/undotbs1.283.705096875
    +DATA/sbdb/datafile/undotbs2.282.705096891
    +DATA/sbdb/datafile/users.261.794687965

    SQL> alter system set db_file_name_convert=’+DATA/var’,’+DATA/sbdb’ scope=spfile;

    System altered.

    alter system set log_archive_dest_2=’service=SBDB lgwr async DB_UNIQUE_NAME=SBDB valid_for=(online_logfile,primary_role)’;

    SQL>
    SQL> alter system set dg_broker_start=true;

    System altered.

    alter system set dg_broker_config_file1 = ‘+DATA/broker1.dat’;
    alter system set dg_broker_config_file2 = ‘+DATA/broker2.dat’;

    SQL> alter system set dg_broker_start =true;

    System altered.

    [oracle@vrh1 admin]$ dgmgrl sys/oracle@VRAC

    DGMGRL> create configuration VRACSB as primary database is VRAC connect identifier is VRAC;
    Configuration “vracsb” created with primary database “vrac”

    DGMGRL> add database SBDB as connect identifier is SBDB maintained as physical;
    Database “sbdb” added

    DGMGRL> enable configuration;
    Enabled.

    DGMGRL> show database vrac

    Database – vrac

    Role: PRIMARY
    Intended State: TRANSPORT-ON
    Instance(s):
    VRAC1
    VRAC2
    Error: ORA-16737: the redo transport service for standby database “sbdb” has an error

    Database Status:
    ERROR

  3. Liao Ryan Avatar

    Hi Maclean看到了你這篇關於RMAN DUPLICATE文章,寫得很仔細詳盡~有個問題想請教您一下,由於內部權責分工的關係,上面要我手工創建一個新的用戶進行Data Guard的維護/創建工作並賦予下面權限:ALTER SYSTEMALTER DATABASESYSDBACONNECT相關的設置——————-$ rman TARGET dgadmin/password@PRO11 AUXILIARY dgadmin/password@PRO11_STBYRecovery Manager: Release 11.2.0.1.0 – Production on Thu Jun 13 15:32:24 2013Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.connected to target database: PRO11 (DBID=3915679015)connected to auxiliary database: PRO11 (not mounted)在運行下面指令會發生如下報錯:RMAN> DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE NOFILENAMECHECK;allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=582 device type=DISKRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of Duplicate Db command at 06/13/2013 15:32:44RMAN-03015: error occurred in stored script Memory ScriptRMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/13/2013 15:32:44ORA-17629: Cannot connect to the remote database serverORA-17629: Cannot connect to the remote database server1. password file已從主庫複製至備庫2. tnsping 主備庫都有回應3. 確認過了應該不是MOS提及ORA-17629: ‘Cannot connect to the remote database server’ with RMAN [ID 1056174.1]的問題4. 先前我是使用SYS建置成功了換成這個自行創建的用戶,看官方文檔說明需要一個SYSDBA身分的用戶,這邊是不是少給了什麼權限? 或是一定要使用SYS才能作業呢?感謝~

  4. pengpengfly Avatar
    pengpengfly

    请问以前建好的从库,坏了,需要重建,能用上面的步骤不,能不能也发下步骤

    1. Ask_Maclean_liu_Oracle Avatar

      如何版本和环境都适配的话,当然可以。

  5. […] Beginner Startup Upgrade为我们做了什么? 11g新特性:Rolling Upgrade With Physical Standby Duplicate standby database from active database Examine 11g automatic block Corruption recovery How to recover from root.sh on 11.2 Grid […]

Leave a Reply

Your email address will not be published. Required fields are marked *