Setup DG, find link below:
data-guard-physical-standby-setup-in
Prepare Primary Site :
Changes: DB_BROKER_CONFIG_FILEn parameter is used to specify the location of the dataguard configuration. DG_BROKER_START parameter is used to start the broker automatically when the instance starts.
SQL> alter system set dg_broker_config_file1='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orclp.dat' sid='*';
System altered.
SQL> alter system set dg_broker_config_file2='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orclp.dat' sid='*';
System altered.
SQL> alter system set dg_broker_start=true sid='*';
System altered.
Listener.ora Changes : GLOBAL_DBNAME attribute value should be set as shown in the following listener.ora configuration on primary site otherwise you will get TNS-12154 error during switch over configuration. A service with name <sid>_DGMGRL will be started when the listener is started. If you have the GLOBAL_DBNAME parameter set, skip this step.
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.8)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
Prepare Standby site:
SQL> alter system set dg_broker_config_file1='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orcls.dat' sid='*';
System altered.
SQL> alter system set dg_broker_config_file2='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orcls.dat' sid='*';
System altered.
SQL> alter system set dg_broker_start=true sid='*';
System altered.
Listener.ora Changes
DGMGRL> CREATE CONFIGURATION 'first_config' AS PRIMARY DATABASE IS 'ORCL' CONNECT IDENTIFIER IS ORCL;
Error: ORA-16642: DB_UNIQUE_NAME mismatch
Failed.
DGMGRL> CREATE CONFIGURATION 'first_config' AS PRIMARY DATABASE IS 'ORCLP' CONNECT IDENTIFIER IS ORCL;
Configuration "first_config" created with primary database "ORCLP"
DGMGRL> ADD DATABASE 'ORCLS' AS CONNECT IDENTIFIER IS ORCLSTBY MAINTAINED AS PHYSICAL;
Database "ORCLS" added
DGMGRL> show configuration;
Configuration - first_config
Protection Mode: MaxPerformance
Databases:
ORCLP - Primary database
ORCLS - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL> help enable configuration;
Enables a configuration, a database, or fast-start failover
Syntax:
ENABLE CONFIGURATION;
ENABLE DATABASE <database name>;
ENABLE FAST_START FAILOVER [CONDITION <condition>];
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;
Configuration - first_config
Protection Mode: MaxPerformance
Databases:
ORCLP - Primary database
ORCLS - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL>
Verifying Configuration With Switchover:
DGMGRL> switchover to 'ORCLS';
Performing switchover NOW, please wait...
New primary database "ORCLS" is opening...
Operation requires shutdown of instance "ORCL" on database "ORCLP"
Shutting down instance "ORCL"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "ORCL" on database "ORCLP"
Starting instance "ORCL"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up and mount instance "ORCL" of database "ORCLP"
DGMGRL> exit
show database 'ORCLP' 'LogXptStatus';
[oracle@primary admin]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 23 19:45:47 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 267825152 bytes
Fixed Size 1335924 bytes
Variable Size 213912972 bytes
Database Buffers 50331648 bytes
Redo Buffers 2244608 bytes
Database mounted.
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PHYSICAL STANDBY
SQL> select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@primary admin]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> conn sys
Unrecognized command "conn", try "help"
DGMGRL> connect sys
Password:
Connected.
DGMGRL> switchover to 'ORCLP';
Performing switchover NOW, please wait...
New primary database "ORCLP" is opening...
Operation requires shutdown of instance "ORCL" on database "ORCLS"
Shutting down instance "ORCL"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "ORCL" on database "ORCLS"
Starting instance "ORCL"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up and mount instance "ORCL" of database "ORCLS"
DGMGRL>
data-guard-physical-standby-setup-in
Prepare Primary Site :
Changes: DB_BROKER_CONFIG_FILEn parameter is used to specify the location of the dataguard configuration. DG_BROKER_START parameter is used to start the broker automatically when the instance starts.
SQL> alter system set dg_broker_config_file1='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orclp.dat' sid='*';
System altered.
SQL> alter system set dg_broker_config_file2='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orclp.dat' sid='*';
System altered.
SQL> alter system set dg_broker_start=true sid='*';
System altered.
Listener.ora Changes : GLOBAL_DBNAME attribute value should be set as shown in the following listener.ora configuration on primary site otherwise you will get TNS-12154 error during switch over configuration. A service with name <sid>_DGMGRL will be started when the listener is started. If you have the GLOBAL_DBNAME parameter set, skip this step.
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.8)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
Prepare Standby site:
SQL> alter system set dg_broker_config_file1='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orcls.dat' sid='*';
System altered.
SQL> alter system set dg_broker_config_file2='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orcls.dat' sid='*';
System altered.
SQL> alter system set dg_broker_start=true sid='*';
System altered.
Listener.ora Changes
DGMGRL> CREATE CONFIGURATION 'first_config' AS PRIMARY DATABASE IS 'ORCL' CONNECT IDENTIFIER IS ORCL;
Error: ORA-16642: DB_UNIQUE_NAME mismatch
Failed.
DGMGRL> CREATE CONFIGURATION 'first_config' AS PRIMARY DATABASE IS 'ORCLP' CONNECT IDENTIFIER IS ORCL;
Configuration "first_config" created with primary database "ORCLP"
DGMGRL> ADD DATABASE 'ORCLS' AS CONNECT IDENTIFIER IS ORCLSTBY MAINTAINED AS PHYSICAL;
Database "ORCLS" added
DGMGRL> show configuration;
Configuration - first_config
Protection Mode: MaxPerformance
Databases:
ORCLP - Primary database
ORCLS - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL> help enable configuration;
Enables a configuration, a database, or fast-start failover
Syntax:
ENABLE CONFIGURATION;
ENABLE DATABASE <database name>;
ENABLE FAST_START FAILOVER [CONDITION <condition>];
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;
Configuration - first_config
Protection Mode: MaxPerformance
Databases:
ORCLP - Primary database
ORCLS - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL>
Verifying Configuration With Switchover:
DGMGRL> switchover to 'ORCLS';
Performing switchover NOW, please wait...
New primary database "ORCLS" is opening...
Operation requires shutdown of instance "ORCL" on database "ORCLP"
Shutting down instance "ORCL"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "ORCL" on database "ORCLP"
Starting instance "ORCL"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up and mount instance "ORCL" of database "ORCLP"
DGMGRL> exit
show database 'ORCLP' 'LogXptStatus';
[oracle@primary admin]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 23 19:45:47 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 267825152 bytes
Fixed Size 1335924 bytes
Variable Size 213912972 bytes
Database Buffers 50331648 bytes
Redo Buffers 2244608 bytes
Database mounted.
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PHYSICAL STANDBY
SQL> select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@primary admin]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> conn sys
Unrecognized command "conn", try "help"
DGMGRL> connect sys
Password:
Connected.
DGMGRL> switchover to 'ORCLP';
Performing switchover NOW, please wait...
New primary database "ORCLP" is opening...
Operation requires shutdown of instance "ORCL" on database "ORCLS"
Shutting down instance "ORCL"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "ORCL" on database "ORCLS"
Starting instance "ORCL"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up and mount instance "ORCL" of database "ORCLS"
DGMGRL>
No comments:
Post a Comment