STIDistrict SQL 2000 Database Management Plans Overview STI recommends that users create SQL database maintenance plans to maintain the integrity of the STIDistrict database. Database maintenance plans are comprised of automated jobs which may be scheduled to run unattended daily, weekly or monthly. This document is intended to help the user create two database maintenance plans which will schedule the following jobs: Optimize drive usage. Maintain indexes. Back up the daisi database. Update database statistics. Database Maintenance Plan 1 Database Maintenance Plan 2 Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 1
Creating Database Maintenance Plan 1 To create the first maintenance plan, go to the STIDistrict server on which Microsoft SQL Server is installed and follow the steps below: Log in to the server as the Administrator. Click Start Programs Microsoft SQL Server Service Manager. Verify that SQL Server Agent is running and is set to Auto-start service when OS starts. Close the SQL Server Service Manager by clicking on the X in the top right of the window. Select Start Programs Microsoft SQL Server Enterprise Manager. Expand the nodes as shown in the screen shot below to display the contents of the Management folder. Right-click on the Database Maintenance Plans node, then select New Maintenance Plan from the menu provided. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 2
Select Next to begin the creation of a new plan, then click Next again to continue. Select the daisi database from the list provided, then click Next to continue. Select the Reorganize data and Remove unused space options, then click Next. Note: By default this part of the job will run at 1:00 A.M. every Sunday. To change this schedule, click on the Change button to the right of the Schedule field and use the form provided to make modifications. When creating a new schedule, be certain there is no conflict between this procedure and any other automated processes, such as data backups. Click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 3
Select the Check database integrity and Attempt to repair any minor problems options as shown below, then click Next. Note: By default this part of the job will run at 12 A.M. every Sunday (that is, at midnight on Saturday night). To change this schedule, click on the Change button to the right of the Schedule field and use the form provided to make modifications. When creating a new schedule, be certain there is no conflict between this procedure and any other automated processes, such as data backups, and be sure to schedule this task for a time that is AFTER the time that has been scheduled for the data optimization job. Click Next to continue. Select the option that will be used when backing up the database: o Either accept the scheduled day/time, or click the Change button to set up a new day and time. o Choose whether to back up to a Tape device if desired (this option may only be selected if the tape device is connected directly to the server), or to Disk (the server s hard drive). o Click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 4
Either accept the default directory or select Use this directory to change to a different directory. Before making this decision, determine the size of the daisi database and compare to the available free space on the hard drive selected. The backup file will be roughly equal to the size of the actual database, so be sure to select a drive with sufficient space. The backup file will be stored in the selected directory with a file name such as daisi_db_200505062202.bak. This file name will represent the name of the database (daisi) and the date and time of the backup. The file extension will be.bak unless you specify otherwise. Also, consider allowing SQL to remove backup files automatically to help manage disk usage. Select the checkbox (shown in the screen shot above) labeled Remove files older than and enter criteria to determine how long to keep backup files before they are deleted. In the example shown below, a backup will be performed once per week and the utility has been set to remove backup files older than one week. This means that there will always be one backup file stored on the drive at any particular time. Since this file will exist while a new one is being created, the drive selected to store backups must have enough storage space available to hold at Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 5
least two times the size of the database. Immediately after the backup is performed each week, the oldest file will automatically be deleted. Click Next to continue. Backing up the transaction log may be considered optional, provided the district is performing a complete backup at least once per week. Do not select the option to back up the transaction log unless you wish to perform transactional backups throughout the week. Click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 6
If desired, select the option to Write report to a text file upon completion of each backup. This will create a report describing the maintenance procedure. Click Next to continue. Take the default options on the plan history and then click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 7
If desired, change the Plan name to something more descriptive and then click Finish. Click OK to close the prompt that notifies you that the plan has been successfully created. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 8
Create Database Maintenance Plan 2 Right-click on Database Maintenance Plans again, and select New Maintenance Plan. Select Next to begin the creation of a new plan. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 9
Select the daisi database from the list provided. Select the option Update statistics used by query optimizer. Change the Sample value to 25%, then click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 10
Do NOT select Check database integrity. Click Next to continue. Do NOT select Back up the database as part of the maintenance plan. Click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 11
Do NOT select Back up the transaction log as part of the maintenance plan. Click Next to continue. Do NOT select Write report to a text file in directory. Click Next to continue. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 12
Keep the default options to Write history and to Limit rows, then click Next to continue. If desired, change the Plan name to something more descriptive and then click Finish. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 13
Click OK to close the prompt that notifies you that the plan has been successfully created. Set Ownership of Jobs Click to expand the SQL Server Agent node, revealing the Jobs node as shown below. To change ownership of each job that has been created, you will need to right-click on the job and select Properties. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 14
Click on the drop-down menu labeled Owner and select sa from the list. Click OK to continue. Repeat for each of the four jobs created. Manual Running of Jobs (Optional) The steps listed in the sections above have created automated jobs that will run according to a regular schedule. If at any point you wish to manually run one of these jobs, do the following: Open SQL Enterprise Manager and drill down to the SQL Server Agent\Jobs node. Right-click on the job you wish to run and select Start Job. The status of the job will not change unless the Enterprise Manager is refreshed. To do this, right-click on Jobs and select Refresh. Quick Reference Guide STI_0801071235 STIDistrict SQL 2000 Database Management Plans 15