如何测试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并行执行的并行度状况的更多相关文章

  1. Oracle并行执行特性应用初探

    1.      序 在历史数据转出测试过程中,通过不断的优化,包括SQL调整和数据库调整,从AWR中看到,基本上难以进行更多的性能提升,于是准备试试并行执行的特性,从这个任务的特点来分析,也比较适合采 ...

  2. 测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程

    测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程 最近系统出现问题,由于数据库产生的日志量太大无法开启归档模式,导致offline的 ...

  3. windows下怎样测试oracle安装是否成功以及在oracle中创建用户并赋予用户权限;和[Err] ORA-65096: 公用用户名或角色名无效的解决方案

    测试oracle数据安装是否成功,可按顺序执行以下两个步骤: 测试步骤 1:请执行操作系统级的命令:tnsping orcl 上述命令假定全局数据库名是 orcl.以下是命令执行后的示例(请在cmd命 ...

  4. 如何取得Oracle并行执行的trace

    如何取得Oracle并行执行的trace: ALTER SESSION SET tracefile_identifier='10046_PROD';ALTER SESSION SET max_dump ...

  5. LoadRunner调用java函数测试oracle

    LoadRunner调用java函数测试oracle 测试oracle的方法有很多,可以使用loadrunner的oracle协议直接调用oracle进行测试,也可以调用开发的java程序对oracl ...

  6. 测试oracle数据库的脱机备份和恢复

    环境:windows7.Oracle11g 一.脱机备份 脱机备份是指在数据库关闭情况下的数据备份,也称为冷备份. 在书上学到的备份步骤: 1.记录所要备份数据库文件所在的操作系统路径: 2.关闭数据 ...

  7. 测试oracle表空间自动扩展

    2019-04-1116:01:25 表空间分配10m自动扩展,向表中插入数据,看表空间达到10m以后是否会报错. 测试过程如下: 1.创建表空间 CREATE TABLESPACE TEST DAT ...

  8. 启动和测试oracle是否安装成功

    转自:https://www.cnblogs.com/justdo-it/articles/5112576.html 测试步骤1:请执行操作系统级的命令:tnsping orcl 测试步骤 2:请执行 ...

  9. Windows 10 64位操作系统 下安装、配置、启动、登录、连接测试oracle 11g

    一.下载oracle安装包 1:详细下载安装版本可见官网:https://www.oracle.com/technetwork/database/enterprise-edition/download ...

随机推荐

  1. java持有对象【2】ArrayList容器续解

    此为JDK API1.6.0对ArrayList的解释. ArrayList 使用java泛型创建类很复杂,但是应用预定义的泛型很简单.例如,要想定义用来保存Apple对象的ArrayList,可以声 ...

  2. leveldb源码阅读

    http://blog.csdn.net/sparkliang/article/details/8567602 http://brg-liuwei.github.io/tech/2014/10/15/ ...

  3. commons-pool 解析

    首先抛出个常见的长连接问题: 1  都知道连接MySQL的应用中大多会使用框架例如 c3p0 ,dbcp proxool 等来管理数据库连接池. 数据库连接池毫无疑问都是采用长连接方式. 那么MySQ ...

  4. 【SVN】Linux下svn搭建配置全过程——初学者轻松上手篇

    版本控制主要用到的是git和svn,其中svn界面化使用操作简单,本篇简单介绍SVN搭建配置全过程. 1. 下载并安装 yum install subversion 查看版本 svnserve --v ...

  5. [Hive_2] Hive 的安装&配置

    0. 说明 在安装好 Hadoop 集群和 ZooKeeper 分布式的基础上装好 MySQL,再进行 Hive 安装配置 1. 安装 1.1 将 Hive 安装包通过 Xftp 发送到 /home/ ...

  6. python is、==区别;with;gil;python中tuple和list的区别;Python 中的迭代器、生成器、装饰器

    1. is 比较的是两个实例对象是不是完全相同,它们是不是同一个对象,占用的内存地址是否相同 == 比较的是两个对象的内容是否相等 2. with语句时用于对try except finally 的优 ...

  7. 图解:图形下控制台中weblogic9.2多池配置为oracle集群RAC

    update: 这个东西如果配置不顺利的话:应用请求数据库的时候,会打印类似这样的错误: :open connection err Pool connect failed : weblogic.com ...

  8. filebeat配置

    filebeat收集日志配置: filebeat.prospectors: - input_type: log enabled: true paths: - /mydata/erp_datacente ...

  9. 前端:background 设置

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. 分布式计算(一)Ubuntu搭建Hadoop分布式集群

    最近准备接触分布式计算,学习分布式计算的技术栈和架构知识.目前的分布式计算方式大致分为两种:离线计算和实时计算.在大数据全家桶中,离线计算的优秀工具当属Hadoop和Spark,而实时计算的杰出代表非 ...