View
243
Download
0
Category
Preview:
Citation preview
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
1/52
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
2/52
During !usiness hours, more units can !e used for CRM applications, and after !usiness
hours, some of them can !e transferred to Retail Batches.
raphic
This example depicts three periods Daytime, Payday, and Holiday season. The
applications in each include HR, DW, CRM, $dle, and RB. $n the Daytime period,
the CRM computin! unit has the pea# or#load. $n Payday application, the HR
computin! unit has the pea# or#load. $n Holiday season application, the RB and
DW computin! units share or#load ith an e'ual ratio. The idle ratio is one(
fourth in all the three periods.
)rid computing minimizes unused resources. his means that overall a grid*ena!led
environment needs less computing po#er than an environment that is not grid ena!led.
In this e(ample, +- of the computing resource units are idle. his unused e(tra capacityis there so that service levels can still !e met in case of failure of components, such as
nodes or instances, and also to deal #ith une(pected #or"loads.
his is much !etter than the industry average of / to 0/- idle rates #hen each machine
is sized for its individual ma(imum.
1reviously, !uilding a !usiness intelligence system re2uired the integration of multiple
server products. he result #as that such systems #ere unnecessarily comple(. he
integration of multiple servers #as costly.
$fter the system #as implemented, there #as an ongoing administration cost inmaintaining different servers and "eeping the data synchronized across all servers.
raphic
The ser"ers used in this example are )T*, DB, and )+T.
he load on the three servers is registered at the follo#ing time periods3
11#$$ p.!.
$t ''3// p.m., the 45 server is !usy using 45 outside the data!ase6 moderate load on
data!ase6 no load on end user server.
%#$$ a.!.& and
$t 73// a.m., no load on 45 server6 moderate load on data!ase 8canned reporting,
aggregation, and potential data mart maintenance96 no load on end user server.
'#$$ a.!.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
3/52
$t 03// a.m., no load on 45 server6 moderate load on data!ase6 end user server is !usy
using analysis outside the data!ase.
4ach system has to !e sized according to the e(pected #or"load pea"s.
:ou calculate the ma(imum total #or"load used for system sizing #ith this formula.
raphic
The formula for maximum total or#load used for system siin! is-
%ieWor#load max total/ 0 1 %ieWor#load max components/
he entire #or"load is evenly spread across all nodes at any point in time.
What #or"s for a single data #arehouse #or"s in a larger environment as #ell.
raphic
$n this example, a sin!le data or#house is depicted usin! less num&er of ser"ers
than a lar!er en"ironment.
(. Role o) services in a RAC environ!ent
he concept of a service #as first introduced in &racle;ias a means for the listener to
perform connection load !alancing !et#een nodes and instances of a cluster. Ho#ever,
the concept, definition, and implementation of services have !een dramatically e(panded.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
4/52
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
5/52
With the activeAspare service configuration, the simplest redundancy "no#n as
primaryAsecondary, or '' redundancy is e(tended to the general case of M
redundancy, #here is the num!er of primary R$C instances providing service, and M is
the num!er of spare R$C instances availa!le to provide the service.
$n e(ample of this solution is a three*node configuration in #hich one instance providesthe $1 service, the second instance provides the )5 service, and the third instance
provides service failover capa!ility for !oth services. he spare node can still !e availa!le
for other applications during normal operation.
active+s"!!etric& and
With the activeAsymmetric service configuration, the same set of services is active on every
instance. In this e(ample, !oth $1 and )5 services are offered on all three instances. 4ach
instance provides service load*sharing and service failover capa!ilities for the other.
active+as"!!etric
With the activeAasymmetric service configuration, services #ith lo#er capacity needs can!e defined #ith single cardinality and configured as having all other instances capa!le of
providing the service in the event of failure.
In this e(ample, the $1 service is running on only one instance, and the )5 service is
running on t#o instances. he first instance supports the $1 services and offers failover for
the )5 service. 5i"e#ise, the second and third instances support the )5 service and offer
failover for $1. If either the first or third instance dies, then )5 and $1 are still offered
through the second instance.
,uestion
$ three*node cluster configuration in #hich one instance provides the $1 service,
the second instance provides the )5 service, and the third instance provides
service failover capa!ility for !oth services is an e(ample of #hat R$C service
configuration
Options#
'. $ctiveAspare
+. $ctiveAsymmetric
7. $ctiveAasymmetric
Answer
Option 1:Correct. With this ser"ice confi!uration, the simplest redundancy #non
as primary3secondary, or 595 redundancy is extended to the !eneral case of :9M
redundancy, here : is the num&er of primary R2C instances pro"idin! ser"ice,
and M is the num&er of spare R2C instances a"aila&le to pro"ide the ser"ice. $n
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
6/52
this case, the spare node can still &e a"aila&le for other applications durin! normal
operation.
Option 2:$ncorrect. With this ser"ice confi!uration, the same set of ser"ices is
acti"e on e"ery instance.
Option 3:$ncorrect. With this ser"ice confi!uration, ser"ices ith loer capacity
needs can &e defined ith sin!le cardinality and confi!ured as ha"in! all other
instances capa&le of pro"idin! the ser"ice in the e"ent of failure.
Correct answer-s#
'. $ctiveAspare
When you create ne# services for your data!ase, you should define each serviceEs
#or"load management characteristics.
he follo#ing are some of the characteristics of a service3
a uni2ue glo!al name to identify the service
a et
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
7/52
he methods for load !alancing 8#hich you can define9 of connections for each service are
SHORT and LONG. he SHORTmethod is used for 5oad Balancing $dvisory and the LONG
method is used for session count !y service.
ailovercharacteristics, Connection load*!alancing algorithm, and High*availa!ility configuration
cannot !e defined for single*instance environments.
&racle Data!ase '/!supports t#o !road types of services F application services and
internal services. $pplication services are mainly functional maps to #or"loads.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
8/52
application components in the same transaction to connect to different nodes of a R$C
cluster.
his situation can occur on systems #ith automatic load !alancing #here the application
cannot control #hich data!ase nodes a distri!uted transaction !ranch gets processed.
raphic
$n this example, the distri&uted transactions usin! R2C is done usin! Mid(tier
partition 5, Mid(tier non(DT, and Mid(tier partition 7. The Mid(tier partition 5 is
connected to the R2C45. The Mid(tier non(DT is connected to R2C47. The Mid(
tier partition 7 is connected to R2C48. The R2C45, R2C47, and R2C48 ha"e
three components namely %4, %5, and %7. R2C47 is connected to the application
component %5, in &oth R2C45 and R2C48.
or distri!uted transactions from other middle tiers, they are partitioned statically via
&racle et
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
9/52
dbms_s!"#%m&d#'(_s!"#)s!"#_*+m,-.S1./ DTP,-TRUE
dbms_s!"#%m&d#'(_s!"#)s!"#_*+m,-.S./ DTP,-TRUE
4ach mid*tier client has &racle et or load !alancing across the cluster, it is !etter to use one or t#o larger application
servers
Answer
Option 1:$ncorrect. When you use R2C ith distri&uted transactions, it is
possi&le for to application components in the same transaction to connect to
different nodes of a R2C cluster. This situation can occur on systems ith
automatic load &alancin!, here the application cannot control hich data&ase
nodes a distri&uted transaction &ranch !ets processed.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
10/52
Option 2:Correct. To pro"ide impro"ed application performance ith distri&uted
transaction processin! in ;racle R2C, you may ant to ta#e ad"anta!e of the
specialied ser"ice referred to as a DTP ser"ice. +sin! DTP ser"ices, you can
direct all &ranches of a distri&uted transaction to a sin!le instance in the cluster.
Option 3:Correct. %tartin! ith ;racle R2C 55!R, distri&uted transactions are
automatically controlled &y the system throu!h the use of ne &ac#!round
processes called GTX02GTXj. GLOBAL_TXN_PROCESSESspecifies the initial
num&er of GTX*&ac#!round processes on an instance, and its default "alue is 5.
*ettin! the data&ase handle distri&uted transactions automatically is useful for
systems that process !lo&al transactions hea"ily.
Option 4:$ncorrect.
restricted connection and
>irst, even users #ith RESTRICTEDSESSIONprivilege are not a!le to connect remotely
through the listeners to an instance that is in the restricted mode. hey need to connect
locally to the node supporting the instance and use the !e2ueath protocol.
restricted and unrestricted instances
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
11/52
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
12/52
select the desired service policy for each instance configured for the cluster data!ase and
select the desired service properties
he ransparent $pplication >ailover or $> policy attri!ute does not configure server*
side $>.
$lthough 4nterprise Manager configures &racle Cluster#are resources for your ne#ly
created services, it does not generate the corresponding entries in your tnsnames.ora
files. :ou have to manually edit them.
>or that, you can use the s!"43&*'#5d+4+b+scommand #ith the 64option,
#hich displays the < entries that you should use for the services created #ith s!"43.
his is the e(ample for the s!"43&*'#5d+4+b+scommand.
Code
$ s!"43 &*'#5 d+4+b+s 7d 89:E 64
E8+m;3 3#*47s#d TNS *4!( '&! s!"# S4+*d+!d+4 ?@&m?&!+3?*&d#*'& sd 7* ./;.>
DBNAME,>;s 7' 5!; db90_RDB 5!; 7" 5!; 5!; 7"
+33&=41 +9: . ;!#*4 $ . sd .s?1?..?. sd
.s?&!+_db90_?..?.>
I1NAME,$DBNAMEF1F
INAME,$DBNAMEFF
?=01?!s115?b#*?!s_s4+4
?=01?!s115?b#*?s!"43 s4+4=s s!"# 7d $DBNAME 7s SERV1
Supple!ent
%electin! the lin# title opens the resource in a ne &roser indo.
3sing the crs4stat co!!and
%ie# the complete output on using the !s_s4+4and s!"43commands.
Launch window
$dd
,>+4 ?@&m?&!+3?*&d#*'& sd 7* ./;.>
http://dowindow%28%27../t3/misc/lw_od_orac_a04_it_enust301.html')http://dowindow%28%27../t3/misc/lw_od_orac_a04_it_enust301.html')8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
16/52
DBNAME,>;s 7' 5!; db90_RDB 5!; 7" 5!; 5!; 7"
+33&=41 +9: . ;!#*4 $ . sd .s?1?..?. sd
.s?&!+_db90_?..?.>
sd .s?NODE1?.$(.?.
?@&m?&!+3?s&3=4#&*s?3ss0?9!&*5_4*ss!"1%&!+ -
?@&m?&!+3?s&3=4#&*s?3ss0?914*ss!"1%&!+
sd .s?NODE?.$.?.
?@&m?&!+3?s&3=4#&*s?3ss0?914*ss!"1%&!+ -
?@&m?&!+3?s&3=4#&*s?3ss0?4*ss!"1%&!+
Supple!ent
%electin! the lin# title opens the resource in a ne &roser indo.
Adding SERV1to tnsnames.ora
%ie# a complete e(ample of adding SERV1to 4*s*+ms%&!+.
Launch window
Connect as SYSTEMunder each instance and loo" at the current value of the
SERVICE_NAMESinitialization parameter, and chec" that it is set correctly.
Code
(,>+4 ?@&m?&!+3?*&d#*'& sd 7* .1/1;.>
,>+4 ?@&m?&!+3?*&d#*'& sd 7* ./;.>
DBNAME,>;s 7' 5!; db90_RDB 5!; 7" 5!; 5!; 7"
+33&=41 +9: . ;!#*4 $ . sd .s?1?..?. sd
.s?&!+_db90_?..?.>
I1NAME,$DBNAMEF1F
INAME,$DBNAMEFF
8;&!4 ORACLE_SID,$I1NAME
8;&!4 ORACLE_HOME,?=01?+;;?&!+3?;!&d=4?11%1%0?db_1
$ORACLE_HOME?b#*?s3;3=s 7s ?NOLOG EOJ
s4 @& &*
&**4 s(s4m?&!+31$I1NAME
http://dowindow%28%27../t3/misc/lw_od_orac_a04_it_enust302.html')http://dowindow%28%27../t3/misc/lw_od_orac_a04_it_enust302.html')8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
17/52
s34 #*s4+*_*+m '!&m "$#*s4+*
s@&9 ;+!+m4! s!"#
&**4 s(s4m?&!+31$INAME
s34 #*s4+*_*+m '!&m "$#*s4+*
s@&9 ;+!+m4! s!"#
Supple!ent
%electin! the lin# title opens the resource in a ne &roser indo.
Set initiali5ation para!eter
%ie# a sample
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
18/52
7. on the Cluster Managed Data!ase
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
19/52
connect to the instance #ith a service name #hen R$C removes that service name from
the instance.
$lthough the preferred method to create a service in a R$C environment is to use
SRVCTLor 4nterprise Manager, you can use the DBMS_SERVICECREATE_SERVICE
procedure to create a service in a single*instance environment.
his is !ecause the DBMS_SERVICEpac"age is not integrated #ith &racle Cluster#are to
define preferred and availa!le instances for the service. Ho#ever, you can use the
DBMS_SERVICE%MODIJY_SERVICEprocedure to modify some of the serviceEs attri!utes
in a R$C environment that cannot !e modified using 4nterprise Manager 8for e(ample,
the JAILOVER_RETRIESparameter9.
In the e(ample sho#n, DBMS_SERVICE%MODIJY_SERVICEis used to set the 5oad
Balancing $dvisory goal for SELJ7SERVICE.
Code
8 DBMS_SERVICE%MODIJY_SERVICE )
.SELJ7SERVICE./ .SELJ7SERVICE%=s%&!+3%&m./
5&+3 ,- DBMS_SERVICE%GOAL_SERVICE_TIME/
3b_5&+3 ,- DBMS_SERVICE%CLB_GOAL_SHORT
,uestion
Which statements a!out the DBMS_SERVICEpac"age are true
Options#
'. he DBMS_SERVICEpac"age is fully integrated #ith &racle Cluster#are.
+. he DBMS_SERVICEpac"age provides the a!ility to disconnect all sessions that
connect to the instance #ith a service name #hen R$C removes that service name
from the instance.
7. =sing the MODIJY_SERVICEprocedure #ith this pac"age allo#s for you to modify
some service attri!utes that cannot !e modified using other methods.
. =sing the CREATE_SERVICEprocedure #ith this pac"age is the recommended
method to create a service in a R$C environment.
Answer
Option 1:$ncorrect. The SRVCTLor )nterprise Mana!er utilities should &e used to
create a ser"ice in a R2C en"ironment. This is &ecause the DBMS_SERVICE
pac#a!e is not inte!rated ith ;racle Clusterare to define preferred and
a"aila&le instances for the ser"ice.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
20/52
Option 2:Correct. The DBMS_SERVICEpac#a!e supports the mana!ement of
ser"ices in the data&ase for the purposes of or#load measurement,
mana!ement, prioritiation, and distri&uted transaction mana!ement. This
pac#a!e allos the creation, deletion, startin!, and stoppin! of ser"ices in &oth
R2C and a sin!le instance. 2dditionally, it pro"ides the a&ility to disconnect all
sessions that connect to the instance ith a ser"ice name hen R2C remo"esthat ser"ice name from the instance.
Option 3:Correct. =ou can use the DBMS_SERVICE%MODIJY_SERVICE
procedure to modify some of the ser"iceEs attri&utes in a R2C en"ironment that
cannot &e modified usin! )nterprise Mana!er.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
21/52
recognize how to use services with RAC client applications, Resource Manager, and the
Scheduler
recognize how to set alert thresholds for a RAC service
1. Services with Resource /anager
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
22/52
)CONNECT_DATA,)SERVICE_NAME,ERP
=!3,Fjdb
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
23/52
)ADDRESS,)PROTOCOL,TCP)HOST,*&d7"#;)PORT,11
)CONNECT_DATA,)SERVICE_NAME,ERP
=!3,Fjdbor e(ample, you define the $1 and B$CH services to run on the same instance, and
assign $1 to a high*priority consumer group and B$CH to a lo#*priority consumer
group.
raphic
The percenta!e of the 2P ser"ice in the $nstance resources is G? and thepercenta!e of B2TCH ser"ice in the $nstance resources is 7?.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
24/52
=sing the )eneral ta!!ed page of the Consumer )roup Mappings page, you can set up a
mapping of sessions connecting #ith a service name to consumer groups.
With the a!ility to map sessions to consumer groups !y service, module, and action, you
have greater fle(i!ility #hen it comes to managing the performance of different
application #or"loads.
=sing the 1riorities ta!!ed page of the Consumer )roup Mappings page, you can
change priorities for the mappings that you set up on the )eneral ta!!ed page.
he mapping options correspond to columns in V$SESSION. When multiple mapping
columns have values, the priorities you set determine the precedence for assigning
sessions to consumer groups.
*ote
=ou can also map a ser"ice to a consumer !roup directly on the Create %er"ice
pa!e.
$ssume that your site has t#o consumer groups called HIGH_PRIORITYand
LOQ_PRIORITY. hese consumer groups map to a resource plan for the data!ase that
reflects either the intended ratios or the intended resource consumption.
Before mapping services to consumer groups, you must first create the consumer groups
and the resource plan for these consumer groups. he resource plan can !e priority
!ased or ratio !ased.
hese 15A
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
25/52
he last 15A
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
26/52
By specifyin! the ser"ice here you ant the Io&s to run, the Io& coordinators
&alance the load on your system for &etter performance.
o configure a @o! to run under a specific service, clic" the Lo! Classes lin" in the
Data!ase
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
27/52
*ote
$t is possi&le to set Io& attri&utes, such as INSTANCE_STICKINESS, &y usin! the
SET_ATTRIBUTEprocedure of the DBMS_SCHEDULERP*3%J* pac#a!e.
In this 15A
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
28/52
2uery can use only those instances that are part of the service that #as specified during
the connection.
his is implemented !y automatically modifying the INSTANCE_GROUPSparameter to
reflect SERVICE_NAMESand !y using the service name used to connect to select the
instance group to use for parallel operations 8unless you specifiedPARALLEL_INSTANCE_GROUPto a different value.9
raphic
$n this example, the %hared dis#s is connected to :ode 5, :ode 7, :ode 8, and
:ode . :ode 5, :ode 7, and :ode 8 forms the )RP and all the nodes are
connected to each other. :ode 5 contains one non shaded )RP and to shaded
)RPs. :ode 7 contains three shaded )RPs and :ode 8 contains to shaded
)RPs. The non shaded )RPs are called )xecution coordinator and the shaded
)RPs are called Parallel execution ser"er.
o override this !ehavior, set a value for the INSTANCE_GROUPSand
PARALLEL_INSTANCE_GROUPinitialization parameters.
In that case, a slave appears to !elong under the service even on an instance that does
not support the service, if that slave is !eing used !y a 2uery coordinator that #as started
on an instance that does support that service. $t the end of the e(ecution, the slaves
revert to the default data!ase service.
ote, ho#ever, that INSTANCE_GROUPSis a deprecated initialization parameter and is
retained only for !ac"#ard compati!ility purposes.
,uestion
Which tool ena!les you to manage the relative priority of services #ithin an
instance !y !inding services directly to consumer groups
Options#
'. DBC$
+. SRVCTL
7.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
29/52
Option 1:$ncorrect. The DBC2 and the SRVCTLcommand are used to create a
ser"ice in R2C. When selectin! a ser"ice to &e used ith client applications, this
ser"ice must match the ser"ice that as created usin! these methods.
Option 2:$ncorrect. The DBC2 and the SRVCTLcommand are used to create a
ser"ice in R2C. When selectin! a ser"ice to &e used ith client applications, thisser"ice must match the ser"ice that as created usin! these methods.
Option 3:$ncorrect. The %cheduler can use the ser"ices and the &enefits they
offer in a R2C en"ironment. The ser"ice that a specific Io& class uses is defined
hen the Io& class is created. Durin! execution, Io&s are assi!ned to Io& classes
and Io& classes run ithin ser"ices. +sin! ser"ices ith Io& classes ensures that
the or# of the %cheduler is identified for or#load mana!ement and performance
tunin!.
Option 4:Correct. The Resource Mana!er ena&les you to identify or# &y usin!
ser"ices. $t mana!es the relati"e priority of ser"ices ithin an instance &y &indin!ser"ices directly to consumer !roups. When a client connects &y usin! a ser"ice,
the consumer !roup is assi!ned transparently at connect time. This ena&les the
Resource Mana!er to mana!e the or# re'uests &y ser"ice in the order of their
importance.
Correct answer-s#
. Resource Manager
%. Setting service thresholds using 6/
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
30/52
C3 ti!e )or calls
C1= time for calls is the CPU_TIME_PER_CALL.
he $WR monitors the service time and pu!lishes $WR alerts #hen the performance
e(ceeds the thresholds. :ou can then respond to these alerts !y changing the priority of a
@o!6 stopping overloaded processes6 or relocating, e(panding, shrin"ing, starting, orstopping a service. =sing automated tas"s, you can automate the reaction. his ena!les
you to maintain service 2uality despite changes in demand.
Code
SELECT s!"#_*+m/ 3+;sd;!+33/ ;=;!+33
JROM V$SERVICEMETRIC
he SELECTstatement gives you the accumulated instance statistics for elapsed time
and for C1=*used metrics for each service for the most recent G/*second interval. >or thelast*hour history, loo" at V$SERVICEMETRIC_HISTORY.
Code
SELECT s!"#_*+m/ 3+;sd;!+33/ ;=;!+33
JROM V$SERVICEMETRIC
:ou can set threshold values for your services from the Data!ase Instance Metric and
1olicy
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
31/52
:ou can directly set service thresholds from the Create
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
32/52
Answer
Option 1:Correct. $n )nterprise Mana!er, you can set threshold "alues for your
ser"ices from the Data&ase $nstance Metric and Policy %ettin!s pa!e. =ou can
access this pa!e from the Data&ase $nstances Home pa!e &y clic#in! the Metric
and Policy Settingslin# in the Related *in#s section.
+sin! the Metric and Policy %ettin!s pa!e, you can set the %er"ice CP+ Time per
user call/ and %er"ice Response Time per user call/ metrics for your ser"ices.
Option 2:$ncorrect. The thresholds must &e created for each R2C instance that
potentially supports the ser"ice.
Option 3:Correct. =ou can explicitly specify to metric thresholds for each
ser"ice on a particular instance the response time for calls,
ELAPSED_TIME_PER_CALL, and CP+ time for calls, CPU_TIME_PER_CALL.
Option 4:$ncorrect. The V$SERVICEMETRIC_HISTORY"ie !i"es you the
accumulated instance statistics for elapsed time and for CP+(used metrics for
each ser"ice for the last(hour history.
Correct answer-s#
'. hreshold values can !e set for your services using 4nterprise Manager
7. #o metric thresholds can !e e(plicitly specified for each service on a particular
instance
9. Setting service thresholds )or RAC
he goal of this demonstration is to set thresholds to service
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
33/52
>rom the Cluster Data!ase Home page, clic" the lin" corresponding to your first instance
in the Instances ta!le. his is the instance currently running RDBBKRDBB'.
raphic
The column headin!s of the $nstances ta&le are :ame, %tatus, 2lerts, Policy
Aiolations, Compliance %core @/, 2%M $nstance, and 2DDM
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
34/52
&n the Confirmation page, you can see an =pdate succeeded message. Clic" O2. his
ta"es you !ac" to the Data!ase Instance page.
=se Data!ase Control to print the rom the Data!ase Instance Home page, clic" All /etrics in the Related 5in"s section at the
!ottom of the page.
The 2ll Metrics lin# is present under the Related *in#s section.
+. &n the $ll Metrics page, e(pand the Database Serviceslin". Clic" the Service Response :i!e -per
user call -!icroseconds lin".
The other option a"aila&le under the Data&ase %er"ices lin# is %er"ice CP+ Time per user call/
microseconds/.
7. &n the
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
35/52
$fter clic"ing O2, on the Confirmation page, you should see an =pdate succeeded
message. Clic" O2.
Su!!ar"
he $utomatic Wor"load Repository or $WR manages services. When service responsetime thresholds are e(ceeded, $WR alerts the DB$. he Resource Manager helps you to
identify #or" !y using services. It manages the relative priority of services #ithin an
instance !y !inding services directly to consumer groups.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
36/52
e(ecuting. 5i"e#ise, ACTIONshould !e set to a specific action or tas" that a user is
performing #ithin a module 8for e(ample, entering a ne# customer.9
$nother aspect of this #or"load aggregation is tracing !y service. he traditional method
of tracing each session produces trace files #ith
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
37/52
SERVICE_NAME?MODULE?ACTION.
he default is to trace for all instances that access the data!ase. $ parameter is provided
that restricts tracing to specified instances #here poor performance is "no#n to e(ist.
his procedure also gives you the option of capturing relevant #aits and !ind varia!le
values in the generated trace files.
SERV_MOD_ACT_TRACE_DISABLEdisa!les the tracing at all ena!led instances for a
given com!ination of service, module, and action.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
38/52
Correct answer-s#
+. he SERV_MOD_ACT_TRACE_ENABLEprocedure ena!les tracing for services
7. &n each instance, important statistics and #ait events are automatically
aggregated and collected !y
service
Here are some e(amples of service aggregation.
Code
8 DBMS_MONITOR%SERV_MOD_ACT_STAT_ENABLE)7
.AP./ .PAYMENTS.
8 DBMS_MONITOR%SERV_MOD_ACT_STAT_ENABLE)7
.AP./ .PAYMENTS./ .UERY_DELINUENT.
8 DBMS_MONITOR%SERV_MOD_ACT_TRACE_ENABLE).AP.
8 DBMS_MONITOR%SERV_MOD_ACT_TRACE_ENABLE)7
.AP./ .PAYMENTS./ .UERY_DELINUENT.
e2e DBS_ONITOR.SERV_OD_ACT_STAT_ENABLE(
3AP34 3PA5ENTS3)6
This code &e!ins collectin! statistics for the PAYMENTSmodule ithin the 2P ser"ice.
e2e DBS_ONITOR.SERV_OD_ACT_STAT_ENABLE(
3AP34 3PA5ENTS34 378ER5_DELIN78ENT3)6
This code collects statistics only for the UERY_DELINUENTpro!ram that runs in the
PAYMENTSmodule under the 2P ser"ice. This ena&les statistics collection on specific
tas#s that run in the data&ase.
e2e DBS_ONITOR.SERV_OD_ACT_TRACE_ENABLE(3AP3)6
$n this code, all sessions that lo! in under the 2P ser"ice are traced. 2 trace file is created
for each session that uses the ser"ice, re!ardless of the module and action. To &e precise,
you can trace only specific tas#s ithin a ser"ice.
e2e DBS_ONITOR.SERV_OD_ACT_TRACE_ENABLE(
3AP34 3PA5ENTS34 378ER5_DELIN78ENT3)6$n this code all sessions of the 2P ser"ice that execute the UERY_DELINUENTaction
ithin the PAYMENTSmodule are traced.
racing !y service, module, and action ena!les you to focus your tuning efforts on
specific
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
39/52
complements collecting statistics !y service, module, and action !ecause relevant #ait
events for an action can !e identified.
he 4!sssutility consolidates trace output from selected trace files on the !asis of
several criteria F session ID, client ID, service name, action name, and module name.
$fter 4!sssmerges the trace information into a single output file, the output file can !eprocessed !y 4:;!&'.
When using the DBMS_MONITOR%SERV_MOD_ACT_TRACE_ENABLE procedure, tracing
information is present in multiple trace files and you must use the 4!ssstool to collect
it into a single file.
he 4!sssutility is useful for consolidating the tracing of a particular session or
service for performance or de!ugging purposes.
racing a specific session is usually not a pro!lem in the dedicated server model !ecause
a single dedicated process serves a session during its lifetime. $ll the trace informationfor the session can !e seen from the trace file !elonging to the dedicated server serving
it.
Ho#ever, tracing a service might !ecome a comple( tas" even in the dedicated server
model.
Moreover, in a shared*server configuration, a user session is serviced !y different
processes from time to time. he trace pertaining to the user session is scattered across
different trace files !elonging to different processes. his ma"es it difficult to get a
complete picture of the life cycle of a session.
he service, module, and action information are visi!le in V$SESSIONand
V$ACTIVE_SESSION_HISTORY.
he call times and performance statistics are visi!le in V$SERVICE_STATS,
V$SERVICE_EVENT, V$SERVICE_QAIT_CLASS, V$SERVICEMETRIC, and
V$SERVICEMETRIC_HISTORY.
When statistics collection for specific modules and actions is ena!led, performance
measures are visi!le at each instance in V$SERV_MOD_ACT_STATS.
here are more than 7// performance*related statistics that are trac"ed and visi!le in
V$SYSSTAT. &f these, +; statistics are trac"ed for services. o vie# the statistics
measured for services, run this 2uery.
Code
SELECT DISTINCT s4+4_*+m JROM "$s!"#_s4+4s
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
40/52
&f the +; statistics, DB4#mand DBCPUare #orth mentioning. DB4#mis a statistic that
measures the average response time per call. It represents the actual #all cloc" time for
a call to complete. DBCPUis an average of the actual C1= time spent per call.
he difference !et#een response time and C1= time is the #ait time for the service. $fter
the #ait time is "no#n, and if it consumes a large percentage of response time, then youcan trace at the action level to identify the #aits.
*ote
DBA_ENABLED_AGGREGATIONSdisplays information a&out ena&led on(demand
statistic a!!re!ation. DBA_ENABLED_TRACESdisplays information a&out ena&led
traces.
:ou can use tracing to de!ug performance pro!lems. race*ena!ling procedures have
!een
implemented as part of the DBMS_MONITORpac"age. hese procedures ena!le tracing
glo!ally for a data!ase.
:ou can use tracing to de!ug performance pro!lems. race*ena!ling procedures have
!een implemented as part of the DBMS_MONITORpac"age. he follo#ing procedures
ena!le and disa!le tracing for a data!ase and a session3
Code
EXEC dbms_m&*#4&!%DATABASE_TRACE_ENABLE)TRUE/TRUE
EXEC dbms_m&*#4&!%DATABASE_TRACE_DISABLE)
EXEC dbms_m&*#4&!%SESSION_TRACE_ENABLE)sss#&*_#d ,-
/ s!#+3_*=m ,- 0/ 9+#4s ,- TRUE/ b#*ds ,-
JALSE
EXEC dbms_m&*#4&!%SESSION_TRACE_DISABLE)sss#&*_#d
,- / s!#+3_*=m ,- 0
DATABASE_TRACE_ENABLE
:ou can use the DATABASE_TRACE_ENABLEprocedure to ena!le instance #ide session*
level
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
41/52
=se the DATABASE_TRACE_DISABLEprocedure to disa!le
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
42/52
he follo#ing are descriptions of the management tas"s related to services in a R$C
environment3
disabling a service
Disa!ling a service is used to disa!le a specified service on all or specified instances. he
disa!le state is used #hen a service is do#n for maintenance to prevent inappropriate
automatic &racle Cluster#are restarts. Disa!ling an entire service affects all the instances
!y disa!ling the service at each instance.
enabling a service
4na!ling a service is used to ena!le a service to run under &racle Cluster#are for
automatic restart and redistri!ution. :ou can ena!le a service even if that service is
stopped. 4na!le is the default value #hen a service is created. If the service is already
ena!led, then the command is ignored. 4na!led services can !e started, and disa!led
services cannot !e started.
4na!ling an entire service affects the ena!ling of the service over all the instances !y
ena!ling the service at each instance.
starting a service& and
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
43/52
his operation can force sessions to !e disconnected transactionally. he relocated
service is temporary until you permanently modify the configuration.
!odi)"ing a service& and
Modifying a service configuration is used to permanently modify a service configuration.
he change ta"es effect #hen the service is restarted later. his allo#s you to move aservice from one instance to another.
$dditionally, this command changes the instances that are to !e the preferred and
availa!le instances for a service.
displa"ing the current state
:ou can get status information !y displaying the current state of a named service.
,uestion
Which statements a!out the management of services in a R$C environment aretrue
Options#
'. 4na!ling a service that has already !een ena!led #ill produce an error message
+. Relocating a service is temporary until you permanently modify the configuration
7. Removing a service can only !e performed once the corresponding service has
already !een stopped
. 4(plicitly stopping a service #ill prevent it from !eing restarted automatically as a
result of another planned operation
Answer
Option 1:$ncorrect. )na&lin! a ser"ice is used to allo a ser"ice to run under
;racle Clusterare for automatic restart and redistri&ution. =ou can ena&le a
ser"ice e"en if that ser"ice is stopped. )na&le is the default "alue hen a ser"ice
is created. $f the ser"ice is already ena&led, then the command is i!nored.
)na&led ser"ices can &e started, and disa&led ser"ices cannot &e started.
)na&lin! an entire ser"ice affects the ena&lin! of the ser"ice o"er all the instances
&y ena&lin! the ser"ice at each instance.
Option 2:Correct. Relocatin! a ser"ice mo"es a ser"ice from a source instance
to a tar!et instance. The tar!et instance must &e on the preferred or a"aila&le list
for the ser"ice. This operation can force sessions to &e disconnected
transactionally. The relocated ser"ice is temporary until you permanently modify
the confi!uration.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
44/52
Option 3:Correct. Remo"in! a ser"ice means that you remo"e its confi!uration
from the cluster data&ase on all or specified instances. =ou must first stop the
correspondin! ser"ice &efore you can remo"e it.
Option 4:$ncorrect. %toppin! is used to stop one or more ser"ices !lo&ally across
the cluster data&ase, or on the specified instance. ;nly ;racle Clusterare
ser"ices that are startin! or ha"e started are stopped. =ou should disa&le a
ser"ice that you intend to #eep stopped after you stop that ser"ice &ecause if the
ser"ice is stopped and is not disa&led, then it can &e restarted automatically as a
result of another planned operation. This operation can force sessions to &e
disconnected transactionally.
Correct answer-s#
+. Relocating a service is temporary until you permanently modify the
configuration
7. Removing a service can only !e performed once the corresponding service has
already !een stopped
When you use the DBC$ to add services, the DBC$ also configures the net service
entries for these services and starts them. When you use the DBC$ to remove services, it
stops the service, removes the &racle Cluster#are resource for the service, and removes
the net service entries.
When you create a service #ith SRVCTL, you must start it #ith a separate SRVCTL
command. SRVCTLdoes not support concurrent e(ecutions of commands on the same
o!@ect. herefore, run only one SRVCTLcommand at a time for each data!ase, service,
or other o!@ect.
*ote
The s!"43s4&;d+4+b+scommand implicitly does a s!"43s4&;
s!"#s&ecause ser"ices are dependent on data&ases./ Hoe"er, a
su&se'uent s!"43start data&ase re'uires an explicit s!"43s4+!4s!"#.
:ou can use 4nterprise Manager to manage services #ithin a )=I frame#or". he
Cluster Managed Data!ase
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
45/52
$n the Cluster Mana!ed Data&ase %er"ices pa!e, the messa!e LThe folloin!
shos the status of all cluster mana!ed ser"ices defined for the current data&ase.
%elect a ser"ice to mana!e the states of its instances.L is displayed. There are
three &uttons %tart, %top, and Test Connection and a drop(don list named
2ctions, hich has the Mana!e option selected. Theres also a ta&le on the pa!e
ith ei!ht columns %elect, %er"ice :ame, %tatus, Runnin! $nstances, Response
Time milliseconds/*ast ? Minutes/, @CP+ *oad *ast ? Minutes/, %er"ice
related alerts amon! all $nstances, and %tatus Details. The F
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
46/52
*ote
This pa!e also displays the T2< policy set for this particular ser"ice. =ou can
directly edit the ser"ices properties, or lin# to the Top Consumers pa!e.
his e(ample demonstrates some management tas"s #ith services !y using SRVCTL.
$ssume that an APservice has !een created #ith four preferred instances F RAC01,
RAC0, RAC0, and RAC0. $n availa!le instance, RAC0, has also !een defined for AP.
Code
$ s!"43 s4+!4 s!"# 6d PROD 6s AP
$ s!"43 s4&; s!"# 6d PROD 6s AP 6# RAC0/RAC0
$ s!"43 d#s+b3 s!"# 6d PROD 6s AP 6# RAC0
$ s!"43 m&d#'( s!"# 6d PROD 6s AP 7# RAC0 6!
9 sr!t* start ser!"e :d PROD :s AP
$n this code, the APser"ice is started on all preferred instances. $f any of the preferred or
a"aila&le instances that support APare not runnin! &ut are ena&led, then they are started.
9 sr!t* sto# ser!"e :d PROD :s AP :" RAC;&4RAC;'
$n this code the s4&;command stops the APser"ice on instances RAC0and RAC0. The
instances themsel"es are not shut don, &ut remain runnin! possi&ly supportin! other
ser"ices. The APser"ice continues to run on RAC01and RAC0.
9 sr!t* d"sa-*e ser!"e :d PROD :s AP :" RAC;'
The intention mi!ht ha"e &een to perform maintenance on RAC0, and so the APser"iceas disa&led on that instance to pre"ent automatic restart of the ser"ice on that instance.
The ;CR records the fact that APis disa&led for RAC0. Thus, ;racle Clusterare ill not
run APon RAC0until the ser"ice is ena&led later.
9 sr!t* mod"
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
47/52
his e(ample presents a possi!le change in a service configuration #ith a minimum do#n
time for your #or"load.
his initial configuration corresponds to the 1ayday period. During the Holiday season,
you need to change your services configuration so that DW is no# run on the first four
instances, and HRon the remaining t#o.
here are four SRVCTLcommands you need to e(ecute to s#itch your services
configuration.
ote that the Fn option of the s!"43m&d#'(s!"#commands is used to remove
the initial configuration of your services. he changes ta"e effect #hen the services are
restarted ne(t. :ou can also use the Ff option for these commands so that the ne(t s4&;
command disconnects corresponding sessions.
Here, you prefer using the Ff option #ith the s!"43s4&;s!"#command, #hichstop the services glo!ally on your cluster. :ou then use the s!"43s4+!4s!"#
command to use the ne#ly created service configuration.
Code
s!"43 m&d#'( s!"# 6d PROD 6s DQ 6* 6# I1/I/I/I 6+
I/I
s!"43 m&d#'( s!"# 6d PROD 6s HR 6* 6# I/I 6+
I1/I/I/I
s!"43 s4&; s!"# 6d PROD 6s DQ/HR 7'
s!"43 s4+!4 s!"# 6d PROD 6s DQ/HR
(. /onitor services using Database Control
:ou use the Data!ase Control to determine the amount of resources used !y sessions
e(ecuting under a particular service. :ou also use Data!ase Control to relocate a service
to another instance.
>rom a terminal session connected to node', using
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
48/52
The 'uery that you execute after you determine the instance on hich your
session is currently runnin! is the folloin!-
select countN/ from d&ao&Iects,d&ao&Iects,d&ao&Iects>
Code
(,>+4 ?@&m?&!+3?*&d#*'& sd 7* .1/1;.>
,>+4 ?@&m?&!+3?*&d#*'& sd 7* ./;.>
DBNAME,>;s 7' 5!; db90_RDB 5!; 7" 5!; 5!; 7"
+33&=41 +9: . ;!#*4 $ . sd .s?1?..?. sd
.s?&!+_db90_?..?.>
I1NAME,$DBNAMEF1F
INAME,$DBNAMEFF
8;&!4 ORACLE_SID,$I1NAME
8;&!4 ORACLE_HOME,?=01?+;;?&!+3?;!&d=4?11%1%0?db_1
$ORACLE_HOME?b#*?s3;3=s 7s ?NOLOG EOJ
&**4 j'"?j'"SERV1
s34 #*s4+*_*+m '!&m "$#*s4+*
s34 &=*4)W '!&m db+_&bj4s/db+_&bj4s/db+_&bj4s
INSTANCE_NAME7777777777777777
RDB
2
$fter a #hile, go to the Data!ase Control op Consumers page from the Cluster
Data!ase Home page. Connect as user SYS. hen chec" that SERV1is using more and
more resources. he follo#ing are the steps to do this3
'. from the Cluster Data!ase Home page, clic" the er)or!anceta!
The Cluster Data&ase Home pa!e screen has ta&s such as Home, Performance, 2"aila&ility,
%er"er, %chema, Data Mo"ement, %oftare and %upport, and Topolo!y. The Performance ta& isselected.
+. on the 1erformance page, clic" the :opConsu!erslin" in the $dditional Monitoring 5in"s section
$n addition to Top Consumers, the 2dditional Monitorin! *in#s section also has lin#s named Top 2cti"ity,
Cluster Cache Coherency, Data&ase *oc#s, and Top %e!ments.
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
49/52
7. this ta"es you to the op Consumers page #ith the Overviewta! selected
$n addition to ;"er"ie, the Top Consumers pa!e has ta&s named Top %er"ices, Top Modules, Top
2ctions, Top Clients, and Top %essions.
. on the &vervie# page, you can vie# the op
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
50/52
Supple!ent
%electin! the lin# title opens the resource in a ne &roser indo.
/onitor services in S,L>lus
%ie# information on monitoring services using 5"$s!"#_s4+4sfrom a
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
51/52
Su!!ar"
:ou can manage services using 4nterprise Manager, SRVCTL, and DBC$. hey allo#
you to ena!le, disa!le, start, stop, remove, relocate, and modify services. :ou can use
4nterprise Manager to manage services #ithin a )=I frame#or". When you create a
service using SRVCTL, you should run only one SRVCTLcommand at a time for each
data!ase, service, or other o!@ects. When you add a service using the DBC$, the DBC$
configures the net service entries for that service and starts it.
:ou can also monitor services using 4nterprise Manager Data!ase Control. It helps you
to determine the amount of resources used !y sessions e(ecuting under a particular
service.
Creating and /anaging Services in RAC
Learning Objective
After completing this topic, you should be able to
create and manage services in RAC
6?ercise overview
:ou are the data!ase administrator for an &racle Data!ase ''!R$C data!ase. :ou #ant
to create a service to organize the universe of #or" e(ecution #ithin the data!ase to
ma"e that #or" more managea!le, measura!le, tuna!le, and recovera!le. :ou also #antto monitor the service using alert thresholds.
In this e(ercise, youEre re2uired to create a service for the RDBB' instance and monitor
service response time for the instance.
his involves the follo#ing tas"s3
creating a service using 4M
setting thresholds for a service
:ask 1# Creating a service using 6/
=se 4nterprise Manager to create a service called
8/10/2019 Oracle Database 11g Configure Manage and Use Services in RAC
52/52
Steps list
Instructions
'. Clic" the Availabilit"ta!
+. Clic" the Cluster /anaged Database Serviceshyperlin" in the
Recommended