首页 » Cloud » Oracle 12cR1, Shutdown abort of a PDB seems to perform commit ,a bug?

Oracle 12cR1, Shutdown abort of a PDB seems to perform commit ,a bug?

今天看到在网上看到一篇笔记 Oracle 12cR1, Shutdown abort of a PDB seems to perform commit 提到在12r1 存在一个奇怪的现象,shutdown abort 在当前会话会执行隐式提交, 这有点颠覆我们之前版本中的理论, 我们都知道shutdown abort 应该是rollback 当前未提交的事务。下面是作者当时的测试 环境 12c Enterprise Edition Release 12.1.0.1.0

SQL> alter session set container=ORCL_PDB;
SQL> alter session set current_schema=HR;
Session altered.

SQL> select * from regions;
 REGION_ID REGION_NAME
---------- -------------------------
 Europe
 Americas
 Asia
 Middle East and Africa

SQL>update regions set region_name=region_name||'*';
1 rows updated.

SQL> shutdown abort;
Pluggable Database closed.

SQL> alter session set container=ORCL_PDB;
Session altered.

SQL> startup
Pluggable Database opened.
SQL> show con_name
CON_NAME
------------------------------
ORCL_PDB

SQL> alter session set current_schema=HR;
Session altered.

SQL> select * from regions;
 REGION_ID REGION_NAME
---------- -------------------------
 Europe*
 Americas*
 Asia*
 Middle East and Africa*

可以看到在abort 后再打开,未提交的事务是隐式提交了,当时作者未在MOS中找到日志说明这种现象是BUG, 现在我在12C R2 看看该问题是否已修正?

SQL> startup mount
ORACLE instance started.

Total systemGlobal Area 1610612736 bytes
Fixed Size                  4583312 bytes
Variable Size             520093808 bytes
Database Buffers         1073741824 bytes
Redo Buffers               12193792 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.

SQL> alter database open;
Database altered.

SQL> select con_id,dbid,con_uid,name,open_mode from v$pdbs;
    CON_ID       DBID    CON_UID NAME                          OPEN_MODE
---------- ---------- ---------- ----------------------------- ----------
 1594295274 1594295274 PDB$SEED                      READ ONLY
 4271435144 4271435144 PDBORCL                       MOUNTED

SQL> alter pluggable database pdborcl open;
Pluggable database altered.

SQL> alter session set container=pdborcl;
Session altered.

SQL> select * from t1;
 OBJECT_ID OBJECT_NAME
---------- ------------------------------
 I_FILE#_BLOCK#
 I_OBJ3
 I_TS1
 I_CON1
 IND$
 CDEF$
 C_TS#
 I_CCOL2
 I_PROXY_DATA$
 I_CDEF4
 rows selected.


SQL> alter session set container=cdb$root;
Session altered.

SQL> alter pluggable database pdborcl open;
alter pluggable database pdborcl open
*
ERROR at line 1:
ORA-01113: file 10 needs media recovery
ORA-01110: data file 10: '/u01/app/oracle/oradata/orcl/pdborcl/users01.dbf'

SQL> alter session set container=pdborcl;
Session altered.

SQL> alter database recover;
Database altered.

SQL> alter pluggable database pdborcl open;
Pluggable database altered.

SQL> select * from t1;
 OBJECT_ID OBJECT_NAME
---------- ------------------------------------------------------
 I_FILE#_BLOCK#
 I_OBJ3
 I_TS1
 I_CON1
 IND$
 CDEF$
 C_TS#
 I_CCOL2
 I_PROXY_DATA$
 I_CDEF4
 rows selected.

SQL> select * from v$version;
BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.2.0.0.1 - 64bit Beta                    0
PL/SQL Release 12.2.0.0.1 - Beta                                                          0
CORE    12.2.0.0.0      Beta                                                              0
TNS for linux: Version 12.2.0.0.0 - Beta                                                  0
NLSRTL Version 12.2.0.0.0 - Beta                                                          0

Note:

未提示的事务在abort后是做了rollback操作,和之前的版本预期的一样,不存在作者测试时的现象,朋友同样在12.1.0.2.0 做了测试也已修复。看来是12.1.0.1存在的一个小bug.

打赏

对不起,这篇文章暂时关闭评论。