Thursday, May 21, 2009

Database Automatic Failover On Another Database

A-on SERVER1:

1-open tnsnames.ora file in this path D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN
2-edit the tnsnames.ora file and modfiy your database service to be like this

ORC1=
(DESCRIPTION=
(FAILOVER=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=SERVER1)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=SERVER2)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=ORC1)))

and add another service for the the database ORC2 on SERVER2


ORC2 =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = SERVER2)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORC2)
)
)


B-On SERVER2

1-open tnsnames.ora file in this path D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN
2-edit the tnsnames.ora file and modfiy your database service to be like this

ORC2=
(DESCRIPTION=
(FAILOVER=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=SERVER2)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=SERVER1)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=ORC2)))

and add another service for the the database ORC1 on SERVER1


ORC1 =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = SERVER1)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORC1)
)
)

C-at this point your databases can failover on each other

D-To test that your configuration is working try to connect an application to or TOAD to the ORC1 database with schema scott/tiger and then open SQLPLUS and shutdown this database
it will be automatically switched on the other database ORC2

No comments: