Reputation: 1070
I want to attach a DB to SQL Server. I have the mdf files for it but those are in read-only state. Also the LDF file is not present. I use the following command to attach the DB.
Create database TrackData on (Filename = N'F:\Data\Bill_Data.mdf') FOR ATTACH_REBUILD_LOG
but i get the following error.
Msg 3415, Level 16, State 3, Line 1
Database 'Bill_Data' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Bill_Data'. CREATE DATABASE is aborted.
I know that it might not be possible to recover the Database in this case as MDF file is in read-only state. Also I do not have a backup of database. But still expecting any wild ideas that could help.
Upvotes: 2
Views: 5242
Reputation: 103
Paste your .mdf file and ldf file in this directory - C:\Program Files\Microsoft SQL Server\MSSQL11.SS2012\MSSQL\DATA and make sure that the folder in which your .mdf file resides is not read only. please see this and this.
Upvotes: 0