Lesson Learned #336: Using STARTUP_STATE option in an extended event in Azure SQL Database

Posted by

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

We got a service request that our customer reported that after a planned maintenance the extended event that they created Lesson Learned #1: Capturing a TSQL Command Timeout - Microsoft Community Hub is not longer captures the events.


In this situation, we saw that the Azure SQL Database was scaled up and our customer is not using the parameter called STARTUP_STATE , so, our customer needs to start it manually. CREATE EVENT SESSION (Transact-SQL) - SQL Server | Microsoft Learn



CREATE EVENT SESSION ssEventoTimeout ON DATABASE ADD EVENT sqlserver.sql_batch_completed ( ACTION (sqlserver.client_app_name,sqlserver.client_connection_id,sqlserver.client_hostname,sqlserver.client_pid,sqlserver.database_id,sqlserver.database_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.username) WHERE ([result] <> (0))) ADD TARGET package0.asynchronous_file_target( SET filename='https://storageaccount.blob.core.windows.net/extended/Data.xel') with( STARTUP_STATE = ON)



To test this one, I changed the definition of my extended event including STARTUP_STATE = ON. After scaling my database I was able to see this extended event running again running the following query: SELECT * FROM SYS.dm_xe_database_session_events.





Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.