As DBAs, we often need to trace activity on our SQL Server instances. We might do this for on-demand tasks, such as collect requests taking more than x seconds to execute. Or we might have multiple traces collecting data in a proactive way so we can check them when needed. For example, we may need to find a specific event, such as a deadlock event, to be analyzed.
Until SQL Server 2008, the native tool that we had for the job was SQL Server Trace and SQL Server Profiler. Since then we have been able to use Extended Events, and, since SQL Server 2012 SP1, it covers 100% of the SQL Trace events. Extended events are a much lighter way to achieve at least the same as SQL Trace, but they can provide even more detailed results.
Being able to quickly create and/or import an extended event to collect data can be the difference between catching or missing specific events to analyze a problematic situation. The GUI within SSMS, until you get used to it, is not the most user-friendly. Being able to leverage T-SQL scripts and some automation will make our life much easier.