A couple of weeks ago I was asked to help troubleshoot problems with a Microsoft Project Server 2007 environment. After looking into the details, it seemed clear the problem only occurred on large projects. It also felt like a timeout. The message was:
Project Center cannot access the project(s) you are trying to view. It is most likely that you either don't have permissions to view the project, another user has deleted this project(s) before you were able to view it or that another user is in the process of publishing the project.
I will not dive into Project Server troubleshooting here, because main reason of this error message was the lack of SQL maintenance. The databases were in bad shape, causing all database related tasks much longer to complete (in this case too long).
This is not Project Server specific though. Every SQL Server should be setup to run some maintenance on a regular basis. In SQL Server, this is done by Maintenance Plans. Although I'm not a certified DBA, I think it is safe to share a basic maintenance plan. Use at your own insights.
Requirements:
- SQL Server Management Studio
- SQL Server Agent running and set to start automatic
So here goes:
- Open SQL Server Management Studio
- Navigate to Management > Maintenance Plans
- Right click on the folder Maintenance Plans and choose Maintenance Plan Wizard

- The Wizard will speak for itself mostly...

- Provide a name
In this case, I will create a weekly plan for the User databases. The User databases are all databases that are not System databases (master, model, msdb and tempdb). The System databases do not require the same extensive maintenance)
- Create a schedule for the plan to run

- Select tasks to be run

In this case, I chose the following:- Check Database Integrity
Make sure the database is consistent, if not we have a serious problem - Rebuild Index
Ideally you would check for fragmentation first, and then choose between Reorganize of Rebuild - Update Statistics
Not always necessary, for instance SharePoint has timer jobs that perform this tasks - Backup (Full and Transaction Log)
Speaks for itself - Maintenance Cleanup Tasks
Clean up some old logfiles or backups
- Check Database Integrity
- Set the right order in which the tasks will be run

- Set options for the Integrity Check
In this case I selected All User Databases (newly created databases are added automatically)
- Set options for Index Rebuild

- Set options for Update Statistics

- Set options for Backup Databases
Note that you can check to create subfolders per database. Also, I selected to verify the backup (which will cause the tasks to run longer)
- Set options for Backup Database Transaction Log
Same options as previous task. Note that system databases do not have transaction logs
- Set cleanup options
We can choose to have the tasks remove old backups or logfiles.
- Write a logfile of the maintenance plan and/or send a report by email (if database mail is configured)

- Review and test

Considerations:
- A consistency check can be done on a daily basis, while Index or Statistics operations would only need to run once a week or so
- Test the plan. See how much time it takes to complete
- Test the plan. See how it impacts performance. Index operations can be very heavy
- Monitor. Review logfiles. It's nice to have these tasks automated now, but how will you know if a consistency check failed?
- Maintenance plans are run by the account that created or modified them. Consider the account you use to create these plans.
I hope this helps in having more healthy SQL Servers. It's like fitness and yoga for your databases :)
No comments:
Post a Comment