Sunday, April 17, 2016

SharePoint Site Backup restore/ Forgot the SA password of SQLServer 2008

I was trying to restore the SharePoint 2010 site backup through content database method, but unfortunately the site backup which I’m trying to restore on my environment has version mismatch.

The site backup version was 14.0.7145.5000 and the current environment where I’m trying to restore it 14.0.6029.1000, but wait I’ve list of other issues as well.
Phase 1 Issues:
  •      Forgot the SA password of the SQL-Server 2008 R2
  •      Unable to login through windows credentials


For password recovery this URL helped me a lot.

I have two option:

  1. Either restore the site backup in SharePoint 
  2. Restore the content database backup (which is relatively easy and recommended way)
Restore the content database backup 

For restore the SQL backup, refer these article, howtogeek msdn

The following commands is little modified command compare to the article, but it really works for me.

use master
go

ALTER DATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE;


RESTORE DATABASE [Target DatabaseName] 
FROM  
DISK = N'C:\Backup\SQLBackupFile.bak' 
WITH  FILE = 1,  
MOVE N'' TO 'c:\mssql\data\.mdf',   
MOVE N'_log' TO 'c:\mssql\log\.ldf',  
KEEP_REPLICATION,  NOUNLOAD,  REPLACE,  STATS = 10
GO

use
go

/********* Use this command if database is throwing error of "database is already use by another user"

ALTER DATABASE SET MULTI_USER;