New in the Community? Get started here

Schneider Electric Exchange Community

Discuss and solve problems in energy management and automation. Join conversations and share insights on products and solutions. Co-innovate and collaborate with a global network of peers.

Register Now
Knowledge Base
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

- Who are the top users of September? Discover them here!

- Check out the ESS Active Energy Management Blog now! 

Set up a Continuum system to do automatic log truncation to save database space

Issue

How do I set up a Continuum system to do automatic log truncation to save database space?

Product Line

Andover Continuum

Environment

Continuum Trend logs

Cause

Database maintenance.

Resolution

Setting up Automatic Log Truncation with SQL Server and MSDE Database 

MSDE Engine

For MSDE, you can download the Stand Alone MSDE Database Utilities from Buildings Download Center. 

These utilities are capable of automatically truncating the logs, as well making automated backups, checking for low hard drive space, etc. 

SQL Server

For full SQL Server, you can easily create a scheduled Job. Details are described below.  

To create a scheduled Job that will truncate the Continuum logs in the SQL Server:

  1. Open up SQL Enterprise Manager  (Note that the SQL Server Agent service must be running in order to create a Job)
  2. Highlight the Continuum database
  3. From the Menu, select Tools \ Job Scheduling
  4. A wizard opens: "Welcome to the Create Job Wizard." Click Next
  5. Select Transact-SQL Command,  Click Next
  6. For the Database Name, select ContinuumDB (or whatever the name of the DB is)
  7. In the large white space for the Transact-SQL Command, cut and paste the code from our web site:
    ****** Replace 90 with the number of days to maintain in each log ********
    delete from accessevent where DATEDIFF(day, timestamp, getdate()) > 90
    delete from activityevent where DATEDIFF(day, timestamp, getdate()) > 90
    delete from alarmevent where DATEDIFF(day, timestamp, getdate()) > 90
    delete from errorevent where DATEDIFF(day, timestamp, getdate()) > 90
  8. Click Next
  9. On the next screen, you are asked when you do want to run this job
  10. Select "On a recurring basis" and hit the Schedule button
  11. On the Schedule page, set up whatever schedule you desire
  12. Click OK to close the Schedule Page • Click Next
  13. On the Job Notifications screen, you can choose (if you want) any email or net send alerts. This is optional • Click Next
  14. In the final page, you are given a summary of the Job you have just created and you can change the name of your Job to anything you want. It might be a good idea to give it a more descriptive name like "Weekly Log Truncation"
  15. Click Finish and you are done. You should get a message that the job was created successfully.
  16. To verify that the Job is running correctly, you can go to the Enterprise Manager of SQL Server and click on the Management Folder, then expand the SQL Server Agent folder and click on Jobs. On the right-hand pane, you will see a list of created jobs. Scroll down and find the job that you just created. You can get information about the history of the Job, whether it ran successfully or not.
Tags (1)
Labels (1)
No ratings