user2420785
user2420785

Reputation: 51

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?

Upvotes: 5

Views: 7192

Answers (2)

sudhansu63
sudhansu63

Reputation: 6180

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.

Upvotes: 11

Satya_MSFT
Satya_MSFT

Reputation: 1022

You can execute below command by connecting to the database you want to modify / master database. alter database ser read_only | read_write

Upvotes: -1

Related Questions