Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Mirroring and Shrink Database

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
US
Hello all
I have a MOSS 2007 (SharePoint 2007) farm setup. I'm mirroring the database servers. I have a maintenance plan I created with the wizard. Part of the plan shrinks the database. I called microsoft today to see if this would be ok. They told me the mirror databases would not reflect the principal databases ahter shrinking them. The pointed me to a KB article that describes this and has a workaround. You create a stored proc. Here's the KB
So i followed this, created the stored proceedure, then i created a job and entered this for each database
EXEC sp_shrink_mirrored_database 'database1'
EXEC sp_shrink_mirrored_database 'database2'
EXEC sp_shrink_mirrored_database 'database3'

Etc for each of my databases. Should I do it this way or can i run the EXEC sp_shrink_mirrored_database 'mydb' against all of my db's as so
EXEC sp_shrink_mirrored_database 'database1, database2, database3'

Thanks.
 
You would need to run the command for one database as a time.

Why are you shrinking the databases? Typically it's better to not shrink databases as this just add load to the disk for no reason.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Thanks for the reply. I'm actually wanting to shrink the log file. They tend to get pretty big. This mirror is a part of a moss sharepoint 2007 farm. As we are migrating sites over from 2003 portal, the sharepoint_config log and database are growing. I ran the maintenance plan the other day and the log file went from 2 gb to 53 megs.
 
If the log grows to 2 Gigs, it's probably because it needs to be two gigs. SQL will simply grow the file back to that size the next time that it needs to. Log files usually grow like this when indexes are rebuilt during database maintenance.

Also a 2 Gig log file isn't all that large. I've had systems which have 30-40 Gig log files do to maintenance.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top