如何测试Oracle并行执行的并行度状况
如何测试Oracle并行执行的并行度状况:
可以通过如下的脚本,来查看要求的并行度,和实际获得的并行度。
脚本来自:
http://askdba.org/weblog/forums/topic/query-to-identify-parallel-slaves/
col username for a12
col module for a10 trunc
col state for a20
col "QC SID" for A6
col SID for a10
col "QC/Slave" for A10
col "ReqDOP" for 999
col "ActDOP" for 999
col "slave set" for A10
col event for a25 trunc
col action for a20 trunc
col p1text for a20 trunc
col secwait for 99999
col state for a10 trunc
col object for a25 trunc
col command for a15 trunc
set pages 300 lines 300
select
s.inst_id,
decode(px.qcinst_id,NULL,s.username,
' - '||lower(substr(s.program,length(s.program)-4,4) ) ) "Username",
decode(px.qcinst_id,NULL, 'QC', '(Slave)') "QC/Slave" ,
to_char( px.server_set) "Slave Set",
to_char(s.sid) "SID",
decode(px.qcinst_id, NULL ,to_char(s.sid) ,px.qcsid) "QC SID",
px.req_degree "Requested DOP",
px.degree "Actual DOP",s.module,s.sql_id,s.event,s.status
from
gv$px_session px,
gv$session s
where
px.sid=s.sid (+) and
px.serial#=s.serial# and
px.inst_id = s.inst_id
order by 2 desc;
在Oracel 11.2.0.4进行实际测试,有效。
实际例子:
$cat q00.sql
col username for a12
col module for a10 trunc
col state for a20
col "QC SID" for A6
col SID for a10
col "QC/Slave" for A10
col "ReqDOP" for 999
col "ActDOP" for 999
col "slave set" for A10
col event for a25 trunc
col action for a20 trunc
col p1text for a20 trunc
col secwait for 99999
col state for a10 trunc
col object for a25 trunc
col command for a15 trunc
set pages 300 lines 300
select
s.inst_id,
decode(px.qcinst_id,NULL,s.username,
' - '||lower(substr(s.program,length(s.program)-4,4) ) ) "Username",
decode(px.qcinst_id,NULL, 'QC', '(Slave)') "QC/Slave" ,
to_char( px.server_set) "Slave Set",
to_char(s.sid) "SID",
decode(px.qcinst_id, NULL ,to_char(s.sid) ,px.qcsid) "QC SID",
px.req_degree "Requested DOP",
px.degree "Actual DOP",s.module,s.sql_id,s.event,s.status
from
gv$px_session px,
gv$session s
where
px.sid=s.sid (+) and
px.serial#=s.serial# and
px.inst_id = s.inst_id
order by 2 desc;
==============================
设置参数:
alter system set PARALLEL_MIN_TIME_THRESHOLD=1 scope=spfile;
alter system set PARALLEL_DEGREE_POLICY=auto scope=spfile;
shu immediate
startup
===================================
通过别的Session,查看状况: <<<<<<<<<<<<<<Requested DOP = 6 、 Actual DOP =6
SQL>@q00.sql
INST_ID Username QC/Slave Slave Set SID QC SID Requested DOP Actual DOP MODULE SQL_ID EVENT STATUS
---------- ------------ ---------- ---------- ---------- ------ ------------- ---------- ---------- -------------------- ------------------------- ------------------------
1 U1 QC 125 125 SQL*Plus 9y3cpa2z9r4zw SQL*Net message from clie INACTIVE
1 - p011 (Slave) 2 19 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p010 (Slave) 2 144 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p009 (Slave) 2 33 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p008 (Slave) 2 142 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p007 (Slave) 2 20 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p006 (Slave) 2 139 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p005 (Slave) 1 18 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p004 (Slave) 1 29 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p003 (Slave) 1 143 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p002 (Slave) 1 141 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p001 (Slave) 1 21 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p000 (Slave) 1 140 125 6 6 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
13行が選択されました。
SQL>
===================================
修改session 级别并行度,再次确认:
alter session force parallel query parallel 3;
select * from dba_segments,dba_extents;
===================================
通过别的Session,查看状况: <<<<< Requested DOP =3 Actual DOP =3
SQL>@q00.sql
INST_ID Username QC/Slave Slave Set SID QC SID Requested DOP Actual DOP MODULE SQL_ID EVENT STATUS
---------- ------------ ---------- ---------- ---------- ------ ------------- ---------- ---------- -------------------- ------------------------- ------------------------
1 U1 QC 125 125 SQL*Plus 9y3cpa2z9r4zw SQL*Net message from clie INACTIVE
1 - p005 (Slave) 2 20 125 3 3 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p004 (Slave) 2 21 125 3 3 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p003 (Slave) 2 144 125 3 3 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p002 (Slave) 1 140 125 3 3 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p001 (Slave) 1 19 125 3 3 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p000 (Slave) 1 148 125 3 3 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
SQL>
===================================
修改session 级别并行度,再次确认:
alter session force parallel query parallel 8;
select * from dba_segments,dba_extents;
===================================
通过别的Session,查看状况: <<<<< Requested DOP = 8 Actual DOP =8
INST_ID Username QC/Slave Slave Set SID QC SID Requested DOP Actual DOP MODULE SQL_ID EVENT STATUS
---------- ------------ ---------- ---------- ---------- ------ ------------- ---------- ---------- -------------------- ------------------------- ------------------------
1 U1 QC 125 125 SQL*Plus 9y3cpa2z9r4zw SQL*Net message from clie INACTIVE
1 - p015 (Slave) 2 153 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p014 (Slave) 2 23 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p013 (Slave) 2 154 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p012 (Slave) 2 29 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p011 (Slave) 2 18 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p010 (Slave) 2 141 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p009 (Slave) 2 33 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p008 (Slave) 2 142 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq: Execution Msg INACTIVE
1 - p007 (Slave) 1 31 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p006 (Slave) 1 139 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p005 (Slave) 1 21 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p004 (Slave) 1 20 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p003 (Slave) 1 144 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p002 (Slave) 1 148 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p001 (Slave) 1 26 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
1 - p000 (Slave) 1 143 125 8 8 SQL*Plus 9y3cpa2z9r4zw PX Deq Credit: send blkd ACTIVE
SQL>
如何测试Oracle并行执行的并行度状况的更多相关文章
- Oracle并行执行特性应用初探
1. 序 在历史数据转出测试过程中,通过不断的优化,包括SQL调整和数据库调整,从AWR中看到,基本上难以进行更多的性能提升,于是准备试试并行执行的特性,从这个任务的特点来分析,也比较适合采 ...
- 测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程
测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程 最近系统出现问题,由于数据库产生的日志量太大无法开启归档模式,导致offline的 ...
- windows下怎样测试oracle安装是否成功以及在oracle中创建用户并赋予用户权限;和[Err] ORA-65096: 公用用户名或角色名无效的解决方案
测试oracle数据安装是否成功,可按顺序执行以下两个步骤: 测试步骤 1:请执行操作系统级的命令:tnsping orcl 上述命令假定全局数据库名是 orcl.以下是命令执行后的示例(请在cmd命 ...
- 如何取得Oracle并行执行的trace
如何取得Oracle并行执行的trace: ALTER SESSION SET tracefile_identifier='10046_PROD';ALTER SESSION SET max_dump ...
- LoadRunner调用java函数测试oracle
LoadRunner调用java函数测试oracle 测试oracle的方法有很多,可以使用loadrunner的oracle协议直接调用oracle进行测试,也可以调用开发的java程序对oracl ...
- 测试oracle数据库的脱机备份和恢复
环境:windows7.Oracle11g 一.脱机备份 脱机备份是指在数据库关闭情况下的数据备份,也称为冷备份. 在书上学到的备份步骤: 1.记录所要备份数据库文件所在的操作系统路径: 2.关闭数据 ...
- 测试oracle表空间自动扩展
2019-04-1116:01:25 表空间分配10m自动扩展,向表中插入数据,看表空间达到10m以后是否会报错. 测试过程如下: 1.创建表空间 CREATE TABLESPACE TEST DAT ...
- 启动和测试oracle是否安装成功
转自:https://www.cnblogs.com/justdo-it/articles/5112576.html 测试步骤1:请执行操作系统级的命令:tnsping orcl 测试步骤 2:请执行 ...
- Windows 10 64位操作系统 下安装、配置、启动、登录、连接测试oracle 11g
一.下载oracle安装包 1:详细下载安装版本可见官网:https://www.oracle.com/technetwork/database/enterprise-edition/download ...
随机推荐
- Android手机上,利用bat脚本模拟用户操作
………… 那么你就可以来看看这篇帖子了. 言归正传 利用bat脚本模拟用户操作,需要用到两点: ①就是adb命令了,adb命令可以用来模拟用户在手机上的操作 ②bat语言,就是批处理语言,主要用来进行 ...
- Python Django框架笔记(四):数据分页和CSRF跨站点请求伪造
(一)数据分页 可以参考 https://docs.djangoproject.com/en/2.0/topics/pagination/ 模板:如果只要显示 1.2.3.4.5.6....的话, ...
- AWS CSAA -- 04 AWS Object Storage and CDN - S3 Glacier and CloudFront(三)
021 Storage Gateway 022 Snowball 023 Snowball - Lab 024 S3 Transfer Acceleration
- She Left Her Shoes
She left her shoes, she took everything else, her toothbrush, her clothes, and even that stupid litt ...
- python的函数(三)
1,函数多类型传值和冗余参数 2,递归函数 1,函数多类型传值和冗余参数 1.0,函数多类型传值 定义1个函数, def fun(x,y): return x+y 调用该函数print fun(1,2 ...
- python数据类型之间的转换
1,字符串转整型,前提条件是该字符串为纯数字. a = '1' a = int(a) 2,整型转字符串 a= 1 a = str(a) 3,整型转浮点型 a = 1 a = float(a) 4,浮点 ...
- 【转】Nginx学习---Nginx&&Redis&&hcache三层缓存架构总结
[原文]https://www.toutiao.com/i6594307974817120782/ 摘要: 对于高并发架构,毫无疑问缓存是最重要的一环,对于大量的高并发,可以采用三层缓存架构来实现,n ...
- 使用 jekyll + github pages 搭建个人博客
1. 新建 github.io 项目 其实 github pages 有两个用途,大家可以在官方网页看到.其中一个是作为个人/组织的主页(每个账号只能有一个),另一个是作为 github 项目的项目主 ...
- 【转】Python操作MongoDB数据库
前言 MongoDB GUI 工具 PyMongo(同步) Motor(异步) 后记 前言 最近这几天准备介绍一下 Python 与三大数据库的使用,这是第一篇,首先来介绍 MongoDB 吧,,走起 ...
- libco协程库上下文切换原理详解
缘起 libco 协程库在单个线程中实现了多个协程的创建和切换.按照我们通常的编程思路,单个线程中的程序执行流程通常是顺序的,调用函数同样也是 “调用——返回”,每次都是从函数的入口处开始执行.而li ...