Вы находитесь на странице: 1из 51

http://dbaregistry.blogspot.

in/search/label/*%20Home
%20*
Welcome to Oracle DBA or!m Home
Server Administration, Performance Tuning
Oracle Wait Events
Latches and Latch Contention
How To find The Row Which is Locked by a Session
SQL : Usefl scri!ts for "#$
Oracle Real Application Clusters (RAC)
Oracle R$C %nterview &estions
R$C Load #alancin'( T$) ( )$*
When drin' the installation !rocess are clsterware co+!onents created
Ste!s to +ove OCR and ,otin' disk
ste!s to Restore R$C "atabase to Sin'le %nstance
Ste! to +i'rate crs resorces to new server-
Backup & Recover, R!A"
Ste!s to recover .ri+ary/s "atafile fro+ Standby
Ste!s to recover Standby after +issin' archivelo'
back!0based d!lication in 112R3
Oracle ##g ne$ features
11' *ew )eatres in "ata'ard
11' *ew )eatres in R4$*
11' *ew )eatres 0 %nvisible %nde5es
11' *ew )eatres for $44
11' *ew )eatres in data!+!
11' *ew )eatres Read only tables
%ata &uard
"ata'ard failover test with flashback
Server 'tilities ((e)p*imp , e)pdp , impdp, S+,-,oader (((
How to chan'e the table na+e drin' i+!ort6
Oracle Wait "#ents
Before looking into wait events, let us understand various state of user process.
Oracle user process is typically in one of the three states:
a. Idle wait. e.g. 'SQL!et "essage fro" client'
#. $unning code % &ither on '() or on a run *ueue. Oracle itself does not know if it is
on%'() or +ust on a run *ueue.
c. ,aiting
i. for so"e resource to #eco"e availa#le. e.g. en*ueue -lock. or a latch
ii. for an activity to co"plete that it has re*uested. Like an IO read re*uest.
Oracle has a set of ',ait &vents' for activities in 'a' and 'c', and record '() utili/ation
for '#'.
0his is #est illustrated with a si"plified e1a"ple of few seconds in the life of an Oracle
shadow process:
State !otes...
22222 22222222
I3L& : ,aiting for 'SQL!et "essage fro" client'. $eceives a SQL!et packet
re*uesting 'parse4e1ecute' of a state"ent
O! '() : decodes the SQL!et packet.
,5I0I!6 : ,aits for 'latch free' to o#tain the a 'li#rary cache' latch 6ets the latch.
O! '() : Scans for the SQL state"ent in the shared pool, finds a "atch, frees latch ,
sets up links to the shared cursor etc.. 7 #egins to e1ecute.
,5I0I!6 : ,aits for 'd# file se*uential read' as we need a #lock which is not in the
#uffer cache. Ie: ,aiting for an IO to co"plete.
O! '() : Block read has co"pleted so e1ecution can continue. 'onstructs a SQL!et
packet to send #ack to the user containing the first row of data.
,5I0I!6 : ,aits on 'SQL!et "essage to client' for an acknowledge"ent that the
SQL!et packet was relia#ly delivered.
I3L& : ,aits on 'SQL!et "essage fro" client' for the ne1t thing to do.
8ost co""on wait events are..
B!$$er B!sy %aits/&ache B!$$ers &hains 'atch %aits
90his wait happens when a session wants to access a data#ase #lock in the #uffer cache
#ut it cannot as the #uffer is :#usy:. 0he two "ain cases where this can occur are:
;.5nother session is reading the #lock into the #uffer
<.5nother session holds the #uffer in an inco"pati#le "ode to our re*uest
'ache Buffers 'hains Latch waits are caused #y contention where "ultiple sessions
waiting to read the sa"e #lock.
0ypical solutions are:%
Look at the e1ecution plan for the SQL #eing run and try to reduce the gets per
e1ecutions which will "ini"ise the nu"#er of #locks #eing accessed and therefore
reduce the chances of "ultiple sessions contending for the sa"e #lock.
Increase the ('0=$&& for the ta#le storage para"eter. 0his will result in less rows per
#lock.
'onsider i"ple"enting reverse key inde1es. -if range scans aren't co""only used
against the seg"ent.
In v>session?wait, the (;, (<, and (@ colu"ns identify the file nu"#er, #lock nu"#er,
and #uffer #usy reason codes, respectively.
()ead By Other *ession( %ait e#ent.
,hen user sessions re*uest for data, Oracle will first read the data fro" disk into the
data#ase #uffer cache. If two or "ore sessions re*uest the sa"e data, the first session
will read the data into the #uffer cache while other sessions wait. In previous versions,
this wait was classified under the :#uffer #usy waits: event. Aowever, in Oracle ;Bg and
higher, this wait ti"e is now #roken out into the :read #y other session: wait event.
&1cessive waits for this event are typically due to several processes repeatedly reading
the sa"e #locks, e.g. "any sessions scanning the sa"e inde1 or perfor"ing full ta#le
scans on the sa"e ta#le. 0uning this issue is a "atter of finding and eli"inating this
contention.
,hen a session is waiting on this event, an entry will #e seen in the v>session?wait
syste" view giving "ore infor"ation on the #locks #eing waited for:
S&L&'0 p; :fileC:, p< :#lockC:
=$O8 v>session?wait ,A&$& event D 'read #y other session'E
If infor"ation collected fro" the a#ove *uery repeatedly shows that the sa"e #lock -or
range of #locks. is e1periencing waits, this indicates a :hot: #lock or o#+ect.
0he following *uery will give the na"e and type of the o#+ect:
S&L&'0 owner, seg"ent?na"e, seg"ent?type
=$O8 d#a?e1tents ,A&$& file?id D 7file
5!3 7#lock B&0,&&! #lock?id 5!3 #lock?id F #locks % ;
'og ile *ync %aits
Log file sync waits occur when sessions wait for redo data to #e written to disk.
0ypically this is caused #y slow writes or co""itting too fre*uently in the application.
db $ile se+!ential read
,ait for an I4O read re*uest to co"plete. 5 se*uential read is usually a single%#lock
read. 0his differs fro" :d# file scattered read: in that a se*uential read reads data into
contiguous "e"ory -whilst a scattered read reads "ultiple #locks and scatters the"
into different #uffers in the S65..
db $ile scattered read
0his wait happens when a session is waiting for a "ulti#lock IO to co"plete. 0his
typically occurs during full ta#le scans or inde1 fast full scans. Oracle reads up to
3B?=IL&?8)L0IBLO'G?$&53?'O)!0 consecutive #locks at a ti"e and scatters the"
into #uffers in the #uffer cache.
direct path read
3irect path reads are generally used #y Oracle when reading directly into (65 "e"ory
-as opposed to into the #uffer cache..
0his style of read re*uest is typically used for:
Sort I4Os when "e"ory Sort areas are e1hausted and te"porary ta#lespaces are used
to perfor" the sort
(arallel Query slaves.
direct path %rite
0his wait is seen for:
3irect load operations -eg: 'reate 0a#le as Select -'05S. "ay use this.
(arallel 38L operations
Sort IO -when a sort does not fit in "e"ory.
db $ile parallel %rite
3B, waits on :d# file parallel write: when waiting for a parallel write to files and #locks
to co"plete.
0he d# file parallel write occurs when the process, typically 3B,$, has issued "ultiple
I4O re*uests in parallel to write dirty #locks fro" the #uffer cache to disk, and is
waiting for all re*uests to co"plete.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
,-*ession.%ait.history
=ro" Oracle 3ata#ase ;Bg a new view H>Session?wait?history will allow us to see the
last few wait events a session waited on.
0he last ;B wait events that a session e1perienced can #e displayed using the
v>session?wait?history view. 0he session has to #e currently active. Once the session
ends this infor"ation is not availa#le.
,e can use the se*C colu"n to sort the wait events into the order in which the wait
events occurred for the session.
La#els: Interview Questions : ,ait &vents
'atches and 'atch &ontention
What is a latch/
Latches are low level seriali/ation "echanis"s used to protect shared data structures in
the S65. 5 process ac*uires a latch when working with a structure in the S65. It
continues to hold the latch for the period of ti"e it works with the structure
5 latch is a type of a lock that can #e very *uickly ac*uired and freed.
Latches are typically used to prevent "ore than one process fro" e1ecuting the sa"e
piece of code at a given ti"e.
List of latches that are of most concern to a DBA
B0") &A&H" 'A1&H"*:
0here are two "ain latches which protect data #locks in the #uffer cache.
% Cache buffers chains latch :% 0his latch is ac*uired whenever a #lock in the #uffer
cache is accessed.
'ache Buffers 'hains Latch waits are caused #y contention where "ultiple sessions
waiting to read the sa"e #lock.
$educe logical I4O rates #y tuning and "ini"i/ing the I4O re*uire"ents of the SQL
involved.
Identify and reduce the contention for hot #locks.
% Cache buffers LRU chain latch:% 0his latch is ac*uired in order to introduce a new
#lock into the #uffer cache and when writing a #uffer #ack to disk.
$educe contention for this #y increasing the si/e of the #uffer cache
)"DO'O2 B0") 'A1&H"*:
% Redo allocation latch:% 0he redo allocation latch is ac*uired in order to allocate
space within the log #uffer.
Increase the si/e of the LO6?B)==&$
$educe the load of the log #uffer using !OLO66I!6 features when possi#le.
% Redo copy latch:%0his latch is used to write redo records into the redolog #uffer.
'ontention can #e reduced #y increasing the value of LO6?SI8)L05!&O)S?'O(I&S in
"ulti%cpu syste".
'3B)A)4 &A&H":
% Library cache latch:% 0he li#rary cache latch "ust #e ac*uired in order to add a new
state"ent to the li#rary cache. %
&nsure that the application is reusing as "uch as possi#le SQL state"ent.
If the application is already tuned, increase the SA5$&3?(OOL?SII&.
% Library cache pin latch:% 0his latch is ac*uired when a state"ent in the li#rary
cache is ree1ecuted.
*HA)"D 5OO' )"'A1"D 'A1&H"*
% Shared pool latch: ,hile the li#rary cache latch protects operations withing the
li#rary cache, the shared pool latch is used to protect critical operations when allocating
and freeing "e"ory in the shared pool.
,ays to reduce the shared pool latch are, avoid hard parses when possi#le.
Row cache objects latch:% 0his latch co"es into play when user processes are
atte"pting to access the cached data dictionary values.
$educe contention for this latch is #y increasing the si/e of the shared pool
-SA5$&3?(OOL?SII&.
Ho% 1o $ind 1he )o% Which is 'oc6ed by a *ession
,hich row is locked in a certain ta#le can only #e *ueried when other session is waiting
for the row involved.
'heck #elow link for the s*l to find.
Aow 0o Identify 0he $ow ,hich is Locked #y a Session
0se$!l *7' *cripts
0se$!l *7' *cripts $or day8to8day DBA tas6s.
*7' to $ind the loc6ed ob9ect and session that loc6ed the ob9ect.
$un #elow script when user co"plaints that update state"ent hangs...
colu"n LO'G&3?OBJ&'0 for"at 5@K wrapped
colu"n O$5'L&?)S&$!58& for"at 5;L wrapped
colu"n OS?)S&$?!58& for"at 5;< wrapped
colu"n S&SSIO!?I3 for"at MMMMMM wrapped
colu"n SI!'& for"at 5<;
select o.O,!&$ NN '.' NN o.OBJ&'0?!58& as LO'G&3?OBJ&'0,
lo.O$5'L&?)S&$!58&,
lo.OS?)S&$?!58&,
lo.S&SSIO!?I3,
lo.($O'&SS,
case lo.LO'G&3?8O3&
when B then 'none'
when ; then 'null -!)LL.'
when < then 'row%S -SS.'
when @ then 'row%O -SO.'
when P then 'share -S.'
when K then 'S4$ow%O -SSO.'
when Q then 'e1clusive -O.'
end as LO'G&3?8O3&,
cast-sysdate%-'0I8&4-<PQBQB.. as ti"esta"p-B.. as SI!'&
fro" 3B5?OBJ&'0S o,
H>LO'G&3?OBJ&'0 lo,
H>LO'G l
where o.OBJ&'0?I3 D lo.OBJ&'0?I3
and lo.OBJ&'0?I3 D l.I3; and lo.S&SSIO!?I3 D l.SI3
order #y LO'G&3?OBJ&'0, O$5'L&?)S&$!58&, OS?)S&$?!58&, S&SSIO!?I3E
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
When a session is %aiting $or loc6: ho% to $ind the bloc6ing session and
%aiting $or ob9ect and ro% ...
0o find who is #locking R
select s#.userna"e NN 'S' NN s#."achine
NN ' - SI3D' NN s#.sid NN ' . is #locking '
NN sw.userna"e NN 'S' NN sw."achine NN ' - SI3D' NN sw.sid NN ' . ' 5S #locking?status
fro" v>lock l#, v>session s#, v>lock lw, v>session sw
where s#.sidDl#.sid and sw.sidDlw.sid
and l#.BLO'GD; and lw.re*uest T B
and l#.id; D lw.id;
and lw.id< D lw.id< E
,aiting for o#+ect and rowid ...
select o.o#+ect?na"e, row?wait?o#+C, row?wait?fileC, row?wait?#lockC,
row?wait?rowC,
d#"s?rowid.rowid?create - ;, o.3505?OBJ&'0?I3, $O,?,5I0?=IL&C,
$O,?,5I0?BLO'GC, $O,?,5I0?$O,C .
fro" v>session s, d#a?o#+ects o where sidD7waiting?sid and s.$O,?,5I0?OBJC D
o.OBJ&'0?I3 E

,aiting for row..

select fro" ta#le?na"e?fro"?a#ove where rowid D7rowid?returned

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1o chec6 datag!ard
,hen you get alert that stand#y data#ase is out of sync..
Run this at Primary
set pages ;BBB
set lines ;<B
colu"n 3&S0?!58& for"at a<B
colu"n 3&S0I!50IO! for"at a@K
colu"n 5$'AIH&$ for"at a;B
colu"n 05$6&0 for"at a;K
colu"n status for"at a;B
colu"n error for"at a;K
select 3&S0?I3,3&S0?!58&,3&S0I!50IO!,05$6&0,S050)S,&$$O$ fro"
v>archive?dest
where 3&S0I!50IO! is !O0 !)LL
4
select ads.dest?id,"a1-se*uenceC. :'urrent Se*uence:,
"a1-log?se*uence. :Last 5rchived:
fro" v>archived?log al, v>archive?dest ad, v>archive?dest?status ads
where ad.dest?idDal.dest?id and al.dest?idDads.dest?id group #y ads.dest?idE
Run this at Standby
select "a1-al.se*uenceC. :Last Se* $ecieved: fro" v>archived?log al
4
select "a1-al.se*uenceC. :Last Se* 5pllied: fro" v>archived?log al
where applied D'U&S'
4
select process,status,se*uenceC fro" v>"anaged?stand#y
4
Note: This script won't wor for RA!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1o get hidden parameters #al!es
"" must be run from S#S$
S&L&'0
a.ksppin" :(ara"eter:,
a.ksppdesc :3escription:,
#.ksppstvl :Session Halue:,
c.ksppstvl :Instance Halue:
=$O8
sys.1>ksppi a,
sys.1>ksppcv #,
sys.1>ksppsv c
,A&$&
a.ind1 D #.ind1
5!3
a.ind1 D c.ind1
5!3
a.ksppin" LIG& '4?V' escape '4'
4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1o generate !ser creation s+l.
0his "ay #e useful when you do sche"a refresh with e1pdp4i"pdp
set pagesi/e B
set heading off
set long MMMMMMMMM
set feed#ack off
set echo off
S&L&'0 3B8S?8&053505.6&0?33L-')S&$', '7;'. =$O8 3)5LE
S&L&'0 3B8S?8&053505.6&0?6$5!0&3?33L-'SUS0&8?6$5!0','7;'. =$O8 3)5LE
S&L&'0 3B8S?8&053505.6&0?6$5!0&3?33L- '$OL&?6$5!0','7;'. =$O8 3)5LE
S&L&'0 '6$5!0 ' NN ($IHIL&6& NN ' O! ' NN O,!&$ NN '.' NN 05BL&?!58& NN ' 0O ' NN
6$5!0&& NN 'E' =$O8 3B5?05B?($IHS ,A&$& 6$5!0&& D '7;'E
S&L&'0 '5L0&$ )S&$ 'NN)S&$!58&NN' Q)O05 )!LI8I0&3 O! 'NN05BL&S(5'&?!58&NN'E'
=$O8 3B5?0S?Q)O05S ,A&$& )S&$!58&D'7;'E
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
&hec6 $or long r!nning 1ransactions:
pro"pt 'urrent transactions open for "ore than <B "inutes
pro"pt
col runlength A&53 '01n Open 8inutes' for"at MMMM.MM
col sid A&53 'Session' for"at a;@
col 1id A&53 '0ransactionI3' for"at a;W
col ter"inal A&53 '0er"inal' for"at a;B
col progra" A&53 '(rogra"' for"at a<L wrap
select t.inst?id, sidNN','NNserialC sid,1idusnNN'.'NN1idslotNN'.'NN1ids*n 1id, -sysdate %
start?date . ;PPB
runlength ,ter"inal,progra" fro" gv>transaction t, gv>session s where t.addrDs.taddr
and -sysdate % start?date. ;PPB T <BE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
La#els: SQL : )seful scripts for 3B5
1 comment:
;.
Anonymo!s=e#ruary ;L, <B;B ;;:<B (8
0o shows top (65 user.
select pid,spid,su#str-userna"e,;,<B.
:)S&$: ,progra",(65?)S&3?8&8,(65?5LLO'?8&8,(65?=$&&5BL&?8&8,
(65?85O?8&8
fro" v>process where pga?alloc?"e"D
-select "a1-pga?alloc?"e". fro" v>process where progra" not like 'VL6,$
V'.E
Oracle )A& 3nter#ie% +!estions and ans%ers
What are Oracle &l!ster%are processes $or ;0g on 0ni< and 'in!<
!luster Synchroni%ation Ser&ices 'ocssd( ) 8anages cluster node "e"#ership and runs
as the oracle userE failure of this process results in cluster restart.
!luster Ready Ser&ices 'crsd( X 0he crs process "anages cluster resources -which
could #e a data#ase, an instance, a service, a Listener, a virtual I( -HI(. address, an
application process, and so on. #ased on the resource's configuration infor"ation that
is stored in the O'$. 0his includes start, stop, "onitor and failover operations. 0his
process runs as the root user
*&ent mana+er daemon 'e&md( )5 #ackground process that pu#lishes events that crs
creates.
Process ,onitor Daemon '-PR-!D( )0his process "onitor the cluster and provide I4O
fencing. O($O'3 perfor"s its check, stops running, and if the wake up is #eyond the
e1pected ti"e, then O($O'3 resets the processor and re#oots the node. 5n O($O'3
failure results in Oracle 'lusterware restarting the node. O($O'3 uses the hangcheck
ti"er on Linu1 platfor"s.
RA!. 'rac+main/ rac+imon( X&1tends clusterware to support Oracle%specific
re*uire"ents and co"ple1 resources. $uns server callout scripts when =5! events
occur.
What are Oracle database bac6gro!nd processes speci$ic to )A&
9L8SX6lo#al 'ache Service (rocess
9L83X6lo#al &n*ueue Service 3ae"on
9L8O!X6lo#al &n*ueue Service 8onitor
9L'GBXInstance &n*ueue (rocess
0o ensure that each Oracle $5' data#ase instance o#tains the #lock that it needs to
satisfy a *uery or transaction, Oracle $5' instances use two processes, the 6lo#al
'ache Service -6'S. and the 6lo#al &n*ueue Service -6&S.. 0he 6'S and 6&S
"aintain records of the statuses of each data file and each cached #lock using a 6lo#al
$esource 3irectory -6$3.. 0he 6$3 contents are distri#uted across all of the active
instances.
What are Oracle &l!ster%are &omponents
0otin+ Dis X Oracle $5' uses the voting disk to "anage cluster "e"#ership #y way
of a health check and ar#itrates cluster ownership a"ong the instances in case of
network failures. 0he voting disk "ust reside on shared disk.
-racle !luster Re+istry '-!R( X 8aintains cluster configuration infor"ation as well as
configuration infor"ation a#out any cluster data#ase within the cluster. 0he O'$ "ust
reside on shared disk that is accessi#le #y all of the nodes in your cluster
Ho% do yo! tro!bleshoot node reboot
(lease check "etalink ...
!ote <QKLQM.; 0rou#leshooting '$S $e#oots
!ote.KKM@QK.; )sing 3iagwait as a diagnostic to get "ore infor"ation for diagnosing
Oracle 'lusterware !ode evictions.
Ho% do yo! bac6!p the O&)
0here is an auto"atic #ackup "echanis" for O'$. 0he default location is :
>O$5?'$S?AO8&YcdataY:clusterna"e:Y
0o display #ackups :
Cocrconfig %show#ackup
0o restore a #ackup :
Cocrconfig %restore
,ith Oracle $5' ;Bg $elease < or later, you can also use the e1port co""and:
Cocrconfig %e1port %s online, and use %i"port option to restore the contents #ack.
,ith Oracle $5' ;;g $elease ;, you can do a "anaual #ackup of the O'$ with the
co""and:
C ocrconfig %"anual#ackup
Ho% do yo! bac6!p #oting dis6
Cdd ifDvoting?disk?na"e ofD#ackup?file?na"e
Ho% do 3 identi$y the #oting dis6 location
Ccrsctl *uery css votedisk
Ho% do 3 identi$y the O&) $ile location
check 4var4opt4oracle4ocr.loc or 4etc4ocr.loc - depends upon platfor".
or
Cocrcheck
3s ssh re+!ired $or normal Oracle )A& operation /
:ssh: are not re*uired for nor"al Oracle $5' operation. Aowever :ssh: should #e
ena#led for Oracle $5' and patchset installation.
What is *&A=/
Single 'lient 5ccess !a"e -S'5!. is s a new Oracle $eal 5pplication 'lusters -$5'.
;;g $elease < feature that provides a single na"e for clients to access an Oracle
3ata#ase running in a cluster. 0he #enefit is clients using S'5! do not need to change
if you add or re"ove nodes in the cluster.
'lick here for "ore details fro" Oracle
What is the p!rpose o$ 5ri#ate 3nterconnect /
'lusterware uses the private interconnect for cluster synchroni/ation -network
heart#eat. and dae"on co""unication #etween the the clustered nodes. 0his
co""unication is #ased on the 0'( protocol.
$5' uses the interconnect for cache fusion -)3(. and inter%process co""unication
-0'(.. 'ache =usion is the re"ote "e"ory "apping of Oracle #uffers, shared #etween
the caches of participating nodes in the cluster.
Why do %e ha#e a ,irt!al 35 >,35? in Oracle )A&/
,ithout using HI(s or =5!, clients connected to a node that died will often wait for a
0'( ti"eout period -which can #e up to ;B "in. #efore getting an error. 5s a result,
you don't really have a good A5 solution without using HI(s.
,hen a node fails, the HI( associated with it is auto"atically failed over to so"e other
node and new node re%arps the world indicating a new 85' address for the I(.
Su#se*uent packets sent to the HI( go to the new node, which will send error $S0
packets #ack to the clients. 0his results in the clients getting errors i""ediately.
What do yo! do i$ yo! see 2& &) B'O&@ 'O*1 in top A 1imed "#ents in AW)
)eport/
0his is "ost likely due to a fault in interconnect network.
'heck netstat %s
if you see :frag"ents dropped: or :packet reasse"#lies failed: , ,ork with your syste"
ad"inistrator find the fault with network.
Ho% many nodes are s!pported in a )A& Database/
;Bg $elease <, support ;BB nodes in a cluster using Oracle 'lusterware, and ;BB
instances in a $5' data#ase.
*r#ctl cannot start instance: 3 get the $ollo%ing error 5)@58;00; &)*802;A:
ho%e#er s+lpl!s can start it on both nodes/ Ho% do yo! identi$y the problem/
Set the environ"ental varia#le S$H8?0$5'& to true.. 5nd start the instance with
srvctl. !ow you will get detailed error stack.
%hat is the p!rpose o$ the O=* daemon/
0he Oracle !otification Service -O!S. dae"on is an dae"on started #y the '$S
clusterware as part of the nodeapps. 0here is one ons dae"on started per clustered
node.
0he Oracle !otification Service dae"on receive a su#set of pu#lished clusterware
events via the local ev"d and racgi"on clusterware dae"ons and forward those events
to application su#scri#ers and to the local listeners.
0his in order to facilitate:
a. the =5! or =ast 5pplication !otification feature or allowing applications to respond to
data#ase state changes.
#. the ;Bg$< Load Balancing 5dvisory, the feature that per"it load #alancing accross
different rac nodes dependent of the load on the different nodes. 0he rd#"s 88O! is
creating an advisory for distri#ution of work every @Bseconds and forward it via
racgi"on and O!S to listeners and applications.
La#els: Oracle $5' Interview *uestions
19 comments:
;.
oracleand$$!n 3ece"#er Q, <B;; at @:;M 58
how "any ethernet card and how "any I(s in $5' R
,hat is the "aster dae"on in $5' R
$eply
$eplies
;.
s!dhir8ay Q, <B;< at <:BW (8
< !I' card and @ I(s for each node in $5' for ;Bg. for ;;g @ e1tra I(s for
S'5!
)eply
<.
Anonymo!s3ece"#er <M, <B;; at ;;:BM (8
,hen did a node #eco"es as :85S0&$ !O3&: R
$eply
$eplies
;.
s!dhir8ay Q, <B;< at <:B@ (8
0he node with the lowest node nu"#er will #eco"e "aster node and
dyna"ic re"astering of the resources will take place.
0o find out the "aster node for particular resource, you can *uery
v>ges?resource for 85S0&$?!O3& colu"n.
0o find out which is the "aster node, you can see ocssd.log file and
search for :"aster node nu"#er:.
<.
s!dhir8ay Q, <B;< at <:BK (8
when the first "aster node fails in the cluster the lowest node nu"#er will
#eco"e "aster node
)eply
@.
Anonymo!s3ece"#er <M, <B;; at ;;:;; (8
what is dyna"ic re"astering R
,hen will the dyna"ic re"astering happensR
$eply
$eplies
;.
s!dhir8ay Q, <B;< at ;:KW (8
dyna"ic re"astering is a#ility to "ove the ownership of resource fro"
one instance to another instance in $5'. dyna"ic resource re"astering is
used to i"ple"ent for resource affinity for increased perfor"ance.
resource affinity opti"i/ed the syste" in situation where update
transactions are #eing e1ecuted in one instance. when activity shift to
another instance the resource affinity correspondingly "ove to another
instance. If activity is not locali/ed then resource ownership is hashed to
the instance.
In ;Bg dyna"ic re"astering happens in fileFo#+ect level.the process of
re"astering is very stringent.for one instance should touch "ore than KB
ti"es than the other instance in particular period-say ;B "ints.. this
touch ratio and ti"e can #e tuned #y gc?affinity?li"it and
?gc?affinity?ti"e para"eter.
)eply
P.
)ahman January @, <B;< at Q:P@ 58
good *uestions and post in depth
$eply
K.
rameshJanuary ;L, <B;< at L:PP (8
why we "aintaning odd nu"#er of voting disksR
$eply
$eplies
;.
Anonymo!s8ay Q, <B;< at ;:PB (8
In oracle $5' 5 node "ust #e a#le to access "ore than half of the voting
disks at any ti"e. =or e1a"ple, if you have five voting disks configured,
then a node "ust #e a#le to access at least three of the voting disks at
any ti"e. If a node cannot access the "ini"u" re*uired nu"#er of voting
disks it is evicted, or re"oved, fro" the cluster.
as P disks will not #e any "ore highly availa#le than @ disks, ;4< of @ is
;.K...rounded to <, ;4< of P is <, once we lose < disks, our cluster will fail
with #oth P voting disks or @ voting disks.
<.
@rishan Baglan June ;, <B;< at ;:BB 58
Odd nu"#er of disk are to avoid split #rain, ,hen !odes in cluster can't
talk to each other they run to lock the Hoting disk and whoever lock the
"ore disk will survive, if disk nu"#er are even there are chances that
node "ight lock KBV of disk -< out of P. then how to decide which node
to evict.
whereas when nu"#er is odd, one will #e higher than other and each for
cluster to evict the node with less nu"#er.
0hanks
krishan
@.
AmCad @han 5ugust <B, <B;< at ;B:@; (8
thank you sir
)eply
Q.
1an#eer January <@, <B;< at W:@W 58
good *uestions
$eply
L.
)a96!mar =e#ruary P, <B;< at Q:BK (8
5 node "ust #e a#le to access "ore than half of the voting disks at any ti"e
=or e1a"ple, if you have three voting disks configured, then a node "ust #e a#le
to
access at least two of the voting disks at any ti"e. If a node cannot access the
"ini"u" re*uired nu"#er of voting disks it is evicted, or re"oved, fro" the
cluster.
$eply
W.
Database DBA =e#ruary <;, <B;< at ;<:BP (8
&1cellent sharing. Gindly provide us "ore *uestions and answers specially for
$85! with $5'.
$eply
M.
Anonymo!sJune @, <B;< at M:K; 58
Hery 6ood #log and 5ll Question%%answers...
Q.; 'an Uou e1plain a #it a#out checkpoint and local 7 $e"ote listener R
Q.< regarding d#"s scheduler +o#s in $5' 3B, i have o#served that all scheduled
+o#s will run fro" one instance only. if "anually run fro" other instance then it
will run fro" that instance.
does instance?stickness para"eter has to do anything in this issue R
$eply
$eplies
;.
*!nil June <Q, <B;< at L:@@ 58
In $5' 3ata#ase, we usually see #oth Local and $e"ote Listeners.
$e"ote listener will #e scan listener wherein it acts as a load #alancer.
)eply
;B.
Anonymo!sJune ;B, <B;< at K:;; 58
Its really a one and only #log which talks a#out $5' =5Q in the entire we#.
0he article :,hen e1actly during the installation process are clusterware
co"ponents createdR:
is really very good. But its for ;Bg. If you update the #log with the ;;g$< would
#e really great
$eply
;;.
Anonymo!sJuly <, <B;< at ;:PW (8
5!U I3&5 O! LO'G 8onitoring in $5'R and 'an so"e one e1plainR
)A& 'oad Balancing: 1A : A=
&lient *ide &onnect81ime 'oad Balance
0he client load #alancing feature ena#les clients to rando"i/e connection re*uests
a"ong the listeners.
0his is done #y client 0nsna"es (ara"eter: LO53?B5L5!'&.
0he -load?#alanceDyes. instructs SQL!et to progress through the list of listener
addresses in the address?list section of the net service na"e in a rando" se*uence.
,hen set to O==, instructs SQL!et to try the addresses se*uentially until one
succeeds.
&lient *ide &onnect81ime $ailo#er
0his is done #y client 0nsna"es (ara"eter: =5ILOH&$
0he -failoverDon. ena#les clients to connect to another listener if the initial connection
to the first listener fails. ,ithout connect%ti"e failover, Oracle !et atte"pts a
connection with only one listener.
*er#er *ide 'istener &onnection 'oad Balancing.
,ith server%side load #alancing, the listener directs a connection re*uest to the #est
instance currently providing the service.
Init para"eter re"ote?listener should #e set. ,hen set, each instance registers with
the 0!S listeners running on all nodes within the cluster.
0here are two types of server%side load #alancing:
Load Based X Server side load #alancing redirects connections #y default depending on
node load. 0his id default.
Session Based X Session #ased load #alancing takes into account the nu"#er of
sessions connected to each node and then distri#utes the connections to #alance the
nu"#er of sessions across the different nodes.
=ro" ;Bg release < the service can #e setup to use load #alancing advisory. 0his "ean
connections can #e routed using S&$HI'& 0I8& and 0A$O)6A()0. 'onnection load
#alancing "eans the goal of a service can #e changed, to reflect the type of
connections using the service.
1ransparent Application ailo#er >1A?
0ransparent 5pplication =ailover -05=. is a feature of the Oracle 'all Interface -O'I.
driver at client side. It ena#les the application to auto"atically reconnect to a data#ase,
if the data#ase instance to which the connection is "ade fails. In this case, the active
transactions roll #ack.
0nsna"es (ara"eter: =5ILOH&$?8O3&
e.g -failover?"odeD-typeDselect.-"ethodD#asic..
=ailover 8ode 0ype can #e &ither S&SSIO! or S&L&'0.
Session failover will have +ust the session to failed over to the ne1t availa#le node. ,ith
S&L&'0, the select *uery will #e resu"ed.
05= can #e configured with +ust server side service settings #y using d#"s?service
package.
ast &onnection ailo#er >&?
=ast 'onnection =ailover is a feature of Oracle clients that have integrated with =5! A5
&vents.
Oracle J3B' I"plicit 'onnection 'ache, Oracle 'all Interface -O'I., and Oracle 3ata
(rovider for .!et -O3(.!et. include fast connection failover.
,ith fast connection failover, when a down event is received, cached connections
affected #y the down event are i""ediately "arked invalid and cleaned up.
Oracle &l!ster%are: &omponents installed
When e<actly d!ring the installation process are cl!ster%are components
created/
5fter fulfilling the pre%installation re*uire"ents, the #asic installation steps to follow
are:
;. Invoke the Oracle )niversal Installer -O)I.
2. &nter the different infor"ation for so"e co"ponents like:
% na"e of the cluster
% pu#lic and private node na"es
% location for O'$ and Hoting 3isks
% network interfaces used for $5' instances
%etc.
D. 5fter the Su""ary screen, O)I will start copying under the >'$S?AO8& -this is the
>O$5'L&?AO8& for Oracle 'lusterware. in the local node the li#raries and
e1ecuta#les.
% here we will have the dae"ons and scripts init. created and configured properly.
-racle !lusterware is formed of se&eral daemons/ each one of which ha&e a special
function inside the stac$ Daemons are e1ecuted &ia the init$2 scripts 'init$cssd/
init$crsd and init$e&md($
% note that for '$S only so"e client li#raries are recreated, #ut not all the e1ecuta#les
-as for the $3B8S..
E. Later the software is propagated to the rest of the nodes in the cluster and the
oraInventory is updated.
A. 0he installer will ask to e1ecute root.sh on each node. )ntil this step the software for
Oracle 'lusterware is inside the >'$S?AO8&.
$unning root.sh will create several co"ponents outside the >'$S?AO8&:
% O'$ and H3 will #e for"ated.
% control files -or S'LS?S$' files . will #e created with the correct contents to start
Oracle 'lusterware.
These files are used to control some aspects of -racle !lusterware lie:
" enable3disable processes from the !SSD family '*+$ oprocd/ osls&mon(
" stop the daemons 'ocssd$bin/ crsd$bin/ etc($
" pre&ent -racle !lusterware from bein+ started when the machine boots$
" etc$
% 4etc4initta# will #e updated and the init process is notified.
4n order to start the -racle !lusterware daemons/ the init$2 scripts first need to be run$
These scripts are e1ecuted by the daemon init$ To accomplish this some entries must
be created in the file 3etc3inittab$
% the different processes init. -init.cssd, init.crsd, etc. will start the dae"ons
-ocssd.#in, crsd.#in, etc.. ,hen all the dae"ons are running then we can say that the
installation was successful
% On ;B.< and later, running root.sh on the last node in the cluster also will create the
nodeapps -HI(, 6S3 and O!S.. On ;B.;, HI('5 is e1ecuted as part of the $5'
installation.
F. 5fter running root.sh on each node, we need to continue with the O)I session. 5fter
pressing the 'OG' #utton O)I will include the infor"ation for the pu#lic and
cluster?interconnect interfaces. 5lso 'H) -'luster Herification )tility. will #e e1ecuted
Ho% to mo#e O&) and ,oting dis6 to ne% storage de#ice/
Go#ing O&)
HHHHHHHHHH
Uou "ust #e logged in as the root user, #ecause root owns the O'$ files. 5lso an
ocr"irror "ust #e in place #efore trying to replace the O'$ device.
8ake sure there is a recent #ackup of the O'$ file #efore "aking any changes:
ocrconfi+ 5showbacup
If there is not a recent #ackup copy of the O'$ file, an e1port can #e taken for the
current O'$ file. )se the following co""and to generate an e1port of the online O'$
file:
In ;B.<
C ocrconfi+ 5e1port "s online
In ;;g
C ocrconfi+ "manualbacup
0he new O'$ disk "ust #e owned #y root, "ust #e in the oinstall group, and "ust
have per"issions set to QPB. (rovide at least ;BB 8B disk space for the O'$.
On one node as root run:
6 ocrconfi+ "replace ocr
6 ocrconfi+ "replace ocrmirror
!ow run ocrcheck to verify if the O'$ is pointing to the new file
Go#ing ,oting Dis6
HHHHHHHHHHHHHHHHHH
!ote: crsctl votedisk co""ands "ust #e run as root
Shutdown the Oracle 'lusterware -crsctl stop crs as root. on all nodes #efore "aking
any "odification to the voting disk. 3eter"ine the current voting disk location using:
crsctl 7uery css &otedis
0ake a #ackup of all voting disk:
dd if8&otin+9dis9name of8bacup9file9name
0o "ove a Hoting 3isk, provide the full path including file na"e:
crsctl delete css &otedis 5force
crsctl add css &otedis 5force
5fter "odifying the voting disk, start the Oracle 'lusterware stack on all nodes
6 crsctl start crs
Herify the voting disk location using
crsctl 7uery css &otedis
La#els: $5' : 8oving O'$ and Hoting disk
1 comment:
;.
Anonymo!sOcto#er <Q, <B;< ;B:KQ (8
this procedure does not work for ;;g
ocrconfig %replace ocr
ocrconfig %replace ocr"irror
are valid only for ;Bg
;;g
ocrconfig %replace oldfile %replace"ent newfile
is the right synta1
further"ore
raw devices are not supported in ;;.< for ocr and voting disks unless you
"igrated fro" ;Bg.
;;g supports ocr and vting disks on 5S8 only.
Ho%1o )estore )A& Database to *ingle 3nstance On Another
=ode
0ake $85! #ackup of the production $5' data#ase..
R,AN: run;
allocate channel c< type dis format '3tmp3=>'?
bacup database?
bacup archi&elo+ all?
@
% 'reate a (=IL& for the single instance data#ase using the production $5' para"eter
file
5nd "odify the para"eters Vdest, control?files, log?archive?dest?;, Vconvert,
cluster?data#ase?instances, cluster?data#ase etc.. for undo?ta#lespace, "ention any
one undo ta#lespace na"e
% 'opy the #ackup pieces and the "odified I!I0.O$5 file to the new host to sa"e
"ount point.
% )se the pfile created a#ove to S05$0)( !O8O)!0 the data#ase on the new host
> s*lplus :4 as sysd#a:
SAL: startup nomount?
> r"an target 4 nocatalog
R,AN: restore controlfile from '3tmp3B bacup piece name of controlfile auto
bacup:'?
R,AN: alter database mount?
% 3eter"ine the recovery point.
R,AN: list bacup of archi&elo+ all?
'heck the last archive se*uence for all redo threads and select the archive se*uence
having L&5S0 :!e1t S'!: a"ong the".
% Aaving deter"ined the point upto which "edia recovery should run, start the
restore4recovery using:
R,AN: run ;
set until se7uence B se7uence6 from abo&e: thread B thread6 :?
restore database?
reco&er database?
@
SAL: alter database open resetlo+s?
If open data#ase fail with error O$5%@WWKQ
then, Set the following para"eter in the init.ora file:
?no?recovery?through?resetlogsD0$)&
0hen open with resetlogs.
Once the data#ase has opened, re"oved this hidden para"eter.
% Once the data#ase is opened successfully, you "ay re"ove the redolog groups for
redo threads of other instances.
SAL: select TCR*AD6/ STAT>S/ *NABL*D
D from &Ethread?
0A$&53C S050)S &!5BL&3
%%%%%%%%%% %%%%%% %%%%%%%%
; O(&! ()BLI'
< 'LOS&3 ($IH50&
SAL: select +roup6 from &Elo+ where TCR*AD68D?
6$O)(C
%%%%%%%%%%
P
K
Q
SAL: alter database disable thread D?
3ata#ase altered.
SAL: alter database clear unarchi&ed lo+file +roup F? - repeat for P to Q.
3ata#ase altered.
SAL: alter database drop lo+file +roup F? - repeat for P to Q.
3ata#ase altered.
% !ow you can re"ove the undo ta#lespaces of other instances.
SAL: show parameter undo?
!58& 0U(& H5L)&
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
undo?"anage"ent string 5)0O
undo?retention integer MBB
undo?ta#lespace string )!3O0BS;
SAL: select tablespace9name from dba9tablespaces where contents8'>ND-'?
05BL&S(5'&?!58&
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
)!3O0BS;
)!3O0BS<
SAL: drop tablespace >ND-TBSD includin+ contents and datafiles?
0a#lespace dropped.
Ho% to e<port and import crs reso!rces %hile migrating
Oracle )A& to ne% ser#er.
Below script generate svrctl add script for data#ase, instance, service and ;;6 listeners
fro" O'$ fro" current $5'.
Save the result of the script and run it at new $5'.
for 3B!58& in >-srvctl config data#ase.
do
C 6enerate 3B resource
srvctl config data#ase %d >3B!58& %a N awk %v d#na"eD:>3B!58&: Y
'B&6I! Z =SD::: [
>;24Oracle ho"e4 NN >;24O$5'L&?AO8&4 Zd#ho"e D :%o: ><[
>;24Spfile4 NN >;24S(=IL&4 Zspfile D :%p: ><[
>;243isk 6roups4 Zdg D :%a: ><[
&!3 Z if -avail DD :%a :. Zavail D ::[E printf :Vs Vs Vs Vs VsYn:, :srvctl add
data#ase %d :, d#na"e, d#ho"e, spfile, dg ['
C 6enerate Instance resource
srvctl status data#ase %d >3B!58& N awk %v d#na"eD:>3B!58&: Y
'>P24running4 Z printf :Vs Vs Vs Vs Vs VsYn:, :srvctl add instance %d :,d#na"e, : %i
:, >< ,: %n :, >L [
>K24running4 Z printf :Vs Vs Vs Vs Vs Vs Yn:, :srvctl add instance %d :,d#na"e, : %i
:, >< ,: %n :, >W ['
C 8odify instance for ;B6 % 5S8 dependency
if \ >-echo >O$5'L&?AO8& N grep :;B<B: N wc %l . %e* ; ]
then
srvctl status data#ase %d >3B!58& N awk %v d#na"eD:>3B!58&: Y
'><24;>4 Z printf :Vs Vs Vs Vs Vs Yn:, :srvctl "odify instance %d :,d#na"e, : %i :, ><
,: %s F5S8;: [
><24<>4 Z printf :Vs Vs Vs Vs Vs Yn:, :srvctl "odify instance %d :,d#na"e, : %i :, ><
,: %s F5S8<: [
><24@>4 Z printf :Vs Vs Vs Vs Vs Yn:, :srvctl "odify instance %d :,d#na"e, : %i :, ><
,: %s F5S8@: [
><24P>4 Z printf :Vs Vs Vs Vs Vs Yn:, :srvctl "odify instance %d :,d#na"e, : %i :, ><
,: %s F5S8P: ['
fi
echo :srvctl start data#ase %d >3B!58&:
C 6enerate Service resource
sna"elistD>-srvctl status service %d >3B!58& N awk 'Zprint ><['.
for sna"e in >sna"elist
do
srvctl config service %d >3B!58& %s >sna"eN awk %v d#na"eD:>3B!58&: %v
sna"eD>sna"e Y
'B&6I! Z =SD:::[
>;24(referred instances4 Zpref D :%r: ><[
>;24($&=4 Zpref D :%r: ><E su#-45H5IL4, ::, pref. [
>;245vaila#le instances4 Zavail D :%a: ><[
><245H5IL4 Zavail D :%a: >@[
>;24=ailover type4 Zft D :%e: ><[
>;24=ailover "ethod4 Zf" D :%": ><[
>;24$unti"e Load Balancing 6oal4 Zg D :%B: ><[
&!3 Z if -avail DD :%a :. Zavail D ::[E printf :Vs Vs Vs Vs Vs Vs Vs Vs Vs VsYn:,
:srvctl add service %d :,d#na"e, :%s :, sna"e, pref, avail ,ft, f",g, :%( B5SI':['
echo :srvctl start service %d >3B!58& %s >sna"e:
done
done
C Listener at ;;6 Ao"e. ;B6 listener can't #a added with srvctl.
srvctl config listener N awk Y
'B&6I! Z =SD:::E state D BE [
>;24!a"e4 Zlna"e D :%l: ><E stateD;[E
>;24Ao"e4 77 state DD ; Zoho"e D :%o: ><E stateD<E[
>;24&nd points4 77 state DD < Zlport D :%p : >@E stateD@E[
state DD @ Zif -oho"e ^D :%o :. Zprintf :Vs Vs Vs VsYn:, :srvctl add listener :,
lna"e, oho"e, lportE[ stateDBE['
La#els: Aow to e1port and i"port crs resources
2 comments:
;.
Anonymo!s3ece"#er W, <B;; ;<:KW 58
this script is not working
gettting error as follows
awk: synta1 error near line ;
awk: #ailing out near line ;
awk: synta1 error near line ;
awk: #ailing out near line ;
srvctl start data#ase %d lrntest
awk: synta1 error near line ;
awk: #ailing out near line ;
$eply
<.
Anonymo!s3ece"#er W, <B;; <:K@ 58
I did the following two things in solaris 7 it is started working
C^4usr4#in4ksh
5,GD4usr41pgP4#in4awk
and i have replaced all awk with >5,G in the script....
Bac6!p I )eco#ery: )GA=
*teps to reco#er the primary databaseJs data$ile !sing a copy
o$ a standby databaseJs data$ile
*teps to reco#er the primary databaseJs data$ile !sing a copy o$ a standby
databaseJs data$ile.
0his procedure will work for all file syste"s including raw or 5S8.
0hrough this e1a"ple we will #e using datafile ;<.
;. On stand#y data#ase, copy datafile fro" 5S8 to a file syste":
$85!T #ackup as copy datafile ;< for"at '4t"p4df;<.d#f'E
<. transfer the datafile copy fro" the stand#y to the pri"ary host using scp.
On pri"ary data#ase
@. (lace the datafile to recover offline.
SQLT alter data#ase datafile ;< offlineE
P. catalog this datafile copy:
$85!T catalog datafilecopy '4t"p4df;<.d#f'E
K. 'onfir" that datafile e1ists:
$85!T list copy of datafile ;<E
Q. $estore the datafile:
$85!T restore datafile ;<E
L. $ecover the datafile:
$85!T recover datafile ;<E
W. (lace the datafile online:
SQLT alter data#ase datafile ;< onlineE
*teps to reco#er the standby databaseJs data$ile !sing a copy o$ a primary
databaseJs data$ile.
;. Backup the pri"ary data#ase's datafile.
$85!T #ackup as copy datafile ;< for"at '4t"p4df;<.d#f'E
<. transfer the file to the stand#y site using an operating syste" utility such as scp.
@. catalog the datafile copy on the stand#y site.
$85!T catalog datafilecopy '4t"p4df;<.d#f'E
P. stop redo apply on the physical stand#y data#ase.
SQLT 5L0&$ 3505B5S& $&'OH&$ 85!56&3 S05!3BU 3505B5S& '5!'&LE
K. on the stand#y site restore the datafile copy.
$85!T restore datafile ;<E
Q. restart redo apply on the physical stand#y data#ase.
SQLT 5L0&$ 3505B5S& $&'OH&$ 85!56&3 S05!3BU 3505B5S& 3IS'O!!&'0
Ho% to reco#er *tandby database $rom a missing archi#elog
)eco#ering a *tandby database $rom a missing archi#elog
5 (hysical Stand#y data#ase relies on continuous application of archivelogs fro" a
(ri"ary 3ata#ase to #e in synch with it. In Oracle 3ata#ase versions prior to ;Bg in the
event of an archivelog gone "issing or corrupt you had to re#uild the stand#y data#ase
fro" scratch.
In ;Bg you can use an incremental bac6!p $rom *&= and recover the stand#y using
the sa"e to co"pensate for the "issing archivelogs as shown #elow
Step ;: On the stand#y data#ase check the current scn.
S03BUT set nu"width @BE
S03BUT select current?scn fro" v>data#aseE
')$$&!0?S'!
%%%%%%%%%%%
;<@PKQLWM
Step <: On the pri"ary data#ase create the needed incre"ental #ackup fro" the a#ove
S'!
':Y3ocu"ents and SettingsYfregoTr"an target 4
$85!T Z
allocate channel c; type diskE
B5'G)( I!'$&8&!05L =$O8 S'! ;<@PKQLWM 3505B5S&
=O$850 4t"p4incr?#kp4incr?#kp?V)'E
[
Step @: 'ancel "anaged recovery at the stand#y data#ase
S03BUTalter data#ase recover "anaged stand#y data#ase cancelE
8edia recovery co"plete.
scp the #ackup files to stand#y server to 4t"p4incr?#kp folder.
Step P: 'atalog the Incre"ental Backup =iles at the Stand#y 3ata#ase
4t"p4incr?#kp T r"an target 4
$85!T '505LO6 S05$0 ,I0A '4t"p4incr?#kp4'E
searching for all files that "atch the pattern 4t"p4incr?#kp4
List of =iles )nknown to the 3ata#ase
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
......
3o you really want to catalog the a#ove files -enter U&S or !O.R U&S
cataloging files...
cataloging done
Step K: 5pply the Incre"ental Backup to the Stand#y 3ata#ase
$85!T $&'OH&$ 3505B5S& !O$&3OE
Step Q: (ut the stand#y data#ase #ack to "anaged recovery "ode.
S03BUTT recover "anaged stand#y data#ase disconnectE
8edia recovery co"plete.
=ro" the alert.log you will notice that the stand#y data#ase is still looking for the old
log files

=5L\client]: =ailed to re*uest gap se*uence


65( % thread ; se*uence ....

0his is #ecause the controlfile has not #een updated.


Aence the stand#y controlfile has to #e recreated
Step L: On the pri"ary create new stand#y controlfile
($I8Talter data#ase create stand#y controlfile as _4t"p4incr?#kp4stand#yB;.ctl`E
Syste" altered.
Step W: 5t Stand#y .. $eplace stand#y controlfile at all location as shown #y
controle?files para"eter.
'opy the stand#y control file to the stand#y site. Shutdown the stan#y data#ase and
replace the stan#y controlfiles and restart the stand#y data#ase in "anaged recovery
"ode...
!ote: % =O$ S05!3BU 3505B5S&S O! 5S8 additional steps is re*uired after replacing
the stan#y control file. Like rena"ing datafiles ...
)GA= D05'3&A1" W31HO01 &O=="&13=2 1O 1A)2"1
DA1ABA*" 3= ;;2)2
(rior versions of Oracle re*uired a connection to the 05$6&0 and optional r"an catalog
for duplicate data#ase.
In ;;6$<, we can perfor" $85! duplicate data#ase to a new server without
connecting to the target data#ase or a recovery catalog.
Steps.
;. 0ake #ackup of the data#ase.
$85!T 'onfigure controlfile auto#ackup onE
$85!T #ackup data#ase plus archivelogE
<. 'opy the #ackupsets to au1illiary server. - In this e1a"ple to 4ora#ackup directory.
@. 'reate an init.ora for duplicate data#ase.
P. Start au1illiary instance
> e1port O$5'L&?SI3D!&,3B
> s*lplus :4 as sysd#a:
SQLT startup no"ountE
K. Start r"an and connect to au1iliary instance
r"an au1iliary 4
$85!T 3)(LI'50& 3505B5S& 0O !&,3B B5'G)( LO'50IO! '4ora#ackup4'
!O=IL&!58&'A&'G
La#els: ;;6$< : #ackup%#ased duplication
1 comment:
;.
Anonymo!sJuly ;B, <B;< ;;:;@ (8
I have used the s"e steps #ut endedup with $85!%BKKLM:'O!0$OL=IL& #ackup
not found....
&venthough I have shipped the #ackup of the contolfile to the specified location.
Oracle ;;g ne% $eat!res
Oracle Database ;;g: =e% eat!res in Data2!ard
Acti#e Data 2!ard
In Oracle 3ata#ase ;Bg and #elow you could open the physical stand#y data#ase for
read%only activities, #ut only after stopping the recovery process.
In Oracle ;;g, you can *uery the physical stand#y data#ase in real ti"e while applying
the archived logs. 0his "eans stand#y continue to #e in sync with pri"ary #ut can use
the stand#y for reporting.
Let us see the steps now..
=irst, cancel the "anaged stand#y recovery:
SAL: alter database reco&er mana+ed standby database cancel?
3ata#ase altered.
0hen, open the data#ase as read only:
SAL: alter database open read only?
3ata#ase altered.
,hile the stand#y data#ase is open in read%only "ode, you can resu"e the "anaged
recovery process.
SAL: alter database reco&er mana+ed standby database disconnect?
3ata#ase altered.
*napshot *tandby
In Oracle 3ata#ase ;;g, physical stand#y data#ase can #e te"porarily converted into
an updatea#le one called Snapshot Stand#y 3ata#ase.
In that "ode, you can "ake changes to data#ase. Once the test is co"plete, you can
roll#ack the changes "ade for testing and convert the data#ase into a stand#y
undergoing the nor"al recovery. 0his is acco"plished #y creating a restore point in the
data#ase, using the =lash#ack data#ase feature to flash#ack to that point and undo all
the changes.
Steps:
'onfigure the flash recovery area, if it is not already done.
SAL: alter system set db9reco&ery9file9dest9si%e 8 D.?
Syste" altered.
SAL: alter system set db9reco&ery9file9dest8 'GHRAD.'?
Syste" altered.
Stop the recovery.
SAL: alter database reco&er mana+ed standby database cancel?
3ata#ase altered.
'onvert this stand#y data#ase to snapshot stand#y using co""and
SAL: alter database con&ert to snapshot standby?
3ata#ase altered.
!ow recycle the data#ase
SAL: shutdown immediate
...
SAL: startup
O$5'L& instance started.
3ata#ase is now open for read4write operations
SAL: select open9mode/ database9role from &Edatabase?
O(&!?8O3& 3505B5S&?$OL&
%%%%%%%%%% %%%%%%%%%%%%%%%%
$&53 ,$I0& S!5(SAO0 S05!3BU
5fter your testing is co"pleted, you would want to convert the snapshot stand#y
data#ase #ack to a regular physical stand#y data#ase #y following the steps #elow
SAL: connect 3 as sysdba
'onnected.
SAL: shutdown immediate
SAL: startup mount
...
3ata#ase "ounted.
SAL: alter database con&ert to physical standby?
3ata#ase altered.
!ow shutdown, "ount the data#ase and start "anaged recovery.
SAL: shutdown
O$5'L& instance shut down.
SAL: startup mount
O$5'L& instance started.
...
3ata#ase "ounted.
Start the "anaged recovery process
SAL: alter database reco&er mana+ed standby database disconnect?
!ow the stand#y data#ase is #ack in "anaged recovery "ode. ,hen the data#ase was
in snapshot stand#y "ode, the archived logs fro" pri"ary were not applied to it. 0hey
will #e applied now.
In ;Bg this can #e done #y following steps .. 3$ failover test with flash#ack
)edo &ompression
In Oracle 3ata#ase ;;g you can co"press the redo that goes across to the stand#y
server via SQL!et using a para"eter co"pression set to true. 0his works only for the
logs shipped during the gap resolution. Aere is the co""and you can use to ena#le
co"pression.
alter syste" set log?archive?dest?< D 'serviceDS03BU3B L6,$ 5SU!'
valid?forD-O!LI!&?LO6=IL&S,($I85$U?$OL&. d#?uni*ue?na"eDS03BU3B
co"pressionDena#le'
Oracle Database ;;g: =e% eat!res in )GA=
Oracle Database ;;g =e% eat!res in )GA= $or DBA inter#ie%.
Ad#ice on reco#ery
0o find out failure...
R,AN: list failure?
0o get the advice on recovery
R,AN: ad&ise failure?
$ecovery 5dvisor generates a script that can #e used to repair the datafile or resolve
the issue. 0he script does all the work.
0o verify what the script actually does ...
R,AN: repair failure pre&iew?
!ow e1ecute the actual repair #y issuing...
R,AN: repair failure?
5roacti#e Health &hec6s
In Oracle 3ata#ase ;;g, a new co""and in $85!, H5LI350& 3505B5S&, can check
data#ase #locks for physical corruption.
R,AN: &alidate database?
5arallel bac6!p o$ the same data$ile.
In ;Bg each datafile is #acked #y only one channel. In Oracle 3ata#ase ;;g $85!, the
"ultiple channels can #ackup one datafiles parallel #y #reaking the datafile into chunks
known as :sections.:
OptimiCed bac6!p o$ !ndo tablespace.
In ;Bg, when the $85! #ackup runs, it #acks up all the data fro" the undo ta#lespace.
But during recovery, the undo data related to co""itted transactions are no longer
needed.
In Oracle 3ata#ase ;;g, $85! #ypasses #acking up the co""itted undo data that is
not re*uired in recovery. 0he unco""itted undo data that is i"portant for recovery is
#acked up as usual. 0his reduces the si/e and ti"e of the #ackup.
3mpro#ed Bloc6 Gedia )eco#ery 5er$ormance
If flash#ack logs are present, $85! will use these in preference to #ackups during #lock
"edia recovery -B8$., which can significantly i"prove B8$ speed.
Bloc6 &hange 1rac6ing *!pport $or *tandby Databases
Block change tracking is now supported on physical stand#y data#ases, which in turn
"eans fast incre"ental #ackups are now possi#le on stand#y data#ases.
aster Bac6!p &ompression
$85! now supports the ILIB #inary co"pression algorith" as part of the Oracle
5dvanced 'o"pression option. 0he ILIB algorith" is opti"i/ed for '() efficiency, #ut
produces larger /ip files than the BII(< algorith" availa#le previously, which is
opti"i/ed for co"pression.
Archi#ed 'og Deletion 5olicy "nhancements
0he archived log deletion policy of Oracle ;;g has #een e1tended to give greater
fle1i#ility and protection in a 3ata 6uard environ"ent. 0he Oracle ;Bg and Oracle ;;g
synta1 is displayed #elow.
C Oracle ;Bg Synta1.
!-NH4.>R* AR!C40*L-. D*L*T4-N P-L4!# ;!L*AR I T- ;APPL4*D -N STANDB# I
N-N*@@
C Oracle ;;g Synta1.
AR!C40*L-. D*L*T4-N P-L4!# ;!L*AR I T- ;APPL4*D -N JALLK STANDB# IBA!L*D
>P inte+er T4,*S T- D*04!* T#P* de&iceSpecifier IN-N* I SC4PP*D T- JALLK
STANDB#@J ;APPL4*D -N JALLK STANDB# I BA!L*D >P inte+er T4,*S T- D*04!* T#P*
de&iceSpecifier IN-N* I SC4PP*D T- JALLK STANDB#@K$$$@
0he e1tended synta1 allows for configurations where logs are eligi#le for deletion only
after #eing applied to, or transferred to, one or "ore stand#y data#ase destinations.
La#els: ;;g: !ew =eatures in $85!
1 comment:
;.
Adam 2orge !ove"#er <W, <B;< at @:;B 58
One day "y Oracle data#ase get corrupted. I used $85! Option to repair "y
corrupt Oracle data#ase. But it got failed to repair "y data#ase. 8y friend has
suggested "e to try Oracle 3ata#ase $ecovery Software. 0he software is
specially designed to repair corrupt Oracle 3ata#ase 7 =iles. I tried Stellar
(hoeni1 Oracle 3ata#ase $ecovery Software. 0he software repairs data#ase in
few easy clicks. 0hanks Stellar to get #ack "y data#ase^^
Oracle Database ;;g: 3n#isible 3nde<es
Oracle ;;g allo%s inde<es to be mar6ed as in#isible.
Invisi#le inde1es are "aintained like any other inde1, #ut they are ignored #y the
opti"i/er unless the O(0I8II&$?)S&?I!HISIBL&?I!3&O&S para"eter is set to 0$)& at
the instance or session level. Inde1es can #e created as invisi#le #y using the
I!HISIBL& keyword, and their visi#ility can #e toggled using the 5L0&$ I!3&O
co""and.
!R*AT* 4ND*M inde19name -N table9name'column9name( 4N04S4BL*?
ALT*R 4ND*M inde19name 4N04S4BL*?
ALT*R 4ND*M inde19name 04S4BL*?
Invisi#le inde1es can #e useful for processes with specific inde1ing needs, where the
presence of the inde1es "ay adversely affect other functional areas. 0hey are also
useful for testing the i"pact of dropping an inde1.
0he current visi#ility status of an inde1 is indicated #y the HISIBILI0U colu"n of the
\3B5N5LLN)S&$]?I!3&O&S views.
Oracle Database ;;g: =e% eat!res $or A!tomatic Gemory
Ganagement
Oracle si"plified "e"ory "anage"ent over the last few versions of the data#ase.
Oracle Mi auto"ated (65 "anage"ent #y introducing (65?566$&650&?05$6&0
para"eter. Oracle ;Bg continued this trend #y auto"ating S65 "anage"ent using the
S65?05$6&0 para"eter. Oracle ;;g takes this one step further #y allowing you to
allocate one chunk of "e"ory, which Oracle uses to dyna"ically "anage #oth the S65
and (65.
5uto"atic "e"ory "anage"ent is configured using two new initiali/ation para"eters:
9G"GO)4.1A)2"1: 0he a"ount of shared "e"ory availa#le for Oracle to use when
dyna"ically controlling the S65 and (65. 0his para"eter is dyna"ic, so the total
a"ount of "e"ory availa#le to Oracle can #e increased or decreased, provided it does
not e1ceed the 8&8O$U?85O?05$6&0 li"it. 0he default value is :B:.
9G"GO)4.GAK.1A)2"1: 0his defines the "a1i"u" si/e the 8&8O$U?05$6&0 can
#e increased to without an instance restart. If the 8&8O$U?85O?05$6&0 is not
specified, it defaults to 8&8O$U?05$6&0 setting.
,hen using auto"atic "e"ory "anage"ent, the S65?05$6&0 and
(65?566$&650&?05$6&0 act as "ini"u" si/e settings for their respective "e"ory
areas. 0o allow Oracle to take full control of the "e"ory "anage"ent, these
para"eters should #e set to /ero.
Oracle Database ;;g: =e% eat!res in datap!mp
&OG5)"**3O= parameter in e<pdp
One of the #ig issues with 3ata (u"p was that the du"pfile couldn't #e co"pressed
while getting created. In Oracle 3ata#ase ;;g, 3ata (u"p can co"press the du"pfiles
while creating the" #y using para"eter 'O8($&SSIO! in the e1pdp co""and line.
0he para"eter has three options:
8&03505?O!LU % only the "etadata is co"pressed
3505?O!LU % only the data is co"pressedE the "etadata is left alone.
5LL % #oth the "etadata and data are co"pressed.
!O!& % this is the defaultE no co"pression is perfor"ed.
"ncryption
0he du"pfile can #e encrypted while getting created. 0he encryption uses the sa"e
technology as 03& -0ransparent 3ata &ncryption. and uses the wallet to store the
"aster key. 0his encryption occurs on the entire du"pfile, not +ust on the encrypted
colu"ns as it was in the case of Oracle 3ata#ase ;Bg.
Data Gas6ing
when you i"port data fro" production to Q5, you "ay want to "ake sure sensitive
data are altered in such a way that they are not identifia#le. 3ata (u"p in Oracle
3ata#ase ;;g ena#les you do that #y creating a "asking function and then using that
during i"port.
)"GA5.1AB'"
5llows you to rena"e ta#les during an i"port operation.

&1a"ple
0he following is an e1a"ple of using the $&85(?05BL& para"eter to rena"e the
e"ployees ta#le to a new na"e of e"ps:
i"pdp hr 3I$&'0O$UDdpu"p?dir; 3)8(=IL&De1psche"a.d"p 05BL&SDhr.e"ployees
$&85(?05BL&Dhr.e"ployees:e"ps
Oracle Database ;;g: )ead only tables
)ead8Only 1ables in Oracle Database ;;g
Oracle ;;g allows ta#les to #e "arked as read%only using the 5L0&$ 05BL& co""and.
ALT*R TABL* table9name R*AD -NL#?
ALT*R TABL* table9name R*AD NR4T*?
5ny 38L state"ents that affect the ta#le data and S&L&'0 ... =O$ )(350& *ueries
result in an O$5%;<BW; error "essage.
Data 2!ard
Data 2!ard $ailo#er %ith $lashbac6
*teps $or datag!ard $ailo#er test %ith database $lashbac6.
On 5rimary
3efer the log shipping to stand#y.
SQLT 5lter syste" set log?archive?dest?state?nDdeferE
'heck last log se*uence Select "a1-se*uenceC. fro" v>log?history
On *atndby
&na#le flash#ack recovery.
Setup flash#ack destination and file si/e.
SQLT 5lter syste" set d#?recovery?file?destD`4uB;4flash` scopeDspfileE
SQLT 5lter syste" set d#?recovery?file?dest?si/eD;B6 scopeDspfileE
'ancel the recovery.
SQLT 5lter data#ase recover "anaged stand#y data#ase cancelE
SQLT Shutdown i""ediate
Startup data#ase in "ount "ode.
SQLT Startup "ount
(ut data#ase in the flash#ack "ode
SQLT alter data#ase flash#ack onE
'reate the $estore (oint on the stand#y data#ase
SQLT 'reate restore point #efore?dr guarantee flash#ack data#aseE
5ctivate Stand#y data#ase
SQLT 5lter data#ase activate stand#y data#aseE
Open the 3$ data#ase
SQLT 5lter data#ase openE
Shutdown and restart the data#ase
%%% (erfor" 3$ tests %%%
*teps to rollbac6 and con#ert to standby.
On *atndby
Shutdown after 3$ test
SQLTShutdown i""ediate
Startup data#ase with "ount and force option.
SQLTstartup "ount force
$estore data#ase to the restored point.
SQLT =lash#ack data#ase to restore point #efore?drE
3rop restored point
SQLT 3rop restore point #efore?drE
0urn off flash#ack
alter data#ase flash#ack offE
'onvert data#ase to physical stand#y
SQLT 5lter data#ase convert to physical stand#yE
shutdown and startup in stand#y "ode
SQLT Shutdown i""ediate
SQLT startup no"ount
SQLT 5lter data#ase "ount stand#y data#aseE
SQLT 5lter data#ase recover "anaged stand#y data#ase disconnect fro" sessionE
On 5rod!ction
&na#le the log shipping to stand#y.
SQLT 5lter syste" set log?archive?dest?state?PD'ena#le'E
switch logg and verify the apply.
SQLT alter syste" switch logfileE
*er#er 0tilities ..e<p/imp : e<pdp : impdp: *7'*'oader ...
Ho% to change the table name d!ring import/
3n ;;g yo! can do this by !sing )"GA5.1AB'"
=ollowing is the infor"ation fro" Oracle ;;g docu"entation.
$&85(?05BL&
3efault: 0here is no default
Purpose:
5llows you to rena"e ta#les during an i"port operation perfor"ed with the
transporta#le "ethod.
Synta1 and Description
$&85(?05BL&D\sche"a.]old?ta#lena"e\.partition]:new?ta#lena"e
Uou can use the $&85(?05BL& para"eter to rena"e entire ta#les.
Uou can also use it to override the auto"atic na"ing of ta#le partitions that were
e1ported using the transporta#le "ethod. ,hen partitioned ta#les are e1ported using
the transporta#le "ethod, each partition and su#partition is pro"oted to its own ta#le
and #y default the ta#le is na"ed #y co"#ining the ta#le and partition na"e -that is,
ta#lena"e?partitionna"e.. Uou can use $&85(?05BL& to specify a na"e other than
the default.
Restrictions
9Only o#+ects created #y the I"port will #e re"apped. In particular, pree1isting ta#les
will not #e re"apped if 05BL&?&OIS0S?5'0IO! is set to 0$)!'50& or 5((&!3.
*1ample
0he following is an e1a"ple of using the $&85(?05BL& para"eter to rena"e the
e"ployees ta#le to a new na"e of e"ps:
i"pdp hr 3I$&'0O$UDdpu"p?dir; 3)8(=IL&De1psche"a.d"p
05BL&SDhr.e"ployees $&85(?05BL&Dhr.e"ployees:e"ps

Вам также может понравиться