pl/sql ,dba-ebs 常用
发布时间:2021-01-07 15:39:03 所属栏目:MySql教程 来源:网络整理
导读:以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 g_sid v$session.SID%type := '-1'; g_serial# v$session.SERIAL#%type; g_terminal v$session.TERMINAL%type; g_username v$session.username%type; function get_o
|
以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 g_sid v$session.SID%type := '-1';
g_serial# v$session.SERIAL#%type;
g_terminal v$session.TERMINAL%type;
g_username v$session.username%type;
function get_object_by_id(p_object_id in number) return varchar2 is
l_object_name varchar2(1000);
begin
select owner || '.' || object_name
into l_object_name
from dba_objects
where object_id = p_object_id;
return l_object_name;
exception
when others then
return p_object_id;
end;
function get_objects_locked_by_session(p_sid in number) return varchar2 is
l_result varchar2(1000) := '';
cursor locks is
select get_object_by_id(id1) locked_object
from v$lock
where type = 'TM'
and sid = p_sid;
begin
for c in locks loop
if l_result is not null then
l_result := l_result || chr(10);
end if;
l_result := l_result || c.locked_object;
end loop;
return l_result;
end;
procedure get_session_info(p_sid in number) is
begin
select serial#,terminal,username
into g_serial#,g_terminal,g_username
from v$session
where sid = p_sid;
end get_session_info;
function get_session_serial#(p_sid in number) return v$session.SERIAL#%type is
begin
if p_sid != g_sid then
get_session_info(p_sid);
end if;
return g_serial#;
end get_session_serial#;
function get_session_terminal(p_sid in number)
return v$session.terminal%type is
begin
if p_sid != g_sid then
get_session_info(p_sid);
end if;
return g_terminal;
end get_session_terminal;
function get_session_username(p_sid in number)
return v$session.username%type is
begin
if p_sid != g_sid then
get_session_info(p_sid);
end if;
return g_username;
end get_session_username;
function get_sids(p_process in varchar2) return varchar2 is
cursor users_sids is
select sid,module,program
from v$session s
where s.process = p_process
or s.process like p_process || ':%';
result varchar2(1000);
begin
result := '';
for c in users_sids loop
if c.program = 'JDBC Thin Client' then
result := 'Web sessions';
else
if result is not null then
result := result || chr(10);
end if;
result := result || to_char(c.sid) || ' ' ||
nvl(c.module,'Main Menu');
end if;
end loop;
return result;
end;
--还有很多 见附件 。。。。。。
以上内容由PHP站长网【52php.cn】收集整理供大家参考研究 如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:应用网_阳江站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐

