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).
Detach the current content db WSS_Intranet from the SQL Server (this is the original database)
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)
Detach the restored content db
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
Keep sharing such great info.