Tns-file example :
# tnsnames.ora Network Configuration File: /oracle/app/orawork/product/12.1.0.2/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
FINDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dm01scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = Findb.database.com)
)
)
Findb_s1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dm01scan.database.com)(PORT = 1521))
(CONNECT_DATA =
(FAILOVER = on)
(FAILOVERTYPE = Select)
(LOAD_BALANCE = on)
(SERVER = DEDICATED)
(SERVICE_NAME = Findb_s1)
)
)
Findb_s2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dm01scan.database.com)(PORT = 1521))
(CONNECT_DATA =
(FAILOVER = on)
(FAILOVERTYPE = Select)
(LOAD_BALANCE = on)
(SERVER = DEDICATED)
(SERVICE_NAME = Findb_s2)
)
)
Silver =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dm01scan.database.com)(PORT = 1521))
(CONNECT_DATA =
(FAILOVER = on)
(FAILOVERTYPE = TRANSACTION)
(LOAD_BALANCE = on)
(SERVER = DEDICATED)
(SERVICE_NAME = Silver)
)
)
##### PDB Entry #####
Finpdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dm01scan.database.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = Finpdb)
)
)
Service creation for rac :
srvctl add service -d Findb -s Findb_s1 -r Findb1,Findb2 -P BASIC -e Select -m BASIC -z 180 -w 5
srvctl add service -d Findb -s Findb_s2 -r Findb1,Findb2 -P BASIC -e Select -m BASIC -z 180 -w 5
Only for 12cR2
srvctl add service -db Findb -service SILVER -preferred Findb1,Findb2 -failover_restore LEVEL1 -failoverretry 1 -failoverdelay 3 -commit_outcome TRUE -failovertype TRANSACTION -replay_init_time 1800 -retention 86400 -notification TRUE -drain_timeout 300 -stopoption IMMEDIATE
Enable the service :
srvctl enable service -d Findb -s Findb_s1
srvctl enable service -d Findb -s Findb_s2
srvctl enable service -d Findb -s SILVER
Start the service and check the status :
[oracle@dm01db01 admin]$ srvctl start service -s Findb_s2 -d Findb
[oracle@dm01db01 admin]$ srvctl start service -s Findb_s1 -d Findb
[oracle@dm01db01 admin]$ srvctl status service -d Findb
Service Findb_s1 is running on instance(s) Findb1,Findb2
Service Findb_s2 is running on instance(s) Findb1,Findb2
Check the config of service :
[oracle@dm01db01 admin]$ srvctl config service -d Findb -s Findb_s1
Service name: Findb_s1
Service is enabled
Server pool: Findb_Findb_s1
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 180
TAF failover delay: 5
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Session State Consistency:
Preferred instances: Findb1,Findb2
[oracle@dm01db01 admin]$ srvctl config service -d Findb -s Findb_s2
Service name: Findb_s2
Service is enabled
Server pool: Findb_Findb_s2
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 180
TAF failover delay: 5
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Session State Consistency:
Preferred instances: Findb1,Findb2
ConversionConversion EmoticonEmoticon