Shrink multiple databases at once

leadtheway
leadtheway used Ask the Experts™
on
Have sql 2008 with about 25 or so Databases, with varying recovery models... backups have been failing so logs have the disk full, I want to set them all to simple and shrink them.  I know how to do it one at a time but was wondering if there is a trick to do all?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AneeshDatabase Consultant
Top Expert 2009

Commented:
You have to run the statement on multiple Query windows..

Also you need to figure out to avoid this process in future.  best way to do so is to have proper backups scheduled for these databases.
Shrinking the databases has a performance impact.

Author

Commented:
yes i'm aware, but this was dropped into my lap with weeks of no backups..So i guess the answer to my question is no..not shrinking the data, shrinking the log
Database Consultant
Top Expert 2009
Commented:
You can dynamically generate the shrink statements and run in manually each of these statements on each query window. Otherwise its going to be sequential

Author

Commented:
yeah i figured, was hoping though..lol, thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial