Posts
33
Comments
186
Trackbacks
0
Create or Restore SQL Database with backup from different location
There comes a scenario when you want to restore database with another database backup but would like its data and transaction files to be located at different location.

Original Database - OldDB (database whose backup is with you)
New Database - NewDB (new database to be created by restoring backup)

Step 1- get the logical file name for OldDB backup using the following sql

RESTORE FILELISTONLY FROM DISK = 'E:\SQLBackups\OlDBBackup.bak'

This will give you logical file name of the Data and transaction log files of the backup.

Step 2- Use below sql to create new database using backup from different location

RESTORE DATABASE NewDB FROM DISK = 'E:\SQLBackups\OlDBBackup.bak'
WITH MOVE 'OldDB Backup Data file Logical name' TO 'E:\Dev2008\Data\NewDB_Data.mdf',
MOVE 'OldDB Backup Log file Logical name' TO 'E:\Dev2008\Logs\NewDB_Log.ldf'

posted on Monday, July 7, 2014 4:35 PM Print
Comments
Gravatar
# university results
entrance test results
6/5/2017 5:20 AM
The MSBSHSE will officially declare the Maharashtra SSC Result 2017 on the web portal.
Gravatar
# bluestacks download for pc
bluestacks for pc
6/14/2017 9:49 AM
BlueStacks App Player, free and safe download. Download BlueStacks App Player for Windows now from Softonic: 100% safe and virus free.
Gravatar
# bluestacks download for pc
OnePlus 5
6/14/2017 10:15 AM
The OnePlus 5 may feature a whopping 8GB of RAM and dual rear cameras for less money than Samsung's flagship phone.
OnePlus 5 review

Post Comment

Title *
Name *
Email
Comment *  
Verification