ORACLE应用经验(2)
程序员文章站
2024-02-06 20:47:04
正在看的oracle教程是:oracle应用经验(2)。------谁正在访问数据库?select c.sid, c.serial#,c.username,a.object...
正在看的oracle教程是:oracle应用经验(2)。------谁正在访问数据库?
select c.sid, c.serial#,c.username,a.object_id,b.object_name,
c.program,c.status,d.name,c.osuser
from v$locked_object a,
all_objects b,
v$session c,
audit_actions d
where a.object_id=b.object_id
and a.session_id =c.sid(+)
and c.command=d.action;
alter system kill session '&1,&2';
select a.sid,a.serial#,a.username,a.status,a.program,b.name,a.osuser
from v$session a,audit_actions b
where a.command=b.action
and username='&1';
------谁被锁住?
select a.sid,a.serial#,a.username,a.lockwait,a.status,a.program,b.name
from v$session a,audit_actions b
where a.command=b.action
and lockwait is not null;
------谁在锁表?
select a.sid,a.serial#,a.username,a.lockwait,a.status,a.program,b.name
from v$session a,audit_actions b
where a.command=b.action
and status='active';
select sid, serial#, object_name, row_wait_block#,
row_wait_row#, row_wait_file#
from all_objects, v$session
where row_wait_obj#=object_id and type='user'
and lockwait is not null ;
select sl.username, sl.sid, sl.serial#
from v_$lock l1, v$session s1
where exists (select * from v_$lock l2, v$session s2
where l2.sid=s2.sid and l2.id1=l1
and s2.lockwait=l2.kaddr
and request=0
and l1.sid=s1.sid) ;
select count(*) from v$session;
select count(*) from sys.v_$process;
select count(*) from sys.v_$transaction;
zyp_35.98
------查看哪些包要固定
column owner format a10
select owner, name, type,
source_size+code_size+parsed_size+error_size bypes
from dba_object_size
where type='package body' order by 4 desc ;
------查看一个用户拥有哪些表空间的实体信息:
select tablespace_name, owner, segment_name,segment_type
from dba_segments
where owner-'sys'
and segment_type_-'rollback'
order by tablespace_name, owner, segment_name ;
break on owner on segment_name
column segment_name format a15
column tablespace_name format a15
column file_name format a20
select a.owner, a.segment_name, b.tablespace_name, b.file_name,
sum(a.bytes) bytes
from dba_extents a, dba_data_files b
where a.file_id-b.file_id group by a.owner, a.segment_name,
b.tablespace_name, b.file_name ;
------看内存缓冲区使用效率的指数是命中率hits:
hits=logical_reads/(logical_reads+physical_reads)
其中:logical_reads=db_block_gets+consistent_reads
select cur.value db, con.value con, phy.value phy,
(cur.value+con.value)/cur.value+con.value+phy.value)*100 hits
from v$sysstat cur, v$sysstat con, v$sysstat phy
where cur.name='db block gets' and
con.name='consistent gets' and
phy.name='physical reads' ;
------如何检测rollback segment竞争?
select class, count from v$waitstat
where class in
('system undo header', 'system undo block',
'undo header', 'undo block') ;
select sum(value) from v$sysstat where name in
('db block gets', 'consistents gets') ;
若count/sum(value)大于1%,则应考虑增加rollback segment
------查看有事务在哪几个回退段中:
column u format a15
column s format a15
column s 正在看的oracle教程是:oracle应用经验(2)。format a80
select osuser o, username u, segment_name s, sa.sql_text
from v$session s, v$transaction t, dba_rollback_segs r, v$sqlarea sa
where s.taddr=t.addr and t.sidusn=r.segmant_id(+)
and s.sql_address=sa.address(+) ;
select c.sid, c.serial#,c.username,a.object_id,b.object_name,
c.program,c.status,d.name,c.osuser
from v$locked_object a,
all_objects b,
v$session c,
audit_actions d
where a.object_id=b.object_id
and a.session_id =c.sid(+)
and c.command=d.action;
alter system kill session '&1,&2';
select a.sid,a.serial#,a.username,a.status,a.program,b.name,a.osuser
from v$session a,audit_actions b
where a.command=b.action
and username='&1';
------谁被锁住?
select a.sid,a.serial#,a.username,a.lockwait,a.status,a.program,b.name
from v$session a,audit_actions b
where a.command=b.action
and lockwait is not null;
------谁在锁表?
select a.sid,a.serial#,a.username,a.lockwait,a.status,a.program,b.name
from v$session a,audit_actions b
where a.command=b.action
and status='active';
select sid, serial#, object_name, row_wait_block#,
row_wait_row#, row_wait_file#
from all_objects, v$session
where row_wait_obj#=object_id and type='user'
and lockwait is not null ;
select sl.username, sl.sid, sl.serial#
from v_$lock l1, v$session s1
where exists (select * from v_$lock l2, v$session s2
where l2.sid=s2.sid and l2.id1=l1
and s2.lockwait=l2.kaddr
and request=0
and l1.sid=s1.sid) ;
select count(*) from v$session;
select count(*) from sys.v_$process;
select count(*) from sys.v_$transaction;
zyp_35.98
------查看哪些包要固定
column owner format a10
select owner, name, type,
source_size+code_size+parsed_size+error_size bypes
from dba_object_size
where type='package body' order by 4 desc ;
------查看一个用户拥有哪些表空间的实体信息:
select tablespace_name, owner, segment_name,segment_type
from dba_segments
where owner-'sys'
and segment_type_-'rollback'
order by tablespace_name, owner, segment_name ;
break on owner on segment_name
column segment_name format a15
column tablespace_name format a15
column file_name format a20
select a.owner, a.segment_name, b.tablespace_name, b.file_name,
sum(a.bytes) bytes
from dba_extents a, dba_data_files b
where a.file_id-b.file_id group by a.owner, a.segment_name,
b.tablespace_name, b.file_name ;
------看内存缓冲区使用效率的指数是命中率hits:
hits=logical_reads/(logical_reads+physical_reads)
其中:logical_reads=db_block_gets+consistent_reads
select cur.value db, con.value con, phy.value phy,
(cur.value+con.value)/cur.value+con.value+phy.value)*100 hits
from v$sysstat cur, v$sysstat con, v$sysstat phy
where cur.name='db block gets' and
con.name='consistent gets' and
phy.name='physical reads' ;
------如何检测rollback segment竞争?
select class, count from v$waitstat
where class in
('system undo header', 'system undo block',
'undo header', 'undo block') ;
select sum(value) from v$sysstat where name in
('db block gets', 'consistents gets') ;
若count/sum(value)大于1%,则应考虑增加rollback segment
------查看有事务在哪几个回退段中:
column u format a15
column s format a15
column s 正在看的oracle教程是:oracle应用经验(2)。format a80
select osuser o, username u, segment_name s, sa.sql_text
from v$session s, v$transaction t, dba_rollback_segs r, v$sqlarea sa
where s.taddr=t.addr and t.sidusn=r.segmant_id(+)
and s.sql_address=sa.address(+) ;
上一篇: ORACLE应用经验(1)
推荐阅读
-
Oracle11gR2 RAC
-
Oracle 11gR2 RAC环境重建ASM spfile
-
PHP应用分页显示制作详细讲解(2)_PHP教程
-
ORACLE11gr2 RAC安装实施规划
-
loadrunner连接数据库oracle脚本 博客分类: 02-loadrunner脚本部分经验总结 IT性能
-
loadrunner连接数据库oracle脚本 博客分类: 02-loadrunner脚本部分经验总结 IT性能
-
Oracle中from中子查询实例应用
-
Oracle数据库安全策略分析(一)第1/2页
-
ca粗略配置 博客分类: Struts2&Webwork2Jsp/Servlet 应用服务器
-
ca粗略配置 博客分类: Struts2&Webwork2Jsp/Servlet 应用服务器