Script to Monitor Current User Activity in the Database
Database to in The user Activity script Current
2023-09-11 14:18:40 时间
Execution Environment: SQL, SQL*Plus, iSQL*Plus Access Privileges: Requires select privileges on view V$SQLTEXT, V$SESSION and V$PROCESS. Usage: sqlplus /nolog SQL> connect sys;/<password> SQL> @sqltext Instructions: Copy the script into the file sqltext.sql and execute it from SQL*Plus connected as sys. PROOFREAD THIS SCRIPT BEFORE USING IT! Due to differences in the way text editors, e-mail packages, and operating systems handle text formatting (spaces, tabs, and carriage returns), this script may not be in an executable state when you first receive it. Check over the script to ensure that errors of this type are corrected. |
|
Description | |
---|---|
The script displays the text of the SQL statements of the shared cursors in the SGA and information of the sessions executing them. SQL> @sqltext Unix PID OS User Oracle Us SID SERIAL# SQL_TEXT --------- --------- --------- ----- ------- ----------------------------------- 16995 lsupport SYS 24 7 /* OracleOEM */ select value from v$sysstat order by statistic# 16999 lsupport SYS 22 6769 /* OracleOEM */ select value from v$sesstat t where sid = :1 |
|
References | |
Script | |
set pagesize 66 col c1 for a9 col c1 heading "OS User" col c2 for a9 col c2 heading "Oracle User" col b1 for a9 col b1 heading "Unix PID" col b2 for 9999 justify left col b2 heading "SID" col b3 for 99999 justify left col b3 heading "SERIAL#" col sql_text for a35 break on b1 nodup on c1 nodup on c2 nodup on b2 nodup on b3 skip 3 select c.spid b1, b.osuser c1, b.username c2, b.sid b2, b.serial# b3, a.sql_text from v$sqltext a, v$session b, v$process c where a.address = b.sql_address -- and b.status = 'ACTIVE' /* YOU CAN CHOOSE THIS OPTION ONLY TO SEE -- ACTVE TRANSACTION ON THAT MOMENT */ and b.paddr = c.addr and a.hash_value = b.sql_hash_value order by c.spid,a.hash_value,a.piece / |
|
Disclaimer | |
EXCEPT WHERE EXPRESSLY PROVIDED OTHERWISE, THE INFORMATION, SOFTWARE, PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS. ORACLE EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ORACLE MAKES NO WARRANTY THAT: (A) THE RESULTS THAT MAY BE OBTAINED FROM THE USE OF THE SOFTWARE WILL BE ACCURATE OR RELIABLE; OR (B) THE INFORMATION, OR OTHER MATERIAL OBTAINED WILL MEET YOUR EXPECTATIONS. ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE DOWNLOADED OR OTHERWISE OBTAINED IS DONE AT YOUR OWN DISCRETION AND RISK. ORACLE SHALL HAVE NO RESPONSIBILITY FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM THE DOWNLOAD OF ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE. ORACLE RESERVES THE RIGHT TO MAKE CHANGES OR UPDATES TO THE SOFTWARE AT ANY TIME WITHOUT NOTICE. |
|
相关文章
- 《ASP.NET MVC4 WEB编程》学习笔记------Entity Framework的Database First、Model First和Code Only三种开发模式
- Database 'xxx' cannot be upgraded because it is read-only or has read-only file Make the database or files writeable, and rerun recovery.
- [Postgres Bash] Wait for database
- Configure Oracle GoldenGate for Oracle to Oracle Database Synchronization
- Database Crash With ORA-27063 and OS Error: 5: I/O Error
- Oracle 集群】ORACLE DATABASE 11G RAC 知识图文详细教程之ORACLE集群概念和原理(二)
- [AngularFire 2] Object Observables - How to Read Objects from a Firebase Database?
- [Firebase] 4. Firebase Object related Database
- SpringCloud database connection debug
- Application log save debug - how log data is persisted to database table
- SAP LUW Database update discuss mengniu 蒙牛
- 【Codeforces 231C】To Add or Not to Add
- 成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified
- 【异常】dbeaver连接ClickHouse时:Unexpected driver error occurred while connecting to the database
- PAT 1033. To Fill or Not to Fill (贪婪)
- Go组件学习——database/sql数据库连接池你用对了吗
- PAT 1033 To Fill or Not to Fill[dp]
- 讲述CBO And Database Statistics
- How To Enable Archive Log Mode In Oracle Database 19c
- How to Setup Archive Log Destination Directory in Oracle Database
- 【Android-Jetpack进阶】5、Room 数据库、ViewModel 内通过 Database 查到 LiveData 并通知变化、用 createFromAsset() 预填充数据库
- Oracle的学习心得和知识总结(二十二)|Oracle数据库Real Application Testing之Database Replay实操(二)