Sql-server – Unable to Watch Live Data on Extended Events Session

extended-eventssql serversql server 2014

I am running SQL Server 2014 Developer Edition on my PC. I am trying to view the data in the system_health session. In SSMS, I have connected to the database, expanded the server / Management / Extended Events / Sessions. I see AlwaysON_health (stopped) and system_health (running).

When I right-click on the system_health session, I get the following error:

The storage failed to initialize using the provided parameters. (Microsoft.SqlServer.XEventStorage)
The Extended Events session named "system_health" could not be found. Make sure the session exists and is started. (Microsoft SQL Server, Error: 25728)

I expand system_health and see the targets package0.event_file and package0.ring_buffer. If I right-click either target and choose "View Target Data", I get this error:

The storage failed to initialize using the provided parameters. (Microsoft.SqlServer.XEventStorage)
Cannot view the function 'fn_MSXe_read_event_stream', because it does not exist or you do not have permission. (Microsoft SQL Server, Error: 15151)

The function does exist. I can run it:

select * from fn_MSXe_read_event_stream('system_health', 0);

When I do, I get this error:

Msg 25728, Level 16, State 10, Line 6
The Extended Events session named "system_health" could not be found. Make  sure the session exists and is started.

I know the system_health session is there. I see in in the list of sessions:

select * from sys.dm_xe_sessions

address name       name
------------------ ------------- 
0x00000001FF6510C1 system_health

I have tried this with my own custom event sessions. I can't watch the live data on them, either.

I can query the system_health ring buffer target data from sys.dm_xe_session_targets.

Why can't I watch live data for any extended events session?

(Note that there is a Microsoft feedback item for this issue.)

Best Answer

I found the problem. My login had a different default database than the master database. When I changed my default database to master, the error went away, and I was able to Watch Live Data on the extended event sessions.

To change the default database, in SSMS, I expanded the server, Security, Logins. I right-clicked on my user credentials. On the Login Properties page for my user, I changed "Default database" to master. The error went away when I closed and reopened the connection in the SSMS Object Explorer.

EDIT 2018-12-11

On the feedback link for this issue, Karl Fasick posted a likely solution:

Object Explorer isn't connected to the master database... To fix - disconnect Object Explorer - Reconnect, but go to Connection Properties and explicitly choose master.