Hi Dears,
In this article, we will see Oracle Sample Unix script to monitor select query during Load Test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#!/bin/bash ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1 ORACLE_SID=ORCL while : do sqlplus -s / as sysdba <<EOF set pagesize 0 set linesize 300 select B.USERNAME ||' ('||B.SID||','||B.SERIAL#||',@'||B.INST_ID||') is Currently '||B.STATUS||' for last '||B.LAST_CALL_ET||' Sec and it''s BLOCKING user '|| W.USERNAME|| ' ('| |W.SID||','||W.SERIAL#||',@'||W.INST_ID||')' from (select INST_ID,SID,SERIAL#,USERNAME,STATUS,BLOCKING_INSTANCE,BLOCKING_SESSION, LAST_CALL_ET from gv\$session where BLOCKING_SESSION >0) W, (select INST_ID,SID,SERIAL#,USERNAME,STATUS,LAST_CALL_ET from gv\$session ) B where W.BLOCKING_INSTANCE=B.INST_ID and W.BLOCKING_SESSION=B.SID; EOF date echo "Hit [CTRL+C] to stop!" sleep 5 done |
Output :
1 2 3 4 5 6 7 8 9 |
Wed Mar 24 11:54:39 PDT 2021 Hit [CTRL+C] to stop! no rows selected Wed Mar 24 11:54:44 PDT 2021 Hit [CTRL+C] to stop! no rows selected |
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Note: Please test scripts in Non Prod before trying in Production.