|
1. 首先获取AWR报告:
- [oracle@cvcdds198 ~]$ cd /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/
- [oracle@cvcdds198 admin]$ sqlplus /nolog
- SQL*Plus: Release 19.0.0.0.0 - Production on Tue May 17 11:09:38 2022
- Version 19.3.0.0.0
- Copyright (c) 1982, 2019, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> @awrrpt
- 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: active-html
- old 1: select 'Type Specified: ',lower(nvl('&&report_type','html')) report_type from dual
- new 1: select 'Type Specified: ',lower(nvl('active-html','html')) report_type from dual
- Type Specified: active-html
- old 1: select '&&report_type' report_type_def from dual
- new 1: select 'active-html' report_type_def from dual
- old 1: select '&&view_loc' view_loc_def from dual
- new 1: select 'AWR_PDB' view_loc_def from dual
- Current Instance
- ~~~~~~~~~~~~~~~~
- DB Id DB Name Inst Num Instance Container Name
- -------------- -------------- -------------- -------------- --------------
- 868254545 RCAT 1 rcat rcat
- <font color="Red">......</font>
- ui0pdUguneHq/gKAALzj
- <report db_version="19.0.0.0.0" cpu_cores="8" hyperthread="N" timezone_offset="28800" packs="2" encode="base64" compress="zlib">
- <report_id><![CDATA[/orarep/addm/main%3fname%3dADDM%3a868254545_1_1107%26owner%3dSYS]]></report_id>
- eAGNVEtP4zAQvvMrRj6vmjiUp5JKUVu0aKFoaffAXio3cVJDYofYBfrvGTuPFra7
- i5JDHI9n5nuMw5IJOToCCCtWs1LbT1yoWuRCsgLUq+R1ROYPcwKG6aelZCWPSDyZ
- 3F6en54HJ0N8lnRJqX9GvPZ0qVKRCZ5+OK3X6nWpn4uIXMU38+kX0oHmiRFKRmQR
- z38QSNlWR4QS0JUyNa8i4jffhdDGLlz90NshCVNumCjAbKu26a+UdThFGpGhPzxp
- D4gUSzdrJpcvlhN6MfCbhwD+a2pcz+aLeDaeko4KbADSlc3W04VIVn9k0JJVFJNS
- /xRB4SJwizOsL0qOO/6JR8+8wA8CoP6lj+9xs4eB+3vU7tEhFtnUrKHv+JQiazV/
- jkjfX6eVBduqjrobrNYD/5fUCAEpD/xj2tKOh729XKGQ2jCZ8F1uATY1NvKJ36ZM
- nTBDYK2skslLkqaaXpwP3uQgexwkEikxzGxQg3gW3zz8nk56s3mfKoWZkKmQ+a5w
- tg8qa5tAkzj/NNWlqktWfAO9SbBlnW0KSFRZFdwSiB07/1zPru7ub+PF9d3MSugs
- B5ko8GPW6u2Gp9T5aLHmNYdXpkEq0CKXOBAJkwZNbNiKaQ4Mvf0izBaMgnojwaw5
- 2LEahJ5N4ObQpRMyU61aluSsdZb3EWdY82QH2TZcsmovS+nYx4HBbn/JJ4mDDfcc
- QZZcYk8IExZ4qKO1AdIrhrxXVYEIXGCMN8NWC30gOHAFJh3IsZKZyFsjHgi3Fo7I
- d1Qd/heKjsbQ+c8bWGwk6nsgmx1WDOE5YjJ/D8MBs2HJGimC8ZrJnB+CYkcvItM3
- VgrJoXOZ02hXG02/T3Xo7WQIrcJK6m7SmmlkBe9+qNUjXnD9vnUSr/slXpVLw9/a
- /dBrrrLREdrDXdnvSkyWPQ==
- </report>
- <report db_version="19.0.0.0.0" cpu_cores="8" hyperthread="N" timezone_offset="28800" packs="2" encode="base64" compress="zlib">
- <report_id><![CDATA[/orarep/addm/main%3fname%3dADDM%3a868254545_1_1106%26owner%3dSYS]]></report_id>
- eAGNVE1P4zAQvfMrRj6vmqS0QFGCFNGiRQtFS7sH9lK5iZMaknGIXaD/nnE+C9vd
- RbnY8XjevPdm7Odc4sURgF/wkufaLmmjSplK5BmoVxRlwBYPCwaG66cV8lwELJxO
- b8/PTs6G4xF9K2/lee4Jc5rbuYplIkX84bbeqNeVfs4CdhXeLGZfSAdaREYqDNgy
- XPxgEPOdDpjHQBfKlKIImFuvM6mN3VT4vtMz8WNhuMzA7Iqm6K/AVjxlHLCROxo1
- F2RM0PWe4+rFauJNBm79MaB/Ncb1fLEM55cz1kpBBUC8ttk6uYjJ+o8MGnnhUVLP
- HRMp2gyrzQnhy1zQiTt2vFNn6A6H4E7OXfd8PKzPKHDvzHPtmXtMINuS1/Idj8ek
- WimeA9bV13plyTauk++G0Dri/7KaKJDkHmWejDrfnb1kvkRtOEaiTy7B5qZKPglc
- 45QRNww2yloZvURxrL3J2eANB8njIELSxHCzJRPCeXjz8Hs27VE/IfmJxFhi2gMn
- +6ySpgjqkqqBanRUZc6zb6C3EZWsk20GkcqLTFgFqeKqga7nV3f3t+Hy+m5uPax6
- DhKZ0WLeGF5NT67Ti+VGlAJeuQZUoGWKNBERR0NdbPiaawGcmvtFmh0YBeUWwWwE
- 2Lka+I5NUA1ilU5iohq7yCInaVrL+cjTL0XUU7YF57zYy5JX6tPEULW/8AlpsuFe
- EMlcINVENGFJl1pZayKdY6R7UWTEoAoM6WnYaakPBNumDNi0JXmpMJFp04kHwqlP
- Kfw7uQ7/C7WjSC/RzxtYbpH8PZCNRseGiJQ4mb+H2aGisGhDEsHlhmMqDlE5rcJm
- bzyXKKDtssqjHtt3PkjtO70NvnVYoW5HrR5Hnon2h1o/0gvXndtOEmW3pbdyZcRb
- c+479Vt2cUTtUb3Z79lfloM=
- </report>
- </report>
- </report>
- <!--FXTMODEL-->
- </script>
- </body>
- </div>
- End of Report
- </body></html>
- 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 Id | SQL Module | SQL 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 | adzjh275fvvx4 | DBMS_SCHEDULER | call 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
- [oracle@cvcdds198 admin]$ sqlplus /nolog
- SQL*Plus: Release 19.0.0.0.0 - Production on Tue May 17 11:05:45 2022
- Version 19.3.0.0.0
- Copyright (c) 1982, 2019, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> @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:
- Type Specified: html
- Current Instance
- ~~~~~~~~~~~~~~~~
- DB Id DB Name Inst Num Instance
- ----------- ------------ -------- ------------
- 868254545 RCAT 1 rcat
- Instances in this Workload Repository schema
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- DB Id Inst Num DB Name Instance Host
- ------------ ---------- --------- ---------- ------
- * 868254545 1 RCAT rcat cvcdds198.xn
- Using 868254545 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 <return> without
- specifying a number lists all completed snapshots.
- Enter value for num_days:
- Listing all Completed Snapshots
- Instance DB Name Snap Id Snap Started Snap Level
- ------------ ------------ ---------- ------------------ ----------
- rcat RCAT 913 09 May 2022 09:00 1
- 914 09 May 2022 10:00 1
- 915 09 May 2022 11:00 1
- 916 09 May 2022 12:00 1
- 917 09 May 2022 13:00 1
- 918 09 May 2022 14:00 1
- 919 09 May 2022 15:00 1
- 920 09 May 2022 16:00 1
- 921 09 May 2022 17:00 1
- 922 09 May 2022 18:00 1
- 923 09 May 2022 19:00 1
- 924 09 May 2022 20:00 1
- 925 09 May 2022 21:00 1
- 926 09 May 2022 22:00 1
- 927 09 May 2022 23:00 1
- 928 10 May 2022 00:00 1
- 929 10 May 2022 01:00 1
- 930 10 May 2022 02:00 1
- 931 10 May 2022 03:00 1
- 932 10 May 2022 04:00 1
- 933 10 May 2022 05:00 1
- 934 10 May 2022 06:00 1
- 935 10 May 2022 07:00 1
- 936 10 May 2022 08:00 1
- 937 10 May 2022 09:00 1
- 938 10 May 2022 10:18 1
- 939 10 May 2022 11:00 1
- 940 10 May 2022 12:00 1
- 941 10 May 2022 13:00 1
- 942 10 May 2022 14:00 1
- 943 10 May 2022 15:00 1
- 944 10 May 2022 16:00 1
- 945 10 May 2022 17:00 1
- 946 10 May 2022 18:00 1
- 947 10 May 2022 19:00 1
- 948 10 May 2022 20:00 1
- 949 10 May 2022 21:00 1
- 950 10 May 2022 22:00 1
- 951 10 May 2022 23:00 1
- 952 11 May 2022 00:00 1
- 953 11 May 2022 01:00 1
- 954 11 May 2022 02:00 1
- 955 11 May 2022 03:00 1
- 956 11 May 2022 04:00 1
- 957 11 May 2022 05:00 1
- 958 11 May 2022 06:00 1
- 959 11 May 2022 07:00 1
- 960 11 May 2022 08:00 1
- 961 11 May 2022 09:00 1
- 962 11 May 2022 10:00 1
- 963 11 May 2022 11:00 1
- 964 11 May 2022 12:00 1
- 965 11 May 2022 13:00 1
- 966 11 May 2022 14:00 1
- 967 11 May 2022 15:00 1
- 968 11 May 2022 16:00 1
- Instance DB Name Snap Id Snap Started Snap Level
- ------------ ------------ ---------- ------------------ ----------
- rcat RCAT 969 11 May 2022 17:00 1
- 970 11 May 2022 18:00 1
- 971 11 May 2022 19:00 1
- 972 11 May 2022 20:00 1
- 973 11 May 2022 21:00 1
- 974 11 May 2022 22:00 1
- 975 11 May 2022 23:00 1
- 976 12 May 2022 00:00 1
- 977 12 May 2022 01:00 1
- 978 12 May 2022 02:00 1
- 979 12 May 2022 03:00 1
- 980 12 May 2022 04:00 1
- 981 12 May 2022 05:00 1
- 982 12 May 2022 06:00 1
- 983 12 May 2022 07:00 1
- 984 12 May 2022 08:00 1
- 985 12 May 2022 09:00 1
- 986 12 May 2022 10:00 1
- 987 12 May 2022 11:00 1
- 988 12 May 2022 12:00 1
- 989 12 May 2022 13:00 1
- 990 12 May 2022 14:00 1
- 991 12 May 2022 15:00 1
- 992 12 May 2022 16:00 1
- 993 12 May 2022 17:00 1
- 994 12 May 2022 18:00 1
- 995 12 May 2022 19:00 1
- 996 12 May 2022 20:00 1
- 997 12 May 2022 21:00 1
- 998 12 May 2022 22:00 1
- 999 12 May 2022 23:00 1
- 1000 13 May 2022 00:00 1
- 1001 13 May 2022 01:00 1
- 1002 13 May 2022 02:00 1
- 1003 13 May 2022 03:00 1
- 1004 13 May 2022 04:00 1
- 1005 13 May 2022 05:00 1
- 1006 13 May 2022 06:00 1
- 1007 13 May 2022 07:00 1
- 1008 13 May 2022 08:00 1
- 1009 13 May 2022 09:00 1
- 1010 13 May 2022 10:00 1
- 1011 13 May 2022 11:00 1
- 1012 13 May 2022 12:00 1
- 1013 13 May 2022 13:00 1
- 1014 13 May 2022 14:00 1
- 1015 13 May 2022 15:00 1
- 1016 13 May 2022 16:00 1
- 1017 13 May 2022 17:00 1
- 1018 13 May 2022 18:00 1
- 1019 13 May 2022 19:00 1
- 1020 13 May 2022 20:00 1
- 1021 13 May 2022 21:00 1
- 1022 13 May 2022 22:00 1
- 1023 13 May 2022 23:00 1
- 1024 14 May 2022 00:00 1
- Instance DB Name Snap Id Snap Started Snap Level
- ------------ ------------ ---------- ------------------ ----------
- rcat RCAT 1025 14 May 2022 01:00 1
- 1026 14 May 2022 02:00 1
- 1027 14 May 2022 03:00 1
- 1028 14 May 2022 04:00 1
- 1029 14 May 2022 05:00 1
- 1030 14 May 2022 06:00 1
- 1031 14 May 2022 07:00 1
- 1032 14 May 2022 08:00 1
- 1033 14 May 2022 09:00 1
- 1034 14 May 2022 10:00 1
- 1035 14 May 2022 11:00 1
- 1036 14 May 2022 12:00 1
- 1037 14 May 2022 13:00 1
- 1038 14 May 2022 14:00 1
- 1039 14 May 2022 15:00 1
- 1040 14 May 2022 16:00 1
- 1041 14 May 2022 17:00 1
- 1042 14 May 2022 18:00 1
- 1043 14 May 2022 19:00 1
- 1044 14 May 2022 20:00 1
- 1045 14 May 2022 21:00 1
- 1046 14 May 2022 22:00 1
- 1047 14 May 2022 23:00 1
- 1048 15 May 2022 00:00 1
- 1049 15 May 2022 01:00 1
- 1050 15 May 2022 02:00 1
- 1051 15 May 2022 03:00 1
- 1052 15 May 2022 04:00 1
- 1053 15 May 2022 05:00 1
- 1054 15 May 2022 06:00 1
- 1055 15 May 2022 07:00 1
- 1056 15 May 2022 08:00 1
- 1057 15 May 2022 09:00 1
- 1058 15 May 2022 10:00 1
- 1059 15 May 2022 11:00 1
- 1060 15 May 2022 12:00 1
- 1061 15 May 2022 13:00 1
- 1062 15 May 2022 14:00 1
- 1063 15 May 2022 15:00 1
- 1064 15 May 2022 16:00 1
- 1065 15 May 2022 17:00 1
- 1066 15 May 2022 18:00 1
- 1067 15 May 2022 19:00 1
- 1068 15 May 2022 20:00 1
- 1069 15 May 2022 21:00 1
- 1070 15 May 2022 22:00 1
- 1071 15 May 2022 23:00 1
- 1072 16 May 2022 00:00 1
- 1073 16 May 2022 01:00 1
- 1074 16 May 2022 02:00 1
- 1075 16 May 2022 03:00 1
- 1076 16 May 2022 04:00 1
- 1077 16 May 2022 05:00 1
- 1078 16 May 2022 06:00 1
- 1079 16 May 2022 07:00 1
- 1080 16 May 2022 08:00 1
- Instance DB Name Snap Id Snap Started Snap Level
- ------------ ------------ ---------- ------------------ ----------
- rcat RCAT 1081 16 May 2022 09:00 1
- 1082 16 May 2022 10:00 1
- 1083 16 May 2022 11:00 1
- 1084 16 May 2022 12:00 1
- 1085 16 May 2022 13:00 1
- 1086 16 May 2022 14:00 1
- 1087 16 May 2022 15:00 1
- 1088 16 May 2022 16:00 1
- 1089 16 May 2022 17:00 1
- 1090 16 May 2022 18:00 1
- 1091 16 May 2022 19:00 1
- 1092 16 May 2022 20:00 1
- 1093 16 May 2022 21:00 1
- 1094 16 May 2022 22:00 1
- 1095 16 May 2022 23:00 1
- 1096 17 May 2022 00:00 1
- 1097 17 May 2022 01:00 1
- 1098 17 May 2022 02:00 1
- 1099 17 May 2022 03:00 1
- 1100 17 May 2022 04:00 1
- 1101 17 May 2022 05:00 1
- 1102 17 May 2022 06:00 1
- 1103 17 May 2022 07:00 1
- 1104 17 May 2022 08:00 1
- 1105 17 May 2022 09:00 1
- 1106 17 May 2022 10:00 1
- 1107 17 May 2022 11:00 1
- Specify the Begin and End Snapshot Ids
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Enter value for begin_snap: 1106
- Begin Snapshot Id specified: 1106
- Enter value for end_snap: 1107
- End Snapshot Id specified: 1107
- Specify the SQL Id
- ~~~~~~~~~~~~~~~~~~
- Enter value for sql_id: drktaf71uygnb
- SQL ID specified: drktaf71uygnb
- Listing all available Container DB Ids for SQL Id drktaf71uygnb
- Container DB Id Container Name
- ----------------- --------------
- * 868254545 rcat
- Using Container DB Id 868254545
- Specify the Report Name
- ~~~~~~~~~~~~~~~~~~~~~~~
- The default report file name is awrsqlrpt_1_1106_1107.html. To use this name,
- press <return> to continue, otherwise enter an alternative.
- Enter value for report_name: /home/oracle/awrsqlrpt_1_1106_1107.html
- Using the report name /home/oracle/awrsqlrpt_1_1106_1107.html
- <html lang="en"><head><title>AWR SQL Report for DB: RCAT, Inst: rcat, Snaps: 1106-1107, SQL Id: drktaf71uygnb</title>
- <style type="text/css">
- body.awr {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black; background:White;}
- pre.awr {font:8pt Courier;color:black; background:White;}
- pre_sqltext.awr {white-space: pre-wrap;}
- 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;}
- h2.awr {font:bold 18pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
- h3.awr {font:bold 16pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
- li.awr {font: 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;}
- th.awrnobg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;padding-left:4px; padding-right:4px;padding-bottom:2px}
- th.awrbg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:White; background:#0066CC;padding-left:4px; padding-right:4px;padding-bottom:2px}
- td.awrnc {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;}
- td.awrc {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;}
- td.awrnclb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;}
- 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;}
- td.awrncrb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-right: thin solid black;}
- td.awrcrb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-right: thin solid black;}
- td.awrclb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-left: thin solid black;}
- 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;}
- a.awr {font:bold 8pt Arial,Helvetica,sans-serif;color:#663300; vertical-align:top;margin-top:0pt; margin-bottom:0pt;}
- td.awrnct {font:8pt Arial,Helvetica,Geneva,sans-serif;border-top: thin solid black;color:black;background:White;vertical-align:top;}
- td.awrct {font:8pt Arial,Helvetica,Geneva,sans-serif;border-top: thin solid black;color:black;background:#FFFFCC; vertical-align:top;}
- 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;}
- 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;}
- 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;}
- 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;}
- 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;}
- 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;}
- table.tdiff { border_collapse: collapse; }
- table.tscl {width: 600;}
- table.tscl tbody, table.tscl thead { display: block; }
- table.tscl thead tr th {height: 12px;line-height: 12px;}
- table.tscl tbody { height: 100px;overflow-y: auto; overflow-x: hidden;}
- table.tscl tbody td, thead th {width: 200;}
- .hidden {position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;}
- .pad {margin-left:17px;}
- .doublepad {margin-left:34px;}
- </style></head><body class="awr">
- <h1 class="awr">
- WORKLOAD REPOSITORY SQL Report
- </h1>
- <h2 class="awr">
- Snapshot Period Summary
- </h2>
- <p />
- <table border="1" width="500" summary="This table displays database instance information">
- <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>
- <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>
- </table>
- <p />
- <table border="1" width="500" summary="This table displays snapshot information">
- <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>
- <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>
- <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>
- <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>
- <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>
- </table>
- <p />
- <a class="awr" name="10652"></a>
- <h3 class="awr">SQL Summary</h3>
- <ul>
- </ul>
- <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>
- <tr><td class='awrc'><a class="awr" href="#10651drktaf71uygnb">drktaf71uygnb</a></td><td align="right" class='awrc'>2,071</td>
- <td class='awrc'>
- </td>
- <td class='awrc'>
- </td>
- <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>
- </table><p />
- <br /><a class="awr" href="#top">Back to Top</a><p />
- <a class="awr" name="10651drktaf71uygnb"></a>
- <h3 class="awr">SQL ID: drktaf71uygnb (Container DB Id: 868254545)</h3>
- <ul>
- <li class="awr"> 1st Capture and Last Capture Snap IDs refer to Snapshot IDs witin the snapshot range</li>
- <li class="awr"><a class="awr" href="#drktaf71uygnb">BEGIN sys.prvt_hdm.auto_execute( db_id => :bind_...</a></li>
- </ul>
- <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>
- <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>
- </table><p />
- <br /><a class="awr" href="#top">Back to Top</a><p />
- <a class="awr" name="303drktaf71uygnb0"></a>
- <h2 class="awr">
- Plan 1(PHV: 0)
- </h2>
- <ul>
- <li class="awr"><a class="awr" href="#10653drktaf71uygnb0">Plan Statistics</a></li>
- <li class="awr"><a class="awr" href="#99996drktaf71uygnb0">Execution Plan</a></li>
- </ul>
- <a class="awr" href="#top">Back to Top</a>
- <a class="awr" name="10653drktaf71uygnb0"></a>
- <h3 class="awr">Plan Statistics</h3>
- <ul>
- <li class="awr"> % Snap Total shows the % of the statistic for the SQL statement compared to the instance total</li>
- </ul>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- </table><p />
- <a class="awr" href="#303drktaf71uygnb0">Back to Plan 1(PHV: 0)</a>
- <br /><a class="awr" href="#top">Back to Top</a><p />
- <a class="awr" name="99996drktaf71uygnb0"></a>
- <h3 class="awr">
- Execution Plan
- </h3>
- <p />
- No data exists for this section of the report.
- <p />
- <br />
- <a class="awr" href="#303drktaf71uygnb0">Back to Plan 1(PHV: 0)</a>
- <br /><a class="awr" href="#top">Back to Top</a><p />
- <a class="awr" name="99997"></a>
- <p />
- <h3 class="awr">Full SQL Text</h3><p />
- <table border="1" summary="This table displays the text of the SQL statements which have been
- referred to in the report">
- <tr><th class="awrbg" scope="col">SQL Id</th><th class="awrbg" scope="col">SQL Text</th></tr>
- <tr><td scope="row" class='awrc'><a class="awr" name="drktaf71uygnb"></a>drktaf71uygnb</td><td class='awrc'><pre_sqltext class="awr">BEGIN
- sys.prvt_hdm.auto_execute(
- db_id => :bind_dbid,
- inst_id => :bind_inst,
- end_snap => :bind_snap,
- time_left_in_secs => :bind_time);
- END;</pre_sqltext></td></tr>
- </table>
- <p />
- <br /><a class="awr" href="#top">Back to Top</a><p />
- </body></html>
- Report written to /home/oracle/awrsqlrpt_1_1106_1107.html
- SQL>
复制代码
4. 查看AWRSQL报告:
WORKLOAD REPOSITORY SQL ReportSnapshot Period Summary
DB Name | DB Id | Instance | Inst num | Startup Time | Release | RAC | RCAT | 868254545 | rcat | 1 | 10-May-22 10:07 | 19.0.0.0.0 | NO |
| Snap Id | Snap Time | Sessions | Cursors/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 Id | Elapsed Time (ms) | Module | Action | SQL Text | Container 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 Value | Total Elapsed Time(ms) | Executions | 1st Capture Snap ID | Last 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 Name | Statement Total | Per 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 Id | SQL Text | drktaf71uygnb | BEGIN 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。
- select distinct session_state from v$active_session_history;
复制代码 ON CPU
WAITING
我们只需要研究处于WAITING状态下的会话,并做了TOP-N分析。
- <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
- select a.event, a.sql_id, dbms_lob.substr(s.sql_fulltext,200,1) sqlf, user_id,cnt
- from
- (select * from
- (select event, sql_id, user_id, count(*) cnt
- from v$active_session_history s
- where sample_time > sysdate - 1 and session_state='WAITING'
- group by event, sql_id, user_id
- order by cnt desc) where rownum <=10
- ) a, v$sqlarea s
- where a.sql_id =s.sql_id (+);
复制代码
|
|