How to build a single-node DG with rhel6.4-11.2.0.3-RAC
This article mainly shows you "rhel6.4-11.2.0.3-RAC how to build a single-node DG", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "rhel6.4-11.2.0.3-RAC how to build a single-node DG" this article.
RAC builds a single-node slave library ADG (active data guard)
Master the core idea of DG, whether it is single node-single node, RAC- single node or RAC-RAC, it is almost the same in essence, come on
1. / etc/hosts RAC is consistent with the standby device.
2. Modify the database to mandatory log mode
SQL > select force_logging from v$database
SQL > alter database force logging
3. Modify the database to be in archive mode
SQL > select open_mode,log_mode from v$database
4. Modify the parameter file on the main library
Primary Database: Primary Role Initialization Parameters
DB_NAME=chicago
DB_UNIQUE_NAME=chicago
LOG_ARCHIVE_CONFIG='DG_CONFIG= (chicago,boston)'
CONTROL_FILES='/arch2/chicago/control1.ctl','/ arch3/chicago/control2.ctl'
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch2/chicago/
VALID_FOR= (ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=chicago'
LOG_ARCHIVE_DEST_2=
'SERVICE=boston ASYNC
VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=boston'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
Primary Database: Standby Role Initialization Parameters
FAL_SERVER=boston
DB_FILE_NAME_CONVERT='boston','chicago'
LOG_FILE_NAME_CONVERT=
'/ arch2/boston/','/arch2/chicago/','/arch3/boston/','/arch3/chicago/'
STANDBY_FILE_MANAGEMENT=AUTO
SQL > alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (ora11g,beiku)'
SQL > show parameter LOG_ARCHIVE_DEST_1
SQL > alter system set LOG_ARCHIVE_DEST_1='LOCATION=+data/ora11g/archivelog/ # Archive location can be artificially specified VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ora11g'
SQL > alter system set LOG_ARCHIVE_DEST_2='SERVICE=beiku ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=beiku'
SQL > alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=spfile
SQL > alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=spfile
SQL > alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile
SQL > show parameter LOG_ARCHIVE_FORMAT # static parameters. Restart takes effect.
SQL > alter system set LOG_ARCHIVE_MAX_PROCESSES=30 scope=spfile
SQL > alter system set fal_server=beiku scope=spfile
SQL > alter system set fal_client=ora11g scope=spfile; # fal_client setting itself, fal_server is the other side, check whether the archive is broken
SQL > ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO SCOPE=SPFILE
SQL > ALTER SYSTEM SET DB_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/' scope = spfile; # static parameters, restart takes effect
SQL > ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/' scope = spfile; # static parameters, restart takes effect
5. Configure listening lisener.ora and network service name tnsnames.ora
Netca is usually used for configuration, and manual configuration for special cases
Tnsping service_names for mutual verification between master and standby computers
6. Transfer the password file orapwORACLE_SID under the host $ORACLE_HOME/dbs/ to the slave, and you can use ssh/ftp
7. Create a control file under the host / home/oracle and transfer it to the standby / home/oracle
SQL > alter database create standby controlfile as'/ home/oracle/control01.ctl'
8. Create an initialization parameter file under the host / tmp and pass it to the standby $ORACLE_HOME/dbs/
SQL > create pfile='/tmp/initORACLE_SID.ora' from spfile
9. Modify the slave initialization parameter file
Modifying Initialization Parameters for a Physical Standby Database
DB_NAME=chicago
DB_UNIQUE_NAME=boston
LOG_ARCHIVE_CONFIG='DG_CONFIG= (chicago,boston)'
CONTROL_FILES='/arch2/boston/control1.ctl','/ arch3/boston/control2.ctl'
DB_FILE_NAME_CONVERT='chicago','boston'
LOG_FILE_NAME_CONVERT=
'/ arch2/chicago/','/arch2/boston/','/arch3/chicago/','/arch3/boston/'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch2/boston/
VALID_FOR= (ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=boston'
LOG_ARCHIVE_DEST_2=
'SERVICE=chicago ASYNC
VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=chicago'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=chicago
* .audit_file_dest='/oracle/app/admin/beiku/adump'
* .audit_trail='db'
* .cluster_database=false
* .compatible='11.2.0.0.0'
* .control_files='/oracle/app/beiku/control01.ctl','/ oracle/app/beiku/control02.ctl'
* .db_block_size=8192
* .db_domain=''
* .db_name='ora11g'
* .diagnostic_dest='/oracle/app'
* .log_archive_max_processes=30
* .memory_target=1264582656
* .open_cursors=300
* .processes=150
* .remote_listener='node-scan:1521'
* .remote_login_passwordfile='EXCLUSIVE'
Undo_tablespace='UNDOTBS1'
DB_UNIQUE_NAME=beiku
LOG_ARCHIVE_CONFIG='DG_CONFIG= (ora11g,beiku)'
DB_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/'
LOG_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1='LOCATION=/arch2/beiku/ VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=beiku'
LOG_ARCHIVE_DEST_2='SERVICE=ora11g ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ora11g'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=ora11g
10. Make the backup set of the database on the host and transfer the backup set to the standby / home/oracle
[oracle@node2 ~] $rman target /
Recovery Manager: Release 11.2.0.3.0-Production on Fri Jul 10 15:21:21 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to target database: ORA11G (DBID=4275958693)
RMAN > backup database format'/ home/oracle/racfull_%s_%p'
11. Use RMAN to copy STANDBY database on standby
Note: connect the main library and standby library with username and password (sys/oracle)
[oracle@jason ~] $rman target sys/oracle@ora11g auxiliary sys/oracle
Recovery Manager: Release 11.2.0.3.0-Production on Fri Jul 10 14:13:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to target database: ORA11G (DBID=4275958693)
Connected to auxiliary database: ORA11G (not mounted) # the slave library is enabled to the nomount stage, and the instance is up.
RMAN > duplicate target database for standby
Starting Duplicate Db at 10-JUL-15
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:
{
Restore clone standby controlfile
}
Executing Memory Script
Starting restore at 10-JUL-15
Using channel ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: restoring control file
Channel ORA_AUX_DISK_1: reading from backup piece / home/oracle/racfull_8_1
Channel ORA_AUX_DISK_1: piece handle=/home/oracle/racfull_8_1 tag=TAG20150710T122559
Channel ORA_AUX_DISK_1: restored backup piece 1
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Output file name=/oracle/app/beiku/control01.ctl
Output file name=/oracle/app/beiku/control02.ctl
Finished restore at 10-JUL-15
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
"/ oracle/app/beiku/temp01.dbf"
Switch clone tempfile all
Set newname for datafile 1 to
"/ oracle/app/beiku/system01.dbf"
Set newname for datafile 2 to
"/ oracle/app/beiku/sysaux01.dbf"
Set newname for datafile 3 to
"/ oracle/app/beiku/undotbs01.dbf"
Set newname for datafile 4 to
"/ oracle/app/beiku/users01.dbf"
Set newname for datafile 5 to
"/ oracle/app/beiku/undotbs02.dbf"
Set newname for datafile 6 to
"/ oracle/app/beiku/jason01.dbf"
Restore
Clone database
}
Executing Memory Script
Executing command: SET NEWNAME
Renamed tempfile 1 to / oracle/app/beiku/temp01.dbf in control file
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Starting restore at 10-JUL-15
Using channel ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00001 to / oracle/app/beiku/system01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00002 to / oracle/app/beiku/sysaux01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00003 to / oracle/app/beiku/undotbs01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00004 to / oracle/app/beiku/users01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00005 to / oracle/app/beiku/undotbs02.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00006 to / oracle/app/beiku/jason01.dbf
Channel ORA_AUX_DISK_1: reading from backup piece / home/oracle/racfull_7_1
Channel ORA_AUX_DISK_1: piece handle=/home/oracle/racfull_7_1 tag=TAG20150710T122559
Channel ORA_AUX_DISK_1: restored backup piece 1
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 10-JUL-15
Contents of Memory Script:
{
Switch clone datafile all
}
Executing Memory Script
Datafile 1 switched to datafile copy
Input datafile copy RECID=10 STAMP=884700883 file name=/oracle/app/beiku/system01.dbf
Datafile 2 switched to datafile copy
Input datafile copy RECID=11 STAMP=884700883 file name=/oracle/app/beiku/sysaux01.dbf
Datafile 3 switched to datafile copy
Input datafile copy RECID=12 STAMP=884700883 file name=/oracle/app/beiku/undotbs01.dbf
Datafile 4 switched to datafile copy
Input datafile copy RECID=13 STAMP=884700883 file name=/oracle/app/beiku/users01.dbf
Datafile 5 switched to datafile copy
Input datafile copy RECID=14 STAMP=884700883 file name=/oracle/app/beiku/undotbs02.dbf
Datafile 6 switched to datafile copy
Input datafile copy RECID=15 STAMP=884700883 file name=/oracle/app/beiku/jason01.dbf
Finished Duplicate Db at 10-JUL-15
RMAN >
After the completion, the slave library will be automatically enabled to mount state.
SQL > select instance_name,status from v$instance
INSTANCE_NAME STATUS
--
Beiku MOUNTED
Open the standby library, which is in maximum performance mode
SQL > alter database open read only; # 11gDG can already apply archiving in open
Database altered.
SQL > select protection_mode,database_role,open_mode from v$database
PROTECTION_MODE DATABASE_ROLE OPEN_MODE
MAXIMUM PERFORMANCE PHYSICAL STANDBY READ ONLY
SQL > alter database recover managed standby database disconnect from session
Database altered.
SQL > select sequence#,thread#,applied from vault archived log; # switch log alter system switch logfile on both nodes of the main database, which is shown below in the slave database. DG has been running normally.
SEQUENCE# THREAD# APPLIED
121 1 YES
119 1 YES
120 1 YES
118 1 YES
122 1 YES
151 2 YES
149 2 YES
150 2 YES
152 2 YES
153 2 YES
154 2 YES
SEQUENCE# THREAD# APPLIED
155 2 YES
156 2 YES
157 2 YES
123 1 YES
158 2 YES
159 2 YES
160 2 YES
161 2 YES
162 2 YES
163 2 YES
164 2 YES
SEQUENCE# THREAD# APPLIED
124 1 YES
125 1 YES
126 1 YES
165 2 YES
127 1 YES
128 1 YES
12. Configure DG to the maximum available mode
To create a STANDBY REDO LOGFILE in the standby library
SQL > select group#,member from v$logfile
GROUP# MEMBER
2 / oracle/app/beiku/redo02.log
1 / oracle/app/beiku/redo01.log
3 / oracle/app/beiku/redo03.log
4 / oracle/app/beiku/redo04.log
SQL > alter database add standby logfile group 5 ('/ oracle/app/beiku/standby_redo05.log') size 50m
SQL > alter database add standby logfile group 6 ('/ oracle/app/beiku/standby_redo06.log') size 50m
SQL > alter database add standby logfile group 7 ('/ oracle/app/beiku/standby_redo07.log') size 50m
SQL > alter database add standby logfile group 8 ('/ oracle/app/beiku/standby_redo08.log') size 50m
SQL > alter database set standbydatabase to maximize availability
SQL > alter database recover managedstandby database using current logfile disconnect from session; # start real-time recovery
SQL > alter database recover managed standby database cancel
These are all the contents of the article "how to build a single-node DG in rhel6.4-11.2.0.3-RAC". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!