How to Restore a Site Collection directly from SQL Content DB

How to Restore a Site Collection directly from SQL Content DB

Here is how you can restore a site collection directly from a SQL Content DB

  • Restore a backup of the SQL database to your SQL server, add this DB to the SQL server using a different name.  do not use the production name (will explain later)
  • Run this stsadm command: 
    • stsadm -o  addcontentdb -url http://temp_web_applicaion -DATABASENAME name of your_restore_DB
    • Note:  I recommend you add this DB to a temp web application, back it up, and then restore it to its properly location.
  • If you browse to your Central Admin and click on Site Connections list for the web app http://temp_web_application, you should see that all the site collection in this DB will not be available.
  • Run a backup using: 
  • Restore it back to its properly location by running a restore using: 
    • stsadm -o restore -url http:// web_applicaion/sites/site_youwant_to_restore -filename c:\restore.cmp