Tags
CRM 2011, Microsoft Dynamics CRM, MSCRM 2011, Restore failed for server(Microsoft.SqlServer.SmoExtended): .mdf cannot be overwritten. It is being used by database. (Microsoft.SqlServer.Smo)
Hello Everyone,
Few days back, I created a testing environment(test1_MSCRM) for one of my Live-Organisation through Import Organization in the deployment Manager. For some further RnD purpose, I wanted to create yet another test organization (test2_MSCRM) for the same Live-Organization on the same server where I already had previous test1_MSCRM.
So, I created a new DB(test2_MSCRM) on my SQL-Sever and tried to restore the full backup of my Live organization, same way as I did while creating test1_MSCRM. But this time the Restore failed with the following Error:
Restore failed for server.(Microsoft.SqlServer.SmoExtended). System.Data.SqlClient.SqlError: The file 'C:\ProgramFiles\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test1_MSCRM.mdf' cannot be overwritten. It is being used by database 'test1_MSCRM'. (Microsoft.SqlServer.Smo)
The
Error clearly mentioned that my backup (test1_MSCRM.mdf) was trying to restore my previous test1_MSCRM.mdf file which is already being used by the test1_MSCRM database.
Actually While restoring I created the new DB with different name but forgot to change the file name for .mdf and .ldf which was taken while Backup.
To change the file name:
- Click on Options.
- At right side, Under ‘Restore the database file as:‘ section. The first column represent the original file names of file type .mdf and .ldf and right most column represents the file name which you want to provide and restore the DB file as.
- Click on the browse button and scroll all the way to see the file name and change it to your preferred name(test2_MSCRM.mdf and test2_MSCRM.ldf).
After changing the restore database file name as, my DB restore succeeded.
Hope this was Helpful.
Thanks !!!
🙂
Ranjith said:
Thanks !!
Ashwani~Ashwin said:
Welcome Ranjith.
Hakuna said:
My case I have 2 mdf files, so obviously one of them needed to be changed.
Ginanjar Dewantoro said:
Thank you is very helpful for me
Ashwani~Ashwin said:
Welcome.
Lincoln Pires said:
Muito bom! Funcionou perfeitamente amigo. Obrigado.
Excellent! Worked perfectly. Thank you.
Ashwani~Ashwin said:
Most Welcome. M glad it was helpful.
Gaurav said:
Helpful post. I am facing the same issue when i do this process though sql command.
I execute this command:
RESTORE DATABASE MyDatabase
FROM DISK = N’D:\OSM.bak’
WITH REPLACE,RECOVERY
After executing, it is giving the same error, which is described in this blog.
Can you please suggest me how can I resolve this?
Thanks.
Biniam A. said:
Thanks a lot. It is exactly what I wanted!
Ashwani~Ashwin said:
Welcome, M glad it was helpful !!!
🙂
Anurag said:
Thanks,
it helped
Ashwani~Ashwin said:
M glad it helped.
Ian said:
Thanks for the excellent write up. It helped me alot.
Ashwani~Ashwin said:
Welcome.
DIPESH said:
thanx man
Ashwani~Ashwin said:
Welcome buddy.
ashini said:
TITLE: Microsoft SQL Server Management Studio
——————————
Restore failed for Server ‘ASHINI_RIKHA’. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
——————————
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The operating system returned the error ‘5(failed to retrieve text for this error. Reason: 15105)’ while attempting ‘RestoreContainer::ValidateTargetForCreation’ on ‘C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\LEOSDB2_MSCRM.mdf’. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&LinkId=20476
——————————
BUTTONS:
OK
——————————
Help me…
Website tips,blogging tips and tricks,wordpress search engine optimization tips,seo tips and tricks,WP SEO Tricks,wordpress installing service,blogging tips,blog tips,Wordpress seo plugins,best wordpress seo extensions,WPSEOTrickswordpress tutorial said:
I enjoy what youu guys tend to be up too.
This type of clever work and exposure! Keep up the
fantastic works guys I’ve added you guys to our blogroll.
Abubakar Akanbi said:
Excellent job. Thanks!
Geller said:
Alguien me puede ayudar con este error..!!
Error de Restaurar para Servidor ‘ASIST-15\SQLEXPRESS’. (Microsoft.SqlServer.SmoExtended)
System.Data.SqlClient.SqlError: Se realizó una copia de seguridad de la base de datos en una versión de servidor 10.50.1600. Esta versión no es compatible con este servidor, que utiliza la versión 10.00.2531. Restaure la base de datos en un servidor que admita la copia de seguridad, o utilice una copia de seguridad que sea compatible con este servidor. (Microsoft.SqlServer.Smo)
Sivananda said:
Great. Thank you very much . it really helped
sanju said:
Thanks alot brother… 🙂
Ashwani~Ashwin said:
Welcome bro. 🙂
Chris Carpenter said:
This saved me during a production upgrade. Great post!
Ashwani~Ashwin said:
Thanks Chris, M glad it was helpful.
🙂
Phuti said:
Thank you so very much
uda said:
thank you brotha.it worked
it said:
Thank u so much sir…Its working
prasanna said:
hai …i am trying to restore adventureworks2014 database….but i got error…Restore database ‘AdventureWorks2014’faild(microsoft.sqlserver.management.relationalenginetasks)……what can i do?
Thanks
erandabuddhi said:
Thank you brother… I got the point…
bala said:
very helpful for me. excellent sir
Mritunjay Singh said:
Thanks D
Note said:
Thx so much
Otoniel said:
Thank you, It works for me.
German avila said:
Thanks, muchas gracias, saludos desde Mexico.
leonard said:
youre my hero! thanks 😀