OracleLogs » История » Редакция 6
Редакция 5 (BEA, 30.01.2025 19:02) → Редакция 6/13 (BEA, 30.01.2025 19:04)
h2. Логи Oracle
h3. Основные:
* @ORACLE_BASE/diag/rdbms/<имя базы>/<имя базы>/trace/alert_<имя базы>.log@ - полный лог работы
* @ORACLE_BASE/diag/tnslsnr/<имя ПК>/listener/alert/log.xml@ - лог работы прослушивателя соединений
h3. Отчёт AWR
h4. Создание отчетов AWR в Oracle через SQL:
Основные три способа получения отчетов AWR:
# *AWRRPT.SQL* и *AWRRPTI.SQL*: Получите отчет AWR с помощью: @@?\rdbms\admin\awrrpt.sql;@
# *AWRSQRPT.SQL* и *AWRSQRPI.SQL* Получите отчет об идентификаторе SQL с помощью: @@?\rdbms\admin\awrsqrpt.sql;@
# *AWRDDRPT.SQL* и *AWRDDRPI.SQL* Получите отчет о различиях с помощью: @@?\rdbms\admin\awrddropt.sql;@
h5. AWRRPT.SQL
{{collapse
Нам нужно создать отчет AWR для получения данных о производительности за определенный интервал. Показать статистику для диапазона идентификаторов снимков.
Во время выборки мы должны ввести некоторые данные:
* Тип отчета: HTML. (В примере @Enter value for report_type: html@)
* Укажите количество дней. (В примере @Enter value for num_days: 2@)
* Укажите идентификаторы начального и конечного снимка. (В примере @Enter value for begin_snap: 483@ и @Enter value for end_snap: 484@)
* Укажите имя отчета. (В примере @Enter value for report_name: C:\reportawr.html@)
Пример:
<pre>SQL> @?\rdbms\admin\awrrpt.sql;
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats. Please enter the
name of the format at the prompt. Default value is 'html'.
'html' HTML format (default)
'text' Text format
'active-html' Includes Performance Hub active report
Enter value for report_type: html
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: 2
Listing the last 2 days of Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level
------------ ------------ ---------- ------------------ ----------
xe XE 483 06 Jan 2020 09:27 1
484 06 Jan 2020 10:30 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 483
Begin Snapshot Id specified: 483
Enter value for end_snap: 484
End Snapshot Id specified: 484
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_483_484.html. To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name: C:\reportawr.html
Using the report name C:\reportawr.html
...
...
...
Report written to C:\reportawr.html</pre>
}}
h5. AWRRPTI.SQL
{{collapse
Он запрашивает еще два параметра:
* идентификатор базы данных (В примере @Enter value for dbid: 2901846628@)
* номер экземпляра. (В примере @Enter value for inst_num: 1@)
Пример:
<pre>SQL> @?\rdbms\admin\awrrpti.sql;
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats. Please enter the
name of the format at the prompt. Default value is 'html'.
'html' HTML format (default)
'text' Text format
'active-html' Includes Performance Hub active report
Enter value for report_type: HTML
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
2900437705 1 XE xe IXC1-LT8TBDW
* 2901846628 1 XE xe IXC1-LT8TBDW
Enter value for dbid: 2901846628
Using 2901846628 for database Id
Enter value for inst_num: 1
Using 1 for instance number
...
...</pre>
}}
h5. AWRSQRPT
{{collapse
Используется для просмотра статистики, связанной с идентификатором SQL, которая помогает повысить производительность конкретного запроса SQL.
Вы можете найти SQLID в диапазоне выборки отчета AWR из того же снимка с помощью AWRRPT.SQL. (В примере @Enter value for sql_id: @)
<pre>SQL> @?\rdbms\admin\awrsqrpt.sql
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
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
2901846628 XE 1 xe
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
2900437705 1 XE xe IXC1-LT8TBDW
* 2901846628 1 XE xe IXC1-LT8TBDW
Using 2901846628 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.
Enter value for num_days: 2
Listing the last 2 days of Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level
------------ ------------ ---------- ------------------ ----------
xe XE 483 06 Jan 2020 09:27 1
484 06 Jan 2020 10:30 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 483
Begin Snapshot Id specified: 483
Enter value for end_snap: 484
End Snapshot Id specified: 484
Specify the SQL Id
~~~~~~~~~~~~~~~~~~
Enter value for sql_id:
...
...</pre>
}}
h4. AWRSQRPTI.SQL
Аналогичен AWRSQRPT, но используется с идентификатором базы данных и номером экземпляра.
h4. AWRDDRPT
{{collapse
Сравните два отчета awr и найдите разницу между двумя снимками разного времени с помощью этой команды. AWRDDRPT
<pre>SQL> @?\rdbms\admin\awrddrpt.sql;
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
DB Id DB Id DB Name Inst Num Inst Num Instance
----------- ----------- ------------ -------- -------- ------------
2901846628 2901846628 XE 1 1 xe
Current Instance
~~~~~~~~~~~~~~~~
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
2900437705 1 XE xe IXC1-LT8TBDW
* 2901846628 1 XE xe IXC1-LT8TBDW
Database Id and Instance Number for the First Pair of Snapshots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using 2901846628 for Database Id for the first pair of snapshots
Using 1 for Instance Number for the first pair of snapshots
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: 2
Listing the last 2 days of Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level
------------ ------------ ---------- ------------------ ----------
xe XE 483 06 Jan 2020 09:27 1
484 06 Jan 2020 10:30 1
485 06 Jan 2020 11:30 1
486 06 Jan 2020 12:30 1
487 06 Jan 2020 13:30 1
488 06 Jan 2020 14:30 1
Specify the First Pair of Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 483
First Begin Snapshot Id specified: 483
Enter value for end_snap: 484
First End Snapshot Id specified: 484
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
2900437705 1 XE xe IXC1-LT8TBDW
* 2901846628 1 XE xe IXC1-LT8TBDW
Database Id and Instance Number for the Second Pair of Snapshots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using 2901846628 for Database Id for the second pair of snapshots
Using 1 for Instance Number for the second pair of snapshots
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_days2: 2
Listing the last 3 days of Completed Snapshots
482 04 Jan 2020 09:59 1
483 06 Jan 2020 09:27 1
484 06 Jan 2020 10:30 1
485 06 Jan 2020 11:30 1
486 06 Jan 2020 12:30 1
487 06 Jan 2020 13:30 1
488 06 Jan 2020 14:30 1
Specify the Second Pair of Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap2: 487
Second Begin Snapshot Id specified: 487
Enter value for end_snap2: 488
Second End Snapshot Id specified: 488
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrdiff_1_483_1_487.html To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name:
...
...</pre>
}}
h4. AWRDDRPI.SQL
Аналогичен awrddropt.sql, но используется с определенным идентификатором базы данных и номером экземпляра.