Oracle:DDL 和事务回滚

2022-01-06 00:00:00 transactions oracle ddl

在 Oracle DDL(创建/更改)中是否可以像在 MS SQL(从 2005 年开始)中那样进行事务处理?

Could in Oracle DDL (create/alter) be transactional like they are in MS SQL (started from 2005)?

推荐答案

没有.在 Oracle DDL 语句中本身不是事务性的.

No. In Oracle DDL statements themselves are not transactional.

在开始实际工作之前,运行 DDL 语句将隐式提交该会话的任何打开事务.

Running a DDL statement will implicitly commit any open transaction for that session before starting the actual work.

此外,如果另一个会话在正在修改的对象或其依赖项之一上具有打开的事务,则某些语句(如更改表语句)可能会失败.您可以设置 ddl_lock_timeout 来指定您希望 Oracle 等待对象变为可用的时间.

In addition some statements, like an alter table statement, may fail if another session has an open transaction on the object being modified or one of its dependencies. You can set a ddl_lock_timeout to specify how long you want Oracle to wait for the object to become available.

参见 DDL 语句,了解 DDL 语句类型的摘要以及有关它们在锁和事务方面的行为的信息.

See DDL Statements for a summary of types of DDL statements and information about their behaviour regarding locks and transactions.

Oracle 数据库在每个 DDL 语句之前和之后隐式提交当前事务.

Oracle Database implicitly commits the current transaction before and after every DDL statement.

相关文章