select tt."INST_ID",
tt."USERNAME",
tt."OSUSER",
tt."MACHINE",
tt.module,
tt.sql_id,
count(*) cnt
from (select t."INST_ID",
t."USERNAME",
t."OSUSER",
t."MACHINE",
module,
nvl(sql_id, prev_sql_id) sql_id
from gv$session t
WHERE t."STATUS" = 'ACTIVE'
and t.username is not null
and t."MODULE" is not null) tt
group by tt."INST_ID",
tt."USERNAME",
tt."OSUSER",
tt."MACHINE",
tt.module,
sql_id
order by 1, cnt desc;
select * from v$sqlarea where sql_id='788qkgz46ckyz';
SELECT a."INST_ID",a."SID",'kill -9 '||b."SPID" FROM gv$session a,gv$process b WHERE a."PADDR"=b."ADDR" AND a.sid=&SID;
#查看游标
SELECT t."SQL_ID",t."CHILD_NUMBER",t."PLAN_HASH_VALUE",t."LAST_ACTIVE_TIME" FROM v$sql t WHERE t."SQL_ID"='&sql_id' order by t."LAST_ACTIVE_TIME" desc;
#查看执行计划
SELECT t."SQL_ID",t."EXECUTIONS",t."PLAN_HASH_VALUE" ,t."LAST_ACTIVE_TIME",t."SQL_FULLTEXT" FROM v$sqlarea t where t."SQL_ID"='&sql_id' order by t."LAST_ACTIVE_TIME" desc;
#查看索引
SELECT * from all_indexes f where f.TABLE_NAME=upper('sb_sbxx')
#创建索引
CREATE INDEX index_name ON table_name(column_name) online;
#删除索引
DROP INDEX index_name
|