Build Standby Database Using RMAN Duplicate

Primary, Physical (redo apply) and Logical (SQL apply) Standby Databases or Active Data Guard
Post Reply
User avatar
Kristoff
Posts: 30
Joined: Thu Jan 19, 2012 2:17 pm
Location: Manila, Philippines

Build Standby Database Using RMAN Duplicate

Post by Kristoff »

This topic covers the steps in creating a Build Standby Database Using RMAN Duplicate.

Primary Database Name: RENZ
Hostname: dgprim.localdomain
db_unique_name: RENZ

Standby Database Name: RENZ
Hostname: dgstan.localdomain
db_unique_name: DRAKE

Oracle 10.2.0.5.0
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)

1. On Primary, Enable Forced Logging:
[RENZ /home/oracle]$ . oraenv
ORACLE_SID = [RENZ] ? RENZ
SQL> ALTER DATABASE FORCE LOGGING;
Note: This statement can take a considerable amount of time to complete, because it waits for all unlogged direct write I/O to finish.
SQL> ALTER DATABASE FORCE LOGGING;

Database altered.
2. Create a password file if one does not already exist. Every database in a Data Guard configuration must use a password file, and the password for the SYS user must be identical on every system for redo data transmission to succeed.
[RENZ /home/oracle]$ orapwd file=$ORACLE_HOME/dbs/orapw${ORACLE_SID} password=[password]entries=5
[RENZ /home/oracle]$ orapwd file=$ORACLE_HOME/dbs/orapw${ORACLE_SID} password=oracle entries=5
3. Create standby redo log file groups. This will be used when PROTECTION_MODE is Maximum protection or Maximum availability and/or for Logical Standby Database.
Standby redo log must be identical is size with online redo log.
SQL> set lines 350
set pages 999
SELECT
lf.GROUP#,
lf.TYPE,
l.MEMBERS,
lf.MEMBER,
l.status,
l.bytes
FROM
v$logfile lf,
v$log l
WHERE
lf.GROUP#=l.GROUP#;

Code: Select all

SQL> set lines 350
set pages 999
SELECT
  lf.GROUP#,
  lf.TYPE,
  l.MEMBERS,
  lf.MEMBER,
  l.status,
  l.bytes
FROM
  v$logfile lf,
  v$log l
WHERE
  lf.GROUP#=l.GROUP#;
SQL> SQL>   2    3    4    5    6    7    8    9   10   11   12
    GROUP# TYPE       MEMBERS MEMBER                                                                           STATUS                BYTES
---------- ------- ---------- -------------------------------------------------------------------------------- ---------------- ----------
         3 ONLINE           2 +VOL1/renz/onlinelog/group_3.293.794263959                                       INACTIVE           52428800
         3 ONLINE           2 +VOL1/renz/onlinelog/group_3.294.794263969                                       INACTIVE           52428800
         2 ONLINE           2 +VOL1/renz/onlinelog/group_2.280.794263937                                       INACTIVE           52428800
         2 ONLINE           2 +VOL1/renz/onlinelog/group_2.285.794263949                                       INACTIVE           52428800
         1 ONLINE           2 +VOL1/renz/onlinelog/group_1.296.794263925                                       CURRENT            52428800
         1 ONLINE           2 +VOL1/renz/onlinelog/group_1.326.794263931                                       CURRENT            52428800

6 rows selected.
Create the standby log file using the formula: Number of online log groups + 1 e.g. 3+1=4
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('+VOL1', '+FRA') size 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('+VOL1', '+FRA') size 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('+VOL1', '+FRA') size 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('+VOL1', '+FRA') size 52428800;

4. Verify the standby redo log file groups were created.
To verify the standby redo log file groups are created and running correctly, invoke a log switch on the primary database, and then query either the V$STANDBY_LOG view or the V$LOGFILE view on the standby database once it has been created. For example:
SQL> alter system switch logfile;
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;

GROUP# THREAD# SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------
4 0 0 YES UNASSIGNED
5 0 0 YES UNASSIGNED
6 0 0 YES UNASSIGNED
7 0 0 YES UNASSIGNED
5. Temporarily disable log and hot backups until this standby creation is complete

6. Backup the Primary Database using RMAN. Backup the controlfile for standby.
Copy the standby controlfile and backup pieces to standby host.
[RENZ /home/oracle]$ rman target /
[RENZ /home/oracle]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Sep 18 06:59:41 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: RENZ (DBID=1760461551)
RMAN> RUN {
BACKUP FULL
format '/u03/backup/%d_%t_%s_%p'
(database) plus ARCHIVELOG;
backup current controlfile for standby format '/u03/backup/standbycontrol.ctl';
}

RMAN> RUN {
BACKUP FULL
format '/u03/backup/%d_%t_%s_%p'
(database) plus ARCHIVELOG;
backup current controlfile for standby format '/u03/backup/standbycontrol.ctl';
}
2> 3> 4> 5> 6>

Starting backup at 18-SEP-12
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=1 stamp=794297990
input archive log thread=1 sequence=2 recid=2 stamp=794298044
input archive log thread=1 sequence=3 recid=3 stamp=794298239
input archive log thread=1 sequence=4 recid=4 stamp=794299950
input archive log thread=1 sequence=5 recid=5 stamp=794299960
input archive log thread=1 sequence=6 recid=6 stamp=794299973
input archive log thread=1 sequence=7 recid=7 stamp=794299974
input archive log thread=1 sequence=8 recid=8 stamp=794299975
input archive log thread=1 sequence=9 recid=9 stamp=794299975
input archive log thread=1 sequence=10 recid=10 stamp=794300408
input archive log thread=1 sequence=11 recid=11 stamp=794300490
input archive log thread=1 sequence=12 recid=12 stamp=794300595
channel ORA_DISK_1: starting piece 1 at 18-SEP-12
channel ORA_DISK_1: finished piece 1 at 18-SEP-12
piece handle=/u03/backup/RENZ_794300596_6_1 tag=TAG20120918T070316 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 18-SEP-12

Starting backup at 18-SEP-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=+VOL1/renz/datafile/system.331.794263769
input datafile fno=00003 name=+VOL1/renz/datafile/sysaux.335.794263769
input datafile fno=00002 name=+VOL1/renz/datafile/undotbs1.317.794263771
input datafile fno=00004 name=+VOL1/renz/datafile/users.263.794263771
channel ORA_DISK_1: starting piece 1 at 18-SEP-12
channel ORA_DISK_1: finished piece 1 at 18-SEP-12
piece handle=/u03/backup/RENZ_794300604_7_1 tag=TAG20120918T070324 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 18-SEP-12
channel ORA_DISK_1: finished piece 1 at 18-SEP-12
piece handle=/u03/backup/RENZ_794300680_8_1 tag=TAG20120918T070324 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 18-SEP-12

Starting backup at 18-SEP-12
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=13 recid=13 stamp=794300685
channel ORA_DISK_1: starting piece 1 at 18-SEP-12
channel ORA_DISK_1: finished piece 1 at 18-SEP-12
piece handle=/u03/backup/RENZ_794300685_9_1 tag=TAG20120918T070445 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-SEP-12

Starting backup at 18-SEP-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including standby control file in backupset
channel ORA_DISK_1: starting piece 1 at 18-SEP-12
channel ORA_DISK_1: finished piece 1 at 18-SEP-12
piece handle=/u03/backup/standbycontrol.ctl tag=TAG20120918T070447 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-SEP-12

RMAN>
7. Copy the backup sets to standby host. If the duplicate host is different from the primary host, then you must make backups and copies on the primary host disks available to the remote node with the same full path name as in the Primary Database.
[RENZ /home/oracle]$ scp -rv /u03/backup/* oracle@dgstan.localdomain:/u03/backup/

8. From Primary, create pfile for standby and copy to standby host.
SQL> create pfile='initDRAKE.ora' from spfile;
SQL> create pfile='initDRAKE.ora' from spfile;

File created.
[RENZ /home/oracle]$ scp -rv initDRAKE.ora oracle@dgstan.localdomain:/u01/app/oracle/product/10.2.0/db_1/dbs


9. Copy the password file for the Primary Database to the destination server as well.
[RENZ /home/oracle]$ scp -rv orapwRENZ oracle@dgstan.localdomain:/u01/app/oracle/product/10.2.0/db_1/dbs/orapwDRAKE

10. Modify Primary initialization parameters.
Primary Database: Primary Role Initialization Parameters

*.db_name='RENZ'
*.db_unique_name='RENZ'
*.log_archive_config='dg_config=(RENZ,DRAKE)'
*.standby_archive_dest='+VOL1'
*.standby_file_management='AUTO'
*.db_file_name_convert='/RENZ/','/DRAKE/' ## Set this only when you're not using ASM
*.log_file_name_convert='/RENZ/','/DRAKE/' ## Set this only when you're not using ASM
*.standby_file_management='AUTO'
*.standby_archive_dest='+FRA'
11. Restart the Primary using the new initialization parameters.
SQL> shutdown immediate;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile;
SQL> startup;
SQL> create spfile from pfile;

File created.

SQL> startup;
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1272600 bytes
Variable Size 75498728 bytes
Database Buffers 88080384 bytes
Redo Buffers 2920448 bytes
Database mounted.
Database opened.
12. Edit Standby initialization parameters.
Remove the control_files parameter
add the db_create_file_dest parameter to the directory you want it to use, in the case of dgstan.localdomain, +VOL1
add db_recovery_file_dest if Flashback is used, configure the same as db_create_file_dest or +VOL1, be sure to include the db_recovery_file_dest_size
add db_create_online_log_dest_n parameters same setup as db_create_file_dest
add fal_client and fal_server
edit db_unique_name to be different than the Primary Databases.
add the log_archive_config parameter

Sample Physical Standby Initialization Parameters:
*.audit_file_dest='/u01/app/oracle/admin/DRAKE/adump'
*.background_dump_dest='/u01/app/oracle/admin/DRAKE/bdump'
*.compatible='10.2.0.5.0'
*.core_dump_dest='/u01/app/oracle/admin/DRAKE/cdump'
*.db_block_size=8192
*.db_create_file_dest='+VOL1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='RENZ'
*.db_recovery_file_dest='+VOL1'
*.db_recovery_file_dest_size=2147483648
*.db_unique_name='DRAKE'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DRAKEXDB)'
*.fal_client='DRAKE'
*.fal_server='RENZ'
*.job_queue_processes=10
*.log_archive_config='dg_config=(RENZ,DRAKE)'
*.log_archive_dest_1='LOCATION=+FRA'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.standby_archive_dest='+FRA'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/DRAKE/udump'

13. Startup Standby in NOMOUNT mode.
SQL> startup nomount;
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1272600 bytes
Variable Size 62915816 bytes
Database Buffers 100663296 bytes
Redo Buffers 2920448 bytes
14. Add entry for Primary and Standby databases to tnsnames.ora on both nodes.
On Primary and On Standby and the following lines:
[RENZ /home/oracle]$ vi $ORACLE_HOME/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DRAKE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgstan.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SID = DRAKE)
)
)

RENZ =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgprim.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RENZ)
)
)

15. Test connectivity between the databases.
From Primary:
[RENZ /home/oracle]$ tnsping RENZ
[RENZ /home/oracle]$ tnsping RENZ

TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:17:04

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dgprim.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RENZ)))
OK (0 msec)
[RENZ /home/oracle]$ tnsping DRAKE
[RENZ /home/oracle]$ tnsping DRAKE

TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:17:36

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dgstan.localdomain)(PORT = 1521))) (CONNECT_DATA = (SID = DRAKE)))
OK (10 msec)
From Standby:
[DRAKE /home/oracle]$ tnsping RENZ
[DRAKE /home/oracle]$ tnsping RENZ

TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:18:00

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dgprim.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RENZ)))
OK (0 msec)
[DRAKE /home/oracle]$ tnsping DRAKE
[DRAKE /home/oracle]$ tnsping DRAKE

TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:18:18

Copyright (c) 1997, 2010, Oracle. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dgstan.localdomain)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = DRAKE)))
OK (0 msec)
16. Verify that correct entry is added to listener.ora of both databases.
From Primary
[RENZ /home/oracle]$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER10G =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = RENZ_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = RENZ)
)
)

LISTENER10G =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgprim.localdomain)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
From Standby:
[DRAKE /home/oracle]$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER10G =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgstan.localdomain)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)

SID_LIST_LISTENER10G =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = DRAKE_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = DRAKE)
)
)
17. Reload listener.
From Primary:
[RENZ /home/oracle]$ lsnrctl stop LISTENER10G
[RENZ /home/oracle]$ lsnrctl start LISTENER10G
[RENZ /home/oracle]$ lsnrctl stop LISTENER10G

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:25:41

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgprim.localdomain)(PORT=1521)))
The command completed successfully
[RENZ /home/oracle]$ lsnrctl start LISTENER10G

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:25:47

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.5.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener10g.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgprim.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgprim.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER10G
Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date 18-SEP-2012 08:25:47
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener10g.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgprim.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "RENZ_DGMGRL" has 1 instance(s).
Instance "RENZ", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
From Standby:
[DRAKE /home/oracle]$ lsnrctl stop LISTENER10G
[DRAKE /home/oracle]$ lsnrctl start LISTENER10G
[DRAKE /home/oracle]$ lsnrctl stop LISTENER10G

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:27:31

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgstan.localdomain)(PORT=1521)))
The command completed successfully
[DRAKE /home/oracle]$ lsnrctl start LISTENER10G

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 18-SEP-2012 08:27:36

Copyright (c) 1991, 2010, Oracle. All rights reserved.

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.5.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener10g.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgstan.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgstan.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER10G
Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date 18-SEP-2012 08:27:36
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener10g.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgstan.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "DRAKE_DGMGRL" has 1 instance(s).
Instance "DRAKE", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
18. Test that you can connect remotely as "sys" to both databases, from both servers.
[DRAKE /home/oracle]$ sqlplus "sys@RENZ as sysdba"
[DRAKE /home/oracle]$ sqlplus "sys@RENZ as sysdba"

SQL*Plus: Release 10.2.0.5.0 - Production on Tue Sep 18 08:28:43 2012

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[RENZ /home/oracle]$ sqlplus "sys@DRAKE as sysdba"
[RENZ /home/oracle]$ sqlplus "sys@DRAKE as sysdba"

SQL*Plus: Release 10.2.0.5.0 - Production on Tue Sep 18 08:29:14 2012

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
19. Begin RMAN Duplication
On Primary server:
[RENZ /home/oracle]$ rman target /
[RENZ /home/oracle]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Sep 18 08:30:44 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: RENZ (DBID=1760461551)
RMAN> connect auxiliary sys@DRAKE <-- Use SERVICE Name(one used in TNS)

RMAN> connect auxiliary sys@DRAKE

auxiliary database Password:
connected to auxiliary database: RENZ (not mounted) << This should be the status. Else, restart your standby in NOMOUNT mode.

RMAN>

RMAN> DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;

Starting Duplicate Db at 18-SEP-12
using channel ORA_AUX_DISK_1

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

Starting restore at 18-SEP-12

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u03/backup/standbycontrol.ctl
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u03/backup/standbycontrol.ctl tag=TAG20120918T070447
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
output filename=+VOL1/drake/controlfile/current.336.794306141
output filename=+VOL1/drake/controlfile/current.335.794306143
Finished restore at 18-SEP-12

sql statement: alter database mount standby database

contents of Memory Script:
{
set newname for clone tempfile 1 to new;
switch clone tempfile all;
set newname for clone datafile 1 to new;
set newname for clone datafile 2 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 4 to new;
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to +VOL1 in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 18-SEP-12
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +VOL1
restoring datafile 00002 to +VOL1
restoring datafile 00003 to +VOL1
restoring datafile 00004 to +VOL1
channel ORA_AUX_DISK_1: reading from backup piece /u03/backup/RENZ_794300604_7_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u03/backup/RENZ_794300604_7_1 tag=TAG20120918T070324
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:45
Finished restore at 18-SEP-12

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy recid=5 stamp=794306267 filename=+VOL1/drake/datafile/system.317.794306161
datafile 2 switched to datafile copy
input datafile copy recid=6 stamp=794306271 filename=+VOL1/drake/datafile/undotbs1.282.794306163
datafile 3 switched to datafile copy
input datafile copy recid=7 stamp=794306271 filename=+VOL1/drake/datafile/sysaux.263.794306163
datafile 4 switched to datafile copy
input datafile copy recid=8 stamp=794306271 filename=+VOL1/drake/datafile/users.279.794306163
Finished Duplicate Db at 18-SEP-12
20. From Standby, verify that online and standby log files are with VALID status.
set pages 999
set lines 350
col member for a80
select GROUP#,TYPE,MEMBER,status from v$logfile order by group#;

Code: Select all

SQL> set pages 999
set lines 350
col member for a80
select GROUP#,TYPE,MEMBER,status from  v$logfile order by group#;
SQL> SQL> SQL>
    GROUP# TYPE    MEMBER                                                                           STATUS
---------- ------- -------------------------------------------------------------------------------- -------
         1 ONLINE  +VOL1                                                                            INVALID
         1 ONLINE  +VOL1                                                                            INVALID
         2 ONLINE  +VOL1                                                                            INVALID
         2 ONLINE  +VOL1                                                                            INVALID
         3 ONLINE  +VOL1                                                                            INVALID
         3 ONLINE  +VOL1                                                                            INVALID
         4 STANDBY +VOL1                                                                            INVALID
         4 STANDBY +VOL1                                                                            INVALID
         5 STANDBY +VOL1                                                                            INVALID
         5 STANDBY +VOL1                                                                            INVALID
         6 STANDBY +VOL1                                                                            INVALID
         6 STANDBY +VOL1                                                                            INVALID
         7 STANDBY +VOL1                                                                            INVALID
         7 STANDBY +VOL1                                                                            INVALID
In this case, they are invalid. If ORLs and SRLs are invalid, perform below:
ALTER DATABASE CLEAR LOGFILE GROUP 1;
ALTER DATABASE CLEAR LOGFILE GROUP 2;
ALTER DATABASE CLEAR LOGFILE GROUP 3;
ALTER DATABASE CLEAR LOGFILE GROUP 4;
ALTER DATABASE CLEAR LOGFILE GROUP 5;
ALTER DATABASE CLEAR LOGFILE GROUP 6;
ALTER DATABASE CLEAR LOGFILE GROUP 7;

Verify again the status. This time it should be fine now.

Code: Select all

SQL> SQL> SQL> SQL>
SQL> set pages 999
set lines 350
col member for a80
select GROUP#,TYPE,MEMBER,status from  v$logfile order by group#;
select GROUP#,BYTES, MEMBERS, status from  v$log;
SQL> SQL> SQL>
    GROUP# TYPE    MEMBER                                                                           STATUS
---------- ------- -------------------------------------------------------------------------------- -------
         1 ONLINE  +VOL1/drake/onlinelog/group_1.295.794306631
         1 ONLINE  +FRA/drake/onlinelog/group_1.256.794306635
         2 ONLINE  +VOL1/drake/onlinelog/group_2.315.794306647
         2 ONLINE  +FRA/drake/onlinelog/group_2.257.794306653
         3 ONLINE  +VOL1/drake/onlinelog/group_3.327.794306655
         3 ONLINE  +FRA/drake/onlinelog/group_3.258.794306661
         4 STANDBY +VOL1/drake/onlinelog/group_4.264.794306663
         4 STANDBY +FRA/drake/onlinelog/group_4.259.794306671
         5 STANDBY +VOL1/drake/onlinelog/group_5.287.794306673
         5 STANDBY +FRA/drake/onlinelog/group_5.260.794306679
         6 STANDBY +VOL1/drake/onlinelog/group_6.289.794306681
         6 STANDBY +FRA/drake/onlinelog/group_6.261.794306689
         7 STANDBY +VOL1/drake/onlinelog/group_7.290.794306691
         7 STANDBY +FRA/drake/onlinelog/group_7.262.794306697
21. Put the standby database in managed recovery mode
SQL> alter database recover managed standby database disconnect from session;
SQL> alter database recover managed standby database disconnect from session;

Database altered.
22. On the Primary, you need to set up log shipping to the new Standby:
SQL> alter system set log_archive_dest_2='SERVICE=DRAKE VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=DRAKE' scope = both;
SQL> alter system set log_archive_dest_2='SERVICE=DRAKE VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=DRAKE' scope = both;

System altered.
23. Find out if the switch was successfully sent and applied:
On Primary:
SQL> alter system switch logfile;
select dest_id, status, error
from v$archive_dest
where dest_id in (1,2);

Code: Select all

SQL> select dest_id, status, error
from v$archive_dest
where dest_id in (1,2);
  2    3
   DEST_ID STATUS
---------- ---------
ERROR
-----------------------------------------------------------------
         1 VALID


         2 VALID
SQL> archive log list;
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA
Oldest online log sequence 17
Next log sequence to archive 19
Current log sequence 19
On Standby:
SQL> archive log list;
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA
Oldest online log sequence 18
Next log sequence to archive 0
Current log sequence 19
Your dataguard setup is synched if the Current log sequence should be the same on both Primary and Standby databases.

-- END OF DATAGUARD SETUP --

To Configure Data Guard Broker, proceed to:
http://www.oracle-forums.com/data-guard ... t7204.html
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Build Standby Database Using RMAN Duplicate

Post by xaeresis »

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Build Standby Database Using RMAN Duplicate

Post by xaeresis »

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Build Standby Database Using RMAN Duplicate

Post by xaeresis »

xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Build Standby Database Using RMAN Duplicate

Post by xaeresis »

Post Reply