70.3. session

本文介绍了一种在Oracle数据库中查看当前所有用户正在执行的SQL语句的方法,通过使用v$session与v$sqltext或v$sqltext_with_newlines视图结合查询来实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查看用户正在执行的SQL

		
SQL> SELECT osuser, username, sql_text from v$session a, v$sqltext b where a.sql_address =b.address order by address, piece;

OSUSER			       USERNAME 		      SQL_TEXT
------------------------------ ------------------------------ ----------------------------------------------------------------
oracle			       SYSMAN			      BEGIN EMD_NOTIFICATION.QUEUE_READY(:1, :2, :3); END;
oracle			       SYS			      SELECT osuser, username, sql_text from v$session a, v$sqltext b
oracle			       SYS			       where a.sql_address =b.address order by address, piece
linea			       Neo			      UPDATE gt_scheduler_config SET report_date = TO_DATE(:1 ,'yyyy-M
linea			       Neo			      M-dd HH24:mi:ss') WHERE id = :2
		
		
		
SQL> select sid,username,sql_text from v$session a,v$sqltext_with_newlines b where a.SQL_ADDRESS=b.ADDRESS;

       SID USERNAME			  SQL_TEXT
---------- ------------------------------ ----------------------------------------------------------------
       177 SYSMAN			  BEGIN EMD_NOTIFICATION.QUEUE_READY(:1, :2, :3); END;
	95 SYS				  lines b where a.SQL_ADDRESS=b.ADDRESS
	95 SYS				  select sid,username,sql_text from v$session a,v$sqltext_with_new		
		
		





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

PS C:\Downloads> pip debug --verbose WARNING: This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice. pip version: pip 25.0.1 from D:\python\Lib\site-packages\pip (python 3.13) sys.version: 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] sys.executable: D:\python\python.exe sys.getdefaultencoding: utf-8 sys.getfilesystemencoding: utf-8 locale.getpreferredencoding: cp936 sys.platform: win32 sys.implementation: name: cpython 'cert' config value: Not specified REQUESTS_CA_BUNDLE: None CURL_CA_BUNDLE: None pip._vendor.certifi.where(): D:\python\Lib\site-packages\pip\_vendor\certifi\cacert.pem pip._vendor.DEBUNDLED: False vendored library versions: CacheControl==0.14.1 distlib==0.3.9 distro==1.9.0 msgpack==1.1.0 packaging==24.2 platformdirs==4.3.6 pyproject-hooks==1.2.0 requests==2.32.3 certifi==2024.08.30 idna==3.10 urllib3==1.26.20 rich==13.9.4 (Unable to locate actual module version, using vendor.txt specified version) pygments==2.18.0 typing_extensions==4.12.2 (Unable to locate actual module version, using vendor.txt specified version) resolvelib==1.0.1 setuptools==70.3.0 (Unable to locate actual module version, using vendor.txt specified version) tomli==2.2.1 truststore==0.10.0 Compatible tags: 45 cp313-cp313-win_amd64 cp313-abi3-win_amd64 cp313-none-win_amd64 cp312-abi3-win_amd64 cp311-abi3-win_amd64 cp310-abi3-win_amd64 cp39-abi3-win_amd64 cp38-abi3-win_amd64 cp37-abi3-win_amd64 cp36-abi3-win_amd64 cp35-abi3-win_amd64 cp34-abi3-win_amd64 cp33-abi3-win_amd64 cp32-abi3-win_amd64 py313-none-win_amd64 py3-none-win_amd64 py312-none-win_amd64 py311-none-win_amd64 py310-none-win_amd64 py39-none-win_amd64 py38-none-win_amd64 py37-none-win_amd64 py36-none-win_amd64 py35-none-win_amd64 py34-none-win_amd64 py33-none-win_amd64
最新发布
03-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值