Migrate uard to a single machine in RAC Environment
Environment Description:
Oracle Version: 11.2.0.3.0
Primary end:
For dual-node RAC, scan uses DNS resolution to run two instances (JSTDB & PAYDB)
Standby end:
Standalone Federation uard
1. Set the network environment;
Vi/etc/hosts
192.168.253.101 rac1.test.com rac1
192.168.253.102 rac2.test.com rac2
192.168.253.103 rac1-vip.test.com rac1-vip
192.168.253.104 rac2-vip.test.com rac2-vip
10.10.10.11 rac1-priv.test.com rac1-priv
Rac2-priv.test.com 10.10.10.12 rac2-priv
192.168.253.200 standby
Vi/etc/resolv. conf
Nameserver 192.168.253.100
Nslookup scan.test.com
Server: 192.168.253.100
Address: 192.168.253.100 #53
Name: scan.test.com
Address: 192.168.253.107
Name: scan.test.com
Address: 192.168.253.106
Name: scan.test.com
Address: 192.168.253.105
2. Modify force logging;
Select force_logging from v $ database;
Alter database force logging;
-------------------------------------- Split line --------------------------------------
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian
Important configuration parameters of Oracle Data Guard
Configure Oracle 11g Data Guard based on the same host
Explore Oracle 11g elastic uard
Oracle Data Guard (RAC + DG) archive deletion policies and scripts
Role conversion for Oracle Data Guard
FAL gap in Oracle Data Guard logs
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby
-------------------------------------- Split line --------------------------------------
3. View and add standby logfile;
Set line 180 pages 1000
Col member for a50
Select * from v $ logfile order by GROUP #;
Alter system set standby_file_management = manual scope = both sid = '*';
Alter database add standby logfile thread 1 group 5' + DATA/jstdb/onlinelog/standby_redo1-1.log 'size 50 M;
Alter database add standby logfile thread 1 group 6' + DATA/jstdb/onlinelog/standby_redo1-2.log 'size 50 M;
Alter database add standby logfile thread 1 group 7' + DATA/jstdb/onlinelog/standby_redo1-3.log 'size 50 M;
Alter database add standby logfile thread 1 group 8' + DATA/jstdb/onlinelog/standby_redo1-4.log 'size 50 M;
Alter database add standby logfile thread 2 group 9' + DATA/jstdb/onlinelog/standby_redo2-1.log 'size 50 M;
Alter database add standby logfile thread 2 group 10' + DATA/jstdb/onlinelog/standby_redo2-2.log 'size 50 M;
Alter database add standby logfile thread 2 group 11' + DATA/jstdb/onlinelog/standby_redo2-3.log 'size 50 M;
Alter database add standby logfile thread 2 group 12 '+ DATA/jstdb/onlinelog/standby_redo2-4.log 'size 50 M;
Alter system set standby_file_management = auto scope = both sid = '*';
4. Collect information about the master database;
Set line 180 pages 1000
Col value for a90
Col name for a50
Select name, value from v $ parameter
Where name in ('db _ name ',
'Db _ unique_name ',
'Log _ archive_config ',
'Log _ archive_dest_1 ',
'Log _ archive_dest_2 ',
'Log _ archive_dest_state_1 ',
'Log _ archive_dest_state_2 ',
'Remote _ login_passwordfile ',
'Remote _ listener ',
'Log _ archive_format ',
'Log _ archive_max_processes ',
'Fal _ Server', 'fal _ client ',
'Db _ file_name_convert ',
'Log _ file_name_convert ',
'Standby _ file_management ');
5. Create an archive log directory for the local hard disk and an rman backup directory;
Mkdir-p/u01/arch/JSTDB
Chown-R oracle. oinstall/u01/arch/
Mkdir-p/u01/rman/JSTDB
Chown-R oracle. oinstall/u01/rman/
6. Modify the DG configuration of the master database;
Alter system set DB_UNIQUE_NAME = JSTDB scope = both sid = '*';
Alter system set LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (JSTDB, JSTDG1) 'scope = both sid = '*';
Alter system set LOG_ARCHIVE_DEST_1 = 'location = + FRA/JSTDB/ARCHIVELOG/VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = JSTDB 'scope = both sid = '*';
Alter system set LOG_ARCHIVE_DEST_2 = 'service = JSTDG1 lgwr async VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = JSTDG1 'scope = both sid = '*';
Alter system set LOG_ARCHIVE_DEST_STATE_1 = ENABLE scope = both sid = '*';
Alter system set LOG_ARCHIVE_DEST_STATE_2 = ENABLE scope = both sid = '*';
Alter system set REMOTE_LOGIN_PASSWORDFILE = SHARED scope = spfile sid = '*';
Alter system set REMOTE_LISTENER = 'Scan .test.com: 1521 'scope = spfile sid = '*';
Alter system set LOG_ARCHIVE_MAX_PROCESSES = 8 SCOPE = both sid = '*';
Alter system set FAL_CLIENT = jstdb scope = both sid = '*';
Alter system set FAL_SERVER = JSTDG1 SCOPE = both sid = '*';
Alter system set db_file_name_convert = '/u01/app/oracle/oradata/JSTDG1/', '+ DATA/JSTDB/'scope = spfile sid = '*';
Alter system set log_file_name_convert = '/u01/app/oracle/oradata/JSTDG1/onlinelog/', '+ DATA/JSTDB/onlinelog /', '/u01/app/oracle/oradata/JSTDG1/onlinelog/', '+ FRA/JSTDB/onlinelog/', '/u01/arch/JSTDG1 /', '+ FRA/JSTDB/ARCHIVELOG/' SCOPE = spfile sid = '*';
Alter system set STANDBY_FILE_MANAGEMENT = auto scope = both sid = '*';
Modify the archivelog format
Alter system set log_archive_format = 'arch _ % r _ % t _ % s. arc' scope = spfile sid = '*';
Shutdown immediate
Startup
7. Create a pfile for the standby database;
Create pfile = '/u01/rman/initJSTDB. ora' from spfile;
8. Modify tns;
Cd $ ORACLE_HOME/network/admin
Vi tnsnames. ora
# Tnsnames. ora Network Configuration File:/u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames. ora
# Generated by Oracle configuration tools.
JSTDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = scan.test.com) (PORT = 1521 ))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = JSTDB)
)
)
JSTDB1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = rac1.test.com) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = rac1-vip.test.com) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = JSTDB)
(INSTANCE_NAME = JSTDB1)
)
)
JSTDB2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = rac2.test.com) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = rac2-vip.test.com) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = JSTDB)
(INSTANCE_NAME = JSTDB2)
)
)
JSTDG1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = standby) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = JSTDG1)
)
)
PAYDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = scan.test.com) (PORT = 1521 ))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PAYDB)
)
)
PAYDG1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = standby) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PAYDB)
)
)
9. Add a listener to the slave database;
Cd $ ORACLE_HOME/network/admin
Vi listener. ora
# Listener. ora Network Configuration File:/u01/app/oracle/network/admin/listener. ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = standby) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = JSTDG1)
(ORACLE_HOME =/u01/app/oracle)
(SID_NAME = JSTDB)
)
(SID_DESC =
(GLOBAL_DBNAME = PAYDG1)
(ORACLE_HOME =/u01/app/oracle)
(SID_NAME = PAYDB)
)
)
ADR_BASE_LISTENER =/u01/app/oracle
Slave database restart listening service
Lsnrctl stop
Lsnrctl start
10. Generate the standby control file on node 1 of RAC;
Export ORACLE_SID = JSTDB1
Rman target/
Backup device type disk format'/u01/rman/ctl01.ctl 'current controlfile for standby;
Scp/u01/rman/ctl01.ctl standby:/u01/rman/
11. Create related directories in standby;
@ Root User
Mkdir-p/u01/rman/JSTDB
Chown-R oracle. oinstall/u01/rman/
Mkdir-p/u01/arch/JSTDG1
Chown-R oracle. oinstall/u01/arch/
@ Oracle user
Mkdir-p/u01/app/oracle/oradata/JSTDG1/datafile/
Mkdir-p/u01/app/oracle/oradata/JSTDG1/onlinelog
Mkdir-p/u01/app/oracle/admin/JSTDG1/adump
12. Copy the password file;
Orapwd file =/$ ORACLE_HOME/dbs/orapwJSTDB1 password = oracle force = y ignorecase = y
Scp/$ ORACLE_HOME/dbs/orapwJSTDB1 rac2:/$ ORACLE_HOME/dbs/orapwJSTDB2
Scp/$ ORACLE_HOME/dbs/orapwJSTDB1 standby:/u01/app/oracle/dbs/orapwJSTDB
13. Copy the parameter file to the slave database and modify the relevant content;
@ Master database
Scp/u01/rman/initJSTDB. ora standby:/u01/app/oracle/dbs/initJSTDB. ora
@ Slave Database
Vi/u01/app/oracle/dbs/initJSTDB. ora
*. Audit_file_dest = '/u01/app/oracle/admin/JSTDG1/adump'
*. Audit_trail = 'db'
*. Compatible = '11. 2.0.0.0'
*. Control_files = '/u01/app/oracle/oradata/JSTDG1/control01.ctl', '/u01/app/oracle/oradata/JSTDG1/control02.ctl ', '/u01/app/oracle/oradata/JSTDG1/control03.ctl'
*. Db_block_size = 8192
# *. Db_create_file_dest = '/u01/app/oracle/oradata /'
# *. Db_create_online_log_dest_1 = '/u01/app/oracle/oradata/onlinelog /'
*. Db_domain =''
*. Db_file_name_convert = '+ DATA/JSTDB/', '/u01/app/oracle/oradata/JSTDG1 /'
*. Db_name = 'jstdb'
*. Db_unique_name = 'jstdg1'
*. Db_recovery_file_dest =''
*. Fal_client = 'jstdg1'
*. Fal_server = 'jstdb'
*. Log_archive_config = 'dg _ CONFIG = (JSTDB, JSTDG1 )'
*. Log_archive_dest_1 = 'location =/u01/arch/JSTDG1/VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = JSTDG1'
*. Log_archive_dest_2 = 'service = jstdb lgwr async VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = jstdb'
*. Log_archive_format = 'arch _ % r _ % t _ % s. arc'
*. Log_archive_dest_state_1 = 'enable'
*. Log_archive_dest_state_2 = 'enable'
*. Log_archive_max_processes = 8
*. Log_file_name_convert = '+ DATA/JSTDB/onlinelog/', '/u01/app/oracle/oradata/JSTDG1/onlinelog/', '+ FRA/JSTDB/onlinelog /', '/u01/app/oracle/oradata/JSTDG1/onlinelog/', '+ FRA/JSTDB/ARCHIVELOG/', '/u01/arch/JSTDG1 /'
*. Open_cursors = 300
*. Processses = 150
*. Remote_login_passwordfile = 'shared'
*. Standby_file_management = 'auto'
*. Undo_management = 'auto'
Undo_tablespace = 'undotbs1'
14. Start the slave database to the nomount state;
Export ORACLE_SID = JSTDB
Sqlplus/as sysdba
Startup nomount pfile = '/u01/app/oracle/dbs/initJSTDB. ora ';
Create spfile from pfile = '/u01/app/oracle/dbs/initJSTDB. ora ';
15. Restore the control file of the slave database;
Rman target/
Restore standby controlfile from '/u01/rman/ctl01.ctl ';
16. Collect RAC database information;
Col file_name for a70
Select file_name, file_id from dba_data_files;
FILE_NAME FILE_ID
--------------------------------------------------------------------------------
+ DATA/jstdb/datafile/system.259.9079385031
+ DATA/jstdb/datafile/sysaux.260.9079385092
+ DATA/jstdb/datafile/undotbs1.261.90790000153
+ DATA/jstdb/datafile/undotbs2.263.9079424254
+ DATA/jstdb/datafile/users.264.9079385275
4 rows selected.
17. Back up the full master database (only for insurance backup, not copy to standby );
Rman target/
Backup format'/u01/rman/JSTDB/fulldb _ % d _ % U' database include current controlfile plus archivelog delete input;
For more details, please continue to read the highlights on the next page: