Uhujkill
Uhujkill

Reputation: 89

How do I change an SQL Server Database from Readonly to allow changes

I have a database where I need to execute the following command to make the database read-only,

UPDATE TSYSTEM SET SYSREADONLY='T'

This is a backed up copy of our live database. However, I may need to make changes in future.

Which command should I execute to allow the database to be edited?

Thanks for the help in advance.

Upvotes: 1

Views: 1325

Answers (1)

M.Ali
M.Ali

Reputation: 69494

I don't know what is this command you have showed in your question, but to change database from read-only to read-write you would execute the following:

USE [master]
GO

ALTER DATABASE [DB_Name] 
  SET READ_WRITE WITH NO_WAIT;
GO

And to put database back into read-only mode you would execute the following:

USE [master]
GO

ALTER DATABASE [DB_Name] 
  SET READ_ONLY WITH NO_WAIT;
GO

Upvotes: 5

Related Questions