To generate the AWR report:
- Log in to the machine hosting Oracle server.
- Connect to Oracle server with SYS or equivalent DBA level access user.
- At a command prompt, issue the following command: @$ORACLE_HOME/rdbms/admin/ awrrpt.sql
<< This script will create an interactive session follow the instruction as shown below.>>
- Specify a format for the report and press Enter.
- Specify the Database instance on which to run the report by typing in the database ID from the list of instances and press Enter (in most cases there is only one choice, but if there is more than one, find out which instance hosts the your schema).
- Type the Inst Num and press Enter.
- Specify when the report should start:
- You can choose to enter a numeric value for the most recent number of days (e.g., entry of 1 produces a report on the most recent one day of workload).
- To have finer unit than days hit enter with no values and a list of snapshots will appear:
- Type the Snap Id for the start time
- Type the Snap Id for the end time
- Type the Snap Id for the start time
- Name the report and press Enter.
- Issue the quit command to exit from SQLPlus.
- The report is generated at the path where the SQLPlus command was issued.
For enabling trace at entire database level you may use the following 2 steps :
1. To enable SQL tracing for the entire database, execute:
ALTER SYSTEM SET sql_trace = true SCOPE=MEMORY;
To stop, execute:
ALTER SYSTEM SET sql_trace = false SCOPE=MEMORY;
2. Locate the trace file under $ORACLE_HOME/diag/rdbms/<<database name>>/<<Instance name>>/trace/
3. Convert the trace file in readable format :
Shell command :
4. Get the AWR report too as this will rank all the wait and read events in well formatted way.
If you want to traces the specific session then following steps can be followed,
1. alter session set tracefile_identifier = 'My_Trace' ;
2. alter session set sql_trace = true;
3. << execute the report/application code >>
4. alter session set sql_trace = false;
5. Locate the trace file under $ORACLE_HOME/diag/rdbms/<<database name>>/<<Instance name>>/trace/
6. Convert the trace file in readable format :
Shell command :
tkprof <<tress file path>> <<output_file_path.txt>> insert=tkprof.sql record=Allsql.sql
Comments
Post a Comment