Home Forums SQL Server 2005 Backups Restore failed for Server. (Microsoft.SqlServer.Smo) RE: Restore failed for Server. (Microsoft.SqlServer.Smo)

  • Great tip on the Activity Monitor, I did not realize you could use that.

    If it is just the test environment, I use this script to kill connections prior to a restore.

    DECLARE @spid varchar(10)

    SELECT @spid = spid

    FROM master.sys.sysprocesses

    WHERE

    dbid IN (DB_ID('Adventerworks), DB_ID('Northwind'), DB_ID('CCL'))

    WHILE @@ROWCOUNT <> 0

    BEGIN

    EXEC('KILL ' + @spid)

    SELECT @spid = spid

    FROM master.sys.sysprocesses

    WHERE

    dbid IN (DB_ID('Adventerworks), DB_ID('Northwind'), DB_ID('CCL'))

    AND spid > @spid

    END