怎样查看最消耗资源的sql语句 与 ora
答案:1 悬赏:0 手机版
解决时间 2021-11-16 08:42
- 提问者网友:未信
- 2021-11-15 10:28
怎样查看最消耗资源的sql语句 与 ora
最佳答案
- 五星知识达人网友:罪歌
- 2021-11-15 11:23
1、查询当前系统中正在执行的sql:
SELECt osuser, username, sql_text from v$session a, v$sqltext b
where a.sql_address =b.address order by address, piece;
2、查找死锁的语句:
SELECt l.session_id sid, s.serial#, l.locked_mode,l.oracle_username,
l.os_user_name,s.machine, s.terminal, o.object_name, s.logon_time
FROM v$locked_object l, all_objects o, v$session s
WHERe l.object_id = o.object_id
AND l.session_id = s.sid
ORDER BY sid, s.serial#;
3、查看oracle的权限角色:
select * from dba_role_privs; 授予用户和其他角色的角色
select * from dba_sys_privs; 授予用户和其他角色的系统权限
select * from dba_tab_privs; 数据库中对象的所有授权
select * from user_role_privs; 查看当前用户的角色
4、oracle 查看已经执行过的sql 这些是存在共享池中的:
select * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc;
5、【获取oracle前10条最耗资源的sql语句】:
SELECt * FROM
(
SELECt PARSING_USER_ID
EXECUTIONS,
SORTS,
COMMAND_TYPE,
DISK_READS,
sql_text
FROM v$sqlarea
ORDER BY disk_reads DESC
)
WHERe ROWNUM<11;
SELECt osuser, username, sql_text from v$session a, v$sqltext b
where a.sql_address =b.address order by address, piece;
2、查找死锁的语句:
SELECt l.session_id sid, s.serial#, l.locked_mode,l.oracle_username,
l.os_user_name,s.machine, s.terminal, o.object_name, s.logon_time
FROM v$locked_object l, all_objects o, v$session s
WHERe l.object_id = o.object_id
AND l.session_id = s.sid
ORDER BY sid, s.serial#;
3、查看oracle的权限角色:
select * from dba_role_privs; 授予用户和其他角色的角色
select * from dba_sys_privs; 授予用户和其他角色的系统权限
select * from dba_tab_privs; 数据库中对象的所有授权
select * from user_role_privs; 查看当前用户的角色
4、oracle 查看已经执行过的sql 这些是存在共享池中的:
select * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc;
5、【获取oracle前10条最耗资源的sql语句】:
SELECt * FROM
(
SELECt PARSING_USER_ID
EXECUTIONS,
SORTS,
COMMAND_TYPE,
DISK_READS,
sql_text
FROM v$sqlarea
ORDER BY disk_reads DESC
)
WHERe ROWNUM<11;
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯