How to restore a SharePoint site using SQL database backup

This week I had to do a restore of a site collection using only SQL database backup. The customers hosting partner had not setup a SharePoint farm backup and had no test environment available that we could restore the database to, so they restored the database back to the SQL server into the production environment.
When I did an attach of the contentdb, SharePoint config would not let that database into the farm since it had the same GUID as the original database (of course, since it was a restore). We tried to run some querys on the SQL to alter the GUID, but without success. Performed these steps instead, which includes detach the original db, attach the restored db to the same web application, export the site that was deleted, detach the restored db again, attach the original db and import the subsite (which was the reason for the restore).

Iisreset /stop
Detach the current content db WSS_Intranet from the SQL Server (this is the original database)
Iisreset /start
Attach the restored content db WSS_IntranetRestored
Open the site you want to restore and copy the URL
Export the site Tools via stsadm –o export –url https://intranet/se/tools -filename d:temp_backuprestore –includeusersecurity –versions 4 overwrite (where the syntax restore is a PREFIX for the backup files and NOT a filename you create)

Iisreset /stop
Detach the restored content db

Iisreset /start
Open Central Administration, enter Content databases, remove the restored db
Content databases, add the original content db
Attach the old content db


Import stsadm -o import -url https://intranet/se/tools -filename “d:temp_backuprestore.cmp” -includeusersecurity -updateversions 2


0 0 votes
Rate this article!
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
oldest most voted
Inline Feedbacks
View all comments

Thanks Lise.
Keep sharing such great info.