Why does Db attach Read Only?

  • I want to work with a copy of my live database on my development machine so that I can work with a reasonable set of data.

    I logged onto the live server, detached the SQL Server 2005 database in question, zipped it, reattached the live db so the live server was back up, brought the zip over to my development machine , unzipped it, checked to make sure the files are not marked read only, attached the db using SQL Server Management Studio, and the db will only attach read only!!!

    I read somewhere that if the account SQL server is running under does not have permissions for the db files, then the db will only attach read only. However, my SQL Server (Express) on my development machine is running under the 'Network Service' account on my Windows XP SP2. If I go to file properties, security tab for the db in question, I cannot locate the 'Netwrok Service' account to add permissions. It's just not there.

    What could be wrong? (I have done this before, so I know it's possible).

    Phil

  • I think you should give read-write access to 'Network Service' for database files at file system level. Right-click on the files, select Security and add 'Network Service' and grant read and write permissions for both data and log files.

     

    Venu

  • As I said, "If I go to file properties, security tab for the db in question, I cannot locate the 'Netwrok Service' account to add permissions. It's just not there."

    However, I booted the machine and somehow the Network Service account now appears. So I added full control for it to the folder that the db files are in, and now all is well.

    So your idea was right.

    Does anyone know why the Network Service account does not appear most of the time??

    Phil

     

  • Hi, just had same problem and no Network Service account available to give permissions to.

    In Computer Managment, Local Users & Groups, Groups I found 3 SQL Server 2005 groups - all of which contained the Network Service User, so I added one of these to cure the problem.

    Problem was half fixed (the old app I am working on copies the DB to a workign subdirectory, makes changes, and if all OK moved them back), as I realised I needed to set permision at directory level (so the temp working files would get the right permissions). When I went to do this, hey presto, Network Service was listed!!!

    the app now works fine.

    So if you get this problem, my advice is to persevere

    Jon

Viewing 4 posts - 1 through 3 (of 3 total)

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