Restore Database in SQL Server using SQL Query
In this article I will explain How to restore Database from .bak or.Mdf file in SQL Server using SQL Query. Please use following SQL queries for restoring the database.
Example:
Refresh databases and check for your restored database
RESTORE DATABASE yourdbname FROM DISK = 'E:\yourbackfile.bak' WITH MOVE 'mdf_file_name' TO 'E:\data_your_mdf_filename.mdf', MOVE 'ldb_file_name' TO 'E:\data_your_ldf_filename.ldf' , REPLACE
Example:
RESTORE DATABASE MySampledb FROM DISK = 'E:\sampledb.bak' WITH MOVE 'Sampledb' TO 'E:\Sampledb.mdf', MOVE 'Sampledb_log' TO 'E:\Sampledb.ldf' , REPLACE
Refresh databases and check for your restored database
0 comments :
Post a Comment