How do to restore database | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How do to restore database

Hi all!
When restore database, i used statement:
USE master
ALTER DATABASE TestDB#SDCList SET recovery bulk_logged
RESTORE DATABASE TestDB#SDCList
FROM DISK = N’C:program FilesHueSDCHueSdcAccountingDataBackupTestDB#SDCList 6-4-2004 10 39 31 AM.dat’

It’s error:
Exclusive access could not be obtained because the database is in use.
Please help me close database when Somebody is openning
Thank!
From QA run SP_WHO2 and see which process is accessing this database.
And kill that process using KILL statement. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Another way is to change Database Properties to dbo only and after restore, back to public again. Luis Martin
Moderator
SQL-Server-Performance.com
Thank you help me!
Small addition to Luis’s comments :
If any of the logins with SYSADMIN privilege uses the database, even though when you enable DBO USE only it will error and only the method is to kill those connections before restoring the database. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>