Friday, October 8, 2010

Database Restore and Backup using Queries

backup database bnsdavgps to disk = 'D:\MS SQL Databases\Data\bnsdavgps.bak'

RESTORE FILELISTONLY FROM DISK = 'D:\MS SQL Databases\Data\bnsdavgps.bak'
--GpsMelissaDPS
--GpsMelissaDPS_log

RESTORE DATABASE BNSDAVGPSNew FROM DISK = 'D:\MS SQL Databases\Data\bnsdavgps.bak'
WITH REPLACE, File=1, Norecovery,
MOVE 'GpsMelissaDPS' TO 'D:\MS SQL Databases\Data\bnsdavgpsnew.mdf',
MOVE 'GpsMelissaDPS_log' TO 'D:\MS SQL Databases\Data\bnsdavgpsnew_log.ldf'

No comments:

Post a Comment