Attach Database Read Only Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack attach database read only sql 2008 Overflow the company Business Learn more about hiring developers or posting ads with us sql server attach database read only Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community sql database read only after attach of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up database attached is read only up vote 15 down vote favorite 4 I used the following error 3624 attach database the script to attach a database. But the database created is read only. What modifications should I make in the script to make it read-write. Please help me. USE [master] GO CREATE DATABASE [GemDatabase] ON ( FILENAME = N'E:\Program Files (x86)\ICE Products\ICEConnect200\New Database\GemDatabase.mdf' ), ( FILENAME = N'E:\Program Files (x86)\ICE Products\ICEConnect200\New Database\GemDatabase_log.ldf' ) FOR ATTACH GO if not exists (select name from master.sys.databases sd where name = N'GemDatabase' and SUSER_SNAME(sd.owner_sid) =
Sql Db Read Only After Attach
SUSER_SNAME() ) EXEC [GemDatabase].dbo.sp_changedbowner @loginame=N'sa', @map=false GO sql-server sql-server-2005 share|improve this question asked May 19 '11 at 7:05 Maanu 1,63562963 add a comment| 9 Answers 9 active oldest votes up vote 38 down vote First make sure that the folder in which your .mdf file resides is not read only. If it is, un-check that option and make sure it reflects to folders and files within that folder. Once that is done, Open Management Studio, in the Object Explorer right click on the Database which is read only and select Properties. In the Options Menu, check that the Read-Only property is false. share|improve this answer answered Mar 7 '14 at 6:57 Varun Rathore 2,7451120 3 In addition to the steps above, I also had to give the Network Service account full control of the MDF and LDF files. –Barbosa Apr 22 at 17:39 add a comment| up vote 13 down vote Make sure the files are writeable (not read-only), and that your user has write permissions on them. Also, on most recent systems, the Program Files directory is read-only. Try to place the files in another directory. share|improve this answer answered May 19 '11 at 7:11 Xavier Poinas 12.5k74069 4 +1 for the hint about Program Files - SQL S
SQL Server experts to answer whatever question you can come up with. Our new SQL Server Forums are live!
Change Database From Readonly To Readwrite
Come on over! We've restricted the ability to create new threads on database cannot be upgraded because it is read-only or has read-only files. these forums. SQL Server Forums Profile | ActiveTopics | Members | Search | ForumFAQ Register Now and get sql server database read only after restore your question answered! Username: Password: Save Password Forgot your Password? All Forums SQL Server 2005 Forums SSIS and Import/Export (2005) Database is ReadOnly when I attach it... Reply to Topic http://stackoverflow.com/questions/6054997/database-attached-is-read-only Printer Friendly Author Topic malachi151 Posting Yak Master 152 Posts Posted-10/12/2007: 11:28:16 Using SQL Express in this case, I have a database on one machine using one instance of SQLExpress that I detach. I then copy the database to a USB drive and take it to a different machine and attach it to a different SQL Express http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90910 instance and it comes in as ReadOnly and I know of no way to change it.One difference is that I have different users on the two systems, is that the cause? I wouldn't think that this would cause the database to show as ReadOnly, thoughI would just think that I may not be able to access it aside from using sa.What is the likely cause of this?Thanks Kristen Test United Kingdom 22859 Posts Posted-10/12/2007: 11:32:11 You sure it wasn't read-only when you detatched it?ALTER DATABASE MyDatabaseName SET READ_WRITEAdd WITH ROLLBACK IMMEDIATE if the DB is in use and its doesn't let you.Kristen malachi151 Posting Yak Master 152 Posts Posted-10/12/2007: 11:51:51 Yes, I'm sure, and to verify I just reattached it from the USB drive to the origional SQLExpress instance and it comes in just fine. When I attach it to the other instance it comes in ReadOnly.I guess I should try backup and restore instead? Kristen Test United Kingdom 22859 Posts Posted-10/12/2007: 13:06:36 I'd try setting it to READ_WRITE firstKristen tkizer Almighty SQL G
(Русский)ישראל (עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsTroubleshootingCommunityForums Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Read Only db after attach https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9d018fb0-98f4-4fde-ab45-e65855de8a28/read-only-db-after-attach-on-sql-2008?forum=sqldatabaseengine on sql 2008 SQL Server > SQL Server Database Engine Question 1 Sign in to vote Hi, i have detach db from sql 2008 for some reason. i attached the db again. now it shows read-only. can anyone let me know why it shows read only? how can fix this ? Thanks!!! Varinder Sandhu http://varindersandhus.blogspot.com/ Thursday, September read only 02, 2010 12:45 PM Reply | Quote Answers 5 Sign in to vote Hi, yes i have tried thru property --> option --> state --> db read only = False after that it works. don't know why it change the option after attached. Thanks!!! Varinder Sandhu http://varindersandhus.blogspot.com/ Marked as answer by Varinder Sandhu Thursday, September 02, database read only 2010 12:57 PM Thursday, September 02, 2010 12:56 PM Reply | Quote 2 Sign in to vote Check whether your SQL service account has access and necessary privilege to the folder whether the mdf and ldf sits , also make sure the files are not set to read-only at the disk level.Thanks, Leks Marked as answer by Varinder Sandhu Thursday, September 16, 2010 6:14 AM Friday, September 03, 2010 8:10 AM Reply | Quote Answerer All replies 0 Sign in to vote Just perform quick testing and cannot reproduce it. Are you sure that just before detaching that database was set to read -only?Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/ Proposed as answer by Jim Kay Friday, August 08, 2014 3:44 PM Thursday, September 02, 2010 12:54 PM Reply | Quote Answerer 5 Sign in to vote Hi, yes i have tried thru property --> option --> state --> db read only = False after that it works. don't know why it change the option after