Turn off Logging for all Orchestrator Runbooks

Bewertung:  / 2
SchwachSuper 
Erstellt am Sonntag, 17. Januar 2016 Geschrieben von Stefan Horz

So, it's still recommended to keep your Orchestrator DB small....

If you want to to turn off the Logging of Activity specific or Common Published Data for all Runbooks you can manage this with a SQL-Query setting the columns LogCommonData and LogSpecificData to 0. But this settings will take no affect without check out and check in each Runbook until the version is incremented. The below SQL statement will increase the version for the concerned Runbooks.

You must just restart the affected currently executing Runbooks starting with a "Monitor*"-Activity. You can get them with this query:

SELECT        POLICIES.Name AS Runbook

FROM            OBJECTTYPES INNER JOIN

                         OBJECTS ON OBJECTTYPES.UniqueID = OBJECTS.ObjectType INNER JOIN

                         POLICIES ON OBJECTS.ParentID = POLICIES.UniqueID

WHERE        (POLICIES.Deleted = 0) AND (OBJECTS.Deleted = 0) AND (OBJECTS.Enabled = 1) AND (POLICIES.Published = 1) 

                    AND (LogCommonData = 1 OR LogSpecificData = 1) AND (OBJECTTYPES.Name LIKE 'Monitor%')

 

And now the SQL statement to turn off Logging for all Orchestrator Runbooks:

Use Orchestrator/* If the name of the Orchestrator DB is different use the right DB name*/

 

DECLARE @uniqueid UNIQUEIDENTIFIER

DECLARE @name NVARCHAR(MAX)

DECLARE @version INT

Declare @published BIT

DECLARE curs CURSOR FOR

 

SELECT UniqueId, Name, [Version], Published FROM POLICIES

WHERE (LogCommonData = 1 OR LogSpecificData = 1) AND (Deleted = 0)

 

OPEN curs

 

FETCH NEXT FROM curs

INTO @uniqueid, @name, @version, @published

 

WHILE @@FETCH_STATUS = 0

BEGIN

PRINT 'Turning Off Specific AND Common Data Logging for : ' + @name

UPDATE POLICIES

SET LogCommonData = 0, LogSpecificData = 0, [Version] = [Version] + 1

WHERE UniqueID = @uniqueid

IF @published  = 1

BEGIN

PRINT 'Turned Off Specific AND Common Data Logging for : ' + @name +'<== ATTENTION Runbook is currently started. Set settings takes affect after next start.'

END

ELSE

BEGIN

PRINT 'Turned Off Specific AND Common Data Logging for: ' + @name 

END

FETCH NEXT FROM curs

    INTO @uniqueid, @name, @version, @published

END

 

CLOSE curs

DEALLOCATE curs