问题描述
早上好,
似乎Oracle在12.2中对 “alter table move ONLINE” 命令进行了一些重大改进。对于由varchar,char和number数据类型组成的具有一些b树索引的基本堆表,似乎我们现在可以执行表移动,同时仍允许应用程序在表上执行select,update,delete或insert!换句话说,如果表移动需要10分钟,则应用程序可以执行DML操作,并且不会收到任何错误。请确认是这种情况,这样我将确保下次运行此命令时不会导致应用程序问题。很高兴知道Oracle如何通过 “alter table move online” 来降低HWM,但是却无法通过 “收缩空间” 命令来做到这一点。
顺便说一句: 我注意到在移动操作之前,之中和之后,索引也得到维护并保持 “有效”。
我不明白为什么我会再使用 “收缩空间”,因为在降低HWM的过程中该操作会造成干扰。另外,作为一个额外的烦恼,我们在表上有 “启用行移动”。
P.S. 我现在知道使用此处列出的 “alter table move ONLINE” 命令时的限制:https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/ALTER-TABLE.html#GUID-552E7373-BF93-477D-9DA3-B2C9386F2877
谢谢,
约翰
似乎Oracle在12.2中对 “alter table move ONLINE” 命令进行了一些重大改进。对于由varchar,char和number数据类型组成的具有一些b树索引的基本堆表,似乎我们现在可以执行表移动,同时仍允许应用程序在表上执行select,update,delete或insert!换句话说,如果表移动需要10分钟,则应用程序可以执行DML操作,并且不会收到任何错误。请确认是这种情况,这样我将确保下次运行此命令时不会导致应用程序问题。很高兴知道Oracle如何通过 “alter table move online” 来降低HWM,但是却无法通过 “收缩空间” 命令来做到这一点。
顺便说一句: 我注意到在移动操作之前,之中和之后,索引也得到维护并保持 “有效”。
我不明白为什么我会再使用 “收缩空间”,因为在降低HWM的过程中该操作会造成干扰。另外,作为一个额外的烦恼,我们在表上有 “启用行移动”。
P.S. 我现在知道使用此处列出的 “alter table move ONLINE” 命令时的限制:https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/ALTER-TABLE.html#GUID-552E7373-BF93-477D-9DA3-B2C9386F2877
谢谢,
约翰
专家解答
改变表...在线移动是非阻塞DDL。这意味着是的,您可以在移动完成时对表运行DML。
尽管如果表上有任何未提交的DML,则此DDL语句本身将被阻止,直到事务本身完成为止。
尽管正如您所指出的,这有一些限制:
Restrictions on Moving Tables Online
Moving tables online is subject to the following restrictions:
* You cannot combine this clause with any other clause in the same statement.
* You cannot specify this clause for a partitioned index-organized table.
* You cannot specify this clause if a domain index is defined on the table.
* Parallel DML and direct path INSERT operations require an exclusive lock on the table. Therefore, these operations are not supported concurrently with an ongoing online table MOVE, due to conflicting locks.
* You cannot specify this clause for index-organized tables that contain any LOB, VARRAY, Oracle-supplied type, or user-defined object type columns.
移动和收缩之间的一个主要区别是移动是离线的。所以你需要足够的空间来存储表的两个副本。SHRINK并非如此。
有关这些之间差异的更多讨论,请参见:https://asktom.oracle.com/pls/apex/f?p=100:11:::NO:RP:P11_QUESTION_ID:9527343800346989243
尽管如果表上有任何未提交的DML,则此DDL语句本身将被阻止,直到事务本身完成为止。
尽管正如您所指出的,这有一些限制:
Restrictions on Moving Tables Online
Moving tables online is subject to the following restrictions:
* You cannot combine this clause with any other clause in the same statement.
* You cannot specify this clause for a partitioned index-organized table.
* You cannot specify this clause if a domain index is defined on the table.
* Parallel DML and direct path INSERT operations require an exclusive lock on the table. Therefore, these operations are not supported concurrently with an ongoing online table MOVE, due to conflicting locks.
* You cannot specify this clause for index-organized tables that contain any LOB, VARRAY, Oracle-supplied type, or user-defined object type columns.
移动和收缩之间的一个主要区别是移动是离线的。所以你需要足够的空间来存储表的两个副本。SHRINK并非如此。
有关这些之间差异的更多讨论,请参见:https://asktom.oracle.com/pls/apex/f?p=100:11:::NO:RP:P11_QUESTION_ID:9527343800346989243
文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




