Click here to Skip to main content
15,893,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two server's one i use for development and other to host web apps and sql server on companies intranet.

I use SQL Server Express 2008 Advanced on the Live server placed in US.
And use SQL Server Express 2012 on the Dev Server placed in India.

I created a backup of the SQL Server database from the Live server.

When i tried to restore the database on the Dev server it gives me a error which is as follows

"Restore of database TimeManager failed. The backup set holds a backup of a database other than the existing TimeManager database."

I am 100% sure that I backed up the correct database from the Live Server as i am no amateur at that (done a 1000 times in classroom).

Is this happening because of the timezone differences because it also once showed a error which said "The backup is of an earlier time" something like that.

Please help.
Posted

1 solution

The problem is that you try to restore into an active database...
You should use WITH REPLACE to overcome the problem...
SQL
RESTORE DATABASE MyDB
FROM DISK = 'C:\MyDB.bak'
WITH REPLACE

Or, if you are using UI choose Options on the restore window and click on the first checkbox, with the text "Overwrite the existing database (WITH REPLACE)"...

If you need to close active connections on an active database use this before restore:
SQL
USE MASTER
ALTER DATABASE MyDB SET OFFLINE WITH ROLLBACK IMMEDIATE

And this after:
SQL
USE MASTER
ALTER DATABASE MyDB SET ONLINE WITH ROLLBACK IMMEDIATE
 
Share this answer
 
v2
Comments
Christopher Fernandes 13-Jan-15 5:43am    
Now it gives an error of Exclusive lock not acquired.
Kornfeld Eliyahu Peter 13-Jan-15 5:54am    
You can not restore a database that actively used, the reason that the restore process try and lock the database exclusively for the time of the restoration process...
You can forcibly close the existing processes (take db offline) but it will give some online users a bad experience...
You may find a time of the day (week, month) when closing the processes will cause minimal problem...
(updated the solution with code to close active processes)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900