Solved

Automated Archive and Purge Tool for a data logging application.

Posted on 2004-09-23
2
359 Views
Last Modified: 2006-11-17
I need to be able to archive all records older than a year, but be able to restore the archived records if required for inspection at a later date.
(The records are a history of alarms, and plant values form a production process)
The logging application uses MS SQL as the database.

Aged 'archived blocks' should be organised in 1 year chunks for easy selection.
What would be the best (and easiest way to implement this). This includes any special applications already available for this type of task.

Thanks fo now,

Jas
0
Comment
Question by:i2rjames
2 Comments
 
LVL 1

Expert Comment

by:RoyJGeorge
ID: 12131546
I think the easiet way to do this is as follows
Use a DTS Package to export all records from the tables into flat  files (text file) comma delimeted. using the win zip command line utility zip the text files and move them into an archive folder.

to re import them just use another DTS package to import the unziped comma delimited files back into the database

This way the archive files are portable and not part of sql server and can be moved off site for safe keeping

Hope this helps
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 12132844
I would suggest the following:
For each Year, create a table (maybe in another dedicated database), with the name of the (new) table having the year postfixed. If you later decided to have chunks of 1 month, the process will not change that much

To "archive" to that table, you simply insert all the relevant records to that table, and then delete them in the actual table, both instructions in a proper transaction with error-checking/handling...

Once you have the records in a table, you can do with that table whatever you want, for example DTS as indicated already above. The advantage of having 1 dedicated table is the fact that you can playback the records to this table instead directly to the main table, thus avoiding to clutter the main table unnecessary.

To automate this process, it will be a bit more tricky, but if you are used to DTS, you know for sure how to work with dynamic properties. The years, tablenames and filenames should be configured dynamically, so you can call the DTS package(s) with the Year as parameter and don't need to reconfigure it every year...

Cheers
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now