Hostname and IP change in case of Switchover and Failover with Dataguard [message #495331] |
Fri, 18 February 2011 03:57 |
preet_kumar
Messages: 204 Registered: March 2007
|
Senior Member |
|
|
We are using a Primary and Physical Standby with DataGuard,Broker Observer and Fast Start Failover .Till now things are working great but still we cannot make everything automated
In case of Switchover or Failover we always have to change the IP's of both Primary and Standby and start the listener.
When the Secondary becomes Primary then all our application which is connecting to Primary loose the connection and can only connect the the new Primary when we have changed the IP and hostname of the new Primary and when we change the IP and hostname same as of the old Primary then the EM stops working.All this causes some downtime.
Is there a solution for this so we can make everything fully automated.
|
|
|
Re: Hostname and IP change in case of Switchover and Failover with Dataguard [message #495340 is a reply to message #495331] |
Fri, 18 February 2011 05:03 |
John Watson
Messages: 8949 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
It is simple enough, and you certainly shouldn't;t be changing hostnames and IP addresses. Give your clients a tnsnames.ora entry such as this:
db=(description=
(address_list=
(load_balance=on)(failover=on)
(address=(protocol=tcp)(host=primary-server)(port=1521))
(address=(protocol=tcp)(host=standby-server)(port=1521))
)
(connect_data=(service_name=db))
)
Then create a service such as this:
dbms_service.create_service('db','db')
and a startup trigger such as this:
create trigger start_service after startup on database
declare
role varchar2(30);
begin
select database_role into role from v$database;
if role = 'PRIMARY' then dbms_service.start_service('db');
end if;
end;
/
The trigger will start the service on whichever machine is currently the primary, and the clients will try both listeners until they find it.
|
|
|
|
|