查看session以及sql语句


何查看session执行的sql语句


老生常谈:

首先要用到上面的四个动态视图。

实验:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> insert into jiajie values(99);

1 row created.

SQL> show user
USER is "JIAJIE"
SQL>

用户名为jiajie的用户执行insert语句

SQL> select username,sql_address,prev_sql_addr from v$session

USERNAME                       SQL_ADDR PREV_SQL
------------------------------ -------- --------
JIAJIE                                          00      6875BABC
                                                                6B78CF90 00
                                                     00       00
SYS                                     68777D00 68DEF1F4
                                                     00       00
                                                                6918FD28 00
                                                     00       00
JIAJIE                                          00       687C9EAC
                                                     00       00
                                                     00       00
                                            6A9E115C 00

SQL> select sql_text from v$sql where address = '6875BABC';

SQL_TEXT
------------------------------------------------------------

insert into jiajie values(99)

 

这样我们就追踪到了刚才用户为jiajie执行的sql语句

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值