miércoles, 3 de junio de 2015

Generando reportes AWR, ASH y ADDM

Generando reportes AWR, ASH y ADDM
En algún momento durante el monitoreo de nuestra base de datos Oracle será necesario obtener información detallada en reportes, estos podrían ser los de AWR, AHR y/o ADDM. Este post se enfocará en realizar las mismas utilizando scripts, una manera alternativa a lo que nos ofrece con la interfaz gráfica de Enterprise Manager. A continuación se detalla los pasos para obtener los reportes.

A) Reporte AWR (awrrpt.sql)
El utilitario de informes AWR proporciona una visión general del rendimiento de bases de datos en un determinado tiempo. En esencia, calcula la variación de la actividad de la base de datos en el intervalo de tiempo elegido. el script "awrrpt.sql" se encuentra en el directorio $ORACLE_HOME/RDBMS/admin.
La salida del archivo es ubicada en el directorio actual. Para una mejor comprensión de dicho informe seleccionar el formato HTML.

1. Ingresamos al directorio donde se generará el Informe AWR.
bash-3.2$ cd /u01/informes/
bash-3.2$ pwd
/u01/informes
bash-3.2$ ls
bash-3.2$
2 Nos conectamos vía sqlplus con usuario de provilegios de DBA.
bash-3.2$ sqlplus pticona

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 22 23:58:15 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>
3. Ejecutamos awrrpt.sql y nos aparecerá los datos actuales de la instancia.
SQL> @$ORACLE_HOME/rdbms/admin/awrrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
  798387748 PRMY                1 prmy
3.1. Elegimos la opción para que el informe se genere en formato "html".
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type:html

Type Specified:  html


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 798387748         1 PRMY         prmy         primario

Using  798387748 for database Id
Using          1 for instance number

3.2. Para encontrar todos los AWR de la base de datos solo damos enter sin escribir nada.
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing  without
specifying a number lists all completed snapshots.

Enter value for num_days:

Listing all Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
prmy         PRMY                 1 18 Jun 2014 01:30      1
                                  2 18 Jun 2014 11:13      1
                                  3 18 Jun 2014 12:00      1
                                  4 22 Jun 2014 15:04      1
                                  5 22 Jun 2014 16:00      1
                                  6 22 Jun 2014 17:00      1
                                  7 22 Jun 2014 18:00      1
                                  8 22 Jun 2014 19:00      1
                                  9 22 Jun 2014 20:00      1
                                 10 22 Jun 2014 21:00      1
                                 11 22 Jun 2014 22:00      1
                                 12 22 Jun 2014 23:00      1
                                 13 23 Jun 2014 00:01      1
3.3. Con el listado desplegado, elegimos el intervalo de tiempo.
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 10
Begin Snapshot Id specified: 10

Enter value for end_snap: 11
End   Snapshot Id specified: 11
3.4. Asignamos el nombre para el reporte.
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_10_11.html.  To use this name,
press  to continue, otherwise enter an alternative.

Enter value for report_name: reporte_awr.html
.
.
Report written to reporte_awr.html
3.5. Salimos de sqlplus.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
bash-3.2$
4 Finalmente verificamos el archivo creado.
bash-3.2$ pwd
/u01/informes
bash-3.2$ ls
reporte_awr.html
bash-3.2$
5 Para realizar una comparativa de reportes AWR, utilizar el siguiente script.
SQL> @$ORACLE_HOME/rdbms/admin/awrddrpt.sql
B) Reporte ASH (ashrpt.sql)
El reporte ASH es útil para determinar la cantidad de sesiones activas, lo que estaban haciendo, y que sentencias SQL son las más activas durante el período de tiempo seleccionado. Especialmente es muy útil para el análisis de problemas de rendimiento transitoria. El script "ashrpt.sql" se encuentra en el directorio $ORACLE_HOME/RDBMS/admin.
La salida del archivo es ubicada en el directorio actual. Para una mejor comprension de dicho informe seleccionar el formato HTML. 

1. Ingresamos al directorio donde se generará el Informe ASH.
bash-3.2$ cd /u01/informes/
bash-3.2$ pwd
/u01/informes
bash-3.2$ ls
bash-3.2$
2 Nos conectamos vía sqlplus con usuario de provilegios de DBA.
bash-3.2$ sqlplus pticona

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 22 23:58:15 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>
3. Ejecutamos ashrpt.sql y nos aparecerá los datos actuales de la instancia.
SQL> @$ORACLE_HOME/rdbms/admin/ashrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
  798387748 PRMY                1 prmy
3.1. Elegimos la opción para que el informe se genere en formato "html".
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html

Type Specified:  html

Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 798387748         1 PRMY         prmy         primario

Defaults to current database

Using database id: 798387748

Enter instance numbers. Enter 'ALL' for all instances in a
RAC cluster or explicitly specify list of instances (e.g., 1,2,3).
Defaults to current instance.

Using instance number(s): 1

3.2. Ingresamos la hora de inicio y el intervalo de tiempo de duracion para el reporte ASH.
ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Oldest ASH sample available:  18-Jun-14 01:19:24   [   7150 mins in the past]
Latest ASH sample available:  23-Jun-14 00:29:06   [      0 mins in the past]


Specify the timeframe to generate the ASH report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter begin time for report:

--    Valid input formats:
--      To specify absolute begin time:
--        [MM/DD[/YY]] HH24:MI[:SS]
--        Examples: 02/23/03 14:30:15
--                  02/23 14:30:15
--                  14:30:15
--                  14:30
--      To specify relative begin time: (start with '-' sign)
--        -[HH24:]MI
--        Examples: -1:15  (SYSDATE - 1 Hr 15 Mins)
--                  -25    (SYSDATE - 25 Mins)

Defaults to -15 mins
Enter value for begin_time: 06/22/14 21:05
Report begin time specified: 06/22/14 21:05

Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
Enter value for duration: 60
Report duration specified:   60

Using 22-Jun-14 21:05:00 as report begin time
Using 22-Jun-14 22:05:00 as report end time
3.3. Asignamos el nombre para el reporte ASH.
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is ashrpt_1_0622_2205.html.  To use this name,
press  to continue, otherwise enter an alternative.
Enter value for report_name: reporte_ash.html
.
.
Report written to reporte_ash.html
3.4. Salimos de sqlplus.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
bash-3.2$
4 Finalmente verificamos el archivo creado.
bash-3.2$ pwd
/u01/informes
bash-3.2$ ls
reporte_ash.html
bash-3.2$
C) Reporte ADDM (addmrpt.sql)
El utilitario de ADDM crea un informe con las conclusiones de rendimiento de base de datos. El script "addmrpt.sql" se encuentra en el directorio $ORACLE_HOME/RDBMS/admin. La salida del archivo se ubica en el directorio actual y es enformato de archivo de texto.
1. Ingresamos al directorio donde se generará el reporte ADDM.
bash-3.2$ cd /u01/informes/
bash-3.2$ pwd
/u01/informes
bash-3.2$ ls
bash-3.2$
2 Nos conectamos vía sqlplus con usuario de provilegios de DBA.
bash-3.2$ sqlplus pticona

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 22 23:58:15 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>
3. Ejecutamos addmrpt.sql y nos aparecerá los datos actuales de la instancia.
SQL> @$ORACLE_HOME/rdbms/admin/addmrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
  798387748 PRMY                1 prmy


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 798387748         1 PRMY         prmy         primario

Using  798387748 for database Id
Using          1 for instance number


Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing  without
specifying a number lists all completed snapshots.



Listing the last 3 days of Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
prmy         PRMY                 4 22 Jun 2014 15:04      1
                                  5 22 Jun 2014 16:00      1
                                  6 22 Jun 2014 17:00      1
                                  7 22 Jun 2014 18:00      1
                                  8 22 Jun 2014 19:00      1
                                  9 22 Jun 2014 20:00      1
                                 10 22 Jun 2014 21:00      1
                                 11 22 Jun 2014 22:00      1
                                 12 22 Jun 2014 23:00      1
                                 13 23 Jun 2014 00:01      1
3.1. Elegimos el intervalo de snapshots para el reporte ADDM.
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 10
Begin Snapshot Id specified: 10

Enter value for end_snap: 11
End   Snapshot Id specified: 11
3.2. Asignamos el nombre para el reporte.
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is addmrpt_1_10_11.txt.  To use this name,
press  to continue, otherwise enter an alternative.

Enter value for report_name: reporte_addm.txt
.
.
.
The database's maintenance windows were active during 100% of the analysis
period.

End of Report
Report written to reporte_addm.txt
SQL>
3.3. Salimos de sqlplus.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
bash-3.2$
4 Finalmente verificamos el archivo creado.
bash-3.2$ pwd
/u01/informes
bash-3.2$ ls
reporte_addm.txt
bash-3.2$

No hay comentarios: