1

I backup my database and I Mistakenly saved it without a name.

what happened is that instead of replace the last file it add to it the last backup.

now I have a .bak file that has 74 backups enter image description here

I want to restore the db in position 74 with query ,since restore from the wizrad always return "db in use"

I tried

alter database <dbname>
set single_user with rollback immediate

with no luck,so my only option is throw query window

any idea how to restore the one db from the file in position 74?

Thanks for any help

Baaroz

  • This site is for programming questions. We are not SQL server support. Try the DBA site. – Marc B Dec 2 '13 at 17:09
0

It doesn't matter how many backups are there. You would have the same error message if there was only one backup in the backup set.

I would either restore the backup 74 under different database name (put its name in "To database" textbox), or would rename current database to some other name, e.g. spetztest_OLD and restore the backup under original name. Then you can make sure you don't need the old one and drop it.

| improve this answer | |
2

try the following:

USE [MASTER]
GO
ALTER DATABASE [spetztest] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE [spetztest] FROM  DISK = N'c:\sdk.bak' WITH FILE = 74,  REPLACE,  STATS = 1
GO

Make sure that your session that you are using to do the restore is not using the database you want to restore.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy