Monday, November 5, 2012

Restoring a SharePoint 2010 Database

First, turn off the Timer Service on the SharePoint server: SharePoint 2010 Timer

Run the following command to set the database to single user:

Use master;
GO
ALTER DATABASE <YOURDB> SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO

Then run sp_who to see if anyone is still connected

Use kill id to kill whoever is connected.  Example: kill 80

Use GUI to restore database by right clicking on database>tasks>restore

Then run the following command to bring it back to multi-user:

Use master;
GO
ALTER DATABASE <YOURDB> SET MULTI_USER;
GO