Академический Документы
Профессиональный Документы
Культура Документы
-------------------------------------------------------------
Enable Timed Statistics to collect certain vital statistics such as CPU execution
time, wait events and elapsed times.
System altered.
Check the USER DUMP destination directory using init.ora file (user_dump_dest
parameter) or by firing following SQL:
VALUE
---------------------------------------------------
E:\oracle\admin\archana\udump
By default tracing is disabled due to the burden (5-10%) it plces on the database.
Enable tracing at session level:
Session altered.
To get th file name of the trace file name for the currently connected session,
fire following query:
SQL>
select c.value || '\' || lower(d.value)
|| '_ora_' || to_char(a.spid, 'fm00000')
|| '.trc' "Trace File"
from v$process a, v$session b, v$parameter c, v$parameter d
where a.addr = b.paddr
and b.audsid = userenv('sessionid')
and c.name = 'user_dump_dest'
and d.name = 'db_name';
Output:
------------
Trace File
--------------------------------------------------------
E:\oracle\admin\archana\udump\archana_ora_04760.trc
Then fire some queres to check the statistics. we will fire following query:
Session altered.
Using earlier given query locate trace file and use tkprof from command line.
Based on the command above, tkprof will process the file archana_ora_4760.trc and
format the results in the file output.txt. Two other files were also created
(tkprof.sql, allsql.sql).
Header: The header simply displays the trace file name, definitions, and sort
options selected.
Body: The body contains the performance metrics for SQL statements.
Observe from the tkprof output above that the SQL statement performed a TABLE
ACCESS FULL, meaning a full-table scan. Full-table scans can degrade performance,
especially when accessing a small subset of the data in a table. In this case, the
query is selecting one row, yet all 100,000 rows in the table are scanned. This is
a perfect situation to add an index to improve the performance.