[分享]表和索引的并发深度报告_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4186 | 回复: 0   主题: [分享]表和索引的并发深度报告        下一篇 
guoqiang
注册用户
等级:上士
经验:252
发帖:26
精华:0
注册:2012-4-12
状态:离线
发送短消息息给guoqiang 加好友    发送短消息息给guoqiang 发消息
发表于: IP:您无权察看 2012-4-12 9:58:58 | [全部帖] [楼主帖] 楼主

表和索引的并发深度报告

目的:

为DBA提供一些脚本去检查表和索引上的并发深度

适用范围和应用

数据库管理员,研发人员和架构分析师

检查脚本

系统有多少个CPU,默认的并发深度是Default = parallel_threads_per_cpu * cpu_count。可以通过select substr(name,1,30) Name , substr(value,1,5) Value from v$parameter where name in ('parallel_threads_per_cpu' , 'cpu_count' );获得系统中并发深度,系统CPU个数。

通常情况下DOP:=degree*instances。看下面的笔记得到更精确的算法公式。在NOTE 260845中可以看到老的和新的设置并发深度的语法。

Sql select * from (
select substr(owner,1,15) Owner , ltrim(degree) Degree,
ltrim(instances) Instances,
count(*) "Num Tables" , 'Parallel'
from all_tables
where ( trim(degree) != '1' and trim(degree) != '0' ) or
( trim(instances) != '1' and trim(instances) != '0' )
group by owner, degree , instances
union
select substr(owner,1,15) owner , '1' , '1' ,
count(*) , 'Serial'
from all_tables
where ( trim(degree) = '1' or trim(degree) != '0' ) and
( trim(instances) != '1' or trim(instances) != '0' )
group by owner
)


order by owner;          可以查看系统中用户拥有的表个数和表的不同并发深度设置

Sql select * from (
select substr(owner,1,15) Owner ,
substr(trim(degree),1,7) Degree ,
substr(trim(instances),1,9) Instances ,
count(*) "Num Indexes",
'Parallel'
from all_indexes
where ( trim(degree) != '1' and trim(degree) != '0' ) or
( trim(instances) != '1' and trim(instances) != '0' )
group by owner, degree , instances
union
select substr(owner,1,15) owner , '1' , '1' ,
count(*) , 'Serial'
from all_indexes
where ( trim(degree) = '1' or trim(degree) != '0' ) and
( trim(instances) != '1' or trim(instances) != '0' )
group by owner
)


order by owner;          查看系统中用户拥有的索引个数和索引的不同并发深度设置

有索引的表有不同的并发深度,下面的sql语句可能会执行一段时间

Sql set lines 150
select substr(t.owner,1,15) Owner ,
t.table_name ,
substr(trim(t.degree),1,7) Degree ,
substr(trim(t.instances),1,9) Instances,
i.index_name ,
substr(trim(i.degree),1,7) Degree ,
substr(trim(i.instances),1,9) Instances
from all_indexes i,
all_tables t
where ( trim(i.degree) != trim(t.degree) or
trim(i.instances) != trim(t.instances) ) and
i.owner = t.owner and


i.table_name = t.table_name;         检索用户名称,表名,深度,实例个数,索引名称




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论