0

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?

2
  • What exactly do you want to see? The actual contents of the transaction log or a trace of activity? Commented Sep 24, 2014 at 13:52
  • I want to see the SQL statements that were executed last. Commented Sep 24, 2014 at 13:55

1 Answer 1

2

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.

2
  • 1
    Worth 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. Commented Sep 24, 2014 at 14:44
  • That's a hard lesson that I learned in my early days as a DBA. :) Commented Sep 24, 2014 at 14:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.