Thursday 12 January 2012

How to re-index WSUS database

Monthly re-indexing of WSUS database is a recommended task to maintain its performance. You can use WsusDBMaintenance script to reindex any version of the WSUS database, SQL Server or Windows Internal Database.

If you are using Windows Internal Database for the WSUS database, you'll need to use the sqlcmd utility.

You can easily install sqlcmd util without having SQL setup media. To do this

Install MS SQL Server Native Client first
X86 Package (sqlncli.msi) - 3511 KB
X64 Package (sqlncli_x64.msi) - 6486 KB
IA64 Package (sqlncli_ia64.msi) - 8365 KB

Then install sqlcmd util to your server
X86 Package (SQLServer2005_SQLCMD.msi) - 2528 KB
X64 Package (SQLServer2005_SQLCMD_x64.msi) - 4264 KB
IA64 Package (SQLServer2005_SQLCMD_ia64.msi) - 5410 KB

Then visit http://gallery.technet.microsoft.com/scriptcenter/6f8cde49-5c52-4abd-9820-f1d270ddea61 to obtain WsusDBMaintenance script. You can easily use the copy code button and paste clipboard into a new text document then rename it to WsusDBMaintenance.sql

To run Re-index

Run the command below, my sqlcmd is located under (I used the installation method above)C:Program FilesMicrosoft SQL Server90Toolsbinn folder if you have already have it please use appropriate path. And I also chose C:Program FilesUpdate ServicesDatabase folder for my WsusDBMaintenance.sql file, it is completely up to you.

sqlcmd -I -S \.pipeMSSQL$MICROSOFT##SSEEsqlquery -i "C:Program FilesUpdate ServicesDatabaseWsusDBMaintenance.sql"

wsusdbmaintenance

 wsusdbmaintenance-2
If you get an error when you run the command please delete and type - (minus) characters by hand.

No comments:

Post a Comment