Our Sites | Alchemy NetCOBOL

NeoData / SQL Server Profiler - Trace results from SQL Server

Friday, March 04, 2011

Have you ever wanted to see what Microsoft SQL Server sees while your application runs? You can log/trace SQL Server events while the NeoData engine interacts with COBOL dynamically converting your ISAM instructionsto SQL Server context. As a matter of fact, all interactions to your SQL Server database, including your ESQL are viewable through the SQL Server Profiler.

If you are trying to debug your NeoData application, it is suggested to use the NeoData Trace log feature first, to which you can find an earlier blog on that topic as well.


You can do additional information gathering, by using a Microsoft SQL Server tool called "SQL Server Profiler". It shows you the syntax of the SQL Server Instructions and problems found. It helped me find out that I had inadvertently copied a table under SQL Server and that SQL Server cannot have two tables with the same index name, in the same Database!

Microsoft SQL Server Profiler is a graphical interface to SQL Trace for monitoring your Database transactions. SQL Server Profiler shows how SQL Server resolves queries internally. You can record and save information about these transactions through the Profiler to a file or table to view
after the application completes. You can create a template (.tdf) file that you can use when you want to trace.

The purpose of this blog is to give a starting point into SQL Server Profiler, to assist you. If you have questions about details of SQL Server, you’ll need to go to the usual sources of SQL Server assistance such as the help files, MSDN or other Microsoft support channels.

Like any tracing, SQL Server Profiler takes additional resources when running, and tracing should only be used when necessary, as it will have some impact on your application, depending on use.

Steps under SQL Server 2008 to create a TRACE file. (At the end of this blog are screen snapshots of the tool in use).
- connect to SQL Server by logging in.
- Go to the Tools menu - Select SQL Server Profiler.
- Log Back in again, at the log-in prompt to get you into the profiler.
- At this point you are brought to the Trace Properties screen, where you can set up if you want to record to a file(.trc), to a database table, or neither or both. The system tells you where it is going to store the table. For my run it was in the “System.database.master.tables (then I named the table dbo.traceExample).

To open a SQL Server Trace File, you can go into the SQL Server Profiler and open it, or under Windows Explorer, right click on the ".trc" file, select "Open With", select "SQL Trace Tool".

You can copy the text from your SQL Statement from the trace, then go into SQL Server and paste the copied query into Query Execute box, and see the results or the error.

Additional Links you may wish to reference :
http://msdn.microsoft.com/en-us/library/ms181091.aspx (High Level Description)
http://msdn.microsoft.com/en-us/library/ms187929.aspx (Additonal how to use detail)

Screen Shots of the SQL Server Profiler tool in action.

Step 1. Log into SQL Server Management Studio.

(normal log in).

Step 2. Select the SQL Server Profiler Tool:

 

Step 3: Log into the SQL Server Profiler tool (screen looks very much like the Management Studio log-in).



Step 3: Set up the parameters of how you wish to run the profiler. Enter the properties, press the run button at the bottom. The snapshot is meant to let you know that you are on the right screen. On this screen, you can set up if you wish to record to a trace file, as described earlier. You can specify what events you wish to use on the other tab. You can save the entries into a table in SQL Server as well!



Step 4 – View your output. At this point, you can start your application if not already started. Below is what the screen will look like while you are running.


Comments
Post has no comments.
Post a Comment




Captcha Image

Trackback Link
http://www.alchemysolutions.com/BlogRetrieve.aspx?BlogID=11346&PostID=316402&A=Trackback
Trackbacks
Post has no trackbacks.

Recent Posts


Tags


Archive

Contact Us | Privacy Policy | Terms of Use | Mainframe Migration | Cloud Solutions | NeoKicks | NeoData | NeoBatch
©2011 Alchemy Solutions. All rights reserved.