SQL Server Express 2012. Creating an audit using profiler - sql-server-2012

SQL Server 2012. Using SQL Server Profiler. How can I set the trace to only display to the results table audit type details? Such as whoever logged in, when a user makes a CRUD query, date and time etc. Just to be able to log and see who made changes in case anything happens at the database level.
Basically I do not want to include all of the stored procedures from displaying.
Thank you.

When you click on new trace in the profiler, go to Events Selection tab in the trace properties window and select whichever event you want to log.
Regards,
Sumit

Related

Best way to debug SQL queries in Acumatica

How can I monitor the SQL queries generated by Acumatica?
You can monitor lots of things such as SQL and Memory through the Request Profiler.
Go to: System-->Management-->Request Profiler
There is a check box to turn on SQL Logging.
Enable Logging + Enable SQL logging then go and do something that causes data to load. Then come back to this screen and click refresh and you will see the actions performed. You can select an action and click SQL to see the SQL for that action.
Remember to turn it off when you are done as it will have a small performance hit.
In SQL Server you can drill down to "Performance Tools" --> SQL Server Profiler.
Using the SQL Server Profiler you can start a trace of the database your system is attached to.
By performing the action you want to watch, you will see the trace fill with queries caused by the action. You can then pause the trace and dissect each query and figure out what is going on.
You can filter the types of things you see in the trace. And by selecting a row, the query or action executed shows the details in the display at the bottom. You can then copy and paste that into a query editor of your choice and discover.

SQL Server activity monitor show all queries

I'm using SQL Server 2005, and I'd like to know if there is any possibility to watch every query sent to SQL server?
SQL Server Management Studio has a built-in tool called the Activity Monitor which gives me nearly what I am searching for in the "Recent Expensive Queries Pane"
This pane shows information about the most expensive queries that have been run on the instance over the last 30 seconds.
I need exactly this for all recent queries, not just the expensive ones...
Can anyone help me?
Name a tool, or give me a hint what to search for...
To watch every query sent to SQL server using SQL profiler, you can use one of SQL Profiler predefined templates. It's TSQL_Duration.
It's designed to track completed stored procedures and TSQL code.
The trace will show you exactly the batch executed.
You can expand the events tracked and columns shown.You can find more information here: How To: Use SQL Profiler
The same feature is also available in ApexSQL Comply, an auditing tool that uses SQL traces to capture the events, then stores them in a central repository database, and provides built-in and custom reports where you can easily filter the transactions, and export them as Excel, Word, or PDF files.
Disclaimer: I work for ApexSQL as a Support Engineer
You're looking for SQL Profiler, it's usually installed along with SSMS.

What tool to capture values passed into SQL Server procedure

I have a DLL, for which I do not have the source code. It is making calls to a stored procedure in a SQL Server 2005 database. I need to know what values it is passing in as the parameters of the call.
Is there a free tool, or one that comes with SQL Server that is able to monitor and record the calls into a database?
Thanks.
You can use for this SQL Server Profiler which comes with SQL Server.
If you have an access to Microsoft SQL Server Management Studio, you find it by clicking Tools → SQL Server Profiler.
When it starts, click Connect. On Trace properties dialog, click Run. It then collects every call to the SQL Server and displays the summary at the top, and the query with its parameters at the bottom of the window.
You can also:
Pause or stop the profiler (icons in the toolbar),
Clear the current trace.
Do not forget to clear the trace before launching the action which will call the stored procedure and do not forget to pause/stop the profiling after you get the results to avoid getting too much information to analyze.
As pointed in the comments, if you are using SQL Server Express, the profiler may be missing. You may want to install a third party profiler for SQL Express instead.
Check the [Tools] menu in SQL Server Management Studio:
If you don't see this option, you most likely have SQL Server EXPRESS which does not come with Profiler.

See queries that hit SQL

Is there a way using sql 2008 Management Studio to look at the queries that hit the server? I'm trying to debug a program and I get messages like "Incorrect syntax near the keyword 'AND'". Since the queries are being dynamically generated it's a hassle to figure out what is going to the server.
Any help is appreciated!
There is a tool called Profiler that will tell you all information that you'll need. MSDN: http://msdn.microsoft.com/en-us/library/ms187929.aspx
I'm not aware of any method to do this using SQL Server Management Studio, but if you installed SSMS then you probably also installed the SQL Profiler. If you fire that up and run the TSQL_SPs profiler template, you can see every statement that's hitting the database.
Since the queries are being dynamically generated it's a hassle to figure out what is going to the server.
Why not just put the query that's generated into a message box, or print it to the console, or webpage, etc. ??
Trying to catch it at the DB server seems to be the long-way-around to debugging some simple ad-hoc queries.
Go to Management...Activity Monitor in the object explorer.
It's not live though, you will have to refresh it manually.
start up profiler from SSMS (Tools-->SQL Server Profiler), run a trace and select the T-SQL events
One option is to use SQL Server Profiler to run a trace. However, in some shops SQL Server permissions are set so only DBAs can run traces.
If you don't have sufficient rights to run a trace, then another option is to view the network traffic between the application that generates the SQL and box SQL Server is running on. WireShark works great for that.

Mysterious CPU Activity in MS SQL 2005

I am looking at the activity monitor in MS SQL Management Studio 2005, and I see an entry from a login that I created, and it's using the tempdb, and the last command is always "SELECT INTO". And everytime I hit "Refresh" in activity monitor, that entry's "CPU" column goes up by like 60. The "program" of that activity is "MS SQL Management Studio."
I tried to kill that process, but it won't allow me, saying "cannot be killed". I disconnect from the database and reconnect, and that process is still there.
Is it gonna eventually crash my SQL Server because of continous activity? And is anyone familiar with this situation?
Thanks!
This is absolutely normal. The Select Into is selecting data into a temp table to show you what you see in the Activity Monitor. No need to panic. It will not crash your SQL Server.
Raj
That is you. More specifically SSMS. Typically it will SELECT INTO some temp table (something it calls, will do it actually) in order to get data from the server to display to you. Open another SSMS and you should see two of them.