查看所有job
select from dba_jobs;
查看正在运行的job
select
from dba_jobs_running;
select job,log_user,priv_user,schema_user,BROKEN from dba_jobs where job=545;
查看数据库建立的回话情况
select sid,serial#,username,program,machine,status
from v$session;
查看对应sid的sql_id
select * from v$session where sid=2272 or sid=327;
知道sql_id后查看sql语句
select SQL_TEXT from v$sql where sql_id='3f18ygbqg41mw';
给MESPRD赋权
grant execute on DBMS_WORKLOAD_REPOSITORY to MESPRD;
kill会话
alter system kill session 'sid,serial#';
alter system kill session '327,8133';
查看进程的spid
select spid, program from v$process
where program!= 'PSEUDO'
and addr not in (select paddr from v$session)
and addr not in (select paddr from v$bgprocess)
and addr not in (select paddr from v$shared_server);
!ps -ef|grep spid|grep -v grep;
查看进程的spid
SELECT s.username,s.status,
x.ADDR,x.KSLLAPSC,x.KSLLAPSN,x.KSLLASPO,x.KSLLID1R,x.KSLLRTYP,
decode(bitand (x.ksuprflg,2),0,null,1)
FROM x$ksupr x,v$session s
WHERE s.paddr(+)=x.addr
and bitand(ksspaflg,1)!=0;
查看进程的spid
select spid,program from v$process where pid in(327,2272);