KBI 310158 Removing Legacy Tables from Argent Job Scheduler

Version

Argent Job Scheduler 7 or later

Date

19 Mar 2009

Summary

This article documents the procedure for removing legacy Argent Job Scheduler (version 4) tables from an Argent Job Scheduler (version 7) back-end database.

Technical Background

During a migration from Argent Job Scheduler version 4 to version 7, legacy tables from version 4 may still be in the database. This is particularly true if the version 4 back-end is migrated to the same (or cloned) database.

Version 4 tables (prefixed TAJS) are not used by version 7 of the Argent Job Scheduler (tables prefixed AJS).

This procedure will work with back-end databases hosted on Microsoft SQL Server 2000 or later. The example in this article uses Microsoft SQL Server 2005.

Resolution

The accompanying script will safely remove the tables for the user. The script follows at the end of this article.

Step 1:

Any changes to a production database should ALWAYS be preceded by a full backup of the database. Once the backup is complete and verified, please proceed.

Step 2:

If you are using Microsoft SQL 2005 as the backend database, open SQL Management Studio. We can see the “old” (prefixed “TAJS”) and “new” tables (prefixed “AJS”).

Step 3:

Click “New Query”.

Step 4:

Copy and paste the query into the query box.

Step 5:

Notice in the first line of the query, you see the command:

USE [database_name]

Replace database_name with the name of the production database you wish to drop the legacy tables from. In the example shown here, Scheduler is the database name. The correctly modified query would look like:

USE [Scheduler]

Step 6:

Execute the query.

Step 7:

Highlight the database in question (in this example, Scheduler) and press F5 (refresh). Expand “Tables”, and confirm the old tables have been dropped from the database.

Alternate method:

Save the script (located at the end of this article) as a file with the extension “.sql”

e.g. drop_legacy_tables.sql

Locate this file in Windows Explorer, and double-click it. This will open the file in the appropriate management tool (SQL Management Studio for Microsoft SQL 2005, Query Analyzer in Microsoft SQL 2000). Execute the script after it has been opened.

SCRIPT FOLLOWS. Copy the following code, and follow either procedure listed above.




/*

** Copyright (c) 2009 ArgSoft Intellectual Property Holdings, Limited

**

** All Rights Reserved.

**

** ArgSoft Intellectual Property Holdings, Limited

** Canon's Court

** 22 Victoria Street

** Hamilton 

** Bermuda HM12

**

**

** This is PROPRIETARY SOURCE CODE of ArgSoft Intellectual Property Holdings, Limited.

**

** The contents of this file may not be disclosed to third parties, copied or

** duplicated in any form, in whole or in part, without the prior written

** permission of ArgSoft Intellectual Property Holdings, Limited.

**

** RESTRICTED RIGHTS LEGEND:

** Use, duplication or disclosure by the Government is subject to restrictions

** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data

** and Computer Software clause at DFARS 252.227-7013, and/or in similar or

** successor clauses in the FAR, DOD or NASA FAR Supplement. 

**

** Unpublished - rights reserved under the Copyright Laws of the United States  

** and other countries.

**

*/





/*******************************************************************************************************





Object:        Argent Job Scheduler Backend Database



Date:          Thu Mar 19, 2009 15:06:40



This script will drop legacy tables (version 4 of the Argent Job Scheduler, prefixed TAJS) from the Argent Job 

Scheduler backend database.



If you have questions, please email Support@Argent.com or access Argent Instant Help at http:\\help.Argent.com



******************************  Copyright (c) 2009 ArgSoft Intellectual Property Holdings, Limited  ***/









USE [database_name]      

/* database_name is the database you wish to remove legacy tables from. */

GO



IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_ALERT]') AND type in (N'U'))

/* Check the schema for user defined objects matching Argent Job Scheduler version 4 (prefix TAJS). */



DROP TABLE [dbo].[TAJS_ALERT] 

/* If such a record exists, drop the corresponding table from the database. */

GO 



/* Iterate through all candidates known to map to Argent Job Scheduler version 4 tables. */

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_ARCHIVE]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_ARCHIVE]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_CALENDAR]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_CALENDAR]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_EREPORT]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_EREPORT]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOB]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOB]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOB_HISTORY]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOB_HISTORY]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOB_SCHEDULE]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOB_SCHEDULE]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOB_TEMPLATE]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOB_TEMPLATE]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOBCLASS]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOBCLASS]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOBLOG]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOBLOG]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_JOURNAL]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_JOURNAL]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJS_MACRO]') AND type in (N'U'))

DROP TABLE [dbo].[TAJS_MACRO]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TAJSJOBS]') AND type in (N'U'))

DROP TABLE [dbo].[TAJSJOBS]

GO







/*******************************************************************************************************





Use the database specified in



USE [database_name]



Where database_name corresponds to the backend database you wish to remove legacy tables from.



Check the schema for user defined objects matching Argent Job Scheduler version 4 (prefix TAJS).

The script will iterate through all candidates known to map to Argent Job Scheduler version 4 tables.



If such a record exists, drop the corresponding table from the database.





******************************  Copyright (c) 2009 ArgSoft Intellectual Property Holdings, Limited  ***/