Asynchronous Global Index

RDBMS 19.23 

-- 参考文档:
https://docs.oracle.com/database/121/VLDBG/GUID-087B87A6-959A-40C6-82AF-36E401FD089B.htm#VLDBG14107      -- 异步GIDX简介
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_3001.htm#CIHCAAGD         -- update [global] index
How To Update Both Global and Local Indexes when Moving Table Partition? (Doc ID 795854.1)  -- 更新global索引和local索引 参考
How to Drop/Truncate Multiple Partitions in Oracle 12C (Doc ID 1482264.1)     -- Index maintenance
Global Index Maintenance (GIDX) on Partitioned Tables not Running Asynchronously in 12c+ (Doc ID 2404701.1)   -- 条件

https://oracle-base.com/articles/12c/asynchronous-global-index-maintenance-for-drop-and-truncate-partition-12cr1#:~:text=When%20combined%20with%20the%20UPDATE%20INDEXES%20clause%20the,types%2C%20domain%20indexes%20or%20those%20owned%20by%20SYS.

异步GIDX简介:

Asynchronous Global Index Maintenance for Dropping and Truncating Partitions

The partition maintenance operations DROP PARTITION and TRUNCATE PARTITION are optimized by making the index maintenance for metadata only.

Asynchronous global index maintenance for DROP and TRUNCATE is performed by default; however, the UPDATE INDEXES clause is still required for backward compatibility.

The following list summarizes the limitations of asynchronous global index maintenance:

  • Only performed on heap tables

  • No support for tables with object types

  • No support for tables with domain indexes

  • Not performed for the user SYS

Maintenance operations on indexes can be performed with the automatic scheduler job SYS.PMO_DEFERRED_GIDX_MAINT_JOB to clean up all global indexes. This job is scheduled to run at 2:00 A.M. on a daily basis by default. You can run this job at any time using DBMS_SCHEDULER.RUN_JOB if you want to proactively clean up the indexes. You can also modify the job to run with a different schedule based on your specific requirements. However, Oracle recommends that you do not drop the job.

You can also force cleanup of an index needing maintenance using one of the following options:

  • DBMS_PART.CLEANUP_GIDX - This PL/SQL procedure gathers the list of global indexes in the system that may require cleanup and runs the operations necessary to restore the indexes to a clean state.

  • ALTER INDEX REBUILD [PARTITION] – This SQL statement rebuilds the entire index or index partition as is done in releases previous to Oracle Database 12c Release 1 (12.1). The resulting index (partition) does not contain any stale entries.

  • ALTER INDEX [PARTITIONCOALESCE CLEANUP – This SQL statement cleans up any orphaned entries in index blocks.

 异步GIDX的条件:

There are a few situations under which asynchronous GIDX will not run:

There is a domain index on the table (unsupported for async index maintenance)
The #_of_table_segments_truncated * #_of_global_index_partitions is  > 125000 (reference unpublished Bug 19017670].
The DBA has set the hidden parameter "_fast_index_maintenance" = FALSE to disable asynchronous GIDX maintenance (not recommended).

 -- 查看隐含参数: _fast_index_maintenance  为true 

SYS@cdbtest SQL> select a.ksppinm name,b.ksppstvl value,a.ksppdesc description     from x$ksppi a,x$ksppcv bwhere a.inst_id = USERENV ('Instance')and b.inst_id = USERENV ('Instance')and a.indx = b.indx
and upper(a.ksppinm) LIKE upper('%_fast_index_maintenance%')order by name  2    3    4    5    6    7  8  ;NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------
_fast_index_maintenance
TRUE
fast global index maintenance during PMOPsSYS@cdbtest SQL>  

-- 查看MO_DEFERRED_GIDX_MAINT_SCHED,修改为每天8点开始运行,默认为凌晨两点开始运行(方便测试,晚上要关闭测试机)

begin
dbms_scheduler.set_attribute (
name => 'SYS.PMO_DEFERRED_GIDX_MAINT_SCHED',
attribute => 'REPEAT_INTERVAL',
value => 'FREQ=DAILY; BYHOUR=8; BYMINUTE=0; BYSECOND=0'
);
end;
/ 

-- 查看修改后的结果 

SYS@cdbtest SQL>  select start_date,last_start_date,next_run_date from dba_scheduler_jobs where job_name='PMO_DEFERRED_GIDX_MAINT_JOB';START_DATE
---------------------------------------------------------------------------
LAST_START_DATE
---------------------------------------------------------------------------
NEXT_RUN_DATE
---------------------------------------------------------------------------
03-JUL-24 08.00.00.882192 AM PST8PDT
01-JUL-24 04.41.01.939138 PM PST8PDT
03-JUL-24 08.00.00.882192 AM PST8PDTSYS@cdbtest SQL> 

-- 创建测试用的分区表和索引

CREATE TABLE mytesttable
(deptno number, secondcol varchar2(80))
PARTITION BY RANGE (deptno)
(
PARTITION p1 VALUES LESS THAN (100001),
PARTITION p2 VALUES LESS THAN (250001),
PARTITION p3 VALUES LESS THAN (350001),
PARTITION p4 VALUES LESS THAN (450001),
PARTITION p5 VALUES LESS THAN (550001)
);-- insert rows
begin
for i in 1..550000 loop
insert into mytesttable values (i, rpad('x',80,'x'));
end loop;
commit;
end;
/
/
/-- create global index
create index deptno_idx on mytesttable (deptno) global;

-- truncate或者drop掉一个分区,这里使用update index,而不是使用update global index。 不要使用update global index,不然达不到测试效果
两者的区别:
The following is a sample to verify that 'UPDATE INDEXES' will update both global and local index during partition move.

ALTER TABLE mytesttable TRUNCATE PARTITIONS p2,p3 update indexes;
ALTER TABLE mytesttable TRUNCATE PARTITIONS p1 update indexes;
--alter table mytesttable drop partition p3 update global indexes;

-- 查看是否有orphaned_entries,orphaned_entries=yes,即达到测试目的 

SYS@cdbtest SQL> select table_name,
index_name,
status,
orphaned_entries
from dba_indexes
where orphaned_entries='YES';  2    3    4    5    6  TABLE_NAME
--------------------------------------------------------------------------------
INDEX_NAME
--------------------------------------------------------------------------------
STATUS   ORP
-------- ---
MYTESTTABLE
DEPTNO_IDX
VALID    YESSYS@cdbtest SQL> 

-- 查看MO_DEFERRED_GIDX_MAINT_SCHED是否运行。这里设置了8:00开始运行,但是实际运行是下午4点多(这个地方比较奇怪,以为设置为8点就8点准时运行,实际上看,是在下午空闲时间运行了)

SYS@cdbtest SQL> select start_date,last_start_date,next_run_date from dba_scheduler_jobs where job_name='PMO_DEFERRED_GIDX_MAINT_JOB';START_DATE
---------------------------------------------------------------------------
LAST_START_DATE
---------------------------------------------------------------------------
NEXT_RUN_DATE
---------------------------------------------------------------------------
03-JUL-24 08.00.00.882192 AM PST8PDT
01-JUL-24 04.41.01.939138 PM PST8PDT
03-JUL-24 08.00.00.882192 AM PST8PDTSYS@cdbtest SQL> SYS@cdbtest SQL> select start_date,last_start_date,next_run_date from dba_scheduler_jobs where job_name='PMO_DEFERRED_GIDX_MAINT_JOB';START_DATE
---------------------------------------------------------------------------
LAST_START_DATE
---------------------------------------------------------------------------
NEXT_RUN_DATE
---------------------------------------------------------------------------
03-JUL-24 08.00.00.882192 AM PST8PDT
03-JUL-24 04.36.32.500768 PM PST8PDT
04-JUL-24 08.00.00.021273 AM PST8PDTSYS@cdbtest SQL>

-- 运行完毕后,再次查看,是否还有orphaned_entries,已经没有orphaned_entries了 

SYS@cdbtest SQL>  select table_name,
index_name,
status,
orphaned_entries
from dba_indexes
where orphaned_entries='YES';  2    3    4    5    6no rows selectedSYS@cdbtest SQL>

END

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

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

相关文章

jQuery UI 定制

jQuery UI 定制 jQuery UI 是一个建立在 jQuery JavaScript 库之上的用户界面交互、特效、小部件和主题框架。它提供了一系列的预构建组件,如拖放、排序、折叠等,以及用于构建高级富交互界面的工具。虽然 jQuery UI 提供了丰富的功能和组件,但有时候开发人员可能需要根据特…

SQL Server和Oracle数据库的实时同步

数据同步在大数据应用中扮演着关键角色,它确保了数据的实时性和一致性,为数据分析和决策提供了重要支持。常见的数据同步方式包括ETL实时同步和实时ETL工具,后者可以基于日志追踪或触发器进行分类。不同的数据库系统针对实时同步也有各自的实…

开发经验:go切片的继承

package main import ( "errors" "fmt" ) // LimitedSlice 是一个封装了切片的结构体,用于限制切片的最大容量 type LimitedSlice struct { slice []int maxCap int } // NewLimitedSlice 创建一个新的LimitedSlice实例&#xff…

python安装或升级模块时,[WinError 5] 拒绝访问

参考&#xff1a; https://www.cnblogs.com/hyisangie/p/15154426.html 基本上遇到 Consider using the --user option… 就是需要管理员权限才能安装或更新 Windows 在命令提示符中输入 安装&#xff1a;pip install <模块名> --user # 这里的 --user 照打就行了&…

数据采集技术:selenium/正则匹配/xpath/beautifulsoup爬虫实例

专栏介绍 1.专栏面向零基础或基础较差的机器学习入门的读者朋友&#xff0c;旨在利用实际代码案例和通俗化文字说明&#xff0c;使读者朋友快速上手机器学习及其相关知识体系。 2.专栏内容上包括数据采集、数据读写、数据预处理、分类\回归\聚类算法、可视化等技术。 3.需要强…

电影解说 剪辑实战带货全新蓝海市场,电影解说实战课程(16节)

课程目录 1-影视解说自媒体带货新玩法_1.mp4 2-影视解说选品及解说规范标准_1.mp4 3-电影解说的脚本模版及流程_1.mp4 4-电影解说编写文案及爆火规律_1.mp4 5-手把手教你影视素材哪里找_1.mp4 6-影视解说剪辑、配音及创收方式_1.mp4 7-电影解说剪辑的实操课程A_1.mp4 8…

关于Ubuntu系统中.config文件夹如何找到

Ubuntu中QT项目使用了setting保存配置&#xff0c;但是找不到配置文件保存了在哪里&#xff0c;找了一下&#xff1a; 因为QT里取的名字是&#xff1a; 于是下载everything搜索Nio&#xff0c;发现目录为/home/nio/.config 虽然已经下载了everything找到了&#xff0c;但是发现…

fyne常用内置颜色

常用内置颜色 在theme包里有一个关于颜色的color.go 常用颜色如下: theme.PrimaryColor() theme.WarningColor() theme.SuccessColor() theme.ErrorColor() theme.ShadowColor() theme.HyperlinkColor()最终这些会返回color.Color接口。 效果图: theme.HyperlinkColor()和t…

图神经网络拉普拉斯矩阵理论

图拉普拉斯矩阵是谱图理论中的一个重要概念&#xff0c;它描述了一个图的结构特性&#xff0c;主要用于量化图的连通性和节点之间的关系。我们可以通过一个简单的无向图例子来说明图拉普拉斯矩阵是如何构造的。 ### 例子&#xff1a;一个无向图 假设我们有一个无向图 \(G(V,E…

VTK- 面绘制体绘制

在VTK中&#xff0c;面绘制&#xff08;Surface Rendering&#xff09;和体绘制&#xff08;Volume Rendering&#xff09;是两种常见的三维数据可视化方法。面绘制和体绘制是计算机图形学中用于三维数据可视化的重要技术&#xff0c;尤其在医学成像、科学可视化和计算机辅助设…

agx orin

Ubuntu20安装ROS2 foxy-CSDN博客 Ubuntu软件源、pip源大全&#xff0c;国内网站网址&#xff0c;阿里云、网易163、搜狐、华为、清华、北大、中科大、上交、山大、吉大、哈工大、兰大、北理、浙大_ubuntu国内源地址-CSDN博客ubuntu-ports镜像_ubuntu-ports下载地址_ubuntu-port…

Android广播机制

简介 某个网络的IP范围是192.168.0.XXX&#xff0c;子网 掩码是255.255.255.0&#xff0c;那么这个网络的广播地址就是192.168.0.255。广播数据包会被发送到同一 网络上的所有端口&#xff0c;这样在该网络中的每台主机都将会收到这条广播。为了便于进行系统级别的消息通知&…

oh-my-zsh启动慢重新安装

在Mac上安装oh-my-zsh并设置主题实际上是一个两步过程&#xff1a;首先安装oh-my-zsh&#xff0c;然后配置你喜欢的主题。oh-my-zsh本身并不直接“安装主题”&#xff0c;而是提供了一个框架&#xff0c;让你能够轻松地更改和配置主题。主题通常是oh-my-zsh框架的一部分&#x…

平滑滚动到页面顶部?分享 1 段优质 JS 代码片段!

本内容首发于工粽号&#xff1a;程序员大澈&#xff0c;每日分享一段优质代码片段&#xff0c;欢迎关注和投稿&#xff01; 大家好&#xff0c;我是大澈&#xff01; 本文约 700 字&#xff0c;整篇阅读约需 1 分钟。 今天分享一段优质 JS 代码片段&#xff0c;通过简单的逻辑…

游戏行业情报 | 手机玩3A终是空想?iOS版3A大作销量滑铁卢

2023年9月的苹果发布会上&#xff0c;苹果宣布iPhone15 Pro系列首发配备的A17 Pro芯片将能够支持3A游戏的游玩&#xff0c;随着该系列设备的发布&#xff0c;《生化危机 4》、《生化危机&#xff1a;村庄》、《死亡搁浅》和《刺客信条&#xff1a;幻景》等大作先后登陆iOS平台。…

Qt 使用 QZipReader 解压文件

Qt 使用 QZipReader 解压文件 文章目录 Qt 使用 QZipReader 解压文件摘要关于 QZipReader使用 QZipReader代码解释&#xff1a; 快速解 extractAll 关键字&#xff1a; Qt、 QZipReader、 extractAll、 Zip、 解压缩 摘要 每日一坑&#xff0c;坑坑难过&#xff0c;今日在…

2024年度 | 推荐PC端时间规划、项目管理软件(最新)

PingCode&#xff1a;适用于IT团队的项目/任务管理。 https://pingcode.com/ Worktile&#xff1a;团队通用的任务规划工具。 https://worktile.com/ Todoist&#xff1a;个人任务管理工具&#xff0c;支持跨平台同步。 Todoist | 管理您工作和生活的To Do List Pomodoro Ti…

网卡配置文件详解

详解 [rootCSDN_xiaodu ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPEEthernet # 网络类型 以太网 BOOTPROTOnone # IP地址的配置方式# none 手动配置# static 手动配置# dhcp 自动获取(不使用) NAMEeth0 # 网卡在系统中的名称 UU…

[JS]面向对象ES6

class类 ES6是基于 class关键字 创建类 <script>// 1.定义类class Person {// 公有属性name// 公有属性 (设置默认值)age 18// 构造函数constructor(name) {// 构造函数的this指向实例化对象// 构造函数的作用就是给实例对象设置属性this.name name// 动态添加属性(不…

Android选择题界面的设计——线性布局实操

目录 任务目标任务分析任务实施 任务目标 使用TextView、Button、CheckBox等实现一个选择题界面&#xff0c;界面如图1所示。 图1 选择题界面效果图 任务分析 上述界面可以分解为上下两部分&#xff0c;上面部分可以使用横向的线性布局来完成&#xff0c;下面部分可以使用…