免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Oralce 檢查表和索引的并行度 DOP 腳本

數(shù)據(jù)庫的并行度使用需要很謹(jǐn)慎,很容易造成數(shù)據(jù)庫運(yùn)行緩慢以及嚴(yán)重的等待。

比較常見的由于 并行度 設(shè)置錯(cuò)誤導(dǎo)致的等待事件:

  • PX Deq Credit: send blkd
  • PX Deq Credit: need buffer

錯(cuò)誤的并行度設(shè)置往往可能是由于在創(chuàng)建索引或者重建索引時(shí)開啟并行度創(chuàng)建,后來忘記關(guān)閉導(dǎo)致!

create index <indexname> on <table><columns>) parallel 4;
alter index <indexname> rebuild parallel 4;

? 使用并行度設(shè)置后的正確操作:

alter index <indexname> noparallel;

當(dāng)我們遇到這樣的等待事件很嚴(yán)重時(shí),可以使用下方腳本快速查看是否存在不正確的并行度設(shè)置!

📢 注意: 以下腳本已經(jīng)過內(nèi)部測(cè)試,但是,不保證它對(duì)您有用。確保在使用前在測(cè)試環(huán)境中運(yùn)行它。

該 SQL 查詢當(dāng)前數(shù)據(jù)庫主機(jī) CPU 數(shù)以及每個(gè) CPU 默認(rèn)的并行度:

col name format a30
col value format a20
Rem How many CPU does the system have?
Rem Default degree of parallelism is
Rem Default = parallel_threads_per_cpu * cpu_count
Rem -------------------------------------------------;
select substr(name,1,30) Name , substr(value,1,5) Value
from v$parameter
where name in ('parallel_threads_per_cpu' , 'cpu_count' );

該 SQL 檢查當(dāng)前數(shù)據(jù)庫中所有用戶中存在不同并行度的

set pagesize1000
col owner format a30
col degree format a10
col instances format a10
Rem Normally DOP := degree * Instances
Rem See the following Note for the exact formula.
Rem Note:260845.1 Old and new Syntax for setting Degree of Parallelism
Rem How many tables a user have with different DOPs
Rem -------------------------------------------------------;
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;

📢 注意: 如果查詢出 Parallel 列的值為 Serial 就證明并行度都是 1,為正常。

該 SQL 檢查當(dāng)前數(shù)據(jù)庫中所有用戶中存在不同并行度的 索引

set pagesize1000
Rem How many indexes a user have with different DOPs
Rem ---------------------------------------------------;
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;

📢 注意: 如果查詢出 Parallel 列的值為 Serial 就證明并行度都是 1,為正常。

該 SQL 檢查具有不同 DOP 的索引的表:

col table_name format a35
col index_name format a35
Rem Tables that have Indexes with not the same DOP
Rem !!!!! This command can take some time to execute !!!
Rem ---------------------------------------------------;
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;

📢 注意:查詢結(jié)果為空代表沒有不同 DOP 的索引的表,正常。

本文的腳本來自于 MOS:

Script to Report the Degree of Parallelism DOP on Tables and Indexes (Doc ID 270837.1)

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Managing Application Thread Use
[Laskey99] 13.2. SQL Command Syntax
SQL Server DB 基于多核CPU的設(shè)置
[Oracle 故障處理]記一次大事務(wù)回滾導(dǎo)致的數(shù)據(jù)庫奇慢
倒序取字符串函數(shù)
一條SQL語句究竟會(huì)產(chǎn)生多少個(gè)并行進(jìn)程? | Oracle官方博客
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服