Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE Without
Goal
Step by step guide on how to create a physical standby database using RMAN DUPLICATE �FROM ACTIVE DATABASE command without shutting down the primary and using primary active database files (No need to take backup)Database Name :- chicago
Primary db_unique_name :- chicago
standby db_unique_name :- Boston[@more@]
Solution
1.Make the necessary changes to the primary database.a. Enable force logging.
b. Creating the password file if one does not exist.
c. Create standby redologs.
d. Modify the parameter file suitable for Dataguard.
2. Ensure that the sql*net connectivity is working fine.
3. Create the standby database over the network using the active(primary) database files.
a. Create the password file
b. Create the initialization parameter file for the standby database (auxiliary database)
c. Create the necessary mount points or the folders for the database files
d. Run the standby creation ON STANDBY by connecting to primary as target database.
DUPLICATE TARGET DATABASE TO
FOR STANDBY
FROM ACTIVE DATABASE
SPFILE
PARAMETER_VALUE_CONVERT '', ''
SET DB_FILE_NAME_CONVERT '', ''
SET LOG_FILE_NAME_CONVERT '', ''
SET SGA_MAX_SIZE 200M
SET SGA_TARGET 125M;
4. Check the log shipping and apply.
PROCEDURE
While creating the standby database we use the active database files i.e., this command will be useful in creating the physical standby database using active database files over the network.
1. Prepare the production database to be the primary database
a. Ensure that the database is in archivelog mode .
b. Enable force logging
SQL> ALTER DATABASE FORCE LOGGING;
c. Create standby redologs
SQL>alter database add standby logfile ' size ;
d. Modify the primary initialization parameter for dataguard on primary,
SQL>alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/databases/chicago/redo/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=chicago';
System altered.
SQL>alter system set LOG_ARCHIVE_DEST_2='SERVICE=boston LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=boston';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
System altered.
SQL>alter system set FAL_SERVER=boston;
System altered.
SQL>alter system set FAL_CLIENT=chicago;
System altered.
SQL>alter system set DB_FILE_NAME_CONVERT='/u01/app/oracle/databases/boston/data/','/u01/app/oracle/databases/chicago/data' scope=spfile;
System altered.
SQL>alter system set LOG_FILE_NAME_CONVERT='/u01/app/oracle/databases/boston/redo/','/u01/app/oracle/databases/chicago/redo' scope=spfile;
System altered.
2. Ensure that the sql*net connectivity is working fine.
In PRIMARY (TNSNAMES.ORA)
BOSTON=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.9.200.108)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = MYSTD.server.com)
)
)
In STANDBY (TNSNAMES.ORA)
CHICAGO=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.9.200.107)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PRIMA.server.com)
)
)
NOTE: Use TNSPING to check the connectivity between PRIMARY and STANDBY
3. Create the standby database
a. Copy the password file from the primary $ORACLE_HOME/dbs and rename it to the standby database name.
cp orapwchicago orapwboston
b. Create a initialization parameter with only one parameter DB_NAME.
DB_NAME=boston
c. Create the necessary directories in the standby location to place the datafiles and the trace files in the $ADR_HOME.
d. Set the environmental variable ORACLE_SID to the standby service and start the instance.
export ORACLE_SID=boston
sqlplus > startup nomount pfile=$ORACLE_HOME/dbs/initcore1.ora
NOTE : Use either PFILE or SPFILE
e. On the primary system invoke the RMAN executable and connect to the primary and the auxiliary database ( i.e., the standby)
$rman target sys/sys@chicago auxiliary sys/sys@boston
connected to target database: CHICAGO (DBID=761464750)
connected to auxiliary database: BOSTON (not mounted)
RMAN> run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'chicago','boston'
set db_unique_name='boston'
set db_file_name_convert='/chicago/','/boston/'
set log_file_name_convert='/chicago/','/boston/'
set control_files='/u01/app/oracle/oradata/control01.ctl'
set log_archive_max_processes='5'
set fal_client='boston'
set fal_server='chicago'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(chicago,boston)'
set log_archive_dest_1='service=chicago ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=chicago'
;
}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21>
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=147 device type=DISK
allocated channel: prmy2
channel prmy2: SID=130 device type=DISK
allocated channel: prmy3
channel prmy3: SID=137 device type=DISK
allocated channel: prmy4
channel prmy4: SID=170 device type=DISK
allocated channel: stby
channel stby: SID=98 device type=DISK
Starting Duplicate Db at 19-MAY-08
contents of Memory Script:
{
backup as copy reuse
file '/u02/app/oracle/product/11.1.0/db_1/dbs/orapwcore' auxiliary format
'/u02/app/oracle/product/11.1.0/db_1/dbs/orapwcore1' file
'/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore.ora' auxiliary format
'/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore1.ora' ;
sql clone "alter system set spfile= ''/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore1.ora''";
}
executing Memory Script
Starting backup at 19-MAY-08
Finished backup at 19-MAY-08
sql statement: alter system set spfile= ''/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore1.ora''
contents of Memory Script:
{
sql clone "alter system set audit_file_dest =
''/u02/app/oracle/admin/boston/adump'' comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=core1XDB)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_2 =
''service=core11 arch async VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=boston'' comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''boston'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''/chicago/'', ''/boston/'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''/chicago/'', ''/boston/'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/u01/app/oracle/oradata/control01.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_max_processes =
5 comment=
'''' scope=spfile";
sql clone "alter system set fal_client =
''boston'' comment=
'''' scope=spfile";
sql clone "alter system set fal_server =
''chicago'' comment=
'''' scope=spfile";
sql clone "alter system set standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_config =
''dg_config=(chicago,boston)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''service=chicago ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=chicago'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
sql statement: alter system set audit_file_dest = ''/u02/app/oracle/admin/boston/adump'' comment= '''' scope=spfile
sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=core1XDB)'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_2 = ''service=core11 arch async VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=boston'' comment= '''' scope=spfile
sql statement: alter system set db_unique_name = ''boston'' comment= '''' scope=spfile
sql statement: alter system set db_file_name_convert = ''/chicago/'', ''/boston/'' comment= '''' scope=spfile
sql statement: alter system set log_file_name_convert = ''/chicago/'', ''/boston/'' comment= '''' scope=spfile
sql statement: alter system set control_files = ''/u01/app/oracle/oradata/control01.ctl'' comment= '''' scope=spfile
sql statement: alter system set log_archive_max_processes = 5 comment= '''' scope=spfile
sql statement: alter system set fal_client = ''boston'' comment= '''' scope=spfile
sql statement: alter system set fal_server = ''chicago'' comment= '''' scope=spfile
sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile
sql statement: alter system set log_archive_config = ''dg_config=(chicago,boston)'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_1 = ''service=chicago ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=chicago'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 845348864 bytes
Fixed Size 1303188 bytes
Variable Size 482348396 bytes
Database Buffers 356515840 bytes
Redo Buffers 5181440 bytes
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/control01.ctl';
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting backup at 19-MAY-08
channel prmy1: starting datafile copy
copying standby control file
output file name=/u02/app/oracle/product/11.1.0/db_1/dbs/snapcf_chicago.f tag=TAG20080519T173406 RECID=2 STAMP=655148053
channel prmy1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 19-MAY-08
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/u02/app/oracle/oradata/boston/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u02/app/oracle/oradata/boston/system01.dbf";
set newname for datafile 2 to
"/u02/app/oracle/oradata/boston/sysaux01.dbf";
set newname for datafile 3 to
"/u02/app/oracle/oradata/boston/undotbs01.dbf";
set newname for datafile 4 to
"/u02/app/oracle/oradata/boston/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u02/app/oracle/oradata/boston/system01.dbf" datafile
2 auxiliary format
"/u02/app/oracle/oradata/boston/sysaux01.dbf" datafile
3 auxiliary format
"/u02/app/oracle/oradata/boston/undotbs01.dbf" datafile
4 auxiliary format
"/u02/app/oracle/oradata/boston/users01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u02/app/oracle/oradata/boston/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 19-MAY-08
channel prmy1: starting datafile copy
input datafile file number=00001 name=/u02/app/oracle/oradata/chicago/system01.dbf
channel prmy2: starting datafile copy
input datafile file number=00002 name=/u02/app/oracle/oradata/chicago/sysaux01.dbf
channel prmy3: starting datafile copy
input datafile file number=00003 name=/u02/app/oracle/oradata/chicago/undotbs01.dbf
channel prmy4: starting datafile copy
input datafile file number=00004 name=/u02/app/oracle/oradata/chicago/users01.dbf
output file name=/u02/app/oracle/oradata/boston/undotbs01.dbf tag=TAG20080519T173421 RECID=0 STAMP=0
channel prmy3: datafile copy complete, elapsed time: 00:00:24
output file name=/u02/app/oracle/oradata/boston/users01.dbf tag=TAG20080519T173421 RECID=0 STAMP=0
channel prmy4: datafile copy complete, elapsed time: 00:00:16
output file name=/u02/app/oracle/oradata/boston/system01.dbf tag=TAG20080519T173421 RECID=0 STAMP=0
channel prmy1: datafile copy complete, elapsed time: 00:02:32
output file name=/u02/app/oracle/oradata/boston/sysaux01.dbf tag=TAG20080519T173421 RECID=0 STAMP=0
channel prmy2: datafile copy complete, elapsed time: 00:02:32
Finished backup at 19-MAY-08
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=655148231 file name=/u02/app/oracle/oradata/boston/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=655148231 file name=/u02/app/oracle/oradata/boston/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=655148231 file name=/u02/app/oracle/oradata/boston/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=655148231 file name=/u02/app/oracle/oradata/boston/users01.dbf
Finished Duplicate Db at 19-MAY-08
released channel: prmy1
released channel: prmy2
released channel: prmy3
released channel: prmy4
4. Now connect to standby sqlplus and start the MRP (Managed Recovery Process). Compare the primary last sequence and MRP (Managed Recovery Process)applying sequence.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/1933/viewspace-1049317/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Step By Step Guide To Create Physical Standby Database Using RMAN [ID 469493.1]GUIIDEDatabase
- Step By Step Guide On Creating Physical Standby Using RMAN Duplicate In ASM Filesystem For ASM PrimaGUIIDEASM
- Step-By-Step Guide To Create Physical Standby On Normal File System For ASM Primary using RMANGUIIDEORMASM
- Creating a Physical Standby using RMAN DUPLICATE FROM ACTIVE DATABASEDatabase
- Creating Physical Standby using RMAN Duplicate Without Shutting Primary_789370.1
- Creating Physical Standby using RMAN Duplicate Without Shutting down The Primary [ID 789370.1]
- oracle Physical Standby failover stepOracleAI
- Creating a Physical Standby DatabaseDatabase
- Step by Step Guide on How to Create Logical Standby [ID 738643.1]GUIIDE
- Step By Step Configure DataGuard (10g) Physical Standby Database On Linux X86_64(2/2)DatabaseLinux
- Using RMAN Incremental Backups to Roll Forward a Physical Standby DatabaseREMForwardDatabase
- Step By Step Configure DataGuard (10g) Physical Standby Database On Linux X86_64(1/2待續...)DatabaseLinux
- Step by Step Guide on converting a database from Windows to AIX-1373780.1GUIIDEDatabaseWindowsAI
- Creating a Standby Database using RMAN (Recovery Manager) [ID 118409.1]Database
- Step by Step Data Replication Using Oracle GoldenGateOracleGo
- Oracle 11gR2 Active DataGuard配置Step By Step(一)Oracle
- Oracle 11gR2 Active DataGuard配置Step By Step(二)Oracle
- Oracle 11gR2 Active DataGuard配置Step By Step(三)Oracle
- 使用RMAN DUPLICATE...FROM ACTIVE DATABASE命令來建立DataGuard物理備庫Database
- 同事總結的 : 用RMAN建立Physical Standby DatabaseDatabase
- Using RMAN Incremental Backups to Refresh a Standby DatabaseREMDatabase
- 11gR2中使用duplicate建立physical standby (從rman備份或從active database)Database
- creating oracle10g data guard using rman(physical db)Oracle
- 使用RMAN備份集搭建Oracle Dataguard Step by Step(一)Oracle
- 使用RMAN備份集搭建Oracle Dataguard Step by Step(二)Oracle
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- 11g rman新特性 duplicate target database for standby from active databaseDatabase
- Creating a physical standby from ASM primaryASM
- 使用RMAN備份集搭建Oracle Datagard Step by Step(三)Oracle
- 透過RMAN進行資料庫恢復(step by step)資料庫
- Physical Standby Database 切換到 Snapshot Standby DatabaseDatabase
- 使用 RMAN DUPLICATE...FROM ACTIVE DATABASE 建立物理備用資料庫的分步指南Database資料庫
- React Step by StepReact
- 11g RMAN新特性 active database duplication createing standbyDatabase
- Oracle DG建立Physical Standby DatabaseOracleDatabase
- Step 7: Issue the CREATE DATABASE Statement (65)Database
- Step 11: Back Up the Database. (69)Database
- Creating a 10gr2 Data Guard Physical Standby database with Real-Time applyDatabaseAPP