Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set the database as read_only

From this article http://msdn.microsoft.com/en-us/library/jj650016.aspx

there's a note tip:

You are charged for each database copy. To avoid additional charges for the copies, you can set the database as read-only, and export a BACPAC file directly from the database to create a transitionally consistent copy. However marking the database as read-only locks the database access until the export is complete and the read-only settings are reverted."

but how we can set the sql azure database to read-only? Is it possible?

like image 407
user2420785 Avatar asked May 25 '13 17:05

user2420785


1 Answers

You can make database read only by using the following query. I am not sure about the charging of Read-Only Data bases in SQL Azure

Make Database Read Only

--USE [master]
--GO
ALTER DATABASE [TESTDB] SET READ_ONLY WITH NO_WAIT
GO

Make Database Read/Write

--USE [master]
--GO
ALTER DATABASE [TESTDB] SET READ_WRITE 
GO

I got this from the SQL_Authority, check the same for more details.

Edit:

USE [master] will not work in Azure Environment.

You can change connection to use [master] database.

like image 159
sudhAnsu63 Avatar answered Jan 01 '23 11:01

sudhAnsu63