NerdyHearn
Home
Blog

Contact
Mailing List

Software

Active Directory Products
Object Compare
Permission Compare

IPhone Products
Calls To Calendar
SMS To CSV
SMS To Gmail
Voicemail To Gmail

Sites
How Long For Me
SaveMySerials

Blog
Twitter

NerdyHearn - Blog


<< Back To All Blogs

Restoring Specific Documents from a MOSS 2007 Content Database Backup

Wednesday, February 24th, 2010

I recently came across a situation in which a user needed files that were on a site that was deleted from a SharePoint site collection. Normally documents can easily be recovered via the recycle bin, and worst-case scenario via the second stage farm recycle bin, but because an entire site was deleted, the recycle bins could not be used, as recycle bins are based on the site. I had a recent backup of the SharePoint server's content database, so it was possible to attach the content database to a new site collection on a separate server to simply restore the requested files for the user.

I figured it would be worthwile to share how I accomplished this as it was somewhat difficult to find proper documentation on the process.

You will need to start with another server (I used a Virtual PC) with the same setup MOSS-wise as the farm in which the content database backup lived.

In my case, I rolled a Virtual PC with MOSS 2007, SQL 2005, and SQL Management Studio (this is necessary for this process as well).

Step 1: Restore the content database to SQL Server
1) Copy the .bak file locally to the VPC
2) Open SQL Server Management Studio
3) Connect to the local SQL Instance (NOTE: Do not attempt to restore to the OfficerServers instance. I would recommend restoring to the default (SQL 2005 engine) instance)
4) Right-click on Databases -> Restore Database…
5) Point the restore dialog to the local .bak file
6) You will need to name the SQL Database the same as it was backed up in the .bak file. If you need to rename the database, do so after the restore has completed
7) Restore the database. Depending on the size of your content database, this could take anywhere from 10 minutes to 2 hours.

Step 2: Create a new web application in SharePoint
1) Open SharePoint Central Administration
2) Go to Application Management -> Create or extend Web application -> Create a new Web application
3) Leave the default settings for the Web Application, and click OK

Step 3: Detach the default content database from the newly-created Web Application
1) Go to Application Management -> Content databases
2) Make sure that the selected Web application is for the site and port that you just created, if it isn't, change the web application
3) Click on the current content database
4) Change the Database status field to "Offline" and click OK

Step 4: Attach Content Database from restored Backup
At this point, there are 2 paths you can take, depending on the size of your content database. If your content database is larger than 30GB, I would recommend taking the second (command-line) route. The reason this is sometimes necessary, is if you are attempting to restore in Central Administration, the ASP.NET application can timeout and therefore your restore will fail.

Option 1 (Central Administration):
1) Go to Application Management -> Content databases
2) Click "Add a content database"
3) Enter the server details for your SQL server, including the instance name
4) Enter the database name you restored the backup content database to
5) I would recommend using SQL authentication for the credentials. If you choose Windows authentication, it will authenticate as the MOSS server user, which if it is a standalone install (which I used for ease of installation on my Virtual PC), will be NETWORK SERVICE. You will need to make sure that your SQL user has proper access to the restored content database
6) Attach the database

Option 2 (STSADM):
1) The same information applies as above, where I recommend that you use SQL-based authentication.
2) Add the content database with the necessary information using the following command:
stsadm -o addcontentdb -url http://MACHINENAME:APPLICATIONPORT -databasename RESTORED_DATABASE_NAME -databaseuser SQLUSER -databasepassword SQLPASSWORD

At this point you should be able to navigate to the web application you previously created and browse the SharePoint site as you would normally.

You may encounter some issues if you are missing custom Content Types, Web Parts, or server installations. You can simply install these on the Virtual PC and these issues should resolve without further problems.

Restorin' Tom Out.

Tags

SharePoint Howto SQL Backup

Related Blogs

SharePoint RPC: Corrupted Binary Files

Using MOSS and WSS SharePoint Workflow to Resize Images in an Image Library
Fixing MOSS/WSS SharePoint errors with Alternate Access Mappings
Using Ext JS in SharePoint... a tip

Comments

Currently no comments.

Add A Comment

Name:


URL:


Email Address: (not public, used to send notifications on further comments)


Comments:



Enter the text above, except for the 1st and last character:


NerdyHearn - Latest tech news relating to C#, ASP.NET, SharePoint, PHP, general development, and more. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers