Wednesday, December 11, 2013

Disable RAC server (and client) side load balance


Here is how to disable RAC server (and client) side load balance, and the test:

* Client side load balance:


SALES_DB =
(DESCRIPTION_LIST=
(LOAD_BALANCE=off)
(FAILOVER=on)
(DESCRIPTION=
(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=rac01_vip)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=rac02_vip)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=oltp_workload))))


* server side load balance:

srvctl modify service -d <dbname> -s <servicename> -B NONE

* Test

$>
#!/bin/bash

echo "">t.txt
for i in {1..70}
do
sqlplus -s system/ABC@sales_db >> t.txt <<+++
set head off
set feedback off
set pagesize 0
select instance_name from v\$instance;
begin
  for lc in (select * from all_objects where rownum < 500)
  loop
    Null;
  end loop;
end;
/
exit;
+++
sleep 0.02
done

cat t.txt|uniq

rac01


If load balance is enabled, then the output will be 2 lines or more,for example, 
rac01,
rac02.
Otherwise, it'll be always one line, e.g. : rac01.

* Reference

srvctl modify service -d db_unique_name -s service_name
     [-g server_pool] [-c {UNIFORM|SINGLETON}] [-P {BASIC|PRECONNECT|NONE}] 
     [-l {[PRIMARY] | [PHYSICAL_STANDBY] | [LOGICAL_STANDBY] | [SNAPSHOT_STANDBY]}
     [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] 
     [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] 
     [-m {NONE|BASIC}] [-z failover_retries] [-w failover_delay]
     [-y {AUTOMATIC | MANUAL}]

Table A-79 srvctl modify service Options
OptionDescription
-d db_unique_name
Unique name for the database
-s service_name
Service name
-g server_pool
The name of a server pool used when the database is policy managed.
Note: This option is available only with Oracle RAC and only for policy-managed databases.
-c {UNIFORM | SINGLETON}
The cardinality of the service, either UNIFORM (offered on all instances in the server pool) orSINGLETON (runs on only one instance at a time)
Note: This option is available only with Oracle Clusterware.
-P {BASIC|PRECONNECT|NONE}
TAF failover policy
Note: The PRECONNECT option applies only to administrator-managed databases.
-l {[PRIMARY] | [PHYSICAL
_STANDBY] | [LOGICAL
_STANDBY] | [SNAPSHOT
_STANDBY]}
The database modes for which the service should be started automatically.
-q {TRUE | FALSE}
Indicates whether AQ HA notifications should be enabled (TRUE) for this service
-x {TRUE | FALSE}
Indicates whether or not Distributed Transaction Processing should be enabled for this service
Note: This option is available only with Oracle Clusterware.
-j {SHORT | LONG}
Connection Load Balancing Goal
-B {NONE | SERVICE_TIME | THROUGHPUT}
Runtime Load Balancing Goal
-e {NONE | SESSION | SELECT}
Failover type
-m {NONE | BASIC}
Failover method
-z failover_retries
The number of failover retry attempts
-w failover_delay
The time delay between failover attempts
-y {AUTOMATIC | MANUAL}
Service management policy

No comments: