[20211025]11g sequemce nocahe測試.txt
[20211025]11g sequemce nocahe測試.txt
--//上個星期我發現19c生產系統有幾個sequence開發給設定為nocache屬性.導致出現row cache lock.
--//當我單獨查詢該語句的等待事件時,出現一個我以前從來沒見過的row cache mutex的等待事件.
--//難道19c做了某些改進,在欄位管理上開始使用mutex.
--//我從來沒有在11g測試使用sequence nocache,使用ashtop看過相關等待,測試看看.
> @ prxx
==============================
PORT_STRING : x86_64/Linux 2.4.xx
VERSION : 19.0.0.0.0
BANNER : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
BANNER_FULL : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.9.0.0.0
BANNER_LEGACY : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
CON_ID : 0
PL/SQL procedure successfully completed.
> @ ashtop event,sql_id "event like '%row cache%' and sql_id='dg0ftvs2tm5an'" sysdate-1/24 sysdate
Total
Seconds AAS %This EVENT SQL_ID FIRST_SEEN LAST_SEEN
--------- ------- ------- ---------------- ------------- ------------------- -------------------
1755 45.0 99% | row cache lock dg0ftvs2tm5an 2021-10-22 15:02:30 2021-10-22 16:02:06
15 .4 1% | row cache mutex dg0ftvs2tm5an 2021-10-22 15:02:32 2021-10-22 16:02:06
--//row cache lock事件並且多了一個row cache mutex。
1.環境:
SCOTT@book> @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
create table job_times (sid number, time_ela number,method varchar2(20));
create sequence seq1 nocache;
SCOTT@book> @ ddl scott.seq1
C300
--------------------------------------------------------------------------------------------------------------------------------------------
CREATE SEQUENCE "SCOTT"."SEQ1" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE ;
$ cat m14.txt
set verify off
host sleep $(echo &&3/50 | bc -l )
variable vmethod varchar2(20);
exec :vmethod := '&&2';
insert into job_times values ( sys_context ('userenv', 'sid') ,dbms_utility.get_time ,:vmethod) ;
commit ;
declare
v_id number;
v_d date;
v_val VARCHAR2(1000);
l_count PLS_INTEGER;
begin
for i in 1 .. &&1 loop
--//select value into v_val from v$nls_parameters where parameter = 'NLS_CHARACTERSET';
--//select value into v_val from nls_database_parameters where parameter = 'NLS_CHARACTERSET';
--//select sql_text into v_val from v$sql where rownum=1;
SELECT /* &&3 */ seq1.NEXTVAL into v_id FROM DUAL;
end loop;
end ;
/
update job_times set time_ela = dbms_utility.get_time - time_ela where sid=sys_context ('userenv', 'sid') and method=:vmethod;
commit;
quit
2.測試:
--//我沒有想到這麼慢,在沒有開啟cache的情況下,只能減少併發數量以及迴圈次數1e4:
$ zzdate;seq 50 | xargs -I{} -P 50 sqlplus -s -l scott/book @m14.txt 1e4 P=50 {} 1 >/dev/null;zzdate
trunc(sysdate)+09/24+12/1440+14/86400 == 2021/10/25 09:12:14
trunc(sysdate)+09/24+14/1440+24/86400 == 2021/10/25 09:14:24
--//2*60+24-14 = 130
SYS@book> @ashtop event,sql_id "module='SQL*Plus' and username='SCOTT'" trunc(sysdate)+09/24+12/1440+14/86400 trunc(sysdate)+09/24+14/1440+24/86400
Total
Seconds AAS %This EVENT SQL_ID FIRST_SEEN LAST_SEEN
--------- ------- ------- ---------------------------------------- ------------- ------------------- -------------------
6288 48.4 97% | row cache lock 9cp836a3k67w2 2021-10-25 09:12:14 2021-10-25 09:14:23
152 1.2 2% | 9cp836a3k67w2 2021-10-25 09:12:14 2021-10-25 09:14:23
4 .0 0% | 2021-10-25 09:12:51 2021-10-25 09:14:21
2 .0 0% | a01fjfup7ruah 2021-10-25 09:12:52 2021-10-25 09:13:12
2 .0 0% | gxgnku5buj8cm 2021-10-25 09:13:51 2021-10-25 09:14:09
1 .0 0% | log file switch (checkpoint incomplete) 9cp836a3k67w2 2021-10-25 09:14:07 2021-10-25 09:14:07
1 .0 0% | 1mm9uymckm8z4 2021-10-25 09:12:28 2021-10-25 09:12:28
1 .0 0% | 24c64p3xa1hr5 2021-10-25 09:13:28 2021-10-25 09:13:28
1 .0 0% | 7b9znjngh150d 2021-10-25 09:13:17 2021-10-25 09:13:17
1 .0 0% | fsc8vbts8tu24 2021-10-25 09:12:26 2021-10-25 09:12:26
1 .0 0% | g2q7km1t9cdnj 2021-10-25 09:13:29 2021-10-25 09:13:29
1 .0 0% | gpa5h7jh3dg4d 2021-10-25 09:14:10 2021-10-25 09:14:10
1 .0 0% | gty6quqfxrgna 2021-10-25 09:13:39 2021-10-25 09:13:39
13 rows selected.
--//僅僅出現row cache lock 等待事件。
SYS@book> Select method,count(*),round(avg(TIME_ELA),0),sum(TIME_ELA) from scott.job_times group by method order by 3 ;
METHOD COUNT(*) ROUND(AVG(TIME_ELA),0) SUM(TIME_ELA)
-------------------- ---------- ---------------------- -------------
P=50 50 12924 646217
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2839138/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20211025]12g sequemce nocahe測試.txt
- [20211025]12c sequence nocache測試補充.txt
- [20201116]測試CURSOR_SPACE_FOR_TIME=false(11g).txtFalse
- [20220815]奇怪的隱式轉換問題(11g測試補充).txt
- [20210304]關於11g一致性讀取的測試.txt
- [20201130]11g or_expand提示.txt
- [20190306]11g health monitor.txt
- [20190219]那個更快(11g).txt
- [20220531]測試quiz night.txtUI
- [20211231]函式索引測試.txt函式索引
- [20201126]11g VPD的問題.txt
- [20220603]測試quiz night(補充).txtUI
- [20211012]測試遠端監聽.txt
- [20190423]oradebug peek測試指令碼.txt指令碼
- [20210218]xargs 與here doc測試.txt
- [20190416]exclusive latch測試指令碼.txt指令碼
- [20201210]11G ACS相關問題.txt
- Oracle 11g 測試停庫對job的影響Oracle
- [20191119]測試dbms_system.wait_for_event.txtAI
- [20020226]iptables PREROUTING POSTROUTING 應用測試.txt
- [20190301]簡單測試linux fsfreeze命令.txtLinux
- [20180627]測試bbed是否支援管道命令.txt
- [20180308]測試ARG_MAX引數.txt
- [20191211]11g streams_pool_size引數.txt
- [20190416]11g下那些latch是Exclusive的.txt
- [20190415]11g下那些latch是共享的.txt
- [20190214]11g Query Result Cache RC Latches.txt
- [20180928]如何能在11g下執行.txt
- [20241121]測試軟軟解析遇到的疑惑.txt
- [20220104]in list 幾種寫法效能測試.txt
- [20211013]測試遠端監聽補充.txt
- [20190502]查詢條件不等於測試.txt
- [20190423]簡單測試latch nowilling等待模式.txt模式
- [20190409]latch get 引數where and why測試.txt
- [20190225]測試如何使用dg快速主庫.txt
- [20181006]建立測試使用者scott.txt
- [20190211]簡單測試埠是否開啟.txt
- [20181112]11g 日誌傳輸壓縮模式.txt模式