Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBScript for shrinking a Database...

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60018
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript for shrinking a Database...
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBScript for shrinking a Database... - 5/8/2008 10:03:18 PM   
  marconi

 

Posts: 8
Score: 0
Joined: 5/7/2008
Status: offline
Hi,
I have to shrink the database on a particular server. For that I am creating a .cmd file with the following code :-
------------------------------------------------------------------------------------------------------------------------------------------------------------------
sqlcmd -s -Q –o switch "EXEC sp_MSForEachDB @Command1 = N'DBCC
SHRINKDATABASE (jobserver1, 10)', @replacechar = 'jobserver1'" -c go

 
sqlcmd -s -Q –o switch "EXEC sp_MSForEachDB @Command1 = N'DBCC
SHRINKDATABASE (jobserver2, 10)', @replacechar = 'jobserver2'" -c go

 
sqlcmd -s -Q –o switch "EXEC sp_MSForEachDB @Command1 = N'DBCC
SHRINKDATABASE (jobserver3, 10)', @replacechar = 'jobserver2'" -c go

 
sqlcmd -s -Q –o switch "EXEC sp_MSForEachDB @Command1 = N'DBCC
SHRINKDATABASE (databaseserver, 10)', @replacechar = 'databaseserver'" -c go

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
When this CMD File is run, neither the databases on each server are shrunk nor the new output details are redirected to a log/txt file.Request you to please let me know the corrections in the script. Thanks a lot in advance. Best Regards,Marconi.  
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript for shrinking a Database... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts