Recommended Maintenance Plan for Siriusware Clients for SQL server 2005 PURPOSE The purpose of this document is to describe how to automate the periodic rebuilding of indexes for the SiriusSQL database. Rebuilding the indexes occasionally is a good idea, like changing the oil in your car to reduce problems you ll have with the engine. In our case, we re also interested in allocating empty space in some of the indexes so that they don t have to be expanded during normal use which results in page splits. Page splits adversely affect performance, especially when inserting new records. There will also be a second procedure to periodically check the integrity of the database, which is optional, but it is recommended. SOLUTION Our solution is to create automated Maintenance Plan Jobs via stored procedures. This will allow us to easily create and modify the plan for our clients if needed via our normal database update scripts. Once the re-index and integrity stored procedures are run to create the Maintenance Plan Jobs, the SQL Server Agent service will periodically run the Jobs. Re-running the stored procedures will drop and re-establish the Maintenance Plan Jobs. IMPORTANT NOTES Maintaining SQL Server is the responsibility of the client. This feature can not be fully automated and the client must ensure that this is setup correctly so that it is done on a regular basis.
REQUIREMENTS FOR AUTOMATICALLY RUNNING THE MAINTENANCE PLAN JOBS Having the SQL Server Agent start along with the OS is most easily accomplished with the SQL Server Service Manager program. To make the system more robust, we should also check this setting from SQL Server Management Studio SQL Server Agent Right-click Properties.
HOW TO CREATE AND RUN DATA MAINTENANCE JOBS 1. Run SQL Server Management Studio, go to the database you want to create maintenance jobs for go to Stored Procedures and make sure you find the 2 procedures as highlighted in the image below. Note that these procedures are only available in SiriusSQL database version 4005c or higher. 2. Press the New Query button, copy and paste the following two lines into the query window: exec siriussp_maintplanjob_integrity exec siriussp_maintplanjob_reindex point to the database you want to create maintenance jobs for (e.g., SiriusSQL) and click execute. Please note the areas circled in red below.
After the scripts are completed, 2 maintenance jobs for Data Integrity and Data Re-index are created. 3. In SQL Server Management Studio, go to SQL Server Agent Jobs, the 2 newly created jobs should be listed like this: 4. Set up for each job: Highlight a job right-click and select Properties - Go to Schedules tab to view the current schedules. To set up the date/time you desire: highlight the schedule click Edit
make sure the Recurring is selected from the drop-down check the Enable box make scheduling options OK Example for Schedule: - To set up notifications: go to Alert Add General Enter a Name and check the Enable box select a database from the drop-down select severity type you would like to receive alerts for
go to Response tab, check the Notify Operators box click New Operator button to add operator(s) who should get notifications and enter Name, email in General tab and appropriate info in the Options tab for the operator OK Example: go to the Notifications tab and select Action type. Example: OK
5. To manually run data maintenance jobs, run one job at a time. Highlight a job right-click and select Start Job, then let it run. The results will be displayed like this: 6. After the jobs are completed, if any of them fails the assigned operator will get notification(s) by email. Also, the following 2 logs are generated and stored in the same folder with the database files: - SiriusIntegrityMaintPlan_SiriusSQL_log_*.txt - SiriusReindexMaintPlan_SiriusSQL_log_*.txt