We can use 2 methods. With SSMS or with sqlcmd
Method 1: Using SSMS
- Install SSMS
- Stop the service WSUS and IIS
Stop-Service WSUSService, W3SVC
- Important: Launch ‘Microsoft SQL Server Management Studio 18’ as an administrator.
- Connect to \\.\pipe\MICROSOFT##WID\tsql\query
- Detach the SUSDB database
- Manually move the SUSDB*.* files from C:\Windows\WID\Data to New Destination“
- Grant the Read/Write (R/W) permissions to the group NT SERVICE\MSSQL$MICROSOFT##WID.
- Attach the SUSDB database from the new path
- Restart server
- Connect to WSUS to check that all are working properly
Method 2: Using sqlcmd
Install tools :
- Download Microsoft® ODBC Driver 11 for SQL Server® – Windows from Official Microsoft Download Center
- Download Microsoft® Command Line Utilities 11 for SQL Server® from Official Microsoft Download Center
Type the following commands (Administrator right)
Stop-Service WSUSService, W3SVC
sqlcmd -E -S np:\\.\pipe\MICROSOFT##WID\tsql\query -Q "sp_detach_db 'SUSDB'
# Manually move the SUSDB*.* files from C:\Windows\WID\Data to New Destination"
sqlcmd -E -S np:\\.\pipe\MICROSOFT##WID\tsql\query -Q "sp_attach_db @dbname=N'SUSDB',@filename1=N'D:\DB\SUSDB.mdf', @filename2=N'D:\DB\SUSDB_log.ldf'"
Start-Service WSUSService, W3SVC
- Grant the Read/Write (R/W) permissions to the group NT SERVICE\MSSQL$MICROSOFT##WID.
- Restart server
- Connect to WSUS to check that all are working properly
0 Comments