Bo's Oracle Station

查看: 1023|回复: 0

awrsqlrpt.sql的使用

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2022-5-17 11:16:21 | 显示全部楼层 |阅读模式
1. 首先获取AWR报告:
  1. [oracle@cvcdds198 ~]$ cd /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/
  2. [oracle@cvcdds198 admin]$ sqlplus /nolog

  3. SQL*Plus: Release 19.0.0.0.0 - Production on Tue May 17 11:09:38 2022
  4. Version 19.3.0.0.0

  5. Copyright (c) 1982, 2019, Oracle.  All rights reserved.

  6. SQL> conn / as sysdba
  7. Connected.
  8. SQL> @awrrpt

  9. Specify the Report Type
  10. ~~~~~~~~~~~~~~~~~~~~~~~
  11. AWR reports can be generated in the following formats.        Please enter the
  12. name of the format at the prompt.  Default value is 'html'.

  13. 'html'                HTML format (default)
  14. 'text'                Text format
  15. 'active-html'        Includes Performance Hub active report

  16. Enter value for report_type: active-html
  17. old   1: select 'Type Specified: ',lower(nvl('&&report_type','html')) report_type from dual
  18. new   1: select 'Type Specified: ',lower(nvl('active-html','html')) report_type from dual

  19. Type Specified:  active-html

  20. old   1: select '&&report_type' report_type_def from dual
  21. new   1: select 'active-html' report_type_def from dual



  22. old   1: select '&&view_loc' view_loc_def from dual
  23. new   1: select 'AWR_PDB' view_loc_def from dual



  24. Current Instance
  25. ~~~~~~~~~~~~~~~~
  26. DB Id               DB Name              Inst Num             Instance            Container Name
  27. -------------- -------------- -------------- -------------- --------------
  28.   868254545        RCAT                            1 rcat             rcat

  29. <font color="Red">......</font>

  30. ui0pdUguneHq/gKAALzj
  31.             <report db_version="19.0.0.0.0" cpu_cores="8" hyperthread="N" timezone_offset="28800" packs="2" encode="base64" compress="zlib">
  32.       <report_id><![CDATA[/orarep/addm/main%3fname%3dADDM%3a868254545_1_1107%26owner%3dSYS]]></report_id>
  33.             eAGNVEtP4zAQvvMrRj6vmjiUp5JKUVu0aKFoaffAXio3cVJDYofYBfrvGTuPFra7
  34. i5JDHI9n5nuMw5IJOToCCCtWs1LbT1yoWuRCsgLUq+R1ROYPcwKG6aelZCWPSDyZ
  35. 3F6en54HJ0N8lnRJqX9GvPZ0qVKRCZ5+OK3X6nWpn4uIXMU38+kX0oHmiRFKRmQR
  36. z38QSNlWR4QS0JUyNa8i4jffhdDGLlz90NshCVNumCjAbKu26a+UdThFGpGhPzxp
  37. D4gUSzdrJpcvlhN6MfCbhwD+a2pcz+aLeDaeko4KbADSlc3W04VIVn9k0JJVFJNS
  38. /xRB4SJwizOsL0qOO/6JR8+8wA8CoP6lj+9xs4eB+3vU7tEhFtnUrKHv+JQiazV/
  39. jkjfX6eVBduqjrobrNYD/5fUCAEpD/xj2tKOh729XKGQ2jCZ8F1uATY1NvKJ36ZM
  40. nTBDYK2skslLkqaaXpwP3uQgexwkEikxzGxQg3gW3zz8nk56s3mfKoWZkKmQ+a5w
  41. tg8qa5tAkzj/NNWlqktWfAO9SbBlnW0KSFRZFdwSiB07/1zPru7ub+PF9d3MSugs
  42. B5ko8GPW6u2Gp9T5aLHmNYdXpkEq0CKXOBAJkwZNbNiKaQ4Mvf0izBaMgnojwaw5
  43. 2LEahJ5N4ObQpRMyU61aluSsdZb3EWdY82QH2TZcsmovS+nYx4HBbn/JJ4mDDfcc
  44. QZZcYk8IExZ4qKO1AdIrhrxXVYEIXGCMN8NWC30gOHAFJh3IsZKZyFsjHgi3Fo7I
  45. d1Qd/heKjsbQ+c8bWGwk6nsgmx1WDOE5YjJ/D8MBs2HJGimC8ZrJnB+CYkcvItM3
  46. VgrJoXOZ02hXG02/T3Xo7WQIrcJK6m7SmmlkBe9+qNUjXnD9vnUSr/slXpVLw9/a
  47. /dBrrrLREdrDXdnvSkyWPQ==
  48.             </report>
  49.      <report db_version="19.0.0.0.0" cpu_cores="8" hyperthread="N" timezone_offset="28800" packs="2" encode="base64" compress="zlib">
  50.       <report_id><![CDATA[/orarep/addm/main%3fname%3dADDM%3a868254545_1_1106%26owner%3dSYS]]></report_id>
  51.             eAGNVE1P4zAQvfMrRj6vmqS0QFGCFNGiRQtFS7sH9lK5iZMaknGIXaD/nnE+C9vd
  52. RbnY8XjevPdm7Odc4sURgF/wkufaLmmjSplK5BmoVxRlwBYPCwaG66cV8lwELJxO
  53. b8/PTs6G4xF9K2/lee4Jc5rbuYplIkX84bbeqNeVfs4CdhXeLGZfSAdaREYqDNgy
  54. XPxgEPOdDpjHQBfKlKIImFuvM6mN3VT4vtMz8WNhuMzA7Iqm6K/AVjxlHLCROxo1
  55. F2RM0PWe4+rFauJNBm79MaB/Ncb1fLEM55cz1kpBBUC8ttk6uYjJ+o8MGnnhUVLP
  56. HRMp2gyrzQnhy1zQiTt2vFNn6A6H4E7OXfd8PKzPKHDvzHPtmXtMINuS1/Idj8ek
  57. WimeA9bV13plyTauk++G0Dri/7KaKJDkHmWejDrfnb1kvkRtOEaiTy7B5qZKPglc
  58. 45QRNww2yloZvURxrL3J2eANB8njIELSxHCzJRPCeXjz8Hs27VE/IfmJxFhi2gMn
  59. +6ySpgjqkqqBanRUZc6zb6C3EZWsk20GkcqLTFgFqeKqga7nV3f3t+Hy+m5uPax6
  60. DhKZ0WLeGF5NT67Ti+VGlAJeuQZUoGWKNBERR0NdbPiaawGcmvtFmh0YBeUWwWwE
  61. 2Lka+I5NUA1ilU5iohq7yCInaVrL+cjTL0XUU7YF57zYy5JX6tPEULW/8AlpsuFe
  62. EMlcINVENGFJl1pZayKdY6R7UWTEoAoM6WnYaakPBNumDNi0JXmpMJFp04kHwqlP
  63. Kfw7uQ7/C7WjSC/RzxtYbpH8PZCNRseGiJQ4mb+H2aGisGhDEsHlhmMqDlE5rcJm
  64. bzyXKKDtssqjHtt3PkjtO70NvnVYoW5HrR5Hnon2h1o/0gvXndtOEmW3pbdyZcRb
  65. c+479Vt2cUTtUb3Z79lfloM=
  66.             </report>
  67.     </report>
  68.    </report>
  69.    <!--FXTMODEL-->
  70.   </script>
  71. </body>
  72. </div>
  73. End of Report
  74. </body></html>
  75. Report written to /home/oracle/awrrpt_1_1106_1107.html

复制代码

2. 查看AWR报告中的那条SQL语句:

SQL ordered by Elapsed Time
  • Resources reported for PL/SQL code includes the resources used by all SQL     statements called by the code.
  • % Total DB Time is the Elapsed Time of the SQL statement divided     into the Total Database Time multiplied by 100
  • %Total - Elapsed Time  as a percentage of Total DB time
  • %CPU   - CPU Time      as a percentage of Elapsed Time
  • %IO    - User I/O Time as a percentage of Elapsed Time
  • Captured SQL account for   3.0E+04% of Total DB Time (s):               0
  • Captured PL/SQL account for   1.6E+04% of Total DB Time (s):               0
Elapsed  Time (s)Executions Elapsed Time per Exec (s) %Total%CPU%IO   SQL IdSQL ModuleSQL Text
2.07
1
2.07
10195.85
41.48
47.94
drktaf71uygnb
BEGIN sys.prvt_hdm.auto_execut...
0.72
8
0.09
3563.29
98.92
0.00
22356bkgsdcnh
SELECT COUNT(*) FROM X$KSPPI A...
0.48
30
0.02
2342.21
95.64
0.00
6uxga5vnsgugt
select s.file#, s.block#, s.t...
0.37
4
0.09
1797.89
98.89
0.00
1fvsn5j51ugz3
begin dbms_rcvman.resetAll; e...
0.36
4
0.09
1796.53
99.03
0.00
28bgqbzpa87xf
declare policy varchar2(512);...
0.32
100
0.00
1580.48
14.21
87.82
3un99a0zwp4vd
select owner#, name, namespace...
0.29
65
0.00
1420.43
11.93
93.41
03guhbfpak0w7
select /*+ index(idl_ub1$ i_id...
0.24
2
0.12
1184.62
38.35
64.53
adzjh275fvvx4DBMS_SCHEDULERcall WWV_FLOW_WORKSHEET_API.DO...
0.24
90
0.00
1161.14
95.26
0.00
1u8v867f5ys43
select ts#, file#, block#, hwm...
0.20
60
0.00
1006.14
83.15
0.00
c9umxngkc3byq
select sql_id, sql_exec_id, db...
0.19
65
0.00
941.70
9.21
94.25
fh5ufah919kun
select /*+ index(idl_sb4$ i_id...
0.17
2,265
0.00
860.72
52.74
52.25
0sbbcuruzd66f
select /*+ rule */ bucket_cnt,...
0.17
4
0.04
849.87
99.67
0.00
5pj6mtazkhmdd
BEGIN /* KSXM:FLUSH DML_MON */...
0.17
65
0.00
828.22
8.47
94.58
a3jpjzh7mtwwp
select /*+ index(idl_ub2$ i_id...
0.16
100
0.00
806.86
11.90
91.77
8swypbbr0m372
select order#, columns, types ...
0.16
1
0.16
803.36
99.46
0.04
9qrhhm7pf2ghv
insert into wrh$_mvparameter (...
0.16
4
0.04
779.80
99.15
0.00
3kqrku32p6sfn
MERGE /*+ OPT_PARAM('_parallel...
0.15
722
0.00
747.15
51.55
58.90
2sxqgx5hx76qr
select /*+ rule */ bucket, end...
0.15
1
0.15
729.91
53.78
47.69
13zr771hsyduv
select sum(BLOCKS) from DBA_SE...
0.15
120
0.00
719.07
92.76
0.00
aykvshm7zsabd
select size_for_estimate, size...
0.14
222
0.00
678.58
74.07
24.54
121ffmrc95v7g
select i.obj#, i.ts#, i.file#,...
0.12
2,581
0.00
615.01
106.87
0.02
2p9fv35c7zxtg
select /* KSXMOAD_DML_INF */...



3. 使用awrsqlrpt单独做那条SQL语句的报告:

drktaf71uygnb
  1. [oracle@cvcdds198 admin]$ sqlplus /nolog

  2. SQL*Plus: Release 19.0.0.0.0 - Production on Tue May 17 11:05:45 2022
  3. Version 19.3.0.0.0

  4. Copyright (c) 1982, 2019, Oracle.  All rights reserved.

  5. SQL> conn / as sysdba
  6. Connected.
  7. SQL> @awrsqrpt.sql

  8. Specify the Report Type
  9. ~~~~~~~~~~~~~~~~~~~~~~~
  10. Would you like an HTML report, or a plain text report?
  11. Enter 'html' for an HTML report, or 'text' for plain text
  12. Defaults to 'html'
  13. Enter value for report_type:

  14. Type Specified:  html


  15. Current Instance
  16. ~~~~~~~~~~~~~~~~
  17.    DB Id    DB Name         Inst Num Instance
  18. ----------- ------------ -------- ------------
  19.   868254545 RCAT                1 rcat




  20. Instances in this Workload Repository schema
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22.   DB Id      Inst Num        DB Name      Instance          Host
  23. ------------ ---------- ---------    ----------   ------
  24. * 868254545         1        RCAT             rcat          cvcdds198.xn

  25. Using  868254545 for database Id
  26. Using               1 for instance number


  27. Specify the number of days of snapshots to choose from
  28. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. Entering the number of days (n) will result in the most recent
  30. (n) days of snapshots being listed.  Pressing <return> without
  31. specifying a number lists all completed snapshots.


  32. Enter value for num_days:

  33. Listing all Completed Snapshots
  34. Instance     DB Name          Snap Id        Snap Started        Snap Level
  35. ------------ ------------ ---------- ------------------ ----------

  36. rcat             RCAT                913  09 May 2022 09:00          1
  37.                                 914  09 May 2022 10:00          1
  38.                                 915  09 May 2022 11:00          1
  39.                                 916  09 May 2022 12:00          1
  40.                                 917  09 May 2022 13:00          1
  41.                                 918  09 May 2022 14:00          1
  42.                                 919  09 May 2022 15:00          1
  43.                                 920  09 May 2022 16:00          1
  44.                                 921  09 May 2022 17:00          1
  45.                                 922  09 May 2022 18:00          1
  46.                                 923  09 May 2022 19:00          1
  47.                                 924  09 May 2022 20:00          1
  48.                                 925  09 May 2022 21:00          1
  49.                                 926  09 May 2022 22:00          1
  50.                                 927  09 May 2022 23:00          1
  51.                                 928  10 May 2022 00:00          1
  52.                                 929  10 May 2022 01:00          1
  53.                                 930  10 May 2022 02:00          1
  54.                                 931  10 May 2022 03:00          1
  55.                                 932  10 May 2022 04:00          1
  56.                                 933  10 May 2022 05:00          1
  57.                                 934  10 May 2022 06:00          1
  58.                                 935  10 May 2022 07:00          1
  59.                                 936  10 May 2022 08:00          1
  60.                                 937  10 May 2022 09:00          1
  61.                                 938  10 May 2022 10:18          1
  62.                                 939  10 May 2022 11:00          1
  63.                                 940  10 May 2022 12:00          1
  64.                                 941  10 May 2022 13:00          1
  65.                                 942  10 May 2022 14:00          1
  66.                                 943  10 May 2022 15:00          1
  67.                                 944  10 May 2022 16:00          1
  68.                                 945  10 May 2022 17:00          1
  69.                                 946  10 May 2022 18:00          1
  70.                                 947  10 May 2022 19:00          1
  71.                                 948  10 May 2022 20:00          1
  72.                                 949  10 May 2022 21:00          1
  73.                                 950  10 May 2022 22:00          1
  74.                                 951  10 May 2022 23:00          1
  75.                                 952  11 May 2022 00:00          1
  76.                                 953  11 May 2022 01:00          1
  77.                                 954  11 May 2022 02:00          1
  78.                                 955  11 May 2022 03:00          1
  79.                                 956  11 May 2022 04:00          1
  80.                                 957  11 May 2022 05:00          1
  81.                                 958  11 May 2022 06:00          1
  82.                                 959  11 May 2022 07:00          1
  83.                                 960  11 May 2022 08:00          1
  84.                                 961  11 May 2022 09:00          1
  85.                                 962  11 May 2022 10:00          1
  86.                                 963  11 May 2022 11:00          1
  87.                                 964  11 May 2022 12:00          1
  88.                                 965  11 May 2022 13:00          1
  89.                                 966  11 May 2022 14:00          1
  90.                                 967  11 May 2022 15:00          1
  91.                                 968  11 May 2022 16:00          1
  92. Instance     DB Name          Snap Id        Snap Started        Snap Level
  93. ------------ ------------ ---------- ------------------ ----------

  94. rcat             RCAT                969  11 May 2022 17:00          1
  95.                                 970  11 May 2022 18:00          1
  96.                                 971  11 May 2022 19:00          1
  97.                                 972  11 May 2022 20:00          1
  98.                                 973  11 May 2022 21:00          1
  99.                                 974  11 May 2022 22:00          1
  100.                                 975  11 May 2022 23:00          1
  101.                                 976  12 May 2022 00:00          1
  102.                                 977  12 May 2022 01:00          1
  103.                                 978  12 May 2022 02:00          1
  104.                                 979  12 May 2022 03:00          1
  105.                                 980  12 May 2022 04:00          1
  106.                                 981  12 May 2022 05:00          1
  107.                                 982  12 May 2022 06:00          1
  108.                                 983  12 May 2022 07:00          1
  109.                                 984  12 May 2022 08:00          1
  110.                                 985  12 May 2022 09:00          1
  111.                                 986  12 May 2022 10:00          1
  112.                                 987  12 May 2022 11:00          1
  113.                                 988  12 May 2022 12:00          1
  114.                                 989  12 May 2022 13:00          1
  115.                                 990  12 May 2022 14:00          1
  116.                                 991  12 May 2022 15:00          1
  117.                                 992  12 May 2022 16:00          1
  118.                                 993  12 May 2022 17:00          1
  119.                                 994  12 May 2022 18:00          1
  120.                                 995  12 May 2022 19:00          1
  121.                                 996  12 May 2022 20:00          1
  122.                                 997  12 May 2022 21:00          1
  123.                                 998  12 May 2022 22:00          1
  124.                                 999  12 May 2022 23:00          1
  125.                                1000  13 May 2022 00:00          1
  126.                                1001  13 May 2022 01:00          1
  127.                                1002  13 May 2022 02:00          1
  128.                                1003  13 May 2022 03:00          1
  129.                                1004  13 May 2022 04:00          1
  130.                                1005  13 May 2022 05:00          1
  131.                                1006  13 May 2022 06:00          1
  132.                                1007  13 May 2022 07:00          1
  133.                                1008  13 May 2022 08:00          1
  134.                                1009  13 May 2022 09:00          1
  135.                                1010  13 May 2022 10:00          1
  136.                                1011  13 May 2022 11:00          1
  137.                                1012  13 May 2022 12:00          1
  138.                                1013  13 May 2022 13:00          1
  139.                                1014  13 May 2022 14:00          1
  140.                                1015  13 May 2022 15:00          1
  141.                                1016  13 May 2022 16:00          1
  142.                                1017  13 May 2022 17:00          1
  143.                                1018  13 May 2022 18:00          1
  144.                                1019  13 May 2022 19:00          1
  145.                                1020  13 May 2022 20:00          1
  146.                                1021  13 May 2022 21:00          1
  147.                                1022  13 May 2022 22:00          1
  148.                                1023  13 May 2022 23:00          1
  149.                                1024  14 May 2022 00:00          1
  150. Instance     DB Name          Snap Id        Snap Started        Snap Level
  151. ------------ ------------ ---------- ------------------ ----------

  152. rcat             RCAT               1025  14 May 2022 01:00          1
  153.                                1026  14 May 2022 02:00          1
  154.                                1027  14 May 2022 03:00          1
  155.                                1028  14 May 2022 04:00          1
  156.                                1029  14 May 2022 05:00          1
  157.                                1030  14 May 2022 06:00          1
  158.                                1031  14 May 2022 07:00          1
  159.                                1032  14 May 2022 08:00          1
  160.                                1033  14 May 2022 09:00          1
  161.                                1034  14 May 2022 10:00          1
  162.                                1035  14 May 2022 11:00          1
  163.                                1036  14 May 2022 12:00          1
  164.                                1037  14 May 2022 13:00          1
  165.                                1038  14 May 2022 14:00          1
  166.                                1039  14 May 2022 15:00          1
  167.                                1040  14 May 2022 16:00          1
  168.                                1041  14 May 2022 17:00          1
  169.                                1042  14 May 2022 18:00          1
  170.                                1043  14 May 2022 19:00          1
  171.                                1044  14 May 2022 20:00          1
  172.                                1045  14 May 2022 21:00          1
  173.                                1046  14 May 2022 22:00          1
  174.                                1047  14 May 2022 23:00          1
  175.                                1048  15 May 2022 00:00          1
  176.                                1049  15 May 2022 01:00          1
  177.                                1050  15 May 2022 02:00          1
  178.                                1051  15 May 2022 03:00          1
  179.                                1052  15 May 2022 04:00          1
  180.                                1053  15 May 2022 05:00          1
  181.                                1054  15 May 2022 06:00          1
  182.                                1055  15 May 2022 07:00          1
  183.                                1056  15 May 2022 08:00          1
  184.                                1057  15 May 2022 09:00          1
  185.                                1058  15 May 2022 10:00          1
  186.                                1059  15 May 2022 11:00          1
  187.                                1060  15 May 2022 12:00          1
  188.                                1061  15 May 2022 13:00          1
  189.                                1062  15 May 2022 14:00          1
  190.                                1063  15 May 2022 15:00          1
  191.                                1064  15 May 2022 16:00          1
  192.                                1065  15 May 2022 17:00          1
  193.                                1066  15 May 2022 18:00          1
  194.                                1067  15 May 2022 19:00          1
  195.                                1068  15 May 2022 20:00          1
  196.                                1069  15 May 2022 21:00          1
  197.                                1070  15 May 2022 22:00          1
  198.                                1071  15 May 2022 23:00          1
  199.                                1072  16 May 2022 00:00          1
  200.                                1073  16 May 2022 01:00          1
  201.                                1074  16 May 2022 02:00          1
  202.                                1075  16 May 2022 03:00          1
  203.                                1076  16 May 2022 04:00          1
  204.                                1077  16 May 2022 05:00          1
  205.                                1078  16 May 2022 06:00          1
  206.                                1079  16 May 2022 07:00          1
  207.                                1080  16 May 2022 08:00          1
  208. Instance     DB Name          Snap Id        Snap Started        Snap Level
  209. ------------ ------------ ---------- ------------------ ----------

  210. rcat             RCAT               1081  16 May 2022 09:00          1
  211.                                1082  16 May 2022 10:00          1
  212.                                1083  16 May 2022 11:00          1
  213.                                1084  16 May 2022 12:00          1
  214.                                1085  16 May 2022 13:00          1
  215.                                1086  16 May 2022 14:00          1
  216.                                1087  16 May 2022 15:00          1
  217.                                1088  16 May 2022 16:00          1
  218.                                1089  16 May 2022 17:00          1
  219.                                1090  16 May 2022 18:00          1
  220.                                1091  16 May 2022 19:00          1
  221.                                1092  16 May 2022 20:00          1
  222.                                1093  16 May 2022 21:00          1
  223.                                1094  16 May 2022 22:00          1
  224.                                1095  16 May 2022 23:00          1
  225.                                1096  17 May 2022 00:00          1
  226.                                1097  17 May 2022 01:00          1
  227.                                1098  17 May 2022 02:00          1
  228.                                1099  17 May 2022 03:00          1
  229.                                1100  17 May 2022 04:00          1
  230.                                1101  17 May 2022 05:00          1
  231.                                1102  17 May 2022 06:00          1
  232.                                1103  17 May 2022 07:00          1
  233.                                1104  17 May 2022 08:00          1
  234.                                1105  17 May 2022 09:00          1
  235.                                1106  17 May 2022 10:00          1
  236.                                1107  17 May 2022 11:00          1


  237. Specify the Begin and End Snapshot Ids
  238. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  239. Enter value for begin_snap: 1106
  240. Begin Snapshot Id specified: 1106

  241. Enter value for end_snap: 1107
  242. End   Snapshot Id specified: 1107


  243. Specify the SQL Id
  244. ~~~~~~~~~~~~~~~~~~
  245. Enter value for sql_id: drktaf71uygnb
  246. SQL ID specified:  drktaf71uygnb

  247. Listing all available Container DB Ids for SQL Id drktaf71uygnb
  248.   Container DB Id Container Name
  249. ----------------- --------------
  250. *        868254545 rcat

  251. Using Container DB Id 868254545


  252. Specify the Report Name
  253. ~~~~~~~~~~~~~~~~~~~~~~~
  254. The default report file name is awrsqlrpt_1_1106_1107.html.  To use this name,
  255. press <return> to continue, otherwise enter an alternative.

  256. Enter value for report_name: /home/oracle/awrsqlrpt_1_1106_1107.html

  257. Using the report name /home/oracle/awrsqlrpt_1_1106_1107.html


  258. <html lang="en"><head><title>AWR SQL Report for DB: RCAT, Inst: rcat, Snaps: 1106-1107, SQL Id: drktaf71uygnb</title>
  259. <style type="text/css">
  260. body.awr {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black; background:White;}
  261. pre.awr  {font:8pt Courier;color:black; background:White;}
  262. pre_sqltext.awr  {white-space: pre-wrap;}
  263. h1.awr         {font:bold 20pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;border-bottom:1px solid #cccc99;margin-top:0pt; margin-bottom:0pt;padding:0px 0px 0px 0px;}
  264. h2.awr         {font:bold 18pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
  265. h3.awr {font:bold 16pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
  266. li.awr {font: 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;}
  267. th.awrnobg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;padding-left:4px; padding-right:4px;padding-bottom:2px}
  268. th.awrbg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:White; background:#0066CC;padding-left:4px; padding-right:4px;padding-bottom:2px}
  269. td.awrnc {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;}
  270. td.awrc    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;}
  271. td.awrnclb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;}
  272. td.awrncbb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;border-right: thin solid black;}
  273. td.awrncrb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-right: thin solid black;}
  274. td.awrcrb    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-right: thin solid black;}
  275. td.awrclb    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-left: thin solid black;}
  276. td.awrcbb    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-left: thin solid black;border-right: thin solid black;}
  277. a.awr {font:bold 8pt Arial,Helvetica,sans-serif;color:#663300; vertical-align:top;margin-top:0pt; margin-bottom:0pt;}
  278. td.awrnct {font:8pt Arial,Helvetica,Geneva,sans-serif;border-top: thin solid black;color:black;background:White;vertical-align:top;}
  279. td.awrct   {font:8pt Arial,Helvetica,Geneva,sans-serif;border-top: thin solid black;color:black;background:#FFFFCC; vertical-align:top;}
  280. td.awrnclbt  {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-top: thin solid black;border-left: thin solid black;}
  281. td.awrncbbt  {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;border-right: thin solid black;border-top: thin solid black;}
  282. td.awrncrbt {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-top: thin solid black;border-right: thin solid black;}
  283. td.awrcrbt     {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-top: thin solid black;border-right: thin solid black;}
  284. td.awrclbt     {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-top: thin solid black;border-left: thin solid black;}
  285. td.awrcbbt   {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-top: thin solid black;border-left: thin solid black;border-right: thin solid black;}
  286. table.tdiff {  border_collapse: collapse; }
  287. table.tscl {width: 600;}
  288. table.tscl tbody, table.tscl thead { display: block; }
  289. table.tscl thead tr th {height: 12px;line-height: 12px;}
  290. table.tscl tbody { height: 100px;overflow-y: auto; overflow-x: hidden;}
  291. table.tscl tbody td, thead th {width: 200;}
  292. .hidden   {position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;}
  293. .pad   {margin-left:17px;}
  294. .doublepad {margin-left:34px;}
  295. </style></head><body class="awr">
  296. <h1 class="awr">
  297. WORKLOAD REPOSITORY SQL Report

  298. </h1>
  299. <h2 class="awr">
  300. Snapshot Period Summary
  301. </h2>
  302. <p />
  303. <table border="1" width="500" summary="This table displays database instance information">
  304. <tr><th class="awrbg" scope="col">DB Name</th><th class="awrbg" scope="col">DB Id</th><th class="awrbg" scope="col">Instance</th><th class="awrbg" scope="col">Inst num</th><th class="awrbg" scope="col">Startup Time</th><th class="awrbg" scope="col">Release</th><th class="awrbg" scope="col">RAC</th></tr>
  305. <tr><td scope="row" class='awrnc'>RCAT</td><td align="right" class='awrnc'>868254545</td><td class='awrnc'>rcat</td><td align="right" class='awrnc'>1</td><td class='awrnc'>10-May-22 10:07</td><td class='awrnc'>19.0.0.0.0</td><td class='awrnc'>NO</td></tr>
  306. </table>
  307. <p />
  308. <table border="1" width="500" summary="This table displays snapshot information">
  309. <tr><th class="awrnobg" scope="col"></th><th class="awrbg" scope="col">Snap Id</th><th class="awrbg" scope="col">Snap Time</th><th class="awrbg" scope="col">Sessions</th><th class="awrbg" scope="col">Cursors/Session</th></tr>
  310. <tr><td scope="row" class='awrnc'>Begin Snap:</td><td align="right" class='awrnc'>1106</td><td align="center" class='awrnc'>17-May-22 10:00:03</td><td align="right" class='awrnc'>64</td><td align="right" class='awrnc'>        8.4</td></tr>
  311. <tr><td scope="row" class='awrc'>End Snap:</td><td align="right" class='awrc'>1107</td><td align="center" class='awrc'>17-May-22 11:00:14</td><td align="right" class='awrc'>64</td><td align="right" class='awrc'>         8.5</td></tr>
  312. <tr><td scope="row" class='awrnc'>Elapsed:</td><td class='awrnc'> </td><td align="center" class='awrnc'>                   60.18 (mins)</td><td class='awrnc'> </td><td class='awrnc'> </td></tr>
  313. <tr><td scope="row" class='awrc'>DB Time:</td><td class='awrc'> </td><td align="center" class='awrc'>                 0.00 (mins)</td><td class='awrc'> </td><td class='awrc'> </td></tr>
  314. </table>
  315. <p />
  316. <a class="awr" name="10652"></a>
  317. <h3 class="awr">SQL Summary</h3>
  318. <ul>
  319. </ul>
  320. <table border="1" summary="SQL Summary"><tr><th class="awrbg" scope="col">   SQL Id</th><th class="awrbg" scope="col">Elapsed  Time (ms)</th><th class="awrbg" scope="col">Module</th><th class="awrbg" scope="col">Action</th><th class="awrbg" scope="col">SQL Text</th><th class="awrbg" scope="col">Container DB Id</th></tr>
  321. <tr><td class='awrc'><a class="awr" href="#10651drktaf71uygnb">drktaf71uygnb</a></td><td align="right" class='awrc'>2,071</td>
  322. <td class='awrc'>
  323. </td>
  324. <td class='awrc'>
  325. </td>
  326. <td class='awrc'><a class="awr" href="#drktaf71uygnb">BEGIN sys.prvt_hdm.auto_execute( db_id => :bind_dbid, inst_id => :bind...</a></td><td align="right" class='awrc'>868254545</td></tr>
  327. </table><p />
  328. <br /><a class="awr" href="#top">Back to Top</a><p />
  329. <a class="awr" name="10651drktaf71uygnb"></a>
  330. <h3 class="awr">SQL ID: drktaf71uygnb (Container DB Id: 868254545)</h3>
  331. <ul>
  332. <li class="awr"> 1st Capture and Last Capture Snap IDs          refer to Snapshot IDs witin the snapshot range</li>
  333. <li class="awr"><a class="awr" href="#drktaf71uygnb">BEGIN sys.prvt_hdm.auto_execute( db_id => :bind_...</a></li>
  334. </ul>
  335. <table border="1" summary="SQL ID: drktaf71uygnb (Container DB Id: 868254545). . 1st Capture and Last Capture Snap IDs refer to Snapshot IDs witin the snapshot range"><tr><th class="awrbg" scope="col">#</th><th class="awrbg" scope="col">Plan Hash Value</th><th class="awrbg" scope="col">Total Elapsed Time(ms)</th><th class="awrbg" scope="col">Executions</th><th class="awrbg" scope="col">1st Capture Snap ID</th><th class="awrbg" scope="col">Last Capture Snap ID</th></tr>
  336. <tr><td class='awrc'><a class="awr" href="#303drktaf71uygnb0">1</a></td><td class='awrc'><a class="awr" href="#303drktaf71uygnb0">0</a></td><td align="right" class='awrc'>2,071</td><td align="right" class='awrc'>1</td><td align="right" class='awrc'>1107</td><td align="right" class='awrc'>1107</td></tr>
  337. </table><p />
  338. <br /><a class="awr" href="#top">Back to Top</a><p />
  339. <a class="awr" name="303drktaf71uygnb0"></a>
  340. <h2 class="awr">
  341. Plan 1(PHV: 0)
  342. </h2>
  343. <ul>
  344. <li class="awr"><a class="awr" href="#10653drktaf71uygnb0">Plan Statistics</a></li>
  345. <li class="awr"><a class="awr" href="#99996drktaf71uygnb0">Execution Plan</a></li>
  346. </ul>
  347. <a class="awr" href="#top">Back to Top</a>
  348. <a class="awr" name="10653drktaf71uygnb0"></a>
  349. <h3 class="awr">Plan Statistics</h3>
  350. <ul>
  351. <li class="awr"> % Snap Total shows the % of the statistic for the SQL statement compared to the instance total</li>
  352. </ul>
  353. <table border="1" summary="Plan Statistics. . % Snap Total shows the % of the statistic for the SQL statement compared to the instance total"><tr><th class="awrbg" scope="col">Stat Name</th><th class="awrbg" scope="col">Statement Total</th><th class="awrbg" scope="col">Per Execution</th><th class="awrbg" scope="col">% Snap Total</th></tr>
  354. <tr><td class='awrc'>Elapsed Time (ms)</td><td align="right" class='awrc'>2,071</td><td align="right" class='awrc'>2,070.78</td><td align="right" class='awrc'>10195.85</td></tr>
  355. <tr><td class='awrnc'>CPU Time (ms)</td><td align="right" class='awrnc'>859</td><td align="right" class='awrnc'>858.97</td><td align="right" class='awrnc'>4223.70</td></tr>
  356. <tr><td class='awrc'>Executions</td><td align="right" class='awrc'>1</td><td align="right" class='awrc'>1.00</td><td align="right" class='awrc'>0.01</td></tr>
  357. <tr><td class='awrnc'>Buffer Gets</td><td align="right" class='awrnc'>9,771</td><td align="right" class='awrnc'>9,771.00</td><td align="right" class='awrnc'>3.58</td></tr>
  358. <tr><td class='awrc'>Disk Reads</td><td align="right" class='awrc'>1,626</td><td align="right" class='awrc'>1,626.00</td><td align="right" class='awrc'>14.49</td></tr>
  359. <tr><td class='awrnc'>Parse Calls</td><td align="right" class='awrnc'>1</td><td align="right" class='awrnc'>1.00</td><td align="right" class='awrnc'>0.01</td></tr>
  360. <tr><td class='awrc'>Rows</td><td align="right" class='awrc'>1</td><td align="right" class='awrc'>1.00</td><td align="right" class='awrc'> </td></tr>
  361. <tr><td class='awrnc'>User I/O Wait Time (ms)</td><td align="right" class='awrnc'>993</td><td align="right" class='awrnc'>992.68</td><td align="right" class='awrnc'>24.72</td></tr>
  362. <tr><td class='awrc'>Cluster Wait Time (ms)</td><td align="right" class='awrc'>0</td><td align="right" class='awrc'>0.00</td><td align="right" class='awrc'>0.00</td></tr>
  363. <tr><td class='awrnc'>Application Wait Time (ms)</td><td align="right" class='awrnc'>0</td><td align="right" class='awrnc'>0.00</td><td align="right" class='awrnc'>0.00</td></tr>
  364. <tr><td class='awrc'>Concurrency Wait Time (ms)</td><td align="right" class='awrc'>0</td><td align="right" class='awrc'>0.00</td><td align="right" class='awrc'>0.00</td></tr>
  365. <tr><td class='awrnc'>Invalidations</td><td align="right" class='awrnc'>0</td><td align="right" class='awrnc'> </td><td align="right" class='awrnc'> </td></tr>
  366. <tr><td class='awrc'>Version Count</td><td align="right" class='awrc'>1</td><td align="right" class='awrc'> </td><td align="right" class='awrc'> </td></tr>
  367. <tr><td class='awrnc'>Sharable Mem(KB)</td><td align="right" class='awrnc'>21</td><td align="right" class='awrnc'> </td><td align="right" class='awrnc'> </td></tr>
  368. </table><p />
  369. <a class="awr" href="#303drktaf71uygnb0">Back to Plan 1(PHV: 0)</a>
  370. <br /><a class="awr" href="#top">Back to Top</a><p />
  371. <a class="awr" name="99996drktaf71uygnb0"></a>
  372. <h3 class="awr">
  373. Execution Plan
  374. </h3>
  375. <p />
  376.                   No data exists for this section of the report.
  377. <p />
  378. <br />
  379. <a class="awr" href="#303drktaf71uygnb0">Back to Plan 1(PHV: 0)</a>
  380. <br /><a class="awr" href="#top">Back to Top</a><p />
  381. <a class="awr" name="99997"></a>
  382. <p />
  383. <h3 class="awr">Full SQL Text</h3><p />
  384. <table border="1" summary="This table displays the text of the SQL statements which have been
  385.       referred to in the report">
  386. <tr><th class="awrbg" scope="col">SQL Id</th><th class="awrbg" scope="col">SQL Text</th></tr>
  387. <tr><td scope="row" class='awrc'><a class="awr" name="drktaf71uygnb"></a>drktaf71uygnb</td><td class='awrc'><pre_sqltext class="awr">BEGIN
  388.           sys.prvt_hdm.auto_execute(
  389.             db_id => :bind_dbid,
  390.             inst_id => :bind_inst,
  391.             end_snap => :bind_snap,
  392.             time_left_in_secs => :bind_time);
  393.         END;</pre_sqltext></td></tr>
  394. </table>
  395. <p />
  396. <br /><a class="awr" href="#top">Back to Top</a><p />
  397. </body></html>
  398. Report written to /home/oracle/awrsqlrpt_1_1106_1107.html
  399. SQL>
复制代码

4. 查看AWRSQL报告:

WORKLOAD REPOSITORY SQL ReportSnapshot Period Summary
DB NameDB IdInstanceInst numStartup TimeReleaseRAC
RCAT
868254545
rcat
1
10-May-22 10:0719.0.0.0.0NO


Snap IdSnap TimeSessionsCursors/Session
Begin Snap:
1106
17-May-22 10:00:03
64
8.4
End Snap:
1107
17-May-22 11:00:14
64
8.5
Elapsed:
60.18 (mins)
DB Time:
0.00 (mins)

SQL Summary
   SQL IdElapsed  Time (ms)ModuleActionSQL TextContainer DB Id
[url=]drktaf71uygnb[/url]
2,071
[url=]BEGIN sys.prvt_hdm.auto_execute( db_id => :bind_dbid, inst_id => :bind...[/url]
868254545

[url=]Back to Top[/url]

SQL ID: drktaf71uygnb (Container DB Id: 868254545)
  • 1st Capture and Last Capture Snap IDs    refer to Snapshot IDs witin the snapshot range
  • [url=]BEGIN sys.prvt_hdm.auto_execute( db_id => :bind_...[/url]
#Plan Hash ValueTotal Elapsed Time(ms)Executions1st Capture Snap IDLast Capture Snap ID
[url=]1[/url][url=]0[/url]
2,071
1
1107
1107

[url=]Back to Top[/url]

Plan 1(PHV: 0)
  • [url=]Plan Statistics[/url]
  • [url=]Execution Plan[/url]
[url=]Back to Top[/url]Plan Statistics
  • % Snap Total shows the % of the statistic for the SQL statement compared to the instance total
Stat NameStatement TotalPer Execution% Snap Total
Elapsed Time (ms)
2,071
2,070.78
10195.85
CPU Time (ms)
859
858.97
4223.70
Executions
1
1.00
0.01
Buffer Gets
9,771
9,771.00
3.58
Disk Reads
1,626
1,626.00
14.49
Parse Calls
1
1.00
0.01
Rows
1
1.00


User I/O Wait Time (ms)
993
992.68
24.72
Cluster Wait Time (ms)
0
0.00
0.00
Application Wait Time (ms)
0
0.00
0.00
Concurrency Wait Time (ms)
0
0.00
0.00
Invalidations
0



Version Count
1



Sharable Mem(KB)
21



[url=]Back to Plan 1(PHV: 0)[/url]
[url=]Back to Top[/url]

Execution Plan                  No data exists for this section of the report.

[url=]Back to Plan 1(PHV: 0)[/url]
[url=]Back to Top[/url]


Full SQL Text
SQL IdSQL Text
drktaf71uygnbBEGIN          sys.prvt_hdm.auto_execute(            db_id => :bind_dbid,            inst_id => :bind_inst,            end_snap => :bind_snap,            time_left_in_secs => :bind_time);        END;

[url=]Back to Top[/url]

5. v$active_session_history
每间隔1秒收集会话信息,对我们调优特别有帮助。该视图记录SQL_ID。
  1. select  distinct session_state from v$active_session_history;
复制代码
ON CPU
WAITING
我们只需要研究处于WAITING状态下的会话,并做了TOP-N分析。
  1. <blockquote>select * from (select    event, sql_id, user_id , count(*) CNT   from v$active_session_history s
复制代码
1        control file parallel write                0        263
2        log file sync                0        34
3        db file async I/O submit                0        31
4        latch free                0        21
5        log file parallel write                0        19
6        control file sequential read                0        10
7        LGWR any worker group                0        6
8        oracle thread bootstrap                0        3
9        os thread creation                0        2
10        latch free        f3yfg50ga0r8n        0        2
  1. select a.event, a.sql_id, dbms_lob.substr(s.sql_fulltext,200,1) sqlf, user_id,cnt
  2. from
  3. (select * from
  4. (select event, sql_id, user_id, count(*) cnt
  5.    from v$active_session_history s
  6.    where sample_time > sysdate - 1 and session_state='WAITING'
  7.    group by event, sql_id, user_id  
  8.    order by cnt desc) where rownum <=10
  9. ) a, v$sqlarea s
  10. where a.sql_id =s.sql_id (+);
复制代码







回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-27 16:07 , Processed in 0.042090 second(s), 24 queries .

快速回复 返回顶部 返回列表