February 18, 2020 at 7:24 pm
Hi,
I am not that knowledgable on backups and the files that they create, so please forgive me if say something wrong here.
My manager restored from a backup a database. So, let's say we had a database named ABC when he restored it, from a backup he named the restored one as Meng; so far no problem. He wants to now restore the ABC database again from the ABC back up again, and call it ABC_Dev. He thinks he cannot do this because of the ABC database and the Meng Shae the same datafile names and in them the (mdf, ndf, and ldf) files.
Questions:
February 18, 2020 at 7:40 pm
- Is it true that for those reasons he/ I could not do this?
No. Look up the WITH MOVE Option
2. If so what can we do?
This syntax should get you started
USE [master]
RESTORE DATABASE [ABC_Dev] FROM DISK = N'YourBackupFile' WITH FILE = 1,
MOVE N'ABC Logical Data File' TO N'D:\Data\ABC_Dev.mdf',
MOVE N'ABC Logical Log File' TO N'L:\Logs\ABC_Dev_log.ldf',
NOUNLOAD, REPLACE, STATS = 5
GO
thank you
You're welcome.
Do yourself a favor, and invest in yourself. There is so much information about backups and restores available from a simple Google search. You can learn 1000 times more in an a hour of reading than you can by posting on a forum.
Good Luck!
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
February 18, 2020 at 7:58 pm
Grant Fritchey has a bunch of videos on YouTube where he shows you how to do a bunch of database backup & restore things. Definitely worth watching.
February 18, 2020 at 10:54 pm
<Is it true that for those reasons he/ I could not do this?>
No, SQL Server would never allow one file to be used by two different dbs at the same time.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply