Monday, February 17, 2020

Finding SQL Statements in an Oracle Trc File

It often comes to pass that I have received an oracle alert file indicating deadlocks along with a .trc file from one of our customers.

As we all know, deadlocks are an *APPLICATION* problem, not a database problem.
Still, the developers are my team, my posse, my *PEOPLE*, yo, and imma help 'em out. ;-)

So, to make their analysis easier, one of the things I like to do is give them a consolidated list of SQL Statements from the .trc file. This helps them to understand what the application is doing when the deadlock  occurrs.

To find any lines that contain select, insert, update, or delete, you can do the following search. (NOTE: This could easily be expanded to include Merge, etc.  )


Using Notepad ++ ,  I search for
\b(?:select|insert|update|delete)\b .*?$
I then use Notepad++'s bookmark feature to bookmark each line that matches the search.


Finally, I use Search -> Bookmark -> Remove Unmarked Lines

This will remove everything but the Select, Insert, Update, and Delete statements.

No comments:

The Database is not accessible after creating Always On Availability Group

 Having created a fully functional SQL Server Always On Availability Group, I connect using SSMS. Upon trying to expand the database, I get ...