Get the App
SLTechnology News&Howtos  ›  Database  › 

ORACLE series script 2: life-saving stored procedure emergency handling script

Shulou Source: shulou.com Published: 2022-06-01 14:45:28 09月30日 Update

Background: the long-term execution of stored procedures in the database leads to excessive resource consumption. Through the following expectations, we can quickly locate stored procedures, quickly intervene processing, and restore database performance. Long-term operation and maintenance through the following statements? t or above database? Yes, it works every time.

-- query the executing stored procedure

Select * from v$db_object_cache where locks > 0 and pins > 0 and type='PROCEDURE'

-- query the execution stored procedure session id of the activity

Select b.sid,b.SERIAL#

From SYS.V$ACCESS a, SYS.V$session b

Where a.type = 'PROCEDURE'

And (a.OBJECT like upper ('% PR_SEA_PAD_JKF_LGK_GOODS_TOP%') or)

A.OBJECT like lower ('% PR_SEA_RTK_JKF_E_ENTRY_COUNT%'))

And a.sid = b.sid

And b.status = 'ACTIVE'

-- stop the session

Alter system kill session '539 and 2022'

Tags: Process storage data database query script processing proven performance situation in progress background statement resource location activity emergency help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi vpn MariaDB macOS