Quantcast
Channel: Broculos.net - SQL
Viewing all articles
Browse latest Browse all 3

How to restore a SharePoint content database from a SQL Server backup

$
0
0

There are several ways to backup and restore SharePoint content. SharePoint itself provides several backup and restore tools: either through the interface in Central Administration or through the command line with STSADM.

In this article I will discuss a different approach: how to restore a backup from SQL Server of a SharePoint content database. It's common to have a scheduled backup plan in a SQL Server, so it's a good alternative when the other methods aren't available.

The biggest hurdle you will have is making sure your database is not in use when you want to do the restore, because SharePoint has a lot of processes that will access your database, even if no one is visiting the site.

  • Stop Windows SharePoint Services Timer
    • Go to Administrative Tools and open Services.
    • Locate the Windows SharePoint Services Timer.
    • Open its properties, make sure the Startup type is set to Manual and stop the service.
    • Wait a few minutes for all running procedures to complete.
  • Kill any processes accessing your database
    • Open SQL Server Management Studio and connect to your database server.
    • Expand Management and double-click on Activity Monitor.
    • Right-click each process that's using your database and kill it or wait for it to finish.
  • Execute the restore script
    • Open a new query script.
    • You can use the following script, which will set the database access to single user to avoid any more database locks and then puts it back as it was in the end.
USE MASTER
ALTER DATABASE [DATABASE_NAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE 
RESTORE DATABASE [DATABASE_NAME] FROM  DISK = 'D:\PATH\Backup.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
ALTER DATABASE [DATABASE_NAME] SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO

Don't forget to start the Windows SharePoint Services Timer again:

  • Go to Administrative Tools and open Services.
  • Locate the Windows SharePoint Services Timer.
  • Open its properties, make sure the Startup type is set to Automatic and start the service.

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images