Share via


making sql server database read -write from read only

Question

Thursday, January 12, 2012 8:11 AM

hey guys

i attached adventure works in sql server 2008 and it showing as read only ,

so please guide me to make it read write or remove read only tag from database

 

thanks in advance

sujeet software devloper kolkata

All replies (12)

Thursday, January 12, 2012 8:25 AM ✅Answered | 2 votes

Disconnect all users from the db and then..

Add WITH NO_WAIT

ALTER DATABASE database-name SET READ_WRITE WITH NO_WAIT

 

VT

Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker


Wednesday, December 11, 2013 1:46 PM ✅Answered | 3 votes

It might be too late to answer this query. I was having same problem updating Adventureworks2012 database in SQL Server 2012. After trying a lot of suggested answers I found out that I only had Read access to the folder in which I had downloaded the .mdf file and that was from where i had attached the database. So I dropped the database and re-attached from the folder which had read&write permissions and it worked out fine. Hope this helps.


Thursday, January 12, 2012 8:12 AM

hey guys

i attached adventure works in sql server 2008 and it showing as read only ,

so please guide me to make it read write or remove read only tag from database

 

thanks in advance

sujeet software devloper kolkatasujeet software devloper kolkata


Thursday, January 12, 2012 8:15 AM

Execute the command 

ALTER DATABASE database-name SET READ_WRITE

 

VT

Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker


Thursday, January 12, 2012 8:17 AM

duplicate posting..

 

ALTER DATABASE database-name SET READ_WRITE

VT

Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker


Thursday, January 12, 2012 8:22 AM

thanks v.vt ,

i have given this command,its  taking to long its all ready one hours since i have given this command 

 

so is there any others option links .

thanks

sujeet software devloper kolkata


Thursday, January 12, 2012 9:38 AM | 1 vote

Hi,

Is there an error message while you attach (Or restore) the database if so please provide it.

If no Right click on your database choose properties -> go to options -> scroll to end then change read only option to false

 

I hope this is helpful.

 

Elmozamil Elamir

MyBlog

Please Mark it as Answered if it answered your question
OR mark it as Helpful if it help you to solve your problem
Elmozamil Elamir Hamid
http://elmozamil.blogspot.com


Sunday, April 6, 2014 8:35 PM

Perfect! This solution worked! 


Friday, June 19, 2015 5:17 AM

Hey, 

I tried your solution it ran successfully but however my application still gives me the same error which is : 

System.Data.OleDb.OleDbException (0x80004005): Cannot update. Database or object is read-only.

Please help me 


Friday, August 7, 2015 10:29 PM

I had the read only issue with Adventureworks2012. 

ALTER DATABASE database-name SET READ_WRITE WITH NO_WAIT .... Didn't work or anything mentioned so far in this thread.

However,  I closed SQL Management Studio 2012.

Right clicked Icon from start menu and clicked Run as Administrator.

You can also select this permanently by going into Properties.

Hope this helps!!!!


Monday, February 27, 2017 4:02 AM

Try this...

USE [dbname]
GO
ALTER DATABASE [dbname] SET READ_WRITE WITH NO_WAIT
GO

If you face an error on above query that if the database is already in use, you can resolve the same by making database in single user mode

ALTER DATABASE [dbname] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

The above query will rollback any transaction which is running on that database and brings SQL Server database in a single user mode.


Thursday, October 12, 2017 8:09 PM | 1 vote

Try this:

LTER DATABASE [Dbname] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

USE [master]
GO
ALTER DATABASE [Dbname] SET READ_ONLY WITH NO_WAIT
GO

ALTER DATABASE [Dbname] SET MULTI_USER WITH ROLLBACK IMMEDIATE;

GO