What Argent Housekeeping Is There?

Argent has a number of optional housekeeping facilities for you.

These are:

  • Purge Argent Predictor data
  • Run a batch command file
  • Run a SQL script

All three are optional and are independent of each other.

As the contents of the batch command file and the SQL script are completely under your control you can do any housekeeping you like, but with one caveat:

Both should complete in under five minutes elapsed time.

When the Argent service starts, it always performs the following checks in this order:

1: Optionally Purge Obsolete Argent Predictor Data

If the Argent service uses the Argent Predictor for trend analysis and capacity planning, the Argent service deletes Argent Predictor data older than the specified number of days in the Engine screen on the Administration section.

If the registry is set to be zero value, this feature to purge the Argent Predictor data is disabled, and no Argent Predictor data will be deleted. You have to be careful this does not lead to massive data being accumulated faster than you expected, and subsequent disk space issues.

Argent Console

HKEY_LOCAL_MACHINE\Software\Argent\ArgentManagementConsole\ArgentConsole\MAX_KEEP_PREDICTOR_DATA

Argent Guardian

HKEY_LOCAL_MACHINE\Software\Argent\ArgentGuardian\MAX_KEEP_PREDICTOR_DATA

Argent Data Consolidator

HKEY_LOCAL_MACHINE\Software\Argent\ArgentDataConsolidator\MAX_KEEP_PREDICTOR_DATA

Argent Exchange Monitor

HKEY_LOCAL_MACHINE\Software\Argent\ArgentExchangeMonitor\MAX_KEEP_PREDICTOR_DATA

2: Execute Your Optional Batch Command File

The content is completely up to you.

The batch command file names are:

Argent Console

AAC_AutoExec.bat

Argent Guardian

AG_AutoExec.bat

Argent Data Consolidator

ADC_AutoExec.bat

Argent Exchange Monitor

AXM_AutoExec.bat

The batch command file should reside in the home directory for each product.

If the batch command file does not exist, no error occurs, the absence is logged.

3: Execute Your Optional SQL Maintenance Script

Every Argent service recycles once every 24 hours, and because there are no SQL connections during the Argent service startup, it’s a great time for you to run the SQL maintenance script to do SQL maintenance as the database is not locked or held.

Of course, you can put any SQL statements in your script.

If the SQL maintenance script is executed frequently enough, the five-minute time limit is generally not an issue. But sometimes the first time running of the script can take much longer time, so you should runs it in SQL management tool first and verify the correctness of syntax and functionality, and to ensure the first one-time process is completed.

The names of SQL maintenance scripts are:

Argent Console

AAC_DBMaint.sql

Argent Guardian

AG_DBMaint.sql

Argent Data Consolidator

ADC_DBMaint.sql

Argent Exchange Monitor

AXM_DBMaint.sql

A sample script DBMaint.sql.SAMPLE that truncates and shrinks transaction logs is provided in the following location:

drive:\ARGENT\ArgentManagementConsole\ArgentAlertConsole


SET NOCOUNT ON

DECLARE @LogicalFileName sysname,

        @MaxMinutes INT,

        @NewSize INT



-- *** ENSURE TO CHANGE THE NEXT 3 LINES WITH YOUR CRITERIA. ***

USE     Your_Database_Name              -- This is the name of the database for which the log will be shrunk.

SELECT  @LogicalFileName = 'Your_log',  -- Use sp_helpfile to identify the logical file name that you want to shrink.

        @MaxMinutes = 10,               -- Limit on time allowed to wrap log.

        @NewSize = 100                  -- in MB



-- Setup / initialize

DECLARE @OriginalSize int

SELECT @OriginalSize = size -- in 8K pages

  FROM sysfiles

  WHERE name = @LogicalFileName



SELECT 'Original Size of ' + db_name() + ' LOG is ' +

        CONVERT(VARCHAR(30),@OriginalSize) + ' 8K pages or ' +

        CONVERT(VARCHAR(30),(@OriginalSize*8/1024)) + 'MB'

  FROM sysfiles

  WHERE name = @LogicalFileName



CREATE TABLE DummyTrans

  (DummyColumn char (8000) not null)



-- Wrap log and truncate it.

DECLARE @Counter   INT,

        @StartTime DATETIME,

        @TruncLog  VARCHAR(255)



SELECT  @StartTime = GETDATE(),

        @TruncLog = 'BACKUP LOG ' + db_name() + ' WITH TRUNCATE_ONLY'



-- Try an initial shrink.

DBCC SHRINKFILE (@LogicalFileName, @NewSize)

EXEC (@TruncLog)



-- Wrap the log if necessary.

WHILE     @MaxMinutes > DATEDIFF (mi, @StartTime, GETDATE()) -- time has not expired

      AND @OriginalSize = (SELECT size FROM sysfiles WHERE name = @LogicalFileName)  -- the log has not shrunk   

      AND (@OriginalSize * 8 /1024) > @NewSize  -- The value passed in for new size is smaller than the current size.

  BEGIN -- Outer loop.

    SELECT @Counter = 0

    WHILE  ((@Counter < @OriginalSize / 16) AND (@Counter < 50000))

      BEGIN -- update

        INSERT DummyTrans VALUES ('Fill Log')  -- Because it is a char field it inserts 8000 bytes.

        DELETE DummyTrans

        SELECT @Counter = @Counter + 1

      END   -- update

    EXEC (@TruncLog)  -- See if a trunc of the log shrinks it.

  END   -- outer loop

SELECT 'Final Size of ' + db_name() + ' LOG is ' +

        CONVERT(VARCHAR(30),size) + ' 8K pages or ' +

        CONVERT(VARCHAR(30),(size*8/1024)) + 'MB'

  FROM sysfiles

  WHERE name = @LogicalFileName

DROP TABLE DummyTrans

PRINT '*** Perform a full database backup ***'

SET NOCOUNT OFF