Hi,
Is it possible to restore a database with only a .bak file??
When I try to restore the system comes up with 2 paths where probably the original .mdf and .ldf files existed, but on my system they don't exist. How can I avoid this problem? (it's not possible to get the ldf and mdf files anymore...)
Grtz
Carloscreate a new database like so...
CREATE DATABASE MyDATABASE
use sp_helpdb to get the filenames for the mdf and the ldf you just created
sp_helpdb MYDATABASE
use RESTORE FILELISTONLY to get the logical filenames of the mdf and ldf in the backup file like
RESTORE FILELISTONLY
FROM DISK = 'C:\Mybackup.bak'
Use RESTORE with MOVE like so
RESTORE DATABASE MyDatabase
FROM DISK = 'C:\Mybackup.bak'
WITH REPLACE,RECOVERY,
MOVE 'Logicalfile_Data' TO 'D:\Microsoft SQL Server\MSSQL\data\physicalfile.mdf' , MOVE 'Logicalfile_Log' TO 'D:\Microsoft SQL Server\MSSQL\data\physicalfile_log.LDF'|||Its quite possible to restore the db even if the underlying db is not preset. U need to provide the correct path where u want the mdf and ldf files to be created.|||Thnx for the quick reply!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment