Posts Tagged ‘SUSDB’


Moving the database (SUSDB)

The following instructions are for moving the SUSDB and should be valid irrespective of if you are using SBS or WSUS as a standalone product.

As with a regular SQL Server datastore, you can detach and move the database.

Since the database is a normal SQL database, you can simply detach, move and reattach the database. In order to do this, you will however need some tools. Note that these tools are not part of the operating system, so if you haven’t already installed them previosly, then you will need to do so now.

The tools you need are eith SQL Server Managment Studio or SQL Server Management Studio Express. At the time of writing the express (free) version can be downloaded from here:
SQL 2005: http://www.microsoft.com/download/en/details.aspx?id=8961
SQL 2008: http://www.microsoft.com/download/en/details.aspx?id=7593
or search on Google if the above links aren’t valid.
Please download the correct version for your platform (x86 or x64) – Note that SBS 2008+ is ALWAYS x64.

NOTE: You can also download and use the command line tools instead of the full management studio. (If you are familliar with these tools and their usage, then these instructions will probably be a piece of cake for you.)

Command line tools:
sqlncli.msi and SQLServer2005_SQLCMD.msi (Search for them on Google or Microsoft Download)

Prior to moving the database, please stop the following services:

  • IIS Admin Service
  • Update Services (Not Windows Update Service!).

You can do this via the commandline or by using the Services MMC snap-in (start run, services.msc).

Command line:

net stop "update services"
net stop w3svc

(Once the database has been moved you will need to restart these services. Also note that if you have any other services which are dependant on the above services – such as Terminal Services Gateway – they will also be stopped and will need to be restarted.)

Once the services have been stopped, you can proceed to detach the database.

Via SQL Server Management Studio (or Express):

  • Login to server as an administrator.
  • Click Start/Programs/Microsoft SQL Server 2005/SQL Server Management Studio Express. (NOTE: If you are not logged in as Administrator, Right click on SQL Server Management Studio and select Run As Administrator.)
  • Fill in the following information and then click Connect
    • Server type: Database Engine
    • Servername: \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query
    • Authentication: Windows Authentication
  • Expand Databases, right-click on SUSDB and select Tasks > Detach…  (Please continue reading before proceeding with this step, unless you are 100% sure where your current SUSDB files are located.)
  • Select the “Drop Connection” checkbox and click OK.  (There shouldn’t be any open connections as we have stopped all the relevant services.)
  • Move C:\WSUS\SUSDB folder to the <new drive>:\WSUS directory.  (Assuming that your SUSDB is currently located here – otherwise you can check where it is located prior to detaching the database by viewing it’s properties.)
  • To reattach the database, right-click on Database and select Attach…
  • On the Attach Databases page select the Add button.
  • Browse to the new location of the SUSDB and click OK twice to complete task

Via command line:

  • Login to server as administrator
  • To detach the database:
    c:\Program Files\Microsoft SQL Server\90\Tools\binn\SQLCMD.EXE" -E -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -Q "sp_detach_db 'SUSDB'
  • Now move the SUSDB.mdf and SUSDB.ldf to their new location. In the example below, we use D:\WSUSDB\. Use explorer to move the files to the path you’d like.
  • Then we reattach the database:
    c:\Program Files\Microsoft SQL Server\90\Tools\binn\SQLCMD.EXE" -E -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -Q "sp_attach_db @dbname=N'SUSDB',@filename1=N'E:\WSUSDB\SUSDB.mdf', @filename2=N'D:\WSUSDB\SUSDB_log.ldf'

Moving the content folders (SBS 2008+):

  • Start the Windows SBS Console
  • Click on the Backup and Server Storage icon
  • Click on the Server Storage Tab
  • Select Move Windows Update Repository Data (Right hand side)

Moving the conent folders (non SBS):

The “movecontent” command:

C:\Program Files\Update Services\Tools\wsusutil.exe" movecontent [newpath] [logfile]

For example:

C:\Program Files\Update Services\Tools\wsusutil.exe" movecontent \\server\WSUS$\ c:\wsusmove.log
C:\Program Files\Update Services\Tools\wsusutil.exe" movecontent D:\WSUS c:\wsusmove.log