Проект

Общее

Профиль

OracleLogs » История » Версия 8

BEA, 30.01.2025 19:08

1 2 BEA
h2. Логи Oracle
2
3 8 BEA
{{>toc}}
4
5 2 BEA
h3. Основные:
6 3 BEA
7 4 BEA
* @ORACLE_BASE/diag/rdbms/<имя базы>/<имя базы>/trace/alert_<имя базы>.log@ - полный лог работы
8 5 BEA
* @ORACLE_BASE/diag/tnslsnr/<имя ПК>/listener/alert/log.xml@ - лог работы прослушивателя соединений
9 6 BEA
10 1 BEA
h3. Отчёт AWR
11
12 8 BEA
Во многих SQL редакторах есть поддержка генерации AWR отчёта. Как его сгенерировать узнавайте у разработчиков SQL редактора. 
13
Если же такой функции нет то можно сгенерировать через стандартные sql скрипты предоставляемые Oracle.
14
Основные три способа получения отчетов AWR через SQL:
15 6 BEA
# *AWRRPT.SQL* и *AWRRPTI.SQL*: Получите отчет AWR с помощью: @@?\rdbms\admin\awrrpt.sql;@
16
# *AWRSQRPT.SQL* и *AWRSQRPI.SQL* Получите отчет об идентификаторе SQL с помощью: @@?\rdbms\admin\awrsqrpt.sql;@
17
# *AWRDDRPT.SQL* и *AWRDDRPI.SQL* Получите отчет о различиях с помощью: @@?\rdbms\admin\awrddropt.sql;@
18
19
h5. AWRRPT.SQL
20
21
{{collapse
22
Нам нужно создать отчет AWR для получения данных о производительности за определенный интервал. Показать статистику для диапазона идентификаторов снимков.
23
Во время выборки мы должны ввести некоторые данные:
24
* Тип отчета: HTML. (В примере @Enter value for report_type: html@)
25
* Укажите количество дней. (В примере @Enter value for num_days: 2@)
26
* Укажите идентификаторы начального и конечного снимка. (В примере @Enter value for begin_snap: 483@ и @Enter value for end_snap: 484@)
27
* Укажите имя отчета. (В примере @Enter value for report_name: C:\reportawr.html@)
28
29
Пример:
30
<pre>SQL> @?\rdbms\admin\awrrpt.sql;
31
32
Specify the Report Type
33
~~~~~~~~~~~~~~~~~~~~~~~
34
AWR reports can be generated in the following formats.  Please enter the
35
name of the format at the prompt.  Default value is 'html'.
36
37
'html'          HTML format (default)
38
'text'          Text format
39
'active-html'   Includes Performance Hub active report
40
41
Enter value for report_type: html
42
43
Specify the number of days of snapshots to choose from
44
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
Entering the number of days (n) will result in the most recent
46
(n) days of snapshots being listed.  Pressing  without
47
specifying a number lists all completed snapshots.
48
49
Enter value for num_days: 2
50
51
Listing the last 2 days of Completed Snapshots
52
Instance     DB Name      Snap Id       Snap Started    Snap Level
53
------------ ------------ ---------- ------------------ ----------
54
55
xe           XE                 483  06 Jan 2020 09:27    1
56
                                484  06 Jan 2020 10:30    1
57
58
Specify the Begin and End Snapshot Ids
59
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
Enter value for begin_snap: 483
61
Begin Snapshot Id specified: 483
62
63
Enter value for end_snap: 484
64
End   Snapshot Id specified: 484
65
66
Specify the Report Name
67
~~~~~~~~~~~~~~~~~~~~~~~
68
The default report file name is awrrpt_1_483_484.html.  To use this name,
69
press  to continue, otherwise enter an alternative.
70
71
Enter value for report_name: C:\reportawr.html
72
73
Using the report name C:\reportawr.html
74
...
75
...
76
...
77
Report written to C:\reportawr.html</pre>
78
}}
79
80
h5. AWRRPTI.SQL
81
82
{{collapse
83
Он запрашивает еще два параметра: 
84
* идентификатор базы данных (В примере @Enter value for dbid: 2901846628@)
85
* номер экземпляра. (В примере @Enter value for inst_num: 1@)
86
Пример:
87
88
<pre>SQL> @?\rdbms\admin\awrrpti.sql;
89
90
Specify the Report Type
91
~~~~~~~~~~~~~~~~~~~~~~~
92
AWR reports can be generated in the following formats.  Please enter the
93
name of the format at the prompt. Default value is 'html'.
94
95
   'html'          HTML format (default)
96
   'text'          Text format
97
   'active-html'   Includes Performance Hub active report
98
99
Enter value for report_type: HTML
100
Type Specified: html
101
102
Instances in this Workload Repository schema
103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
  DB Id      Inst Num   DB Name      Instance     Host
105
------------ ---------- ---------    ----------   ------
106
  2900437705     1      XE           xe           IXC1-LT8TBDW
107
* 2901846628     1      XE           xe           IXC1-LT8TBDW
108
109
Enter value for dbid: 2901846628
110
Using 2901846628 for database Id
111
Enter value for inst_num: 1
112
Using 1 for instance number
113
...
114
...</pre>
115
}}
116
117
h5. AWRSQRPT
118
119
{{collapse
120
Используется для просмотра статистики, связанной с идентификатором SQL, которая помогает повысить производительность конкретного запроса SQL.
121
Вы можете найти SQLID в диапазоне выборки отчета AWR из того же снимка с помощью AWRRPT.SQL. (В примере @Enter value for sql_id: @)
122
123
<pre>SQL> @?\rdbms\admin\awrsqrpt.sql
124
125
Specify the Report Type
126
~~~~~~~~~~~~~~~~~~~~~~~
127
Would you like an HTML report, or a plain text report?
128
Enter 'html' for an HTML report, or 'text' for plain text
129
Defaults to 'html'
130
131
Enter value for report_type: html
132
Type Specified:  html
133
134
Current Instance
135
~~~~~~~~~~~~~~~~
136
   DB Id    DB Name      Inst Num Instance
137
----------- ------------ -------- ------------
138
 2901846628 XE                  1 xe
139
140
Instances in this Workload Repository schema
141
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142
  DB Id      Inst Num   DB Name      Instance     Host
143
------------ ---------- ---------    ----------   ------
144
  2900437705     1      XE           xe           IXC1-LT8TBDW
145
* 2901846628     1      XE           xe           IXC1-LT8TBDW
146
147
Using 2901846628 for database Id
148
Using          1 for instance number
149
150
Specify the number of days of snapshots to choose from
151
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152
Entering the number of days (n) will result in the most recent
153
(n) days of snapshots being listed.  Pressing  without
154
specifying a number lists all completed snapshots.
155
156
Enter value for num_days: 2
157
158
Listing the last 2 days of Completed Snapshots
159
Instance     DB Name      Snap Id       Snap Started    Snap Level
160
------------ ------------ ---------- ------------------ ----------
161
xe           XE                 483  06 Jan 2020 09:27    1
162
                                484  06 Jan 2020 10:30    1
163
164
165
Specify the Begin and End Snapshot Ids
166
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
Enter value for begin_snap: 483
168
Begin Snapshot Id specified: 483
169
170
Enter value for end_snap: 484
171
End   Snapshot Id specified: 484
172
173
Specify the SQL Id
174
~~~~~~~~~~~~~~~~~~
175
Enter value for sql_id:
176
...
177
...</pre>
178
}}
179
180 7 BEA
h5. AWRSQRPTI.SQL 
181 6 BEA
182
Аналогичен AWRSQRPT, но используется с идентификатором базы данных и номером экземпляра.
183
184 7 BEA
h5. AWRDDRPT
185 6 BEA
186
{{collapse
187
Сравните два отчета awr и найдите разницу между двумя снимками разного времени с помощью этой команды. AWRDDRPT
188
189
<pre>SQL> @?\rdbms\admin\awrddrpt.sql;
190
191
Specify the Report Type
192
~~~~~~~~~~~~~~~~~~~~~~~
193
Would you like an HTML report, or a plain text report?
194
Enter 'html' for an HTML report, or 'text' for plain text
195
Defaults to 'html'
196
Enter value for report_type: html
197
198
   DB Id       DB Id    DB Name      Inst Num Inst Num Instance
199
----------- ----------- ------------ -------- -------- ------------
200
 2901846628  2901846628 XE                  1        1 xe
201
202
Current Instance
203
~~~~~~~~~~~~~~~~
204
Instances in this Workload Repository schema
205
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206
  DB Id      Inst Num   DB Name      Instance     Host
207
------------ ---------- ---------    ----------   ------
208
  2900437705     1      XE           xe           IXC1-LT8TBDW
209
* 2901846628     1      XE           xe           IXC1-LT8TBDW
210
211
Database Id and Instance Number for the First Pair of Snapshots
212
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213
Using 2901846628 for Database Id for the first pair of snapshots
214
Using          1 for Instance Number for the first pair of snapshots
215
216
Specify the number of days of snapshots to choose from
217
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218
Entering the number of days (n) will result in the most recent
219
(n) days of snapshots being listed.  Pressing  without
220
specifying a number lists all completed snapshots.
221
222
Enter value for num_days: 2
223
224
Listing the last 2 days of Completed Snapshots
225
Instance     DB Name      Snap Id       Snap Started    Snap Level
226
------------ ------------ ---------- ------------------ ----------
227
xe           XE                 483  06 Jan 2020 09:27    1
228
                                484  06 Jan 2020 10:30    1
229
                                485  06 Jan 2020 11:30    1
230
                                486  06 Jan 2020 12:30    1
231
                                487  06 Jan 2020 13:30    1
232
                                488  06 Jan 2020 14:30    1
233
234
235
Specify the First Pair of Begin and End Snapshot Ids
236
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237
Enter value for begin_snap: 483
238
First Begin Snapshot Id specified: 483
239
240
Enter value for end_snap: 484
241
First End   Snapshot Id specified: 484
242
243
Instances in this Workload Repository schema
244
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245
  DB Id      Inst Num   DB Name      Instance     Host
246
------------ ---------- ---------    ----------   ------
247
  2900437705     1      XE           xe           IXC1-LT8TBDW
248
* 2901846628     1      XE           xe           IXC1-LT8TBDW
249
250
Database Id and Instance Number for the Second Pair of Snapshots
251
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252
Using 2901846628 for Database Id for the second pair of snapshots
253
Using          1 for Instance Number for the second pair of snapshots
254
255
Specify the number of days of snapshots to choose from
256
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257
Entering the number of days (n) will result in the most recent
258
(n) days of snapshots being listed.  Pressing  without
259
specifying a number lists all completed snapshots.
260
261
Enter value for num_days2: 2
262
263
Listing the last 3 days of Completed Snapshots
264
                                482  04 Jan 2020 09:59    1
265
                                483  06 Jan 2020 09:27    1
266
                                484  06 Jan 2020 10:30    1
267
                                485  06 Jan 2020 11:30    1
268
                                486  06 Jan 2020 12:30    1
269
                                487  06 Jan 2020 13:30    1
270
                                488  06 Jan 2020 14:30    1
271
272
273
Specify the Second Pair of Begin and End Snapshot Ids
274
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
275
Enter value for begin_snap2: 487
276
Second Begin Snapshot Id specified: 487
277
278
Enter value for end_snap2: 488
279
Second End   Snapshot Id specified: 488
280
281
Specify the Report Name
282
~~~~~~~~~~~~~~~~~~~~~~~
283
The default report file name is awrdiff_1_483_1_487.html  To use this name,
284
press  to continue, otherwise enter an alternative.
285
286
Enter value for report_name:
287
...
288
...</pre>
289
}}
290
291 7 BEA
h5. AWRDDRPI.SQL
292 6 BEA
293
Аналогичен awrddropt.sql, но используется с определенным идентификатором базы данных и номером экземпляра.