Tuesday, May 28, 2019

Deleted Offline Database? No Issue

Yes you read right, no worry if you deleted Offline database it is easy to recover.

Very first thing all must aware that if you delete any Offline database, SQL Server will not delete mdf and ldf files from filesystem. Still there are chances of recover database directly using old mdf files you can create new database.

Benefits :

  • Easy to Restore
  • Easy to Recover
  • No loss of tables and data
Use below query to create new database.

Here is mdf file of offline database which is still exists on filesystem after deleting of offline database


CREATE DATABASE offlinedbname ON 
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\offlinedbname.mdf' )
FOR ATTACH
GO

No comments:

Post a Comment

web stats