IF EXISTS(
    SELECT * 
    FROM sys.[dm_xe_sessions] [dxs]
    WHERE NAME = 'octpdba-443_azcash'
)
BEGIN 
    DROP EVENT SESSION [octpdba-443_azcash] ON SERVER 
END 
GO


CREATE EVENT SESSION [octpdba-443_azcash] ON SERVER 
ADD EVENT sqlserver.attention(
    ACTION(package0.event_sequence,sqlserver.client_app_name,sqlserver.client_pid,sqlserver.nt_username,sqlserver.query_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text)
    WHERE (([package0].[equal_boolean]([sqlserver].[is_system],(0))) AND ([sqlserver].[database_name]=N'arizonaCash'))),
ADD EVENT sqlserver.rpc_completed(
    ACTION(package0.event_sequence,sqlserver.client_app_name,sqlserver.client_pid,sqlserver.nt_username,sqlserver.query_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text)
    WHERE (([package0].[equal_boolean]([sqlserver].[is_system],(0))) AND ([sqlserver].[database_name]=N'arizonaCash'))),
ADD EVENT sqlserver.sql_batch_completed(
    ACTION(package0.event_sequence,sqlserver.client_app_name,sqlserver.client_pid,sqlserver.nt_username,sqlserver.query_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text)
    WHERE (([package0].[equal_boolean]([sqlserver].[is_system],(0))) AND ([sqlserver].[database_name]=N'arizonaCash'))),
ADD EVENT sqlserver.sql_batch_starting(
    ACTION(package0.event_sequence,sqlserver.client_app_name,sqlserver.client_pid,sqlserver.nt_username,sqlserver.query_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text)
    WHERE (([package0].[equal_boolean]([sqlserver].[is_system],(0))) AND ([sqlserver].[database_name]=N'arizonaCash'))),
ADD EVENT sqlserver.sql_statement_completed(
    ACTION(sqlserver.client_app_name,sqlserver.sql_text)
    WHERE ([sqlserver].[database_name]=N'arizonaCash')),
ADD EVENT sqlserver.sql_statement_starting(
    ACTION(sqlserver.client_app_name,sqlserver.sql_text)
    WHERE ([sqlserver].[database_name]=N'arizonaCash'))
ADD TARGET package0.event_file(SET filename=N'd:\octpdba-443_azcash',max_file_size=(100))
WITH (MAX_MEMORY=8192 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=5 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=PER_CPU,TRACK_CAUSALITY=ON,STARTUP_STATE=ON)
GO


ALTER EVENT SESSION [octpdba-443_azcash] ON SERVER STATE = START