How to manually create a Microsoft SQL Job to Age Stats and Audits:
The following example will retain 365 days worth of data in the MessageStats database.
- Open SQL Management Studio
- Expand Databases | MessageStats | Table and Right click on the T_Configuration table and select Open Table or Edit Top 200 Rows in SQL 2008
- Change the StatsRetentionDays to 365 and press enter and change the the AuditRetentionDays to 365 and press enter. And close out the Tab.
- Expand SQL Server Agent and Right click on Jobs and Select New Job.
- In the General section For the Name: put QMDataAge .
- For the Owner: make sure it is an account that is a sysadmin on the SQL server.
- In the General section for the Category: Select Database Maintenance.
- On the Steps Tab Select New
- In the General section The Step name should be QMSDataAge_SQL_Step0
- The Type should be Transact-SQL script (T-SQL)
- The Database should be MessageStats
- And in the Command section put EXEC PR_DataAgingDelStats and Click OK
- On the Steps Tab Select New
- In the General section The Step name should be QMSDataAge_SQL_Step1
- The Type should be Transact-SQL script (T-SQL)
- The Database should be MessageStats
- And in the Command section put EXEC PR_DataAgingDelAudits and Click OK
- On the Schedules Tab please select New
- For the Name Select QMS_SCHEDULE
- For the Schedule Type Select Recurring and check the Enabled box.
- For the Frequency we recommend setting this to run daily (Schedule at a time when the MessageStats Tasks are not running) And Click OK then OK again and the job has been created.