Configure TAF Basic Configuration on Server-side
srvctl add service -d db_unique_name -service service_name
[-failovertype {NONE|SESSION|SELECT|TRANSACTION}]
[-failovermethod {NONE | BASIC | PRECONNECT}]
[-failoverretry failover_retries ]
[-failoverdelay failover_delay }]
[oracle@srv1 ~]$ srvctl add service -db rac -service staf -preferred rac1 -available rac2 -failovermethod BASIC -failovertype SELECT -failoverretry 10 -failoverdelay 5
[oracle@srv1 ~]$ srvctl start service -db rac -service staf
[oracle@srv1 ~]$ srvctl config service -d rac -s staf
Service name: staf
Server pool:
Cardinality: 1
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: 10
TAF failover delay: 5
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Session State Consistency:
GSM Flags: 0
Service is enabled
Preferred instances: rac1
Available instances: rac2
[oracle@srv1 ~]$
srvctl add service -d db_unique_name -service service_name
[-failovertype {NONE|SESSION|SELECT|TRANSACTION}]
[-failovermethod {NONE | BASIC | PRECONNECT}]
[-failoverretry failover_retries ]
[-failoverdelay failover_delay }]
[oracle@srv1 ~]$ srvctl add service -db rac -service staf -preferred rac1 -available rac2 -failovermethod BASIC -failovertype SELECT -failoverretry 10 -failoverdelay 5
[oracle@srv1 ~]$ srvctl start service -db rac -service staf
[oracle@srv1 ~]$ srvctl config service -d rac -s staf
Service name: staf
Server pool:
Cardinality: 1
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: 10
TAF failover delay: 5
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Session State Consistency:
GSM Flags: 0
Service is enabled
Preferred instances: rac1
Available instances: rac2
[oracle@srv1 ~]$
SQL> col failover_method format a20
SQL> col failover_type format a20
SQL> SELECT FAILOVER_METHOD, FAILOVER_TYPE FROM DBA_SERVICES WHERE NAME like 'staf%';
FAILOVER_METHOD FAILOVER_TYPE
-------------------- --------------------
BASIC SELECT
SQL>
[root@srv1 ~]# crsctl status resource -t
ora.rac.staf.svc
1 ONLINE ONLINE srv1 STABLE
staf=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.91)(PORT = 1531))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = staf.example.com)
)
)
C:\Users\varunyadav>tnsping staf
TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 05-JUN-2019 19:40:58
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\app\client\varunyadav\product\12.1.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.91)(PORT = 1531)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = staf.example.com)))
OK (0 msec)
C:\Users\varunyadav> sqlplus sys/system123@staf as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 5 19:41:00 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL>
SQL> SELECT SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL;
SYS_CONTEXT('USERENV','INSTANCE_NAME')
--------------------------------------------------------------------------------
rac1
SQL>
SELECT A.OBJECT_NAME FROM ALL_OBJECTS A UNION ALL SELECT B.OBJECT_NAME FROM ALL_OBJECTS B;
pkill -9 -f ora_pmon_rac1
SQL> SELECT SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL;
SYS_CONTEXT('USERENV','INSTANCE_NAME')
--------------------------------------------------------------------------------
rac2
SQL>
[root@srv1 ~]# crsctl status resource -t
ora.rac.racsrv.svc
1 ONLINE ONLINE srv2 STABLE
col username format a10
col service_name format a20
SELECT INST_ID, USERNAME, SERVICE_NAME, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER FROM GV$SESSION;
srvctl stop service -database rac -service staf
srvctl remove service -database rac -service staf
No comments:
Post a Comment