Subhash Sharma

Subhash Sharma
Subhash Sharma

This is Subhash Sharma(Software Engineer) Blog

Welcome to this blog and find every solution.............

Search This Blog

Software Engineer(Subhash Sharma)

Software Engineer(Subhash Sharma)
Software Engineer

Tuesday, October 19, 2010

Backup and Restore DataBase

//Backup Databse
backup database subhash to disk='f:\subhash1234.bak'

//Restore DataBase

Retrive the Logical file name of the database from backup.
RESTORE FILELISTONLY
FROM DISK = 'f:\subhash1234.bak' after this query run You find out .MDF AND .Ldf file.

MDF = Primary Data File.
LDF = Log File.
RESTORE DATABASE YourDB
FROM DISK = 'f:\subhash1234.bak'
WITH MOVE 'YourMDFLogicalName' TO 'F:\DataYourMDFFile.mdf',
MOVE 'YourLDFLogicalName' TO 'F:\DataYourLDFFile.ldf'

Example-----
RESTORE DATABASE Deepak1
FROM DISK = 'f:\subhash1234.bak'
WITH MOVE 'subhash' TO 'F:\subhash.mdf',
MOVE 'subhash_log' TO 'F:\subhash_log.LDF'

No comments:

Post a Comment