Link to home
Start Free TrialLog in
Avatar of VitalSolutions
VitalSolutions

asked on

Move WSUS 3.0 Database

I have an SBS 2008 server, running WSUS 3.0, the database is located on the C: drive of the server and is starting to take up to much space.

How can i move the WSUS folders / database to another hard drive within the server and keep everything intact ?

Thanks !
ASKER CERTIFIED SOLUTION
Avatar of Cris Hanna
Cris Hanna
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How to move WSUS MSDE database files to another drive using OSQL

This will work for any MSDE database, you just need to know the name of the DB, and stop the relevant services tied to it (not SQL, of course!)

Copy this to a batch file or to a command line.  This makes the assumptions:

MSDE install is in default location, and instance was named WSUS
You want to move the DB to directory d:\wsusdb
If these are not true you need only tweak the commands below to match your end goal.


--------------------------------------------------------------------------------

net stop "update services"
net stop w3svc
cd "C:\Program Files\Microsoft SQL Server\MSSQL$WSUS\Binn"
osql -E -S %computername%\wsus -Q "exec sp_detach_db 'SUSDB'"
md d:\WSUSDB
move "C:\Program Files\Microsoft SQL Server\MSSQL$WSUS\Data\SUS*.*" d:\wsusdb
osql -E -S %computername%\wsus -Q "exec sp_attach_db @dbname=N'SUSDB', @filename1=N'D:\WSUSDB\SUSDB.mdf', @filename2=N'D:\WSUSDB\SUSDB_log.ldf'"
net start "update services"
net start w3svc


--------------------------------------------------------------------------------

* Note - If you're trying to move any other MSDE database, you need to know the name.  

    osql -E -S %computername%\wsus -Q "sp_databases"

Will output this information for you.
seems like an awful lot of effort when the SBS product team has made this so easy with 3 to 4 clicks using the built in wizard I mention above