The standby Construction Method for a RAC is basically the same as that for a single node. we can regard RAC as a single node database. We only need to ensure that the logs of all nodes can be transmitted to the slave database.
The standby Construction Method for a RAC is basically the same as that for a single node. we can regard RAC as a single node database. We only need to ensure that the logs of all nodes can be transmitted to the slave database.
The standby Construction Method for a RAC is basically the same as that for a single node. we can regard RAC as a single node database and only need to ensure that the logs of all nodes can be transmitted to the slave database.
1. Install Oracle software on the slave Database Server
Only install software and do not create databases. The ORACLE software version is consistent with that of the master database.
Ii. Modify master database Parameters
Run Node 1:
SQL> show parameter spfile
NAME TYPE VALUE
-----------------------------------------------------------------------------
Spfile string/dev/raw/raw14
Node 2 execution:
SQL> show parameter spfile
NAME TYPE VALUE
-----------------------------------------------------------------------------
Spfile string/dev/raw/raw14
It can be seen that in this example, each node of RAC shares a spfile. Therefore, when we modify the parameters, we only need to modify them under one node.
-- Force database LOGGING
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
-- Modify parameters related to DATAGUARD
SQL> ALTER SYSTEM SET DB_UNIQUE_NAME = primary scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (primary, standby) 'scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'location =/soft/archivelog/VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = primary 'scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 = 'service = standby LGWR ASYNC VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = standby 'scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1 = ENABLE scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2 = ENABLE scope = spfile;
System altered.
SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_FORMAT = '% t _ % s _ % r. arc' scope = spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES = 4 scope = spfile;
System altered.
SQL> ALTER SYSTEM SET COMPATIBLE = '10. 2.0.3 'scope = spfile;
System altered.
-- The following parameters are optional for switch over.
-- But for the convenience of possible switch over in the future, we should develop the habit of setting these parameters.
SQL> ALTER SYSTEM SET FAL_CLIENT = PRIMARY SCOPE = SPFILE;
System altered.
SQL> ALTER SYSTEM SET FAL_SERVER = STANDBY SCOPE = SPFILE;
System altered.
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT = AUTO SCOPE = SPFILE;
System altered.
SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT = '/soft/oradata/rac/', '/dev/raw/' SCOPE = SPFILE;
System altered.
SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT = '/soft/oradata/rac/', '/dev/raw/' SCOPE = SPFILE;
System altered.
-- In the testing environment of this article, because the paths of the master database and the slave database are inconsistent, you must set the path conversion parameters.
3. Change the master database to archive Mode
1. -- disable all instances
-- Note: After modifying the preceding parameters, you must disable all instances. Otherwise, an error may occur when the instance is started:
-- ORA-00600: internal error code, arguments: [kccsbck_first], [2], [2241198041],
[], [], [], [], []
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
2. Change to archive Mode
-- Close all nodes
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-- Enable archiving on one node
SQL> startup mount
ORACLE instance started.
Total System Global Area 159383552 bytes
Fixed Size 1260672 bytes
Variable Size 79692672 bytes
Database Buffers 75497472 bytes
Redo Buffers 2932736 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
Before 10GR2, you must set cluster_database = false to archive the database in the RAC environment, and then set this parameter to true. However, this step can be omitted in 10GR2.
Iv. Back up databases
1. Back up the database
The backup operation is performed on node 1 (rac1.
Because archive is stored on different nodes, you need to connect all nodes for backup:
[Oracle @ rac1 ~] $ ORACLE_HOME/bin/rman target/
Recovery Manager: Release 10.2.0.3.0-Production on Wed Apr 30 14:48:23 2008
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to target database: RAC (DBID = 2232067446)
RMAN> run
2> {
3> allocate channel c1 device type disk format'/soft/backup/% u'connect sys/test @ rac1;
4> allocate channel c2 device type disk format'/soft/backup/% u'connect sys/test @ rac2;
5> backup database plus archivelog delete all input;
6>}
Using target database control file instead of recovery catalog
Allocated channel: c1
Channel c1: sid = 134 instance = rac1 devtype = DISK
Allocated channel: c2
Channel c2: sid = 141 instance = rac2 devtype = DISK
Starting backup at 30-APR-08
Current log archived
Channel c1: starting archive log backupset
Channel c1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 80 recid = 1 stamp = 653247673
Input archive log thread = 1 sequence = 81 recid = 4 stamp = 653268228
Input archive log thread = 1 sequence = 82 recid = 5 stamp = 653353066
Channel c1: starting piece 1 at 30-APR-08
Channel c2: starting archive log backupset
Channel c2: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 85 recid = 13 stamp = 653409646
Input archive log thread = 2 sequence = 42 recid = 2 stamp = 653248818
Input archive log thread = 2 sequence = 43 recid = 3 stamp = 653250118
Input archive log thread = 2 sequence = 46 recid = 10 stamp = 653353763
Input archive log thread = 2 sequence = 47 recid = 11 stamp = 653354798
Input archive log thread = 2 sequence = 48 recid = 12 stamp = 653409644
Input archive log thread = 2 sequence = 49 recid = 16 stamp = 653410122
Channel c2: starting piece 1 at 30-APR-08
Channel c2: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/02jf4fql_1_1 tag = tag2008020.t144854 comment = NONE
Channel c2: backup set complete, elapsed time: 00:00:05
Channel c2: deleting archive log (s)
Archive log filename =/soft/archivelog/1_85_644085430.arc recid = 13 stamp = 653409646
Archive log filename =/soft/archivelog/2_42_644085430.arc recid = 2 stamp = 653248818
Archive log filename =/soft/archivelog/2_43_644085430.arc recid = 3 stamp = 653250118
Archive log filename =/soft/archivelog/2_46_644085430.arc recid = 10 stamp = 653353763
Archive log filename =/soft/archivelog/2_47_644085430.arc recid = 11 stamp = 653354798
Archive log filename =/soft/archivelog/2_48_644085430.arc recid = 12 stamp = 653409644
Archive log filename =/soft/archivelog/2_49_644085430.arc recid = 16 stamp = 653410122
Channel c1: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/01jf4fqq_1_1 tag = tag2008020.t144854 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:14
Channel c1: deleting archive log (s)
Archive log filename =/soft/archivelog/41580_644085430.arc recid = 1 stamp = 653247673
Archive log filename =/soft/archivelog/1_81_644085430.arc recid = 4 stamp = 653268228
Archive log filename =/soft/archivelog/12782_644085430.arc recid = 5 stamp = 653353066
Channel c1: starting archive log backupset
Channel c1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 83 recid = 6 stamp = 653353068
Input archive log thread = 1 sequence = 84 recid = 9 stamp = 653353575
Input archive log thread = 1 sequence = 86 recid = 14 stamp = 653409966
Input archive log thread = 1 sequence = 87 recid = 15 stamp = 653410123
Input archive log thread = 2 sequence = 44 recid = 7 stamp = 653353071
Input archive log thread = 2 sequence = 45 recid = 8 stamp = 653353072
Channel c1: starting piece 1 at 30-APR-08
Channel c1: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/03jf4fr9_1_1 tag = tag2008020.t144854 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:02
Channel c1: deleting archive log (s)
Archive log filename =/soft/archivelog/41583_644085430.arc recid = 6 stamp = 653353068
Archive log filename =/soft/archivelog/12784_644085430.arc recid = 9 stamp = 653353575
Archive log filename =/soft/archivelog/41586_644085430.arc recid = 14 stamp = 653409966
Archive log filename =/soft/archivelog/41587_644085430.arc recid = 15 stamp = 653410123
Archive log filename =/soft/archivelog/2_44_644085430.arc recid = 7 stamp = 653353071
Archive log filename =/soft/archivelog/2_45_644085430.arc recid = 8 stamp = 653353072
Finished backup at 30-APR-08
Starting backup at 30-APR-08
Channel c1: starting full datafile backupset
Channel c1: specifying datafile (s) in backupset
Input datafile fno = 00001 name =/dev/raw/raw1
Input datafile fno = 00005 name =/dev/raw/raw7
Input datafile fno = 00003 name =/dev/raw/raw2
Channel c1: starting piece 1 at 30-APR-08
Channel c2: starting full datafile backupset
Channel c2: specifying datafile (s) in backupset
Input datafile fno = 00002 name =/dev/raw/raw3
Input datafile fno = 00004 name =/dev/raw/raw5
Channel c2: starting piece 1 at 30-APR-08
Channel c2: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/05jf4frg_1_1 tag = tag2008020.t144919 comment = NONE
Channel c2: backup set complete, elapsed time: 00:00:43
Channel c2: starting full datafile backupset
Channel c2: specifying datafile (s) in backupset
Including current control file in backupset
Channel c2: starting piece 1 at 30-APR-08
Channel c2: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/06jf4ft0_1_1 tag = tag2008020.t144919 comment = NONE
Channel c2: backup set complete, elapsed time: 00:00:22
Channel c2: starting full datafile backupset
Channel c2: specifying datafile (s) in backupset
Including current SPFILE in backupset
Channel c2: starting piece 1 at 30-APR-08
Channel c2: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/07jf4ftm_1_1 tag = tag2008020.t144919 comment = NONE
Channel c2: backup set complete, elapsed time: 00:00:06
Channel c1: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/04jf4frg_1_1 tag = tag2008020.t144919 comment = NONE
Channel c1: backup set complete, elapsed time: 00:01:13
Finished backup at 30-APR-08
Starting backup at 30-APR-08
Current log archived
Channel c1: starting archive log backupset
Channel c1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 88 recid = 17 stamp = 653410237
Channel c1: starting piece 1 at 30-APR-08
Channel c1: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/08jf4fv9_1_1 tag = tag2008020.t145120 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:04
Channel c1: deleting archive log (s)
Archive log filename =/soft/archivelog/41588_644085430.arc recid = 17 stamp = 653410237
Channel c1: starting archive log backupset
Channel c1: specifying archive log (s) in backup set
Input archive log thread = 2 sequence = 50 recid = 18 stamp = 653410279
Channel c1: starting piece 1 at 30-APR-08
Channel c1: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/09jf4fvf_1_1 tag = tag2008020.t145120 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:04
Channel c1: deleting archive log (s)
Archive log filename =/soft/archivelog/2_50_644085430.arc recid = 18 stamp = 653410279
Finished backup at 30-APR-08
Released channel: c1
Released channel: c2
2. Generate the slave Database Control File
RMAN> run
2> {
3> allocate channel c1 device type disk format'/soft/backup/CON _ % U ';
4> backup current controlfile for standby;
5>}
Allocated channel: c1
Channel c1: sid = 131 instance = rac1 devtype = DISK
Starting backup at 30-APR-08
Channel c1: starting full datafile backupset
Channel c1: specifying datafile (s) in backupset
Including standby control file in backupset
Channel c1: starting piece 1 at 30-APR-08
Channel c1: finished piece 1 at 30-APR-08
Piece handle =/soft/backup/CON_0ajf4gqi_1_1 tag = tag2008020.t150554 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:12
Finished backup at 30-APR-08
Released channel: c1
The standby Construction Method for a RAC is basically the same as that for a single node. we can regard RAC as a single node database and only need to ensure that the logs of all nodes can be transmitted to the slave database.
V. Prepare the standby database environment
1. Add tnsnames pointing to the master database in the slave Database
Add the following content to tnsnames. ora of the slave database:
Primary =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 200.200.200.11) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 200.200.200.22) (PORT = 1521 ))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
) 2. Create related directories in the standby Database
Including adump, bdump, cdump, udump, and data file directory.
3. Copy the password file of the master database to the slave database.
-- Copy the password file of rac1 to $ ORACLE_HOME/dbs in the slave database and change the password file to orapwd. . Here, my sid uses rac1, so you don't need to change the name.
[Oracle @ rac1 dbs] $ scp orapwrac1 172.25.0.35: 'pwd'
Orapwrac1 100% 1536 1.5KB/s
4. Configure the standby Database Listener
[Oracle @ standby admin] $ more listener. ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standby)
(ORACLE_HOME =/opt/oracle/product/10.2/database)
(SID_NAME = rac1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = standby) (PORT = 1521 ))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC ))
)
)
Start slave database listening: lsnrctl start