几个日常巡检 监控数据库的语句
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 04:50 点击:次
查看数据库表空间语句==========================================================================================================
select df.tablespace_name "表空间名",totalspace "总空间M",freespace "剩余空间M",round((1-freespace/totalspace)*100,2) "使用率%"
from
(select tablespace_name,round(sum(bytes)/1024/1024) totalspace
from dba_data_files
group by tablespace_name) df,
(select tablespace_name,round(sum(bytes)/1024/1024) freespace
from dba_free_space
group by tablespace_name) fs
where df.tablespace_name=fs.tablespace_name;
查询长时间运行的SQL
select username,sid,opname,
round(sofar*100 / totalwork,0) || % as progress,
time_remaining,sql_text
from v$session_longops , v$sql
where time_remaining <> 0
and sql_address = address
and sql_hash_value = hash_value;
查锁的状态:
select * from v$locked_object;
select df.tablespace_name "表空间名",totalspace "总空间M",freespace "剩余空间M",round((1-freespace/totalspace)*100,2) "使用率%"
from
(select tablespace_name,round(sum(bytes)/1024/1024) totalspace
from dba_data_files
group by tablespace_name) df,
(select tablespace_name,round(sum(bytes)/1024/1024) freespace
from dba_free_space
group by tablespace_name) fs
where df.tablespace_name=fs.tablespace_name;
查询长时间运行的SQL
select username,sid,opname,
round(sofar*100 / totalwork,0) || % as progress,
time_remaining,sql_text
from v$session_longops , v$sql
where time_remaining <> 0
and sql_address = address
and sql_hash_value = hash_value;
查锁的状态:
select * from v$locked_object;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>