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

Determine version of SQL server and Release Version Number

Some useful references:

Query to determine the version of a SQL 2000/2005/2008

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel')
, SERVERPROPERTY ('edition')

SQL 2008 Release Revision:

  • SQL Server 2008 RTM – 2007.100.1600.0
  • SQL Server 2008 Service Pack 1 – 2007.100.2531.0

SQL 2005 Release Revision:

  • SQL Server 2005 RTM 2005.90.1399
  • SQL Server 2005 Service Pack 1 – 2005.90.2047
  • SQL Server 2005 Service Pack 2 – 2005.90.3042
  • SQL Server 2005 Service Pack 3 – z2005.90.4035

SQL 2000 Release Revision:

  • SQL Server 2000 RTM – 2000.80.194.0
  • SQL Server 2000 SP1 – 2000.80.384.0
  • SQL Server 2000 SP2 – 2000.80.534.0
  • SQL Server 2000 SP3 – 2000.80.760.0
  • SQL Server 2000 SP3a – 2000.80.760.0
  • SQL Server 2000 SP4 2000.8.00.2039

SQL 2005/2008 Mirroring Databases

Was working on mirroring a few SQL databases for Sharepoint.  but keep getting the following error:

– error 1817, fail to connect to the server xxx

– when you check the server’s event log, it mention there were a log showing the 2 SQL server were trying to connect thru anonymous account.

Here is what I did to fix it:

– ensure to use a FQDN  such as

– ENSURE SQL services is running on a Services account AND NOT LOCAL OR NETWORK SERVICES!!!! (this was my problem).