Меню

Microsoft sql server ошибка 3415

SQL error 3415 occurs while attaching a database to an SQL server. It normally happens due to insufficient permission of the user or SQL server version conflicts.

As a part of our Server Management Services, we help our Customers to fix SQL related errors regularly.

Let us today discuss the possible causes and fixes for this error.

What causes SQL error 3415?

Users often face the SQL error 3415  while attaching a database to the SQL server. A typical error message looks like:

SQL error 3415

Major reasons for this error are:

  1. The user does not have sufficient permission to the MSSQL data folder.
  2. The database is in read-only mode.
  3. Version conflict of SQL Servers.

Let us now look at each of these reasons and their solutions one by one.
 

How to fix the SQL error 3415?

The most common reason for error 3415 is that the user under which the SQL service runs does not have full access permissions to MSSQL data folder. To fix this error, we need to grant proper permission to the user using the steps below:

1. Go to the MSSQL data folder and right-click on it.
2.Select Properties.
3. Go to the Security tab.
*If the "Log On As" user from your service is a user account, make sure that user account has Full Control for the folder.
*If the "Log On As" user from your service is "Network Service" or "Local System" those accounts should already have access.

The database is in read-only mode

While we attach the database to a higher version of SQL Server than the instance the .mdf was originally attached to, it triggers the error. SQL Server tries to upgrade the database as part of the attachment, but it cannot as the database is in read-only mode.

SQL Server does not detect the read-only filegroup before it starts to upgrade the database. After the upgrade has started, SQL Server writes entries to the transaction log. Earlier versions cannot read the new transaction log entries.

To fix the error, we will need to move the database that contains a read-only filegroup to an instance of the new SQL Server version. A detailed procedure to perform this is available here.

Alternate Solutions

If the error message appears even after having proper permissions and the database is not read-only, it could be related to SQL Server Management Studio. Starting the SQL Server Management Studio in Administrator mode may help to fix the error message.

Another alternate fix for this error is to restore a backup of the database from the old instance to the new instance. Since the conflict with the versions in the two servers is a major reason for this error, performing an upgrade of the earlier version of SQL Server to a higher version of SQL Server would also help to fix it.

Further, retrying after changing the locations of MDF and LDF files may also help to fix the issue. Also, we need to make sure that the account jas the required privileges.

 
[Need any further assistance in fixing Cloudflare errors? – We’re available 24*7]
 

Conclusion

In short, SQL error 3415 occurs while attaching a database to an SQL server. It normally happens due to insufficient permission of the user or SQL server version conflicts. Today, we saw how our Support Engineers fix this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

  • Remove From My Forums
  • Question

  • Hi all:

    I recently download sql server 2012

    I try to attach databases, but I have this error

    Database 'DBName' cannot be upgraded because it is read-only, has read-only files or the user does not have permissions to modify some of the files. Make the database or files writeable, and rerun recovery. (Microsoft SQL Server, Error: 3415)

    I don’t know how to Access the databases. I would like not to lose them

    Can u help me?

    Thanks in advanced

Answers

  • Hello volar,

    Where are the database files mdf+ldf located? As it’s best move the files to the DATA subfolder of your SQL Server installation, here the SQL Server service account do have all required permissions to access the files.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by

      Tuesday, August 6, 2013 5:20 AM

    • Marked as answer by
      Fanny Liu
      Monday, August 12, 2013 10:08 AM

  • Agree, the files and directories that you are using need to be owned, or at least allocate permissions to the account that is running the SQL Server engine. If you have downloaded the files you may also find that they are in read only mode and you need to
    unlock them.

    As you are attaching the files, just move them to the default data and log directories and check the file ACL’s


    Virtual Realm Consulting (http://www.virtualrealm.com.au)

    • Proposed as answer by
      Alisa Tang
      Tuesday, August 6, 2013 5:20 AM
    • Marked as answer by
      Fanny Liu
      Monday, August 12, 2013 10:08 AM

RRS feed

  • Remove From My Forums
  • Вопрос

  • hi,
    I am trying to attach database AdventureworksLT, and it shows me an error message:
    Database AdventureworksLT cannot be upgraded because it has readonly files,make the database or files writable or rerun recovery.

    how can i make database or files writable?

Ответы

    • Предложено в качестве ответа
      Paul Svirin
      31 августа 2009 г. 20:48
    • Помечено в качестве ответа
      Xiao-Min Tan – MSFT
      8 сентября 2009 г. 9:46

Все ответы

    • Предложено в качестве ответа
      Paul Svirin
      31 августа 2009 г. 20:48
    • Помечено в качестве ответа
      Xiao-Min Tan – MSFT
      8 сентября 2009 г. 9:46
  • doing it the other way worked for me

    I was getting the error with windows auth

    Switched to sql and it worked

  • I got the same error 3415 and it was resolved when I opened SQL Server Management Studio with Windows authentification.

    Thank you,

    Herokey

When i attaching mdf file to SQL Server i am getting error database cannot be upgraded because it is read only or it has read only file. Make sure Database or files are writeable.

asked Dec 11, 2009 at 4:04

1

The database you attach is an previous SQL build. It has to be upgraded and it cannot be upgraded because the file is read only.

answered Dec 11, 2009 at 4:24

Remus Rusanu's user avatar

Remus RusanuRemus Rusanu

8,2531 gold badge19 silver badges22 bronze badges

before you detach the database in the previous version. Change any read-only file groups to read-write. Microsoft also recommends that you turn on auto-grow if its disabled.

After you’ve attached the database in the new version, can then change the filegroup back to read-only and disable auto-grow.

answered Dec 11, 2009 at 4:30

Nick Kavadias's user avatar

Nick KavadiasNick Kavadias

10.8k7 gold badges36 silver badges47 bronze badges

I had this issue when attempting to attach a sql server 2000 database to a sql server 2008 r2 server. Checked that nothing had been marked read only. Ran management studio as administrator, problem solved.

The moral of my story is «Try running management studio as administrator while you do it».

answered Apr 6, 2012 at 0:56

Tory Netherton's user avatar

0

In addition to checking any read-write flag on the file, make sure that the security ACLs on the file and the folder that you put it in will allow the login that the SQL Server service is using to access the file. If you are unsure what the acl should look like, find the master.mdf file for your instance, look at the ACL/permissions for that file and then make the permissions for your particular mdf file match.

Also, you don’t mention the ldf. If you are expecting the server to automatically create the ldf file, figure out where it will be creating and make sure that sql server can write files at that location. It would be better to create the database by attaching both the mdf and ldf files and NOT rely on SQL Server to create a missing LDF. There may be updates in the LDF that did not make it to your MDF file.

answered Apr 6, 2012 at 12:17

Darin Strait's user avatar

Darin StraitDarin Strait

2,01212 silver badges6 bronze badges

Thanks,Telarian

I had this issue when attempting to attach a sql server 2000 database to a sql server 2008 r2 server. Checked that nothing had been marked read only. Ran management studio as administrator, problem solved.

The moral of my story is «Try running management studio as administrator while you do it».

=> Running SSMS as an Administrator & giving db owner permission to the user by which you are trying to attach the database resolved my problem.

answered Jul 6, 2017 at 13:23

Satish Barpagga's user avatar

RRS feed

  • Remove From My Forums
  • Question

  • hi,
    I am trying to attach database AdventureworksLT, and it shows me an error message:
    Database AdventureworksLT cannot be upgraded because it has readonly files,make the database or files writable or rerun recovery.

    how can i make database or files writable?

Answers

    • Proposed as answer by
      Paul Svirin
      Monday, August 31, 2009 8:48 PM
    • Marked as answer by
      Xiao-Min Tan – MSFT
      Tuesday, September 8, 2009 9:46 AM

All replies

    • Proposed as answer by
      Paul Svirin
      Monday, August 31, 2009 8:48 PM
    • Marked as answer by
      Xiao-Min Tan – MSFT
      Tuesday, September 8, 2009 9:46 AM
  • doing it the other way worked for me

    I was getting the error with windows auth

    Switched to sql and it worked

  • I got the same error 3415 and it was resolved when I opened SQL Server Management Studio with Windows authentification.

    Thank you,

    Herokey

RRS feed

  • Remove From My Forums
  • Question

  • hi,
    I am trying to attach database AdventureworksLT, and it shows me an error message:
    Database AdventureworksLT cannot be upgraded because it has readonly files,make the database or files writable or rerun recovery.

    how can i make database or files writable?

Answers

    • Proposed as answer by
      Paul Svirin
      Monday, August 31, 2009 8:48 PM
    • Marked as answer by
      Xiao-Min Tan – MSFT
      Tuesday, September 8, 2009 9:46 AM

All replies

    • Proposed as answer by
      Paul Svirin
      Monday, August 31, 2009 8:48 PM
    • Marked as answer by
      Xiao-Min Tan – MSFT
      Tuesday, September 8, 2009 9:46 AM
  • doing it the other way worked for me

    I was getting the error with windows auth

    Switched to sql and it worked

  • I got the same error 3415 and it was resolved when I opened SQL Server Management Studio with Windows authentification.

    Thank you,

    Herokey

If you see any of the following two errors when you attach a database to an SQL instance:

ERROR 1:

TITLE: Microsoft SQL Server Management Studio

——————————

Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476

——————————
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

——————————

CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create the physical file ‘E:_restoreMSSQL10_50.SHAREPMSSQLDATAUPSA_Social.mdf’. (Microsoft SQL Server, Error: 5123)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476

——————————
BUTTONS:

OK
——————————

ERROR 2:

Event ID: 3415 

Source: MSSQLServer

Level: Error

Text:

“Database ‘Your database’ cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.”

Then you should know it has nothing to do with the permissions to the database files you try to add, it is only because you need to start SQL Server Management Studio as administrator(Right click and select Run as Administrator).

Take a look at the error messages below.

I have received a database file and the instructions for loading it is to install SQL Server 2005 and then attach it using SQL Server Management Studio.

After installing everything, I tried to attach the MDF file but then it tells me:

the directory lookup for the file «D:{folderName}{filename}.LDF» failed with the operating system error 21 (error not found)

An LDF file did not come with the database, so presumably it should be generated automatically.

Now, D drive is where my CD drive is, so it’s not going to find anything there. Nor is it going to have any luck trying to create anything there.

  1. Why is it trying to look for a log file at a specific path? Why not where the database file is?

  2. How can I attach this database?

I realized that when I select a database to attach, three entries appear under «database details». an MDF, NDF, and LDF. The LDF’s «current file path» points to the D drive path above, so I removed it.

This time, when I hit «OK», I get a different error message:

Database cannot be upgraded because it is read-only or has read-only files.
Make the database or files writeable, and rerun recovery.

File activation Failure. The physical name D:{folder}{file}.LDF may be incorrect.
New log file «…» was created. (Microsoft SQL Server, Error: 3415)

So now it creates a new log file in the same folder as the database file, which is great, but it seems like there are security issues.

Additional information:

  • The instructions require me to use the login name «sa», which appears to be the sysadmin account. I am connected to my SQL Server instance using that login.

  • I have checked the file properties that it is not read-only. The directory is not read-only either. All ACLs are allowed.

  • I am unable to attach the database. When I try to attach it, it throws an error message with «attach database failed».

  • Closing SSMS and reopening it as an Administrator made no difference.

  • select SERVERPROPERTY('ProductVersion') returns 9.00.4035.00. There’s another file that comes with the database called «dbdata.ini» which says «IsSql2000=1» so presumably it is meant to be loaded in SQL Server 2000. I’ll see if I can get it working on 2000.

Asked
9 years, 3 months ago

Viewed
1k times

I tried to add luxury database to my SQL Serever 2008 but I’m getting an error.

It displays below error :

attach database failed for server ‘SAMEER-PC’.(Microsoft.SqlServer.Smo)
ADDITIONAL INFORMATION
An exception occured while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
Database luxury Drive cannot be upgraded because it is read-only or has read only files. Make the database or files writeable,and rerun recovery.
Could not open new database’luxury drive’. CREATE DATABASE id aborted.(Microsoft SQL Server, Error: 3415)

marc_s's user avatar

marc_s

721k173 gold badges1320 silver badges1442 bronze badges

asked Oct 5, 2013 at 5:23

Sameer's user avatar

2

Follow this steps :

  • Right click on your .MDF , click on properties
    Uncheck Read Only property.

  • Right click on the folder that contain your .MDF , click on properties
    Uncheck Read Only property.

  • Open SSMS ( SQL Server Management Studio).

  • Right click on the DB in the Object Explorer , Set Read Only Property toFALSE in the options menu.

answered Dec 6, 2016 at 7:16

Ilyes's user avatar

IlyesIlyes

14.5k4 gold badges28 silver badges53 bronze badges

Community's user avatar

answered Oct 5, 2013 at 5:27

Prahalad Gaggar's user avatar

Prahalad GaggarPrahalad Gaggar

11.2k16 gold badges52 silver badges70 bronze badges

0

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Microsoft sql server ошибка 3140
  • Microsoft sql server ошибка 3132