PROACTIVE MONITORING IS BETTER THAN REACTIVE BOTTLENECK ELIMINATION OF PERFORMANCE AFTER AN UPGRADE
To proactively achieve something, benchmark analysis is needed to prevent upcoming issues.
It is expected that after every upgrade, there arise a performance issue due to major changes in the optimizer behavior and other value added features. Hence, application team often complaint about the regression of sql after upgrade rather than the benefits that are achieved.
Upgrading database should improve overall performance of the database and some sql work faster and some may get slower.
Firstly, install OSwatcher report to monitor and capture the preupgrade behavior of the OS layer to have OS baseline for the oracle database.
[oracle@hydrupgrd ~]$ tar -xvf oswbb840.tar >/dev/null 2>&1
Take a note of initial connections and active session counts.
SQL> select count(*) from v$session;
COUNT(*)
----------
141
SQL> select count(*) from v$session where username='C##HYDRA';
COUNT(*)
----------
102
SQL> select count(*) from dba_hist_active_sess_history;
COUNT(*)
----------
1269
SQL> select count(*) from dba_hist_snapshot;
COUNT(*)
----------
17
Initialize the application workload in the database or if it is production, then leave the database as it is for business operations.


[oracle@hydrupgrd bin]$ ./oewizard

After the workload is initiated or if running 24/7 in production system, then capture the OS reports using OSwatcher.
[oracle@hydrupgrd oswbb]$ ./startOSWbb.sh
[oracle@hydrupgrd oswbb]$
Info...You did not enter a value for snapshotInterval.
Info...Using default value = 30
Info...You did not enter a value for archiveInterval.
Info...Using default value = 48
Setting the archive log directory to/home/oracle/oswbb/archive
Testing for discovery of OS Utilities...
VMSTAT found on your system.
IOSTAT found on your system.
[oracle@hydrupgrd oswbb]$ MPSTAT found on your system.
IP found on your system.
TOP found on your system.
Warning... /proc/slabinfo not found on your system. Check to see if this user has permission to access this file.
PIDSTAT found on your system.
NFSIOSTAT found on your system.
Warning... TRACEROUTE not found on your system. No TRACEROUTE data will be collected.
Discovery of CPU CORE COUNT
CPU CORE COUNT will be used by oswbba to automatically look for cpu problems
CPU CORE COUNT = 4
VCPUS/THREADS = 4
Discovery completed.
Starting OSWatcher v8.4.0 on Wed Oct 11 06:58:01 IST 2023
With SnapshotInterval = 30
With ArchiveInterval = 48
OSWatcher - Written by Carl Davis, Center of Expertise,
Oracle Corporation
For questions on install/usage please go to MOS (Note:301137.1)
Data is stored in directory: /home/oracle/oswbb/archive
Starting Data Collection...
oswbb heartbeat:Wed Oct 11 06:58:06 IST 2023
If auto baseline is enabled, then all the plans of sql query are captured during the execution in the database. Hence, enable the capture auto baseline parameter and these baselines are very important after upgrade to tune the sql with benchmark performance. Check the available baselines in the database.
SQL> show parameter sql_plan
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL> alter system set optimizer_capture_sql_plan_baselines=TRUE scope=both;
System altered.
SQL> SELECT count(*) from dba_sql_plan_baselines;
COUNT(*)
----------
152
Collect SQL Performance Statistics using STS CAPTURE:
Pack all the baselines from the 12c database as a backup so that it will be useful in future.
SQL> EXEC dbms_sqltune.create_sqlset(sqlset_name => 'B4UPGDLOAD', description => 'SQL performance statistics backup before upgrade');
PL/SQL procedure successfully completed.
SQL> SELECT name,statement_count as total_sql, description from all_sqlset;
NAME TOTAL_SQL DESCRIPTION
-------------------- ---------- ------------------------------
B4UPGDLOAD 0 SQL performance statistics bac
kup before upgrade
SQL> DECLARE
c_sqlarea_cursor DBMS_SQLTUNE.SQLSET_CURSOR;
BEGIN
OPEN c_sqlarea_cursor FOR
SELECT VALUE(p)
FROM TABLE(
DBMS_SQLTUNE.SELECT_CURSOR_CACHE(
' module = ''B4UPGDLOAD'' AND parsing_schema_name = ''SH'' ')
) p;
-- load the tuning set
DBMS_SQLTUNE.LOAD_SQLSET (
sqlset_name => 'B4UPGDLOAD'
, populate_cursor => c_sqlarea_cursor
2 3 4 5 6 7 8 9 10 11 12 13 14 );
END;
/ 15 16
PL/SQL procedure successfully completed.
SQL> EXEC DBMS_SQLTUNE.CAPTURE_CURSOR_CACHE_SQLSET( -
sqlset_name => 'B4UPGLOAD', -
time_limit => 30, -
repeat_interval => 5);> > >
PL/SQL procedure successfully completed.
SQL> col owner for a20
SQL> col description for a20
SQL> col statement_count for 9999999
SQL> SELECT owner,description,statement_count "TOTALSQLCAPTURED" from ALL_SQLSET;
OWNER DESCRIPTION TOTALSQLCAPTURED
-------------------- -------------------- ----------------
SYS SQL performance stat 0
istics backup before
upgrade
C##HYDRA Performance statisti 147
cs before upgrade
SQL> BEGIN
DBMS_SQLTUNE.create_stgtab_sqlset(table_name => 'STS',
schema_name => 'KISH',
tablespace_name => 'HYDRA');
END;
/ 2 3 4 5 6
PL/SQL procedure successfully completed.
SQL> BEGIN
DBMS_SQLTUNE.pack_stgtab_sqlset(sqlset_name => 'B4UPGLOAD',
sqlset_owner => 'C##HYDRA',
staging_table_name => 'STS',
staging_schema_owner => 'KISH');
END;
/ 2 3 4 5 6 7
PL/SQL procedure successfully completed.
Run the SQL performance analyzer for the database to capture the workload.
SPA can be used to capture the SQL workload
SQL> var v_spa char(50)
begin
:v_spa:=dbms_sqlpa.create_analysis_task(
sqlset_name => 'B4UPGLOAD',
task_name => 'spa_task');
end;
/
SQL> print v_spa
V_SPA
--------------------------------------------------------------------------------
SQL> COL TASK_NAME FOR A20
SQL> SET LINES 200 PAGES 1000
SQL> SELECT task_name,task_id from dba_advisor_tasks WHERE task_name like '%spa%';
TASK_NAME TASK_ID
-------------------- ----------
spa_task 786
SQL>
SQL> begin
DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(
task_name => 'spa_task',
execution_type => 'TEST EXECUTE',
execution_name => 'spa_task_exe');
end;
/ 2 3 4 5 6 7
PL/SQL procedure successfully completed.
variable rep CLOB;
begin
:rep := DBMS_SQLPA.REPORT_ANALYSIS_TASK(
task_name=>'spa_task',
type=>'HTML',
level=>'ALL',
section=>'ALL');
end;
/
PL/SQL procedure successfully completed.
SET LONG 100000 LONGCHUNKSIZE 100000 LINESIZE 130
PRINT :rep
Create a stat table to pack and save the database statistics to the backup table.
SQL> EXEC DBMS_STATS.CREATE_STAT_TABLE('C##HYDRA','HYDRA','USERS');
PL/SQL procedure successfully completed.
SQL> EXEC DBMS_STATS.EXPORT_DATABASE_STATS('HYDRA','B4UPGRADE','C##HYDRA');
PL/SQL procedure successfully completed.
SQL> conn c##hydra/hydra
Connected.
SQL>
SQL> BEGIN
DBMS_SPM.CREATE_STGTAB_BASELINE(
table_name => ‘BASELINE’);
END;
/ 2 3 4 5
PL/SQL procedure successfully completed.
SQL> DECLARE
x number;
BEGIN
x := DBMS_SPM.PACK_STGTAB_BASELINE(
table_name => ‘BASELINE’,
enabled => ‘yes’);
END;
/ 2 3 4 5 6 7 8
PL/SQL procedure successfully completed.
Collect the spa report for comparison and to identify the top resourceful sql before upgrade.
SQL> SET LONG 100000 LONGCHUNKSIZE 100000 LINESIZE 130 SQL> PRINT :rep REP ———————————————————————————————————————————- General Information
Task Information: | Workload Information: |
Task Name: spa_taskTask Owner: C##HYDRADescription: | SQL Tuning Set Name: B4UPGLOADSQL Tuning Set Owner: C##HYDRATotal SQL Statement Count: 2484 |
Execution Information:
Execution Name: spa_task_exeExecution Type: TEST EXECUTEDescription:Scope: COMPREHENSIVEStatus: COMPLETEDNumber of Unsupported SQL: 23 | Started: 01/02/2023 21:21:13Last Updated: 01/02/2023 21:33:26Global Time Limit: UNLIMITEDPer-SQL Time Limit: UNUSEDNumber of Errors: 1065 |
Top 100 SQL Sorted by elapsed_time desc
object_id | sql_id | Executions | Parse time(s) | Elapsed time(s) | CPU time(s) | Buffer gets |
---|---|---|---|---|---|---|
659 | 401yc6ds819kc | 1 | .000189 | 98.302861 | 16.301622 | 598900 |
634 | 3vpgn6npg6qc0 | 1 | .000074 | 95.761493 | 2.75148 | 598900 |
1784 | bgu2pvaum8466 | 1 | .000207 | 75.538409 | 1.719255 | 323315 |
1750 | b8zgdxhtb88jr | 1 | .000926 | .61881 | .60932 | 3808 |
427 | 2nr2b6gp7d0rh | 1 | .001026 | .539213 | .532411 | 3169 |
1249 | 7xqrwj883n4pj | 1 | .000444 | .377705 | .045964 | 6823 |
1655 | an7zy20kanc4w | 1 | .00017 | .307784 | .252061 | 3301 |
235 | 1f3kd1crx53qk | 1 | .000134 | .254286 | .221358 | 3295 |
100 | 0juypq5ys6gnc | 1 | .000049 | .205632 | .203654 | 168872 |
2000 | cv6ctbmh9u241 | 1 | .000139 | .198326 | .114289 | 315 |
2208 | f7qhsax7hkhmd | 1 | .000104 | .165782 | .139594 | 1353 |
376 | 2c8au1whd41z3 | 1 | .001002 | .155694 | .153341 | 1939 |
1996 | ctjvga0vf5md1 | 234 | .164331 | .065059 | .062937 | 2153 |
2240 | fh85sau14d9yp | 1 | .000678 | .055803 | .054626 | 1580 |
64 | 0bxa6g4t3a19x | 26 | .004101 | .053302 | .052744 | 4109 |
2107 | dn4y2m7wgc7t0 | 1 | .000784 | .037015 | .036486 | 1355 |
1315 | 8cppfttsw1xsv | 1 | .072965 | .030027 | .029512 | 12 |
1475 | 9fgfas6bfzfp0 | 1 | .000177 | .028029 | .027396 | 261 |
994 | 6ax6d90rq13vq | 1 | .060067 | .027295 | .02686 | 10 |
2305 | fvkavpa902cmv | 1 | .059187 | .027187 | .026603 | 14 |
1209 | 7mp45jmrxj835 | 1 | .052025 | .026628 | .026066 | 66 |
2259 | fn269s4zzd6km | 1 | .058514 | .026628 | .026292 | 160 |
1360 | 8prvy3kmknq4x | 1 | .058228 | .025809 | .025465 | 10 |
1555 | 9zvgx4wwamxha | 1 | .06068 | .025372 | .024977 | 66 |
1265 | 82q67m7d9uyhk | 1 | .092256 | .0252 | .024911 | 66 |
245 | 1hnyn6v69xks4 | 1 | .055554 | .025174 | .024839 | 113 |
28 | 05218zwf6vh23 | 1 | .000057 | .023443 | .023182 | 703 |
1579 | a51991cqqyak6 | 1 | .00061 | .022836 | .022475 | 389 |
1267 | 82tzq2gv0h4jt | 1 | .00014 | .022755 | .02256 | 471 |
2170 | f07qu0h30qvu5 | 1 | .070401 | .020065 | .019389 | 92 |
1755 | ba3m1hr5zy5q0 | 1 | .011365 | .018716 | .018372 | 1005 |
1135 | 74cpnuu24wmx7 | 31 | .562778 | .018238 | .018062 | 7574 |
2191 | f48m4mt7xh01r | 1 | .000536 | .016735 | .016138 | 24 |
443 | 2snp8upbjtf9h | 1 | .00125 | .016676 | .016414 | 589 |
505 | 35ju38anvqk7q | 1 | .00119 | .016534 | .016269 | 361 |
645 | 3xjw1ncw5vh27 | 70 | .022218 | .016476 | .016458 | 7045 |
1872 | c1p08yuayfcp2 | 1 | .000577 | .016287 | .016119 | 24 |
1286 | 86crkuax70gm1 | 1 | .000204 | .015901 | .015638 | 628 |
2014 | cx8adhucss180 | 1 | .076542 | .015848 | .015361 | 20743 |
568 | 3jc3q52z4z80p | 1 | .000361 | .015221 | .01517 | 0 |
1883 | c44c7dsy44qab | 1 | .000397 | .015147 | .014866 | 413 |
1752 | b9pm1w8gauh8a | 1 | .062539 | .014693 | .014422 | 248 |
1240 | 7v0r54aa5j3hh | 1 | .000486 | .014615 | .014336 | 374 |
1609 | ab1u1phxvmmuj | 1 | .067135 | .014203 | .013797 | 76 |
1343 | 8jpxkhmbxsun1 | 1 | .02446 | .01338 | .013087 | 1005 |
320 | 1z8nzdcjuxyx9 | 1 | .000425 | .012508 | .012312 | 0 |
806 | 4ynvg2s77fxdf | 1 | .036005 | .012133 | .011968 | 106 |
1903 | c88j7ssdk3y1a | 1 | .000496 | .011662 | .011445 | 24 |
1125 | 72krsth7b7smr | 1 | .069245 | .01121 | .011002 | 374 |
2398 | gg2cz79k0yjbh | 1 | .001778 | .01117 | .010802 | 1865 |
119 | 0pbkanxamxgvy | 1 | .000347 | .010559 | .010366 | 24 |
2192 | f4a02jbd8hhw4 | 1 | .000363 | .010329 | .010145 | 5 |
129 | 0qa2n6kz2ay1w | 1 | .000618 | .01031 | .010143 | 34 |
1968 | cpfcvxn2dytp9 | 1 | .000082 | .010078 | .009807 | 55 |
582 | 3nam07bx4dqq8 | 1 | .000352 | .009805 | .009781 | 34 |
250 | 1j86gd5p5y392 | 1 | .000338 | .009747 | .009506 | 5 |
1206 | 7mc90jfb8sn07 | 1 | .000304 | .009561 | .009446 | 5 |
1546 | 9y2r9ctm8sq2g | 18 | .004213 | .009455 | .009139 | 18 |
1488 | 9jtrdu77d6637 | 3 | .010211 | .009325 | .008995 | 47 |
1417 | 90ctbpqpmy4tt | 3 | .009853 | .009279 | .009198 | 47 |
2095 | dk479ty4sut9z | 3 | .009829 | .009206 | .009002 | 10 |
2403 | ggrn6a5xs009f | 3 | .010294 | .009206 | .008953 | 47 |
959 | 61xnxx28469mr | 1 | .091224 | .008952 | .008809 | 789 |
1675 | at0pvc5v0yg7m | 1 | .030275 | .008905 | .008813 | 92 |
1146 | 77asq3hypx966 | 1 | .000092 | .00851 | .008304 | 244 |
159 | 0z1kvzckt62cz | 18 | .004506 | .008489 | .008233 | 18 |
263 | 1msk5g3ktpj7t | 37 | .003969 | .008343 | .00823 | 9 |
702 | 49jnj80n7wfw5 | 18 | .003729 | .008311 | .00823 | 18 |
993 | 6atd17x59rdus | 1 | .046059 | .008214 | .007866 | 7419 |
1639 | ajj2ta3ygqq62 | 2 | .053946 | .007162 | .007055 | 2420 |
810 | 4zvang41gdxw3 | 1 | .000773 | .007157 | .007083 | 14 |
1506 | 9q32z5h7knjrm | 1 | .000531 | .007097 | .007036 | 3803 |
1569 | a1zm097zca8qg | 1 | .00031 | .00681 | .00678 | 170 |
14 | 01xv155rhts3j | 1 | .017455 | .006733 | .00646 | 7419 |
1082 | 6xcgfkf6u7sq0 | 1 | .000112 | .006588 | .006479 | 359 |
2178 | f1hxmdtdj2p39 | 1 | .000535 | .006272 | .006124 | 101 |
1226 | 7st5288cd82zm | 1 | .000374 | .006254 | .006079 | 1580 |
1254 | 7zup5jg28jffr | 1 | .000457 | .006125 | .005961 | 376 |
2183 | f35by4mtvw881 | 1 | .000426 | .006111 | .005973 | 1580 |
1673 | asyh9u1uh3rvd | 1 | .000304 | .005959 | .005766 | 32 |
2394 | gf9psa2a0fd48 | 1 | .00009 | .005927 | .005757 | 130 |
1420 | 90u1f2xf5j3gb | 1 | .000164 | .005514 | .005422 | 155 |
317 | 1yz61wkagq6r6 | 2 | .020025 | .00524 | .005247 | 1590 |
307 | 1xfz9wthyh45m | 2 | .019973 | .005063 | .005053 | 1590 |
1771 | bf7tbka73w96a | 1 | .038153 | .00501 | .004817 | 114 |
1007 | 6d31mkvp1vq3j | 1 | .255112 | .004999 | .00387 | 3803 |
1577 | a4mub1jc8waz9 | 1 | .065198 | .004977 | .004928 | 101 |
278 | 1q6swssfmnhj1 | 1 | .000312 | .004867 | .004836 | 41 |
2329 | g0u4unb36u100 | 6 | .000119 | .004795 | .004679 | 1422 |
479 | 2zgnwxrqaz8gc | 1 | .000353 | .00467 | .004615 | 1580 |
1870 | c1juncpz96u73 | 1 | .000312 | .004654 | .004449 | 129 |
2056 | d7z9aqg6ykngg | 1 | .000392 | .004303 | .004085 | 40 |
1498 | 9n46v29kftuyg | 1 | .012484 | .004292 | .00425 | 248 |
188 | 14pxdq7txvfvs | 1 | .000189 | .004223 | .004146 | 92 |
1136 | 74d2pct303ts5 | 1 | .036912 | .004171 | .004133 | 19 |
2122 | dpzw9aq5s2pd7 | 1 | .000079 | .004048 | .003873 | 312 |
843 | 58b5u5brjbzpu | 1 | .000237 | .003856 | .003789 | 13 |
1992 | csrmkat7qmy50 | 1 | .000687 | .003745 | .003718 | 53 |
890 | 5jtujanbxdysq | 1 | .000094 | .003554 | .00337 | 99 |
116 | 0nppdhg0y1hmc | 1 | .000318 | .003486 | .003426 | 12 |
Object ID | : 659 |
---|---|
Schema Name | : C##HYDRA |
Container Name | : CDB$ROOT |
SQL ID | : 401yc6ds819kc |
Execution Frequency | : 1 |
SQL Text | : /* SQL Analyze(1) */ select /*+ full(t) no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_ex act use_weak_name_resl dynamic_sampling(0) no_monitoring xmlindex_sel_idx_tbl no_substrb_pad */to_char(count(“PROD_ID”)),substrb( dump(min(“PROD_ID”),16,0,64),1,240),substrb(dump(max(“PROD_ID”),16,0,64),1,240),to_char(count(“CUST_ID”)),substrb(dump(min(“CUST_I D”),16,0,64),1,240),substrb(dump(max(“CUST_ID”),16,0,64),1,240),to_char(count(“TIME_ID”)),substrb(dump(min(“TIME_ID”),16,0,64),1,2 40),substrb(dump(max(“TIME_ID”),16,0,64),1,240),to_char(count(“CHANNEL_ID”)),substrb(dump(min(“CHANNEL_ID”),16,0,64),1,240),substr b(dump(max(“CHANNEL_ID”),16,0,64),1,240),to_char(count(“PROMO_ID”)),substrb(dump(min(“PROMO_ID”),16,0,64),1,240),substrb(dump(max( “PROMO_ID”),16,0,64),1,240),to_char(count(“QUANTITY_SOLD”)),substrb(dump(min(“QUANTITY_SOLD”),16,0,64),1,240),substrb(dump(max(“QU ANTITY_SOLD”),16,0,64),1,240),to_char(count(“SELLER”)),substrb(dump(min(“SELLER”),16,0,64),1,240),substrb(dump(max(“SELLER”),16,0, 64),1,240),to_char(count(“FULFILLMENT_CENTER”)),substrb(dump(min(“FULFILLMENT_CENTER”),16,0,64),1,240),substrb(dump(max(“FULFILLME NT_CENTER”),16,0,64),1,240),to_char(count(“COURIER_ORG”)),substrb(dump(min(“COURIER_ORG”),16,0,64),1,240),substrb(dump(max(“COURIE R_ORG”),16,0,64),1,240),to_char(count(“TAX_COUNTRY”)),substrb(dump(min(“TAX_COUNTRY”),16,0,64),1,240),substrb(dump(max(“TAX_COUNTR Y”),16,0,64),1,240),to_char(count(“TAX_REGION”)),substrb(dump(min(“TAX_REGION”),16,0,64),1,240),substrb(dump(max(“TAX_REGION”),16, 0,64),1,240),to_char(count(“AMOUNT_SOLD”)),substrb(dump(min(“AMOUNT_SOLD”),16,0,64),1,240),substrb(dump(max(“AMOUNT_SOLD”),16,0,64 ),1,240) from “C##HYDRA”.”SALES” t /* NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL ,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL*/ |
Execution Statistics:
parse_time | : .000189 |
---|---|
cost | : 163016 |
elapsed_time | : 98.302861 |
cpu_time | : 16.301622 |
user_io_time | : 82.602702 |
buffer_gets | : 598900 |
reads | : 598879 |
writes | : 0 |
io_interconnect_bytes | : 4906016768 |
rows | : 1 |
Note: time statistics are displayed in seconds
Notes:
The statement was first executed to warm the buffer cache.Statistics shown were from the second execution. |
Execution Plan:
Plan Id | : 4357 |
---|---|
Plan Hash Value | : 1047182207 |
Id | Operation | Name | Rows | Bytes | Cost | Time |
---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 1 | 49 | 163016 | 00:00:07 | |
1 | . SORT AGGREGATE | 1 | 49 | |||
2 | .. TABLE ACCESS FULL | SALES | 76249610 | 3736230890 | 163016 | 00:00:07 |
Object ID | : 634 |
---|---|
Schema Name | : SYS |
Container Name | : CDB$ROOT |
SQL ID | : 3vpgn6npg6qc0 |
Execution Frequency | : 1 |
SQL Text | : select /*+ DYNAMIC_SAMPLING(0) NO_INDEX(mytab) */ count(*) from “C##HYDRA”.”SALES” mytab |
Execution Statistics:
parse_time | : .000074 |
---|---|
cost | : 162593 |
elapsed_time | : 95.761493 |
cpu_time | : 2.75148 |
user_io_time | : 94.009092 |
buffer_gets | : 598900 |
reads | : 598879 |
writes | : 0 |
io_interconnect_bytes | : 4906016768 |
rows | : 1 |
Note: time statistics are displayed in seconds
Notes:
The statement was first executed to warm the buffer cache.Statistics shown were from the second execution. |
Execution Plan:
Plan Id | : 4332 |
---|---|
Plan Hash Value | : 1047182207 |
Id | Operation | Name | Rows | Bytes | Cost | Time |
---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 1 | 162593 | 00:00:07 | ||
1 | . SORT AGGREGATE | 1 | ||||
2 | .. TABLE ACCESS FULL | SALES | 76249610 | 162593 | 00:00:07 |
Object ID | : 1784 |
---|---|
Schema Name | : SYS |
Container Name | : CDB$ROOT |
SQL ID | : bgu2pvaum8466 |
Execution Frequency | : 1 |
SQL Text | : select /*+ DYNAMIC_SAMPLING(0) NO_INDEX(mytab) */ count(*) from “KISH”.”STS” mytab |
Execution Statistics:
parse_time | : .000207 |
---|---|
cost | : 87796 |
elapsed_time | : 75.538409 |
cpu_time | : 1.719255 |
user_io_time | : 74.405416 |
buffer_gets | : 323315 |
reads | : 323113 |
writes | : 0 |
io_interconnect_bytes | : 2646941696 |
rows | : 1 |
Note: time statistics are displayed in seconds
Notes:
The statement was first executed to warm the buffer cache.Statistics shown were from the second execution. |
Execution Plan:
Plan Id | : 5482 |
---|---|
Plan Hash Value | : 1256971950 |
Id | Operation | Name | Rows | Bytes | Cost | Time |
---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 1 | 87796 | 00:00:04 | ||
1 | . SORT AGGREGATE | 1 | ||||
2 | .. TABLE ACCESS FULL | STS | 2405881 | 87796 | 00:00:04 |
Object ID | : 1750 |
---|---|
Schema Name | : SYS |
Container Name | : CDB$ROOT |
SQL ID | : b8zgdxhtb88jr |
Execution Frequency | : 1 |
SQL Text | : select /*+ no_parallel_index(t, “I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST”) dbms_stats cursor_sharing_exact use_weak _name_resl dynamic_sampling(0) no_monitoring xmlindex_sel_idx_tbl no_substrb_pad no_expand index(t,”I_WRI$_OPTSTAT_H_OBJ#_ICOL#_S T”) */ count(*) as nrw,count(distinct sys_op_lbid(12938,’L’,t.rowid)) as nlb,count(distinct hextoraw(sys_op_descend(“OBJ#”)||sys_o p_descend(“INTCOL#”)||sys_op_descend(“SYS_NC00017$”)||sys_op_descend(“COLNAME”))) as ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as clf from “SYS”.”WRI$_OPTSTAT_HISTGRM_HISTORY” t where “OBJ#” is not null or “INTCOL#” is not null or “SYS_NC00017$” is not null or “COLNAME” is not null |
Execution Statistics:
parse_time | : .000926 |
---|---|
cost | : 3508 |
elapsed_time | : .61881 |
cpu_time | : .60932 |
user_io_time | : 0 |
buffer_gets | : 3808 |
reads | : 0 |
writes | : 0 |
io_interconnect_bytes | : 0 |
rows | : 1 |
Note: time statistics are displayed in seconds
Notes:
The statement was first executed to warm the buffer cache.Statistics shown were from the second execution. |
Execution Plan:
Plan Id | : 5448 |
---|---|
Plan Hash Value | : 3428983716 |
Id | Operation | Name | Rows | Bytes | Cost | Time |
---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 1 | 57 | 3508 | 00:00:01 | |
1 | . SORT GROUP BY | 1 | 57 | |||
2 | .. INDEX FULL SCAN | I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST | 427198 | 24350286 | 3508 | 00:00:01 |
Object ID | : 427 |
---|---|
Schema Name | : SYS |
Container Name | : CDB$ROOT |
SQL ID | : 2nr2b6gp7d0rh |
Execution Frequency | : 1 |
SQL Text | : /* SQL Analyze(1) */ select /*+ full(t) no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_ex act use_weak_name_resl dynamic_sampling(0) no_monitoring xmlindex_sel_idx_tbl no_substrb_pad */to_char(count(“OBJ#”)),substrb(dum p(min(“OBJ#”),16,0,64),1,240),substrb(dump(max(“OBJ#”),16,0,64),1,240),to_char(count(“INTCOL#”)),substrb(dump(min(“INTCOL#”),16,0, 64),1,240),substrb(dump(max(“INTCOL#”),16,0,64),1,240),to_char(count(“SAVTIME”)),substrb(dump(min(“SAVTIME”),16,0,64),1,240),subst rb(dump(max(“SAVTIME”),16,0,64),1,240),to_char(count(“BUCKET”)),substrb(dump(min(“BUCKET”),16,0,64),1,240),substrb(dump(max(“BUCKE T”),16,0,64),1,240),to_char(count(“ENDPOINT”)),substrb(dump(min(“ENDPOINT”),16,0,64),1,240),substrb(dump(max(“ENDPOINT”),16,0,64), 1,240),to_char(count(“EPVALUE”)),substrb(dump(min(“EPVALUE”),16,0,64),1,240),substrb(dump(max(“EPVALUE”),16,0,64),1,240),to_char(c ount(“COLNAME”)),substrb(dump(min(“COLNAME”),16,0,64),1,240),substrb(dump(max(“COLNAME”),16,0,64),1,240),to_char(count(“EP_REPEAT_ COUNT”)),substrb(dump(min(“EP_REPEAT_COUNT”),16,0,64),1,240),substrb(dump(max(“EP_REPEAT_COUNT”),16,0,64),1,240),to_char(count(“EP VALUE_RAW”)),substrb(dump(min(“EPVALUE_RAW”),16,0,64),1,240),substrb(dump(max(“EPVALUE_RAW”),16,0,64),1,240),to_char(count(“SAVTIM E_DATE”)),substrb(dump(min(“SAVTIME_DATE”),16,0,64),1,240),substrb(dump(max(“SAVTIME_DATE”),16,0,64),1,240),to_char(count(“SPARE1” )),substrb(dump(min(“SPARE1”),16,0,64),1,240),substrb(dump(max(“SPARE1”),16,0,64),1,240),to_char(count(“SPARE2”)),substrb(dump(min (“SPARE2”),16,0,64),1,240),substrb(dump(max(“SPARE2”),16,0,64),1,240),to_char(count(“SPARE3”)),substrb(dump(min(“SPARE3”),16,0,64) ,1,240),substrb(dump(max(“SPARE3”),16,0,64),1,240),to_char(count(“SPARE4”)),substrb(dump(min(“SPARE4”),16,0,64),1,240),substrb(dum p(max(“SPARE4”),16,0,64),1,240),to_char(count(“SPARE5”)),substrb(dump(min(“SPARE5”),16,0,64),1,240),substrb(dump(max(“SPARE5”),16, 0,64),1,240),to_char(count(“SPARE6”)),substrb(dump(min(“SPARE6”),16,0,64),1,240),substrb(dump(max(“SPARE6”),16,0,64),1,240),to_cha r(count(“SYS_NC00017$”)),substrb(dump(min(“SYS_NC00017$”),16,0,64),1,240),substrb(dump(max(“SYS_NC00017$”),16,0,64),1,240),count(r owidtochar(rowid)) from “SYS”.”WRI$_OPTSTAT_HISTGRM_HISTORY” t /* TOPN,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,ND V,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,TOPN,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL ,TOPN,NIL,NIL,RWID,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254U*/ |
Execution Statistics:
parse_time | : .001026 |
---|---|
cost | : 847 |
elapsed_time | : .539213 |
cpu_time | : .532411 |
user_io_time | : 0 |
buffer_gets | : 3169 |
reads | : 0 |
writes | : 0 |
io_interconnect_bytes | : 0 |
rows | : 1 |
Note: time statistics are displayed in seconds
Notes:
The statement was first executed to warm the buffer cache.Statistics shown were from the second execution. |
Execution Plan:
Plan Id | : 4125 |
---|---|
Plan Hash Value | : 2746973440 |
Id | Operation | Name | Rows | Bytes | Cost | Time |
---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 1 | 57 | 847 | 00:00:01 | |
1 | . SORT AGGREGATE | 1 | 57 | |||
2 | .. PARTITION RANGE ALL | 427198 | 24350286 | 847 | 00:00:01 | |
3 | … TABLE ACCESS FULL | WRI$_OPTSTAT_HISTGRM_HISTORY | 427198 | 24350286 | 847 | 00:00:01 |
Object ID | : 1249 |
---|---|
Schema Name | : SYS |
Container Name | : CDB$ROOT |
SQL ID | : 7xqrwj883n4pj |
Execution Frequency | : 1 |
SQL Text | : select substrb(dump(val,16,0,64),1,240) ep, freq, cdn, ndv, (sum(pop) over()) popcnt, (sum(pop*freq) over( )) popfreq, substrb(dump(max(val) over(),16,0,64),1,240) maxval, substrb(dump(min(val) over(),16,0,64),1,240) minval from (sele ct val, freq, (sum(freq) over()) cdn, (count(*) over()) ndv, (case when freq > ((sum(freq) over())/254) then 1 else 0 end) pop from (select /*+ no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_ monitoring xmlindex_sel_idx_tbl no_substrb_pad */ “ORDER_ID” val, count(“ORDER_ID”) freq from “C##HYDRA”.”ORDER_ITEMS” sample ( .0128204435) t where “ORDER_ID” is not null group by “ORDER_ID”)) order by val |
Execution Statistics:
parse_time | : .000444 |
---|---|
cost | : 27009 |
elapsed_time | : .377705 |
cpu_time | : .045964 |
user_io_time | : .338925 |
buffer_gets | : 6823 |
reads | : 6136 |
writes | : 0 |
io_interconnect_bytes | : 50266112 |
rows | : 5496 |
Note: time statistics are displayed in seconds
Notes:
The statement was first executed to warm the buffer cache.Statistics shown were from the second execution. |
Execution Plan:
Plan Id | : 4947 |
---|---|
Plan Hash Value | : 1884174387 |
Id | Operation | Name | Rows | Bytes | Cost | Time |
---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 5499 | 263952 | 27009 | 00:00:02 | |
1 | . WINDOW SORT | 5499 | 263952 | 27009 | 00:00:02 | |
2 | .. VIEW | 5499 | 263952 | 27009 | 00:00:02 | |
3 | … WINDOW BUFFER | 5499 | 98982 | 27009 | 00:00:02 | |
4 | …. HASH GROUP BY | 5499 | 98982 | 27009 | 00:00:02 | |
5 | ….. INDEX SAMPLE FAST FULL SCAN | ITEM_ORDER_IX | 5500 | 99000 | 27008 | 00:00:02 |
Object ID | : 1655 |
---|---|
Schema Name | : SYS |
Container Name | : CDB$ROOT |
SQL ID | : an7zy20kanc4w |
Execution Frequency | : 1 |
SQL Text | : select /*+ parallel_index(t, ” SQL> spool off |
SQL> select count(*) from dba_sql_profiles;
COUNT(*)
----------
0
set lines 200 pages 1000
col SQL_TEXT for a50
SELECT * from (
select to_char(dhsn.BEGIN_INTERVAL_TIME,'dd-mm-yy hh24:mi:ss') time,
dhss.elapsed_time_total,
dhss.plan_hash_value,
dhst.sql_id,
dhst.sql_text
from dba_hist_sqlstat dhss
inner join dba_hist_snapshot dhsn on ( dhss.snap_id = dhsn.snap_id )
inner join dba_hist_sqltext dhst on ( dhst.dbid = dhsn.dbid)
where plan_hash_value <> 0
order by dhss.elapsed_time_total asc
)
WHERE ROWNUM < 6;
6 7 8 9 10 11 12 13
TIME ELAPSED_TIME_TOTAL PLAN_HASH_VALUE SQL_ID SQL_TEXT
----------------- ------------------ --------------- ------------- --------------------------------------------------
13-01-23 19:30:50 368 4024720576 5n1cu9123nabt create index r_id_name on rp(r_name)
13-01-23 19:30:50 368 4024720576 asvzxj61dc5vs select timestamp, flags from fixed_obj$ where obj#
=:1
13-01-23 19:30:50 368 4024720576 7tchj0bmt6tn1 select xmlagg(
xmlelement("operation",
13-01-23 19:30:50 368 4024720576 0v3dvmc22qnam insert into sys.col_usage$ (obj#, intcol#, equalit
y_preds, equijoin_preds, noneq
13-01-23 19:30:50 368 4024720576 b1wc53ddd6h3p select audit$,options from procedure$ where obj#=:
1
SQL> SQL> @coe_xfr_sql_profile 7tchj0bmt6tn1 4024720576
Parameter 1:
SQL_ID (required)
PLAN_HASH_VALUE AVG_ET_SECS
--------------- -----------
1660022729 .011
Parameter 2:
PLAN_HASH_VALUE (required)
Values passed to coe_xfr_sql_profile:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL_ID : "7tchj0bmt6tn1"
PLAN_HASH_VALUE: "4024720576"
Export AWR data from the database for capturing the baseline performance data of the instance level.
SQL> @?/rdbms/admin/awrextr
~~~~~~~~~~~~~
AWR EXTRACT
~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ This script will extract the AWR data for a range of snapshots ~
~ into a dump file. The script will prompt users for the ~
~ following information: ~
~ (1) database id ~
~ (2) snapshot range to extract ~
~ (3) name of directory object ~
~ (4) name of dump file ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Databases in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id DB Name Host
------------ ------------ ------------
* 1185489427 HYDRUPGD hydrupgrd
[oracle@hydrupgrd ~]$ cd /u01/app/oracle/product/19.0.0/db_home1/
[oracle@hydrupgrd db_home1]$ ls
[oracle@hydrupgrd db_home1]$ ls
LINUX.X64_193000_db_home.zip
[oracle@hydrupgrd db_home1]$ unzip LINUX.X64_193000_db_home.zip