表 ,索引的 degree 检查, trim(degree) default INSTANCES

检查degree >1 的

select substr(owner,1,15) Owner , ltrim(degree) Degree,
ltrim(instances) Instances,
count(*) "Num Tables" , 'Parallel'
from dba_tables
where ( trim(degree) > '1'   )   
and table_name not like 'ET$%'
group by owner, degree , instances 
order by owner;

--select *from dba_tables where ( trim(degree) > '1'   )   


 
select substr(owner,1,15) Owner ,
substr(trim(degree),1,7) Degree ,
substr(trim(instances),1,9) Instances ,
count(*) "Num Indexes",
'Parallel'
from dba_indexes
where ( trim(degree) > '1'   ) or
( trim(instances) != '1' and trim(instances) != '0' )
group by owner, degree , instances 
order by owner;

 
--select *  from dba_indexes where ( trim(degree) > '1'   ) or ( trim(instances) != '1' and trim(instances) != '0' )
alter index  xxx noparallel  change default to 1

----------------- degree default

For index maintenance (online rebuild). The session level degree of parallelism was altered to a higher value.

Alter session force parallel DDL parallel 12;

Alter session force parallel Query parallel 12;

Alter session force parallel DML parallel 12;

ALTER INDEX index_name rebuild ONLINE;

QUESTION : After the above maintenance, the index DOP is reflecting 12 instead of the default.

Is this an expected behavior ?

CHANGES

CAUSE

 This is expected behavior.

SOLUTION

FORCE Clause

FORCE forces parallel execution of subsequent statements in the session. If no parallel clause or hint is specified, then a default degree of parallelism is used. This clause overrides any parallel_clause specified in subsequent statements in the session but is overridden by a parallel hint.

DML: Provided no parallel DML restrictions are violated, subsequent DML statements in the session are executed with the default degree of parallelism, unless a degree is specified in this clause.

DDL: Subsequent DDL statements in the session are executed with the default degree of parallelism, unless a degree is specified in this clause. Resulting database objects will have associated with them the prevailing degree of parallelism. >>>>>>>>>>>>>>

Specifying FORCE DDL automatically causes all tables created in this session to be created with a default level of parallelism. The effect is the same as if you had specified the parallel_clause (with the default degree) in the CREATE TABLE statement.

QUERY: Subsequent queries are executed with the default degree of parallelism, unless a degree is specified in this clause.

--------------------

This article has been written to explain the formula to compute the new default value for the Database parameter  PARALLEL_MAX_SERVERS in 11.2.0.2 and above.

DETAILS

With 11.2.0.2 & above, there is a new method to compute the default for PARALLEL_MAX_SERVERS.


In the Oracle Rdbms Reference Guide we find:

parallel_max_servers = PARALLEL_THREADS_PER_CPU * CPU_COUNT * concurrent_parallel_users * 5

In the formula, the value assigned to concurrent_parallel_users running at the default degree of parallelism on an 

instance is dependent on the memory management setting. 

 - If automatic memory management is disabled (manual mode), then the value of concurrent_parallel_users is 1. 

 - If PGA automatic memory management is enabled, then the value of concurrent_parallel_users is 2. 

 - If global memory management or SGA memory target is used in addition to PGA automatic memory management, 

   then the value of concurrent_parallel_users is 4.

The value is capped by processes -15 (this is true for versions prior 11.2.0.2 as well).

As example we have the following values

parallel_threads_per_cpu  = 2
cpu_count                 = 4
pga_aggregate_target      = 500M
sga_target                = 900M
processes                 = 150

parallel_max_servers = 2 * 4 * 4 * 5 = 160
parallel_max_servers = min( 150-15 , 160 ) = 135

So with these values we get a default of 135 for parallel_max_servers.

Note if the parallel_max_servers is reduced due to value of processes, then you see similar to the following in alert log (e.g. at instance start up):

Mon May 06 18:43:06 2013
Adjusting the default value of parameter parallel_max_servers
from 160 to 135 due to the value of parameter processes (150)
Starting ORACLE instance (normal)

------check degree

Provide script for a DBA to check the degree of parallelism on tables and indexes.

SOLUTION

Requirements

Any tool that can execute SQL in the database. A simple one is SQLPlus.

Configuring

No configuration needed, other than remove the column formatting lines if not executed in SQLPlus.

Instructions

The scripts can be run with copy and paste after connected to the database as a user who has select access on the queried objects.

Script 

Check Script
-------------
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' );

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;


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;


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;

Sample Output

NAME VALUE
------------------------------ --------------------
cpu_count 2
parallel_threads_per_cpu 2

OWNER DEGREE INSTANCES Num Tables 'PARALLEL'
------------------------------ ---------- ---------- ---------- ------------
APEX_030200 1 1 360 Serial
APEX_040000 1 1 426 Serial
APEX_WS1 1 1 18 Serial
APPQOSSYS 1 1 4 Serial
CTXSYS 1 1 49 Serial
DWHBW 8 1 1 Parallel
DWH_DM DEFAULT DEFAULT 1 Parallel
... OWNER DEGREE INSTANCES Num Indexes 'PARALLEL'
------------------------------ ---------- ---------- ----------- -----------
APEX_030200 1 1 946 Serial
APEX_040000 1 1 1177 Serial
APEX_WS1 1 1 28 Serial
CTXSYS 1 1 59 Serial
DWHBW 1 1 20 Serial
DWH_DM DEFAULT DEFAULT 1 Parallel ... OWNER TABLE_NAME DEGREE INSTANCES INDEX_NAME DEGREE INSTANCES
------------------------------ ----------------------------------- ---------- ---------- ----------------------------------- ---------- ----------
OWBSYS CMPFCOCLASSES 1 1 IDX_FCOUOID DEFAULT DEFAULT
OWBSYS CMPFCOCLASSES 1 1 IDX_FCOCLASSNAMEELEMID DEFAULT DEFAULT
OWBSYS CMPFCOCLASSES 1 1 IDX_FCOOWNINGFOLDER DEFAULT DEFAULT
OWBSYS CMPFCOCLASSES 1 1 IDX_FCONAME DEFAULT DEFAULT 

------------------instance default-------------

This notes explain the differences for setting of the  DOP ( Degree of Parallelism )
on a object between old and new syntax.

SCOPE

 DBA's , Developer's and Engineers.

DETAILS

Before 8.1 we used the syntax

parallel(object, degree, instances)

to define the degree of parallelism. In 8.1 we changed the syntax to

parallel(object, degree )

There was a documentation bug until 10g that the documentation
only used the old syntax.
For the backward compatibilty we convert internally the old into the
next syntax.

When we use the old syntax, a value for instances, does not mean that
we restrict slaves only on this instances.


1.) DOP's on Tables and Indexes
--------------------------------

We use the Matrix above to convert table /index setting's into the next syntax:

    Degree          Instances         new Oracle DOP
   ---------        ---------        ------------------
      1                1                    1
      x             Default                 x
      x                1                    x
      1             Default              Default
   Default             y                    y
      1                y                    y
   Default             1                 Default
      x                y                   x*y
   Default          Default              Default


Example:

 create table test ...   parallel (degree 2 instances 3);

 is the same as

 create table test ...   parallel 6;



2.) DOP's setting via Hints

=======都强制了ALTER SESSION 还是并行,这个instance defalut的值是什么呢???

GOAL

What is the reason for which a statement is executed in parallel even so all the conditions of having this in serial are met?

The degree for all the tables involved is set to 1

and

parallel_degree_limit      CPU         
parallel_degree_policy     MANUAL

Much more even when setting:

ALTER SESSION DISABLE PARALLEL DML;
ALTER SESSION DISABLE PARALLEL DDL;
ALTER SESSION DISABLE PARALLEL QUERY;


the statement is still executed in parallel.
 

SOLUTION

Parallelism was triggered by the fact that instances was set to default for one of the tables even if the degree was set to 1.

SQL> select owner, table_name, degree, instances from dba_tables where table_name='LMCMPHQ';

OWNER       TABLE_NAME      DEGREE INSTANCES
------------------------------ ------------------------------ ---------- ----------------------------------------
TEST           LMTEST                 1    DEFAULT

This is  expected behaviour as explained into "Old and New Syntax for Setting Degree of Parallelism (Doc ID 260845.1)" when degree is 1 and instances is DEFAULT then the DOP is DEFAULT.

-------------------------

Query executes with DEFAULT PX sessions  when Degree=1 on object and no parallel hint is present
 

CAUSE

When a query shows parallel execution plan even if degree=1 and no hint used, check the value of "INSTANCES" from DBA_TABLES or DBA_INDEXES. A value of DEFAULT for INSTANCES will make the query use DEFAULT degree

e.g.

SQL> create table table_objects as select * from dba_objects union select * from dba_objects union select * from dba_objects union select * from dba_objects union select * from dba_objects union select * from dba_objects union select * from dba_objects;Table created.
SQL> create index table_objects_idx on TABLE_OBJECTS(OBJECT_TYPE,object_name) parallel(DEGREE 1 INSTANCES DEFAULT);Index created.SQL> explain plan for select /*+ index_ffs(table_objects,table_objects_idx) */ count(distinct object_name) from table_objects where OBJECT_TYPE='TABLE';Explained.SQL> select * from table(dbms_xplan.display) ;PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 2868850136---------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                      | Name              | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
---------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT               |                   |     1 |    66 |   175   (6)| 00:00:01 |        |      |            |
|   1 |  SORT AGGREGATE                |                   |     1 |    66 |            |          |        |      |            |
|   2 |   PX COORDINATOR               |                   |       |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM)         | :TQ10001          |     1 |    66 |            |          |  Q1,01 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE             |                   |     1 |    66 |            |          |  Q1,01 | PCWP |            |
|   5 |      VIEW                      | VW_DAG_0          |  2387 |   153K|   175   (6)| 00:00:01 |  Q1,01 | PCWP |            |
|   6 |       HASH GROUP BY            |                   |  2387 |   184K|   175   (6)| 00:00:01 |  Q1,01 | PCWP |            |
|   7 |        PX RECEIVE              |                   |  2387 |   184K|   175   (6)| 00:00:01 |  Q1,01 | PCWP |            |
|   8 |         PX SEND HASH           | :TQ10000          |  2387 |   184K|   175   (6)| 00:00:01 |  Q1,00 | P->P | HASH       |
|   9 |          HASH GROUP BY         |                   |  2387 |   184K|   175   (6)| 00:00:01 |  Q1,00 | PCWP |            |
|  10 |           PX BLOCK ITERATOR    |                   |  2387 |   184K|   166   (0)| 00:00:01 |  Q1,00 | PCWC |            |
|* 11 |            INDEX FAST FULL SCAN| TABLE_OBJECTS_IDX |  2387 |   184K|   166   (0)| 00:00:01 |  Q1,00 | PCWP |            |
---------------------------------------------------------------------------------------------------------------------------------Predicate Information (identified by operation id):
---------------------------------------------------11 - filter("OBJECT_TYPE"='TABLE')
 
SQL> select index_name,degree,instances from dba_indexes where index_name='TABLE_OBJECTS_IDX';INDEX_NAME                     DEGREE                                   INSTANCES
------------------------------ ---------------------------------------- ----------------------------------------
TABLE_OBJECTS_IDX              1                                        DEFAULTSQL> alter index table_objects_idx noparallel;Index altered.SQL> select index_name,degree,instances from dba_indexes where index_name='TABLE_OBJECTS_IDX';INDEX_NAME                     DEGREE                                   INSTANCES
------------------------------ ---------------------------------------- ----------------------------------------
TABLE_OBJECTS_IDX              1                                        1SQL> explain plan for select /*+ index_ffs(table_objects,table_objects_idx) */ count(distinct object_name) from table_objects where OBJECT_TYPE='TABLE';Explained.SQL> select * from table(dbms_xplan.display) ;PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1073692753---------------------------------------------------------------------------------------------
| Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT        |                   |     1 |    66 |   168   (2)| 00:00:01 |
|   1 |  SORT AGGREGATE         |                   |     1 |    66 |            |          |
|   2 |   VIEW                  | VW_DAG_0          |  2387 |   153K|   168   (2)| 00:00:01 |
|   3 |    HASH GROUP BY        |                   |  2387 |   184K|   168   (2)| 00:00:01 |
|*  4 |     INDEX FAST FULL SCAN| TABLE_OBJECTS_IDX |  2387 |   184K|   166   (0)| 00:00:01 |
---------------------------------------------------------------------------------------------Predicate Information (identified by operation id):
---------------------------------------------------4 - filter("OBJECT_TYPE"='TABLE')

As observed making the object to NoParallel makes the INSTANCES value to 1 or just to make INSTANCES=1 you can issue : alter index table_objects_idx PARALLEL(INSTANCES 1) ;

SOLUTION

When an object is created with PARALLEL and have INSTANCES=DEFAULT, it will make query to spawn DEFAULT degree. From 11gR2 onwards it is recommended not to use INSTANCES variable in PARALLEL clause

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/22179.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

电商平台接口|获取价格数据,做好竞品分析

京东获得JD商品详情 API返回值说明 item_get-获得JD商品详情 jd.item_get 公共参数 名称类型必须描述keyString是调用key(必须以GET方式拼接在URL中)secretString是调用密钥api_nameString是API接口名称(包括在请求地址中)[it…

Springboot 在线学习交流平台-计算机毕业设计源码46186

摘 要 随着科学技术的飞速发展,社会的方方面面、各行各业都在努力与现代的先进技术接轨,通过科技手段来提高自身的优势,在线学习交流平台当然也不能排除在外。在线学习交流平台是以实际运用为开发背景,运用软件工程原理和开发方法…

飞睿uwb定位tag防丢器,蓝牙智能防丢器原理,支持苹果IOS的本地防丢查找

在当今这个快节奏的社会,人们的注意力经常被各种琐事分散,丢三落四的情况时有发生。随着科技的发展,智能防丢器应运而生,成为帮助我们解决这一烦恼的助手。今天,我们就来深入探讨一款备受瞩目的智能防丢产品——飞睿UW…

CDH6.3.2安装文档

前置环境: 操作系统: CentOS Linux release 7.7 java JDK : 1.8.0_231 1、准备工作 准备以下安装包: Cloudera Manager: cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm cloudera-manager-daemons-6.3.1-1466458.el…

视频号小店是什么?没有货源可以去做吗?一篇详解!

大家好,我是电商小V 视频号小店近两年在创业者眼中可以说是一个可以去操作的项目,也是可以激起来很高的讨论度,但是很多小伙伴对视频号小店了解不是很深,今天咱们就来详细的说一下:视频号小店, 视频号小店就…

鸿蒙Ability Kit(程序框架服务)【ServiceExtensionAbility】

ServiceExtensionAbility 概述 [ServiceExtensionAbility]是SERVICE类型的ExtensionAbility组件,提供后台服务能力,其内部持有了一个[ServiceExtensionContext],通过[ServiceExtensionContext]提供了丰富的接口供外部使用。 本文描述中称被…

EasyV开发人员的使用说明书

在可视化大屏项目时,开发人员通常需要承担以下任务: 技术实现:根据设计师提供的设计稿,利用前端技术(如HTML、CSS、JavaScript等)和后端技术(根据具体项目需求,可能是Java、Python、…

【工具】windows下VMware17解锁mac安装选项(使用unlocker427)

目录 0.简介 1.环境 2.安装前后对比 3.详细安装过程 3.1 下载unlocker427 1)下载地址 2)下载unlocker427.zip 3)解压之后是这样的 4)复制iso中的两个文件到你本地的VMware的安装目录下 5)复制windows下的所有…

计网期末复习指南(四):网络层(IP协议、IPv4、IPv6、CIDR、ARP、ICMP)

前言:本系列文章旨在通过TCP/IP协议簇自下而上的梳理大致的知识点,从计算机网络体系结构出发到应用层,每一个协议层通过一篇文章进行总结,本系列正在持续更新中... 计网期末复习指南(一):计算…

学生在课堂上可以用小风扇吗?五款学生可用迷你手持小风扇分享!

随着夏季的来临,高温酷暑成为了学生日常学习生活中的一大挑战。在闷热的教室里,人多风扇少,闷热的环境很容易就会让人学不下去。因此学生在课堂上最好是使用手持小风扇,但选择的手持小风扇噪音一定要小,不然很容易就会…

HarmonyOS(29)onMeasureSize和PlaceChildren (View的测量和布局)

onMeasureSize和PlaceChildren onMeasureSize和PlaceChildren 说明官方使用示例参考资料 onMeasureSize和PlaceChildren 说明 在Android开发中View的测量onMeasure和布局onLayout是自定义组件必备的两个方法,HarmonyOS对自定义布局也提供了两个方法: on…

面试题:谈谈你对 JS 内存泄漏与内存溢出的理解

面试题:谈谈你对 JS 内存泄漏与内存溢出的理解 内存泄漏(Memory Leak)指的是程序不需要使用的内存没有被正确释放,从而导致内存占用逐渐增加,最终可能会耗尽所有可用内存。 内存泄漏即不想用的内存没被释放 内存溢出&a…

【VSCode实战】转换大小写快捷键

今天在VSCode Insiders上编码,突然想将某常量转换为大写。按照virtual studio的习惯,我Ctrl Shift U没有效果,Ctrl U也没效果。网上搜了搜,原来VSCode Insiders没有这个默认功能。 而VSCode Insiders这么强大怎么可能没有大小…

ELK 使用 metricbeat监控数据

IP功能版本192.168.140.153elk-18.13.4192.168.140.153metricbeat8.13.4192.168.140.156elk-28.13.4192.168.140.156metricbeat8.13.4192.168.140.159logstash8.13.4192.168.140.159kibana8.13.4 一、安装ELK 参考文档: https://download.csdn.net/download/weix…

TG-5510CA温补晶振用于GPS应用

随着现代社会对精准定位和导航需求的不断增加,GPS(全球定位系统)已成为我们日常生活和各行各业中不可或缺的一部分。无论是在智能手机、汽车导航、无人机飞行控制,还是在精密的科学研究和军事应用中,GPS系统都扮演着至…

爬虫入门教程:爬虫概述

在数字化时代,数据已经成为我们生活和工作中不可或缺的一部分。而如何高效、准确地获取这些数据,成为了许多领域面临的共同问题。今天,我们就来一起探讨一下爬虫技术,这个能够自动从互联网上抓取信息的神奇工具。 一、什么是爬虫…

Android电量优化,让你的手机续航更持久

节能减排,从我做起。一款Android应用如果非常耗电,是一定会被主人嫌弃的。自从Android手机的主人用了你开发的app,一天下来,也没干啥事,电就没了。那么他就会想尽办法找出耗电量杀手,当他找出后&#xff0c…

Ambient Diffusion: Learning Clean Distributions from Corrupted Data

我们采用以下六个标准,用于对从损坏数据中学习的领域的研究进行分类: **学习范式:**该标准区分模型如何从数据中学习: 监督学习,如 Noise2Noise [39] 所示,涉及在损坏和干净图像对上训练模型。这种方法需要访问干净的数据,这可能并不总是可行的。无监督学习方法,如 Amb…

用户定制应用顺序

经常会有这样的个性化需求,用户希望可以在页面上按自己的偏好拖放移动应用图标,而且还能保存,下次访问该页面时应用图标就是按自己上次保存的顺序展示的。 拖放是一种常见的特性,即抓取对象后移动到另一个位置后放下。在 HTML5 中…

CentOS 7基础操作10_Linux备份与恢复文档

在Linux 操作系统中,最简单的文件和目录备份工具就是cp (复制)命令,但是当需要备份的文件、目录数量较多时,仅仅使用cp 命令就显得“力不从心”,并且备份的文件数量及其所占用的磁盘空间都可能会对服务器产生不小的压力…