Our Jr. DBA ran to me with this error just a few days ago while restoring the database.
Error 3154: The backup set holds a backup of a database other than the existing database.
Solution is very simple and not as difficult as he was thinking. He was trying to restore the database on another existing active database.
Fix/WorkAround/Solution:
1) Use WITH REPLACE while using the RESTORE command. View Example
2) Delete the older database which is conflicting and restore again using RESTORE command.
I understand my solution is little different than BOL but I use it to fix my database issue successfully.
3) Sample Example :
RESTORE DATABASE AdventureWorks
FROM DISK = 'C:\BackupAdventureworks.bak'
WITH REPLACE
Reference : Pinal Dave (http://blog.SQLAuthority.com)












This was a huge help.
But I think you forgot the slash in the example
FROM DISK = ‘C:\
(it didn’t work for me until I added the slash.)
Anyways, thanks a lot, you saved me from having to go to my senior dba
Hi pinal,
i have dought in sql admin :
1) how to check in sql server port number in command prompt.
2)how to check database or table which extent is using , where can i find out , any query is there please tell me
Thanks&Regrads
harish
Charming little piece of code!! thanks!
great!
Great! thanks.
check the ‘Restore on Existing Database’ option box if you are using the GUI
Thanks for the GUI (ie novice aka hack) user consideration, Arjun. Very helpful.
Thanks Arjun
Nice post. Could have stopped our Go live ! Thanks a lot.
Good for you man!!!!! A question: Why it did not work when I tried to do it through the RESTORE option available in Microsoft SQL 2005? The script generates “WITH FILE = 1, NOUNLOAD, STATS = 10″ instead of “WITH REPLACE”. Did I miss anything in the set up?
Thanks man, I was trying to restoring using the wizard, but it work beautifully, with your code
Thanks for this. Seems small to one who knows but I had some pain trying to restore a db until I found this. Thanks
This helps me a lot!
Great! it helped!
you just saved my life! Thanks!!!
Thankyou so much !! gr8 help
Thank you so much, it worked great
You can also go to the options page of the Restore Data Base dialog (In Management Studio Express) and select the option, Overwrite Existing Database.
Pinal you are great!!!!!
Three cheers for Pinal….right from my heart…..
Thank you very much….
Hi Pinal,
Thank you very much…
It’s working fine….
Simply super coding…
Great article, especiall full example with MOVE. BTW, is there some workaround in order not to use all the files-to-move? In my case there was 5 files or so. Is there some way to point all of them to some default location?
Thanks alot man, helped me a lot :)
I have tried to use the GUI, and the ‘Restore on Existing Database’ option, but I still get the error.
Thank You very much. This article helped at right time
you are a genius, problem SOLVED !
Thanks a lot for this post. People using the GUI should tick the following option: “Overwrite the existing database”. (SQL Server Management Studio Express)
Thanks a lot for the Article. It saved a hell lot of time.
thanks a lot…
really helpful!!! thanks a lot…
A lot a thank!!
THANK YOU VERY MUCH PINAL
U SOLVED MY PROBLEM IN A MATTER OF SECS
U r the TOUGHEST person in SQL SERVER
You are the man!!!!!!!!!!
thanks a lot..
Great piece of code. Was almost convinced that MS had put a restriction in there…
Nice!
Thanks a lot…!!!!
Thanks a lot ……………..
Thanks…developers aren’t DBA’s…saved my rear!
tsss, amazing what this little query can do :) saved me a phonecall and alot of time, thanks alot :)
Excellent!! …. thanks Pinal!
Thanks a lot…It was a magical code..
Thanks a lot! I could do it from the GUI of SQL Mgt.. but this worked just great!
Thanks a lot! I coudnt do it using GUI but this didit!
Hi..
This really helped me!!!! Thank you soo much!!!!
hi…
Thank u very much…. :)
Thank you!!!
Many thanks for your help :)
Great, saved hours of recreating the database table by table again, and also i said “oh, hope i knew that before, and didn’t waste …..”
Thank you :)
Fantastic ! Thanks a ton !!!
– Juwel
If you are using the wizard you can achieve exactly the same by clicking the radio button that says “restore over the existing database” (or similar) it’s the top option on the options bit … but nobody’s gonna read my comment it’s too low on the page!
i read it lee .. thx
Great. It worked for me Thanks
great work man,
It simplifies my search
Hi Pinal Dave,
And thanks Pinal Dave too much you know why . b/c when ever i have problem with sql server query i search in your site and i got the rite solution :) .
i m happy to see you when ever i see your site.
i have RESTORE DB in sql server 2000 so i use your this solution.
RESTORE DATABASE AdventureWorks
FROM DISK = ‘C:\BackupAdventureworks.bak’
WITH REPLACE
it is very halp full for me Thanks again Dave :)
ok
Take care
bye bye
Thanks man its a good code
hi,
thanks for the response.
right now i am searching for sql dba openings.
can any body help me the important and frequent interview questions on core sql dba.
thanks
great thanks , and i wasn’t expect this solution will be solve my problem.
Great Idea, but if I want to restore without replacing the existing database ?? I want to insert tables inside the backup file to be added to the tables already there in the existing database !!
Any help ?
Many thanks Pinal, good things always comes in small packages…this query solved my problem…cheers:)
It Worked ! Thanks :D
Worked like a charm! Thanks!
These 2 lines of codes save my lots times, whenever i goes to restore dayabase i always face this problem … I search problem on google and always yout these lines works ,.
Thanks a ton
Thanks a lot!
great code. huge thanks!
hey thanks for the great tip! was a big help — jp
Thanks a bunch for the tip!
Hi Pinal,
I took a full back-up from a server and tried to restore it on another server by creating a new database.
Since it was a full-back up, I had three files
abc.mdf
abc_log.ldf
sysft_abcCatalog
When I try to restore, the other machine did not have full-text installed. Thus I went for partial restore with replace option enable…. but the replace does not work.
I get the error Error 3154: The backup set holds a backup of a database other than the existing database. ….. even through I have written REPLACE option in the restore query:
Below is my query:
RESTORE DATABASE XYZ
FROM DISK = ‘C:\nusrath\abc.bak’
WITH REPLACE,
FILE=1,
PARTIAL,
MOVE ‘abc’ TO ‘c:\DATA\XYZ.mdf’,
MOVE ‘abc_log’ TO ‘c:\DATA\XYZ_log.ldf’,
NOUNLOAD,
STATS = 10
How should I work around ? Please help.
Thanks,
Nusrath
Did you ever get your question answered? I’m having the exact same problem and can’t get it to restore because it is looking for the full text catalog location. Please help!
@Dan Did you get a resolution? I’m having the same problem.
I resolved this by renaming my mdf and ldf files to match the source mdf and ldf file names. I used the WITH REPLACE option, though I’m not sure if it was required in my case or not.
I was just able to migrate a 2000 sql database to a 2008 with this little tidbit.
THANX!
H! Pinal , thanks a lot .i tried da way u suggested . i am able to create database from my backup file . but still getting db blank with no tables . i am using ms-sql 2005 server.
could any one suggest me whats the issue i m facing .
i am doin like”RESTORE DATABASE RelinkDB
FROM DISK = ‘C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\RelinkDB.bak’
WITH REPLACE”
Thanks mate. Your post was quite useful.
Great hint. Cheers!
THanxxxxxxxxxxxxxxxxxxxx a lot!
Thank you!!!!! I don’t think i’ve ever had an issue resolved so fast and simply!!!
Thanks for this, I was having the same problem, but that has fixed it!
Thank you. That was a big help.
Dax
Great Article! It helped us a lot. Thank you very much!
Thanks Man! :D
This is really a great work around and it resolved the issue.
Thanks a lot Pinal
Thanks for the tip, Pinal. I’ve had to use it on several occasions.
Hello Nusrath
I had exactly the same issue. It seems to happend when we make a backup of several databases appendes on a same bak fIle.
In my case I had one backup file named J04Vendredi.BAK on which where 4 databases backup
1-master
2-msdb
3-lienWinXS
4-aeosdb
I wanted to restore aeosdb on a database called aeosdbLFSB on the target server located physically ON
C:\Data\aeosdbLFSB.mdf’,
C:\Data\aeosdbLFSB_log.ldf’,
After 2 hours of unsuccessfull tries, searches on the net, in the doc and a lot of dirty words I got it that way:
You have to know what was the name of the logical file on the source server with
RESTORE FILELISTONLY
FROM disk = ‘C:\LFSBVM002\J04Vendredi.BAK’ (replace with your path and filename
WITH file = 4
(You have to specify the sequence number where is the wished database !!!)
The first colum showed the logical names of the source server
-aeosdb_dat
-aeosdb_log
Then, I had to write the SQL statement below
RESTORE DATABASE aeosdbLFSB
FROM DISK = ‘C:\LFSBVM002\J04Vendredi.BAK’
WITH
REPLACE,
MOVE ‘aeosdb_dat’ TO ‘C:\Data\aeosdbLFSB.mdf’,
MOVE ‘aeosdb_log’ TO ‘C:\Data\aeosdbLFSB_log.ldf’,
FILE=4
@Pierre, Thanks a lot. You solved my problem :)
Thank you very much!
Thanks alot!!! Your code very useful…
Thanks a lot. Worked in minutes !!
You saved me a lot of time. Thanks!!!
cool, solve my issue:
RESTORE DATABASE AdventureWorks
FROM DISK = ‘C:\BackupAdventureworks.bak’
WITH REPLACE
Thanks… I restored the database correctly… Once again thanks…
Thanks Alot!
Really Greate and Wonderful
Hi,
For developing/testing purposes with original data I need to restore / copy data from one database to another with same database structure (tables, SPs, views, etc) but a different database name. from a backup file from original.
What is the best approach for this? CAn I use the restore command for this?
Take a backup of the existing database and restore it by giving new database name
Thanks for the article…
Have a nice day.
It worked!!
Thanks
U DA MAN
Thanks Pinal. You have very good common sense in programming. Now let’s see what cool chakra graphic I get!
Hi, I got a question…I backuped my database from an Win2003 Server English Edition and when I try to restore the database into my development enviorment (wich is an XP Professional Spanish Edition) it shows an error like this:
Mens. 5133, Nivel 16, Estado 1, Línea 1
Directory lookup for the file “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDataBase.mdf” failed with the operating system error 3(El sistema no puede hallar la ruta especificada.).
Mens. 3156, Nivel 16, Estado 3, Línea 1
Of course I dont Have “Program Files”, in spanish it is called “Archivos de Programa” I dont how I can change that..hope you can help me…Thanks..
(by the way, El sistema no puede hallar la ruta especificada. = The system could not find the specified path.)
hai,
i tried many time to restore backup file through GUI restore.
i wasn’t able to restore.
i tried your query within second finished.
Many Thanks,
Bala
Thank you so much, your solution worked for me!!
thanks a lot, this was the my problem.
this solved my problem..
thank a lot
Great!!! Works like a charm :)
Sorry, it doesnt work for me please help…
Thank you very much for your simple example. It works
Another individual happy to have stumbled upon your post. Thanks for sharing.
Thank you sir! I can go to bed now!!
Thanks a lot. It work !!!!!!!!!!!
Thanks a lot for this is very helpful
You’re the king man, a great piece of code that helped me a lot. Thanks kindly
thnx
Excellent! Thanks.
Magic…..
thank you pinal
the simple code was easy to use and it worked like a charm
thanks
WOW, you saved a life out there somewhere in Atlanta man…. I was dead before this.. you win two internets!
Thanks. This tip should be on the main page of Microsoft SQL Server issues?
Why isn’t it there yet?
Thank you very much, you saved my ass.
LOL
hay thanx it really helped me alot
Great Work…… very helpful and efficient technique !!!!!!!
Thank you Thank you!!!
Your my idol!!
Thank you very much! Great Help!
Thanks a bunch cos FIX No 1 solved my problems perfectly.
Is this possible to replace filegroup with restore command with replace
Mate,
That is golden
Nice Work
Super. Worked like magic. Thanks a lot!!!!
Is there a way to delete/drop a database backup from the tape device? Please kindly advise.
thanks.
Thanks Pinal….Keep up this nice work…..cheers
Hi
Thanks for the answer, mate. It was spot on. For newbies like me this was a great help
Cheers, Prad
Saved me a lot of trouble, thanks
Thanks! worked for me!
For SQL2005 do not use ‘WITH REPLACE’ but only ‘REPLACE’ indeed, the word WITH must not be present
Thanks Pinal , this script worked for me.
At first I thought the script was freezing because I ran it for 25 minutes and it didn’t do anything. I thought it was freezing up.
I finally added “STATS = 1″ to the script because I needed to see when the script completed at 1% intervals. It turns out that the database I was restoring was so big (60+ GBs) that the script ran for nearly 2 hours.
Thanks again!
-Jody
It works really great for me. Thank You
Thanks Pinal Sir, it worked for me loads of thanks
Great post !!!!
Thanks much :)
Thanks for sharing your expertise, it helped me restore
my databases successfully.
:-)
Thanks alot !!
workedi n my case .:)
Excellent post!!!!!!!!!!!!!!!!!!
Thank you very much! :D It has solved my problem!
Thank you very much ! It works well.
Once again, you have provided a solution to another problem I encountered!
Thank you very much, and keep up the god work :)
Hi Pinal
hope u doing good, i used your code and also i tried to restore my backup with Overwrite flag, still having some issue.
Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database ‘Database Name’ because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
thanks,
Jimmy
Thank you so much for this! :)
Hello Jimmy,
First take the database in SINGLE_USER mode and then execute the restore command. For details please visit the below article:
http://mssqlonline.blogspot.com/2007/02/restore-database-backup-using-sql.html
Regards,
Pinal Dave
Excellent Solution, thanks for the great tip !
I want to restore the database with a new name, so I can use it as my test database
Yes you can do it by giving different database name while restoring it
Really interesting…thanks a lot.
thank you sir it’s working.
WITH REPLACE – thanks! You’re in my favorites now.
thank u very much sir
it saved my time
gr8 man gr8
gr8, with using above code I restored database file of sql server 2005 in sql server 2008.
thank you for your interesting posts…
thank you!! :)
Server: Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file “G:\SQL DATA\MSSQL\DATA\material_data1.ndf” failed with the operating system error 3(The system cannot find the path specified.).
Server: Msg 3156, Level 16, State 1, Line 1
File ‘material_1_Data’ cannot be restored to ‘G:\SQL DATA\MSSQL\DATA\material_data1.ndf’. Use WITH MOVE to identify a valid location for the file.
Server: Msg 3119, Level 16, State 1, Line 1
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
This is really helpful to take the backups.
Hello ,
i want to restore database in sql server but i have ony *.ibu
file.i have used this syntax but i am failed….
can you give me some solution how to restore this database?
Thanks a lot. you just help me again and again.
:D
Thanks man !!!
You really saved valueable time :)
Cheers !
Excellent,
Thanks. I knew it was simple; just needed the reminder
This is very helpful solution to me.
Thanks for your greatfull help realy it is too simple but for professionals like you maybe we are too beginners to find the solution in such way you do.
thanks a lot…this cud be best solution.
Saved my gourd. Had accidentally ran script which fouled up production database files in big way. Original restoration procedure failed. That simple code (we rarely use) restored , accountants are now back at work.
Thanks,
its great to have people like you around!
Thanks a tonnnnnn……
Its working fine
Thanks
Thank you very much
Thanks a lot :)
If you use SQLExpress instead of applying these commands, follow these steps:
1-Select the base you created for the restoration right
2 – Tasks> Restore> Database
A new window will open.
1 – Select “From Device” and click on … to choose the origin
2 – Click Add
3 – Select aorigem Base and OK and OK
4 – Check the box where his base appears to be restored
5 – Go to Options and check the “Overwrite the existing base”
So far, this seems more complicated than just typing the command, but in practice it is not. It does not take even 5 seconds.
If you use SQLExpress instead of applying these commands, follow these steps:
1-Select the base you created for the restoration, and click the right mouse button
2 – Tasks> Restore> Database
A new window will open.
1 – Select “From Device” and click on … to choose the origin
2 – Click Add
3 – Select aorigem Base and OK and OK
4 – Check the box where his base appears to be restored
5 – Go to Options and check the “Overwrite the existing base”
So far, this seems more complicated than just typing the command, but in practice it is not. It does not take not even 5 seconds.
“The comment above is bad transalted, choose this one end ignore this line for post”
Thank you sir,
You saved my day
Hi pinal,
I need your help in SQL server restoring issue. Error is as follows.
“The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.RESTORE FILELIST is terminating abnormally. (Microsoft SQL Server, Error: 3169)”
I know that it is not possible to restore SQL server 2005 database in SQL server 2000 database.
Do we have any way to export the data from 2005 and import it to SQL server 2000?
Please assist me.
Hi
I do not agree that all those answers are for the subject :
The backup set holds a backup of a database other than the existing database
Yes you could do : restore with replace
But the answer for the above subject is :
If you get that message “The backup set holds a backup of a database other than the existing database”
This is happening with a restore to SS 2005 from a SS2000 backup. This article says to use the ‘WITH REPLACE’ clause. The SS2005 management studio does not seem to allow this via the GUI.
Hi,
I am new to SQL Server.I have faced the same problem.When i used the query which you have given i got an error
Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database ‘India’ because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Please help me to resolve
Regards
Nidhin
Hi,
First of all..thanks a lot for this post..It helped me to restore.
I tried from GUI (slect override checkbox)..but didnt work.
Answer for last post – Connect to master database and then try this, it would work.
Rgds,
Ekta
Hello Alex Farias,
Great job.Double Thanks for the tips. It works.
Venki
ThankYou,
Thanks,
Tnx………………………
It worked,…
Thanks for this beautiful little piece of code, saved a lot of effort!!!
Thanks pinal
Thank you so much. Thank you for your time, for publish that kind of tips .
Dear Mr. Pinal,
I have a database in my organizaion. DB File Size is about 4GB and Transaction Logfile Size is about 82 GB. I am taking full backup of the database everyday at 12:10 AM by a job. When I tried to restore the database in another Server its after 48 hours… the Database restore is still going on. The Source Server is IBM x3600 8GB RAM M2 with 1TB Space and Target Server is IBM x3600 16GB RAM M3 with 1TB Space.
I also tried the following thing:
1. Backup only PRIMARY Filegroup on Target Server by
Backup Database FileGroup=’PRIMARY’ TO DISK=’C:\test.bak’
2. Copy test.bak from Source Server C: Drive to Target Server C:\
3. Restore that database on Target Server by
Restore Database FROM DISK=’C:\test.bak’
But still it shows me “The backup set holds a backup of a database other than the existing ” Message.
Could you please help
Thanks and Regards
Aziz
That worked great! Thanks!
Thank u so much…
Thank u so much your blog have solved my problem so many times.
Thanks a lot.
how to restore sqb backup in sql . in this back up contain 3 mdf file and 1 log file .please guide me to restore
Great! It worked for me…. Thanks a lot Pinal!!!!!!
This is very helpful.
Pinal Deva ki jai ho…… ,
I was trying to restore that database by wizard and also selecting Replace / overwirte than too its was going me Error:3154
And i tried by query it work perfect …. dont know how this happen but my problem get solved for now i will find the cause y such happen …..
ThnQ boss :)
cu soon
in TechDays :)
Thanks. I come across this error occasionally and I always forget the SQL statement to restore.
Hi Guys,
This is for all you techie’s who like me might have scratched their head for sometime.
Thanks for all the people who had posted in this page, reading your postings I could arrive at my solution.
I had to use a combination of both REPLACE and MOVE commands.
My posting is done based on SQL 2005. I hadn’t tested it in other versions.
My Situation:
I backed up a database in T-SQL, created a new DB with a diff name and used the backup file to restore onto the new DB and came up with the dreaded error – “The backup set holds a backup of a database other than the existing ‘xxx’ database.”
My Predicament:
I cannot use the Enterprise manager, because this is an application where the coding is done and it is a process that needs to create the database doing the above steps.
My Solution:
RESTORE DATABASE NewDBName FROM DISK = N’C:\OldDB.BAK’ WITH REPLACE, MOVE ‘OldDBLogicalName_data’ TO ‘C:\Location\NewDB_Data.mdf’, MOVE ‘OldDBLogicalName_Log’ TO ‘C:\Location\NewDB_Log.ldf’, STATS = 10
Hi pinal,
I need your help in SQL server restoring issue. Error is as follows.
“The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.RESTORE FILELIST is terminating abnormally. (Microsoft SQL Server, Error: 3169)”
I know that it is not possible to restore SQL server 2005 database in SQL server 2000 database.
Do we have any way to export the data from 2005 and import it to SQL server 2000?
Please assist me.
Dear All,
This post really saved a lot of time and got the solution in a minute.
Manoj
Hi All,
I tried to restore a .bak file from 2005 SQL server to 2008 SQL server, but the process errors out using the above method. I have got a list of errors, one of them is
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file “M:\MSSQL\MARKET\MARKET_primary_01.mdf” failed with the operating system error 3(The system cannot find the path specified.).
The process is referring to M:\MSSQL\MARKET, the location where the MARKET_primary_01.mdf was residing originally in the source server, whereas it should refer to the location where the destination sever is.(correct me if I am wrong)
Most of the errors are for the incorrect locations.
Can anyone help me out with this?
Thanks in advance.
Regards,
Litesh
Hi Pinal
1)How to restore the .bak file in sql server 2005..
But that .bak was created by using sql server 2000….
2) How to store the IP address..
hi ramya
u create the sqlscript of that .bak file in sql server 2000 and execute the script in sql2005.. itz wil be work fine….
Refer the below link..
http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/
1 restore database dbname from disk=’backup path’
2 Use varchar column
Hi Pinal,
1. I have 30 GB database, this database contain 3 mdf files and 1 log file. It’s possible to merge 1 mdf files. if possible how we can do it.
2.My drive free space contain 70 GB while i Restore 30 GB database It’s required nearly required 82 GB why it’s happen
Please guide on this………….
Thank you so much!
Thanks
Thanks a lot. It was of great help to me.
Thank you, this was a huge help :)
I was trying to restore a customers database and they only had a .bak file, so this solved the problem :D
Thanks
For me it worked with the WITH MOVE clause
RESTORE DATABASE [XXX]
FROM DISK = ‘D:\XXX.bak’
WITH MOVE XXX’ TO N’D:\MSSQL\MSSQL.2\MSSQL\DATA\XXX.mdf’
, MOVE N’XXX_log’ TO N’D:\MSSQL\MSSQL.2\MSSQL\DATA\XXX.ldf’
, NOUNLOAD, REPLACE, STATS = 10
Cheers
U saved my life Thanks
on the money, thanks!
Why was SQL SMS not answering me what to do with target database?
u r a genious sir…
live long n happy life
:)
Thanks it worked
thank you
worked perfectly! thanks Pidal!
Thanks, it save my life!
Execellent one..
Thanks you are a star…
Thank a lot ! With a tiny REPLACE that works great !
Funcionó de 10. Gracias
Thanks; Such a simple fix; I have heard of people doing all sorts of things like attaching the .mdf files etc but this worked perfectly :)
Please update the installation instructions to use the SQL command
RESTORE DATABASE ScotlandYard FROM DISK = ‘[path to backup folder]\ScotlandYard.bak’ WITH REPLACE
as the instructions posted don’t work.
You are genius….
Hi Pinal,
I followed the same as mentioned by you. But I am still getting the same error message
I have trouble with multiple restore, get the media issue
[Msg 3231, Level 16, State 1, Line 1 The media loaded on "D:\db\db1.bak" is formatted to support 1 media families, but 2 media families are expected according to the backup device specification.]
Trying to restore one bak file with REPLACE option is replacing the previously restored tables. But without REPLACE option get the following error
[Msg 3154, Level 16, State 4, Line 1 The backup set holds a backup of a database other than the existing 'SIMSDB' database.]
Any ideas?
Man, you are amazing, i find the answers always in your blog :), thanks so much
Thanks
Thank you.
hi pinal i had tried to restore the database by using your way but it give this error msg 3102 level 16,state 1,line 2
restore cannot process database ‘mydatabase’ because it is use by this session it is recommended that the master database be used when performing this operation 3013 level 16 state 1, line 2
restore database is terminating abnormally
Thanks its really helped
I’ve got same error,
I fixed it by selecting the Overwrite the existing database option
Hi Pinal,
i am new to sql development and I was trying this..
when I replaced “With move” with “with Replace” it says
Replace is not a recognized option.
where did I go wrong..
Worked great! So simply explained. You are the best!
Thank you very much!
Worked great! Thank you sir.
Msg 3101, Level 16, State 1, Line 1
Exclusive access could not be obtained because the database is in use.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I’m getting this error. Any thoughts? I’m not running anything on this DB.
Worked great! Thank you sir.
Thank you. There is several times that you blog was save my time…
thanks a lot..
thank you it’s helpful
Thanks mate, helped me get around an issue.
I use this script to drop active connection before the restore script
USE [master]
GO
ALTER DATABASE [X] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
cheers
Wonderful! Wonderful! Wonderful!…thanks for your help….i deleted the database folder causing the conflict and just restore the backup…i did not use command, just the GUI….. thanks
Hi Pinal,
As per your advise i have given the correct path to restore the database,but its not succeed.
here my SQL query to restore the database is
restore database customer_test
from disk = ‘D:\DB BAK\customer.bak’ with replace
after execute this query i got an error :
Msg 3203, Level 16, State 1, Line 4
Read on “D:\DB BAK\customer.bak” failed: 13(The data is invalid.)
Msg 3013, Level 16, State 1, Line 4
RESTORE DATABASE is terminating abnormally.
The database size is : 13GB
SQL Server Version : 2008R2
kindly give me suggestion in this
Is that a valid backup? How was the backup done?
Thank you very much for such a great help
vrish
1) i want to create a procedure to copy 1 database schema including all objects (views,index,procedures,tables,table data etc.) to another database schema within 1 server without generating script..but with SMO object
2) after getting all schema i want to get all updates which is done in source database without droping the previous data and schema..with SMO object..
plz let me knw as early… thank you..
Fantastic – as alway, clear and simple instructions. Thank you
Thank you pinal
Thanks, It worked like a charm!
It works!!! Thank you!
v v thanxs sir
Man!! you are a genious!!!! thanks!!