包括了: 查正在运行的SQL语句, 某个服务中的session 表空间管理 锁状态 数据库中当前活跃用户信息 。。。。 这些代码来至于dbadmin 项目 是一个美国的DBA 写的 不错,在googlde code中的 有 PL/SQL DBA g_sid v$session.SID%type := ‘-1’; g_serial# v$sess
包括了:
查正在运行的SQL语句,
某个服务中的session
表空间管理
锁状态
数据库中当前活跃用户信息
。。。。
这些代码来至于dbadmin 项目 是一个美国的DBA 写的 不错,在googlde code中的 有
PL/SQL DBA <style> .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;} .CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;} .CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;} .CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;} .CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;} .CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;} </style> <!—ecms
- –> <!—ecms
- $velocityCount
–> <!—ecms
–>
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 := r<div>本文来源gaodai.ma#com搞##代!^码@网3</div>esult || chr(10); end if; result := result || to_char(c.sid) || ' ' || nvl(c.module, 'Main Menu'); end if; end loop; return result; end;--还有很多 见附件 。。。。。。