Gold
Gold

Reputation: 62554

where to find MyDataBase.BAK file on SQL server 2008?

where to find MyDataBase.BAK file on SQL server 2008 ?

and how i can restore this file to my DataBase ?

thank's in advance

Upvotes: 0

Views: 206

Answers (1)

Rup
Rup

Reputation: 34418

Did you back it up using SQL only without specifing a full path, e.g.

BACKUP DATABASE MyDataBase TO DISK='MyDataBase.BAK'
GO

I think by default your backup will get placed in the Backup folder in the SQL Server install, i.e. C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup or similar. You can restore it using

RESTORE DATABASE MyDataBase FROM DISK='MyDataBase.BAK'
GO

but if the orginal files are still there you'll need to specify alternate paths for the restore, e.g.

RESTORE DATABASE MyDataBaseTestRestore FROM DISK='MyDataBase.BAK'
WITH MOVE 'MyDataBase' TO 'C:\Temp\TestRestore.mdf',
     MOVE 'MyDataBase_Log' TO 'C:\Temp\TestRestore_log.ldf'
GO

but it's so much simpler if you use management studio for all of this stuff.

Upvotes: 1

Related Questions