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

CMCLEAN.

SQL - Non Destructive Script to Clean Concurrent Manager Tables

PURPOSE

ThisdocumentprovidesareferencetoselfserviceCleaningthe
ConcurrentManagertables.

SCOPE&APPLICATION

ThisreferenceismadeavailableasatooltoassistDBA'sand
SystemAdministrators

NonDestructiveScripttoCleanConcurrentManagerTables

***11.5.7+OAMUsers***

PleaseruntheConcurrentManagerRecoveryfeaturetoaddressany
Concurrent
Manager/ConcurrentProcessingissueswithintheOracleApplication
Manager.

UsingtheConcurrentManagerRecoverywizardisthemethodtoclearthe
errorsuponbringingthe
internalmanagerbackup.

Thecmcleanscriptcanstillbeusedfor11.5.7+instancesprovidedthe
managersaredownand
noFNDLIBRprocessesarestillrunning.

***11.5.7=OAMUsers***

NOTE:

Thisscriptworkswith10.7,11.0,11.5&12Applications.

NOTE:

EnsurethatNoFNDLIBRprocessesarerunningasdetailedwithin
theTroubleshootingNote 104541.1andthattheConcurrentManager
isdown.

Youneedtoissueacommitoncethescriptisrunforthechanges
totakeeffect.

NOTE:

CopyfromthefirstREMstatementbelowtolastREMstatementofthis
documentandsaveas:cmclean.sql
====================================================================

REM
REMFILENAME
REMcmclean.sql
REMDESCRIPTION
REMCleanouttheconcurrentmanagertables
REMNOTES
REMUsage:sqlplus<apps_user/apps_passwd>@cmclean
REM
REM
REM$Id:cmclean.sql,v1.42001/04/0715:55:07pfergusoExp$
REM
REM
REM
+======================================================================+

setverifyoff;
setheadoff;
settimingoff
setpagesize1000

columnmanagerformata20heading'Managershortname'
columnpidheading'Processid'
columnpscodeformata12heading'Statuscode'
columnccodeformata12heading'Controlcode'
columnrequestheading'RequestID'
columnpcodeformata6heading'Phase'
columnscodeformata6heading'Status'

WHENEVERSQLERROREXITROLLBACK;

DOCUMENT

WARNING:Donotrunthisscriptwithoutexplicitinstructions
fromOracleSupport

***Makesurethatthemanagersareshutdown***
***beforerunningthisscript***

***IftheconcurrentmanagersareNOTshutdown,***
***exitthisscriptnow!!***

acceptanswerprompt'Ifyouwishtocontinuetypetheword''dual'':'

setfeedoff
selectnullfrom&answer;
setfeedon
REMUpdateprocessstatuscodestoTERMINATED

prompt
prompt

promptUpdatinginvalidprocessstatuscodesin
FND_CONCURRENT_PROCESSES
setfeedbackoff
setheadon
breakonmanager

SELECTconcurrent_queue_namemanager,
concurrent_process_idpid,
process_status_codepscode
FROMfnd_concurrent_queuesfcq,fnd_concurrent_processesfcp
WHEREprocess_status_codenotin('K','S')
ANDfcq.concurrent_queue_id=fcp.concurrent_queue_id
ANDfcq.application_id=fcp.queue_application_id;

setheadoff
setfeedbackon
UPDATEfnd_concurrent_processes
SETprocess_status_code='K'
WHEREprocess_status_codenotin('K','S');

REMSetallmanagersto0processes

prompt
prompt

promptUpdatingrunningprocessesinFND_CONCURRENT_QUEUES
promptSettingrunning_processes=0andmax_processes=0forall
managers

UPDATEfnd_concurrent_queues
SETrunning_processes=0,max_processes=0;

REMResetcontrolcodes

prompt
prompt

promptUpdatinginvalidcontrol_codesinFND_CONCURRENT_QUEUES
setfeedbackoff
setheadon
SELECTconcurrent_queue_namemanager,
control_codeccode
FROMfnd_concurrent_queues
WHEREcontrol_codenotin('E','R','X')
ANDcontrol_codeISNOTNULL;

setfeedbackon
setheadoff
UPDATEfnd_concurrent_queues
SETcontrol_code=NULL
WHEREcontrol_codenotin('E','R','X')
ANDcontrol_codeISNOTNULL;

REMAlsonullouttarget_nodeforallmanagers
UPDATEfnd_concurrent_queues
SETtarget_node=null;

REMSetall'Terminating'requeststoCompleted/Error
REMAlsosetRunningrequeststocompleted,sincethemanagersare
down

prompt
prompt

promptUpdatinganyRunningorTerminatingrequeststo
Completed/Error
setfeedbackoff
setheadon
SELECTrequest_idrequest,
phase_codepcode,
status_codescode
FROMfnd_concurrent_requests
WHEREstatus_code='T'ORphase_code='R'
ORDERBYrequest_id;

setfeedbackon
setheadoff
UPDATEfnd_concurrent_requests
SETphase_code='C',status_code='E'
WHEREstatus_code='T'ORphase_code='R';

REMSetallRunaloneflagsto'N'
REMThishastobedonedifferentlyforRelease10

prompt
prompt

promptUpdatinganyRunaloneflagsto'N'
prompt
setserveroutputon
setfeedbackoff
declare
cpls_integer:=dbms_sql.open_cursor;
upd_rowspls_integer;
versvarchar2(50);
tblvarchar2(50);
colvarchar2(50);
statementvarchar2(255);
begin

selectsubstr(release_name,1,2)
intovers
fromfnd_product_groups;

ifvers>=11then
tbl:='fnd_conflicts_domain';
col:='runalone_flag';
else
tbl:='fnd_concurrent_conflict_sets';
col:='run_alone_flag';
endif;

statement:='update'||tbl||'set'||col||'=''N''where
'||col||'=''Y''';
dbms_sql.parse(c,statement,dbms_sql.native);
upd_rows:=dbms_sql.execute(c);
dbms_sql.close_cursor(c);
dbms_output.put_line('Updated'||upd_rows||'rowsof'||
col||'in'||tbl||'to''N''');
end;
/

prompt

prompt

promptUpdatescomplete.
promptTypecommitnowtocommittheseupdates,orrollbacktocancel.
prompt

prompt

setfeedbackon

REM<=LastREMstatment

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