{"id":406,"date":"2024-07-28T03:31:38","date_gmt":"2024-07-28T03:31:38","guid":{"rendered":"https:\/\/humtechno.com\/intro\/?p=406"},"modified":"2024-07-28T03:32:39","modified_gmt":"2024-07-28T03:32:39","slug":"oracle-database-performance-monitoring","status":"publish","type":"post","link":"https:\/\/humtechno.com\/intro\/2024\/07\/28\/oracle-database-performance-monitoring\/","title":{"rendered":"Oracle Database Performance Monitoring"},"content":{"rendered":"\n\n\n\n<p>Improving Oracle Database performance involves several strategies. First, optimizing SQL queries can significantly reduce execution time. Second, proper indexing can enhance data retrieval speed. Third, regular database maintenance, such as statistics collection and defragmentation, ensures optimal performance. Fourth, using Oracle&#8217;s built-in performance tuning tools, like Automatic Workload Repository (AWR) and SQL Tuning Advisor, helps identify and resolve bottlenecks. Lastly, scaling hardware resources, such as CPU and memory, can provide the necessary power for high-demand operations.<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check Database Session Locking<br><\/mark><\/strong>select\u00a0 blocking_session, sid, serial#, wait_class,\u00a0\u00a0 seconds_in_wait\u000bfrom\u000b\u00a0\u00a0 v$session where blocking_session is not NULL order by blocking_session;<br>select username, sid,serial#,sql_id , wait_time from v$session where (sid ) in<br>(<br>select blocking_session from v$session<br>);<br>select inst_id,last_call_et,username,machine,event,status from gv$session where username=&#8217;T24&#8242; and lower(event) like &#8216;%contention%&#8217;;<br>select * from gv$session a , gv$lock b where a.sid=b.sid and A.INST_ID=b.inst_id and username=&#8217;T24&#8242; and lower(event) like &#8216;%contention%&#8217;;<\/p>\n\n<p>select * from dba_blockers;<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check the Queries which last_call_et column value high and increasing in your Database<\/mark><\/strong><\/p>\n\n<p>select event,last_call_et,username,module,program,machine,sql_id,prev_sql_id,<br>((select max(sql_text) from gv$sql a where a.sql_id=s.sql_id)) as sql1,<br>((select max(sql_text) from gv$sql a where a.sql_id=s.prev_sql_id)) as sql2<br>from gv$session s where status=&#8217;ACTIVE&#8217; and not username is null order by last_call_et desc;<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check Active \/ In Active Database Sessions<\/mark><\/strong><\/p>\n\n<p>select inst_id,sid,last_call_et,username,machine,event,status from gv$session where username=&#8217;T24&#8242; order by last_call_et desc;<br>select inst_id,sid,last_call_et,username,machine,event,status from gv$session where username=&#8217;T24&#8242; and status=&#8217;ACTIVE&#8217; order by last_call_et desc;<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check User Level Session Locking.<\/mark><\/strong><\/p>\n\n<p>SELECT se.inst_id,se.last_call_et,<br>lk.SID, se.username, se.OSUser, se.Machine,DECODE (lk.TYPE,&#8217;TX&#8217;, &#8216;Transaction&#8217;,&#8217;TM&#8217;, &#8216;DML&#8217;,&#8217;UL&#8217;, &#8216;PL\/SQL User Lock&#8217;,lk.TYPE)<br>lock_type, DECODE (lk.lmode, 0, &#8216;None&#8217;, 1, &#8216;Null&#8217;,<br>2, &#8216;Row-S (SS)&#8217;,<br>3, &#8216;Row-X (SX)&#8217;,<br>4, &#8216;Share&#8217;,<br>5, &#8216;S\/Row-X (SSX)&#8217;,<br>6, &#8216;xclusive&#8217;,<br>TO_CHAR (lk.lmode))<br>mode_held,<br>DECODE (lk.request,<br>0, &#8216;None&#8217;,<br>1, &#8216;Null&#8217;,<br>2, &#8216;Row-S (SS)&#8217;,<br>3, &#8216;Row-X (SX)&#8217;,<br>4, &#8216;Share&#8217;,<br>5, &#8216;S\/Row-X (SSX)&#8217;,<br>6, &#8216;Exclusive&#8217;,<br>TO_CHAR (lk.request))<br>mode_requested,<br>TO_CHAR (lk.id1) lock_id1,<br>TO_CHAR (lk.id2) lock_id2,<br>ob.owner,<br>ob.object_type,<br>ob.object_name,<br>DECODE (lk.Block, 0, &#8216;No&#8217;, 1, &#8216;Yes&#8217;, 2, &#8216;Global&#8217;) block,<br>se.lockwait<br>FROM GV$lock lk, dba_objects ob, GV$session se<br>WHERE lk.TYPE IN (&#8216;TX&#8217;, &#8216;TM&#8217;, &#8216;UL&#8217;)<br>AND lk.SID = se.SID<br>AND lk.id1 = ob.object_id(+)<br>AND lk.inst_id = se.inst_id<br>and last_call_et &gt; 100;<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Generate AWR Report<br><\/mark><\/strong>Check &#8220;DB Time&#8221;<\/p>\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"614\" height=\"95\" src=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-2.png\" alt=\"\" class=\"wp-image-409\" srcset=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-2.png 614w, https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-2-300x46.png 300w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n<p><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Check &#8220;SQL ordered by Elapsed Time&#8221;<\/mark><\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"796\" height=\"248\" src=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-3.png\" alt=\"\" class=\"wp-image-410\" srcset=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-3.png 796w, https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-3-300x93.png 300w, https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-3-768x239.png 768w\" sizes=\"(max-width: 796px) 100vw, 796px\" \/><\/figure>\n\n<p><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Check Top 10 Foreground Events by Total Wait Time<br><\/mark><\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"602\" height=\"113\" src=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image.png\" alt=\"\" class=\"wp-image-407\" srcset=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image.png 602w, https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-300x56.png 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Wait Classes by Total Wait Time<\/mark><\/p>\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"618\" height=\"136\" src=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-1.png\" alt=\"\" class=\"wp-image-408\" srcset=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-1.png 618w, https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/image-1-300x66.png 300w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/figure>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check Table Stats<\/mark><\/strong><\/p>\n\n<p>select max(LAST_ANALYZED),&#8217;execute dbms_stats.gather_table_stats(ownname=>&#8217; || &#8221;&#8221; || &#8216;t24&#8217; || &#8221;&#8221; || &#8216;,&#8217; || &#8216;tabname=>&#8217; || &#8221;&#8221; || table_name || &#8221;&#8221; || &#8216;,DEGREE=> 10, estimate_percent=> 10 );&#8217; from dba_tab_statistics where owner=&#8217;T24&#8242; and stale_stats =&#8217;YES&#8217;<br>group by table_name order by max(LAST_ANALYZED) asc;<br>select max(LAST_ANALYZED),&#8217;execute dbms_stats.gather_table_stats(ownname=>&#8217; || &#8221;&#8221; || &#8216;t24&#8217; || &#8221;&#8221; || &#8216;,&#8217; || &#8216;tabname=>&#8217; || &#8221;&#8221; || table_name || &#8221;&#8221; || &#8216;,DEGREE=> 10, estimate_percent=> 10 );&#8217; from dba_tab_statistics where owner=&#8217;T24&#8242; and stale_stats =&#8217;YES&#8217; group by table_name order by max(LAST_ANALYZED) asc;<\/p>\n\n<p>select owner,table_name,LAST_ANALYZED from dba_tables;<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check Invalid Objects<\/mark><\/strong><\/p>\n\n<p>select * from dba_ind_partitions where index_owner=&#8217;T24&#8242; and not status=&#8217;USABLE&#8217; ;<br>select index_name,status from dba_indexes where not status=&#8217;VALID&#8217; and owner=&#8217;T24&#8242;;<\/p>\n\n<p>Move Objects in Keep Pool<\/p>\n\n<p>select table_name,BUFFER_POOL from dba_tables where OWNER=&#8217;T24&#8242; AND not BUFFER_POOL=&#8217;DEFAULT&#8217;;<\/p>\n\n<p>alter TABLE T24.F_BATCH storage (buffer_pool keep);<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Increase INITRANS and PCT Free as DML <\/mark><\/strong><\/p>\n\n<p>ALTER TABLE t24.F_LOCKING INITRANS 100 PCTUSED 0 PCTFREE 60;<\/p>\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Check Execution Plan for Query<\/mark><\/strong><\/p>\n\n<pre class=\"wp-block-code\"><code>explain plan for insert into test1 select * from test1;\nselect * from table(dbms_xplan.display);\n\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">Create Partitions on Tables on Index\n<\/mark><\/strong><\/code><\/pre>\n\n<p><\/p>\n\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":333,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[3],"tags":[44,43],"class_list":["post-406","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-database-performance","tag-oracle-database-performance"],"_links":{"self":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/comments?post=406"}],"version-history":[{"count":3,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/406\/revisions"}],"predecessor-version":[{"id":413,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/406\/revisions\/413"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media\/333"}],"wp:attachment":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media?parent=406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/categories?post=406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/tags?post=406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}