Is it possible to see the T-SQL Query log in AWS RDS? is there a UI for that in the console, or i need to use the CLI or SQL Management Studio?
- What exactly do you want to see? The actual contents of the transaction log or a trace of activity?squillman– squillman2014-09-24 13:52:37 +00:00Commented Sep 24, 2014 at 13:52
- I want to see the SQL statements that were executed last.Faris Zacina– Faris Zacina2014-09-24 13:55:51 +00:00Commented Sep 24, 2014 at 13:55
Add a comment |
1 Answer
To view SQL statements that were executed you can do a trace. This link explains what you need to do to do a trace in AWS RDS.
From the documentation:
Generating a Trace SQL Query
declare @rc int declare @TraceID int declare @maxfilesize bigint set @maxfilesize = 5 exec @rc = sp_trace_create @TraceID output, 0, N'D:\rdsdbdata\rdstest', @maxfilesize, NULL Viewing an Open Trace
select * from ::fn_trace_getinfo(default) Viewing Trace Contents
select * from ::fn_trace_gettable('D:\rdsdbdata\rdstest.trc', default) You will also want to familiarize yourself with SQL Traces if you are not already. There are several options available to you for capturing data.
- 1Worth mentioning that you need to be careful with traces. Running them on production can be very intensive and bring the SQL instance to a halt. Be judicious when running a trace and as selective as possible with the events that you want to trace.Kris Gruttemeyer– Kris Gruttemeyer2014-09-24 14:44:54 +00:00Commented Sep 24, 2014 at 14:44
- That's a hard lesson that I learned in my early days as a DBA. :)Kris Gruttemeyer– Kris Gruttemeyer2014-09-24 14:51:07 +00:00Commented Sep 24, 2014 at 14:51