Guys! As a software engineer, you need to be ready to work around the clock, and equally prepared to sit idle for weeks, even months.
Throughout most of my career, I’ve experienced the former—non-stop work. But in the past couple of months, I found myself in the latter, far more boring phase. Luckily, I recognized it early on and discovered a remedy for this monotonous stretch. That remedy, my friends, was “Installation and Configuration of MetaSolv.”
I must admit, installing MetaSolv M6 from scratch was a real challenge. One of the most valuable lessons I learned along the way involved Oracle Trace Files. Although MetaSolv includes a trace option, I had to use Oracle’s native trace feature to troubleshoot some privilege issues.
What is Trace in Oracle?
Trace is a feature in Oracle that logs the smallest details of a session. When enabled, it generates trace files with the extension “.trc.” These files follow a standardized naming convention:
- DB_NAME: Global database name
- SID: Session ID
Example:
Enabling Trace
Trace can be enabled at the session level, either through an ALTER statement or by using the DBMS_SUPPORTpackage.
Example:
If you want to enable tracing for another session, use the DBMS_SUPPORT package.
The last two procedures allow you to start and stop tracing for any session in the database. Below is an example of enabling trace for all active sessions of a specific user using a BEGIN-END block.
Example:
To stop tracing, use:
Sample Trace File
Below is an excerpt from a sample trace file:
Every line in a trace file contains statistics. These statistics help decode session details. For example:
- PARSE: Displays cursor length (
len=79
), user ID (uid=73
), and parse time (tim=
). - C: CPU time
- E: Elapsed time
- P: Number of database blocks read
- CR: Consistent mode blocks read
- CU: Current mode blocks read
- MIS: Number of library cache misses
- R: Number of rows fetched
- OG: Optimizer goal (1 = all_rows, 2 = first_rows, 3 = rule, 4 = choose)
Understanding the Trace File
Trace files provide a detailed view of each session, including:
- The client used for execution
- Time and resources required for query execution
- The number of rows fetched, along with the optimizer goal
Reading trace files gives valuable insights into session performance, query optimization, and resource usage. For more information, you can explore Oracle’s documentation on trace file output formats.
This version retains the technical depth and structure of the original while improving clarity, consistency, and readability.
2 comments:
The post looks interesting. So, finding enough time at last.
nice article.
I read the other link you mentioned and i noticed this statment.
"If there are TIMESTAMPS in the file you can use the difference between 'tim' values to determine an absolute time."
This is what i am trying to achieve..basically the absolute times between all the query's shown in the trace. Would you know what query or technique I could use extract that output?
thanks!
Post a Comment