We have several cases where our customers are looking for ways to stop an Azure SQL Database.
Some common scenarios where our customers request this option are when they want to decommission an Azure SQL Database and want to ensure that no one is using the database, or because the customer wants to save some money and stop the database during the hours they are not using it.
Stopping an Azure SQL Database is not currently supported, but there are several options that could be helpful in these scenarios:
If auto-pausing is enabled, but a database does not auto-pause after the delay period, the application or user sessions may be preventing auto-pausing. To see if there are any application or user sessions currently connected to the database, connect to the database using any client tool and execute the following query:
SELECT session_id,
host_name,
program_name,
client_interface_name,
login_name,
status,
login_time,
last_request_start_time,
last_request_end_time
FROM sys.dm_exec_sessions AS s
INNER JOIN sys.dm_resource_governor_workload_groups AS wg
ON s.group_id = wg.group_id
WHERE s.session_id <> @@SPID
AND
(
(
wg.name like 'UserPrimaryGroup.DB%'
AND
TRY_CAST(RIGHT(wg.name, LEN(wg.name) - LEN('UserPrimaryGroup.DB') - 2) AS int) = DB_ID()
)
OR
wg.name = 'DACGroup'
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.