Quantcast
Channel: Database Design forum
Viewing all articles
Browse latest Browse all 2729

Does WITH MOVE during Restore effect the source database?

$
0
0
I am a bit new to this, so I'm not sure what's going on under the hood.

I can no longer use SMO wizard to copy a database. Not sure if its the size/locks or what but its timingout. I've done some research on that, and it seems the best solution is just use the Backup/Restore to create a copy of my database.

I have this file: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\VeteransNewsNetwork.bak

I want to use it to restore a copy. Here is my Restore script:
USE master
RESTORE DATABASE [VeteransNewsNetwork_Dev001] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\VeteransNewsNetwork.bak'
WITH FILE = 2,
MOVE N'HTHProject' TO N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\VeteransNewsNetwork_Dev001.mdf',
MOVE N'HTHProject_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\VeteransNewsNetwork_Dev001_log.ldf',
NOUNLOAD,
STATS = 5

Does WITH MOVE actually redirect the main database to point to these new files? Or are the MOVEs really just copies used with [VeteransNewsNetwork_Dev001]?

The original file names are:
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\VNN.mdf'
and
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\VNN_log.ldf'

What exactly are these .mdf and .ldf files in the MSSQL\DATA folder? Is this the actual data in the online database? And if I fire this script, am I really "MOVE"ing the file and directing the online database to point to these new files, or am I doing what I hope I am doing and just creating new files for my restored copy of the database?

Thanks for the insight!

Viewing all articles
Browse latest Browse all 2729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>