Tuesday, March 15, 2011

Activate Domain Status

**** Be Sure that PUB/SUB processes are up and running before using this script ****
SET SERVEROUT ON;
SPOOL D:\APPS\MONITORDOMAIN\MONITORDOMAIN.LOG;
DECLARE

DSTAT VARCHAR2(1) := 'T';

BEGIN

BEGIN
SELECT DOMAIN_STATUS INTO DSTAT FROM PSAPMSGDOMSTAT WHERE DOMAIN_STATUS = 'I';
EXCEPTION
WHEN NO_DATA_FOUND THEN
DSTAT:='A';
WHEN TOO_MANY_ROWS THEN
DSTAT:='I';
END;
IF DSTAT ='I' THEN

UPDATE PSIBFAILOVER SET IB_FAILOVER_FLAG = 1;

UPDATE PSAPMSGDSPSTAT SET DSPSTATUS = 0 , STATUSSTRING = 'ACT' WHERE STATUSSTRING='INACT';

UPDATE PSAPMSGDOMSTAT SET DOMAIN_STATUS = 'A' WHERE DOMAIN_STATUS = 'I';

END IF;
DBMS_OUTPUT.PUT_LINE(DSTAT);

END;
/

SPOOL OFF;
EXIT;

No comments: