sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 运维DBA >

【学习笔记】Oracle进程调度策略优先级 high_priority_processes案例

时间:2016-10-27 21:51   来源:Oracle研究中心   作者:HTZ   点击:

天萃荷净 分享一篇关于Oracle数据库进程调度策略优先级的测试文章,关于参数high_priority_processes的使用案例。

1,测试环境

oracleplus.net> !lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 4.8 (Tikanga)
Release: 4.8
Codename: Tikanga

oracleplus.net> select * from v$version where rownum<3;

BANNER
—————————————————————-
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 – 64bi
PL/SQL Release 10.2.0.5.0 – Production

2,数据库中修改指定进程的调度策略

linux环境中进程调度的策略有如下几种:
普通的分时策略 TS SCHED_OTHER
实时FIFO的策略 FF SCHED_FIFO
实时时间片策略 RR SCHED_RR
普通批处理策略 B SCHED_BATCH
下面lgwr为例在数据库中修改进程的调度策略
[root@oracleplus.net ~]#ps -Acfl|head -1;ps -Acfl|grep lgwr
F S UID PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22959 1 TS 24 – 70706 – Jul17 00:00:00 asm_lgwr_+ASM
0 S oracle 26054 1 TS 41 – 190806 – 05:26 00:00:00 ora_lgwr_asm10g
0 R root 26227 26114 TS 21 – 15296 – 05:53 pts/4 00:00:00 grep lgwr

oracleplus.net> alter system set "_high_priority_processes"="LMS*|LGWR" scope=spfile;

System altered.

oracleplus.net> startup force;
ORACLE instance started.

Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 163580992 bytes
Database Buffers 427819008 bytes
Redo Buffers 6287360 bytes
Database mounted.
Database opened.
oracleplus.net> show parameter high

NAME TYPE
———————————— ———–
VALUE
——————————
_high_priority_processes string
LMS*|LGWR

[root@oracleplus.net ~]#ps -Acfl|head -1;ps -Acfl|grep lgwr
F S UID PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22959 1 TS 24 – 70706 – Jul17 00:00:00 asm_lgwr_+ASM
0 S oracle 26054 1 RR 41 – 190806 – 05:26 00:00:00 ora_lgwr_asm10g
0 R root 26227 26114 TS 21 – 15296 – 05:53 pts/4 00:00:00 grep lgwr
这里可以看到lgwr的调试策略已经更改为RR模式。

3,操作系统更改进程调度模式

在操作以上面我们也可以通过chrt来更改进程的调度模式,不过只能在root用户下面执行,下面以dbw为例
[root@oracleplus.net ~]#chrt -r -p 1 26052

[root@oracleplus.net ~]#ps -Afl|head -1;ps -Afl|grep dbw
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22957 1 0 75 0 – 71540 – Jul17 00:00:00 asm_dbw0_+ASM
0 S oracle 26052 1 0 58 – – 186310 – 05:26 00:00:00 ora_dbw0_asm10g
0 R root 26555 26114 0 79 0 – 15296 – 06:42 pts/4 00:00:00 grep dbw

[root@oracleplus.net ~]#ps -Afcl|head -1;ps -Afcl|grep dbw
F S UID PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22957 1 TS 24 – 71540 – Jul17 00:00:00 asm_dbw0_+ASM
0 S oracle 26052 1 RR 41 – 186310 – 05:26 00:00:00 ora_dbw0_asm10g
0 R root 26559 26114 TS 20 – 15296 – 06:42 pts/4 00:00:00 grep dbw

下面将dbw进程调度模式从RR更改TS

[root@oracleplus.net ~]#chrt –other -p 0 26052
[root@oracleplus.net ~]#ps -Afcl|head -1;ps -Afcl|grep dbw
F S UID PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22957 1 TS 24 – 71540 – Jul17 00:00:00 asm_dbw0_+ASM
0 S oracle 26052 1 TS 29 – 186310 – 05:26 00:00:00 ora_dbw0_asm10g
0 R root 26586 26114 TS 20 – 15296 – 06:47 pts/4 00:00:00 grep db

4,renice更改进程优先级

renice只能在root用户下才能提高进程优先级,普通用户下只能降低进程的优化先级
下面两样以dbw进程为例

[root@oracleplus.net ~]#ps -Afcl|head -1;ps -Afcl|grep dbw
F S UIDOracleо PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22957 1 TS 24 – 71540 – Jul17 00:00:00 asm_dbw0_+ASM
0 S oracle 26052 1 TS 29 – 186310 – 05:26 00:00:00 ora_dbw0_asm10g
0 R root 26532 26114 TS 20 – 15296 – 06:37 pts/4 00:00:00 grep dbw
[root@oracleplus.net ~]#ps -Afl|head -1;ps -Afl|grep dbw
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22957 1 0 75 0 – 71540 – Jul17 00:00:00 asm_dbw0_+ASM
0 S oracle 26052 1 0 75 0 – 186310 – 05:26 00:00:00 ora_dbw0_asm10g
0 R root 26522 26114 0 79 0 – 15296 – 06:36 pts/4 00:00:00 grep dbw

这里看到DBW进程的调度策略为TS,NI的值为0,下面我们将NI的更改为–5

[root@oracleplus.net ~]#renice -5 -p 26052
26052: old priority 0, new priority -5
[root@oracleplus.net ~]#ps -Afl|head -1;ps -Afl|grep dbw
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22957 1 0 75 0 – 71540 – Jul17 00:00:00 asm_dbw0_+ASM
0 S oracle 26052 1 0 70 -5 – 186310 – 05:26 00:00:00 ora_dbw0_asm10g

这里看到renice已经修改成功。
不过这里需要注意的是,renice修改进程的调试模式为RR时,提示修改成功,但是使用命令无法查看。

[root@oracleplus.net ~]#ps -Afcl|head -1;ps -Afcl|grep lgw
F S UID PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22959 1 TS 24 – 70706 – Jul17 00:00:00 asm_lgwr_+ASM
0 S oracle 26054 1 RR 80 – 190806 – 05:26 00:00:00 ora_lgwr_asm10g
0 R root 26541 26114 TS 20 – 15296 – 06:39 pts/4 00:00:00 grep lgw

[root@oracleplus.net ~]#renice -5 -p 26054
26054: old priority -5, new priority -5

[root@oracleplus.net ~]#ps -Afl|head -1;ps -Afl|grep lgw
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
0 S oracle 22959 1 0 75 0 – 70706 – Jul17 00:00:00 asm_lgwr_+ASM
0 S oracle 26054 1 0 19 – – 190806 – 05:26 00:00:00 ora_lgwr_asm10g
0 R root 26546 26114 0 79 0 – 15296 – 06:40 pts/4 00:00:00 grep lgw

本文固定链接: http://www.htz.pw/2014/07/18/linux%e7%8e%af%e5%a2%83oracle%e8%bf%9b%e7%a8%8b%e8%b0%83%e5%ba%a6%e7%ad%96%e7%95%a5%e4%b8%8e%e4%bc%98%e5%85%88%e7%ba%a7.html | 认真就输

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle进程调度策略优先级 high_priority_processes案例

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1085.html

Oracle研究中心

关键词:

Oracle high_priority_processes使用案例

ORACLE进程调度策略与优先级