Attach Database Question

  • Hi,

    I was wondering if it is possible to attach a Enterprise Edition database to a Developer Edition instance.  

    I took a SAN snapshot of the production database which is on Enterprise Edition and am attempting to bring up that snapshot to another server (development) that has Developer Edition.  These are the errors I'm getting:

    Msg 3415, Level 16, State 5, Line 1
    Database 'DB_Dev' 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.
    Msg 1813, Level 16, State 2, Line 1
    Could not open new database 'DB_Dev'. CREATE DATABASE is aborted.

    Honestly, I'm not sure if I'm having permissions issue or what, but then I thought "can I even attach an Enterprise database to a Developer instance"?  

    Thank you!

  • As long as the Developer edition instance is the same version or newer of SQL (IE the production instance is SQL 2012 and the Dev is SQL2014 is OK) they should attach fine.

    Based on the error you're getting, I'd lean towards either you're missing one or more database files or the SQL Server service account on your dev instance doesn't have permissions to the locations the files are in.

  • Thank you!

    They're both the same product (SQL Server 2016), but the Developer Edition is running SP1 CU3 whereas the Enterprise Edition is a couple of CUs behind.  So I guess that means that the database should attach fine.  

    So I guess it's a permissions thing.  Argh.  I'm so frustrated.

  • check the service account on the new server has sufficient ACLs to the database files

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Is it my account?  SQL Server service account?  sa account?

  • Is the database still online on the Enterprise Edition server?  Is the database, or any of its filegroups, read-only?

    John

  • Database is online on Enterprise Edition server.  None of the filegroups are read-only.

  • I just tried "takeown /F *" and the message is:
    INFO: The media is write protected. ( "DB" )

    What?!

  • Speak to the SAN admin?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Also check the file properties on both the data and log files to ensure they're not read-only.  If they're read-only because of the SAN snapshot and you don't have permissions to change them, then Gail has the end-all: speak to the SAN admin.

    You could also try restoring from a full backup taken from production.

  • dajonx - Friday, June 2, 2017 8:57 AM

    Is it my account?  SQL Server service account?  sa account?

    The account sql server instance runs under will need ACLs on the folders and files

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Haha!  I'm the admin of all infrastructure stuff...  If I asked myself, I would've said: ¯\_(?)_/¯

    So I figured it out!  It wasn't a permissions issue.  It was a disk issue.  

    I originally typed this in diskpart:
    attributes volume clear readonly
    attributes volume clear hidden

    But I needed to run this command as well:
    attributes disk clear readonly

    And now I am able to attach the database.  I made sure that that one command was the resolution by redoing the whole snapshot/attach process without fiddling with permissions.  

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply