您的位置:首页 > 数据库

查看最近用户使用过的sql语句

2013-09-13 13:39 267 查看
1  select /* recetsql */ sql_id,child_number,hash_value,address,executions,sql_text
2  from v$sql
3  where parsing_user_id =(select  user_id from all_users
4  where username=upper('&uname'))
5  and command_type in (2,3,6,7,189)
6* and upper(sql_text)  not like upper('%rece%')

对于v$sql字段的

SQL_TEXT
VARCHAR2(1000)
First thousand characters of the SQL text for the current cursor --返回当前游标的sql 文本
SQL_ID
VARCHAR2(13)
SQL identifier of the parent cursor in the library cache--返回在库缓存中父游标的id号
EXECUTIONS
NUMBER
Number of executions that took place on this object since it was brought into the library cache --返回当前对象在库缓存中被执行的次数
PARSING_USER_ID
NUMBER
User ID of the user who originally built this child cursor  --生成这个子游标的用户iD
CHILD_NUMBER
NUMBER
Number of this child cursor  ---子游标的个数
HASH_VALUE
NUMBER
Hash value of the parent statement in the library cache  --当前语句在库缓存中的哈希值
COMMAND_TYPE
NUMBER
Oracle command type definition 
关于command_type的几种类型:
Insert 2
Select 3
Update 6
Delete 7
Lock Table 26
Alter Database 35
Alter Session 42
Commit 44
Rollback 45
Savepoint 46
Begin/Declare 47
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐