Improve company productivity with a Business Account.Sign Up

x
?
Solved

Automated Archive and Purge Tool for a data logging application.

Posted on 2004-09-23
2
Medium Priority
?
411 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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 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

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

608 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