eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 关于ORA-20315数据库攻击事件的核心 AfterConnect.sql | Blog首页 | Oracle 12c多租户新特性:Common用户和Local用户的管理 »

Oracle 12c 多租户:PDB 支持 abort 关闭么?
modb.pro

在Oracle 12c的考试中,有这样一道题目:

When executing shutdown abort in a pluggable database (PDB), you ____________.
A. shut down abort the CDB
B. shut down abort the PDB
C. shut down immediate the PDB
D. shut down immediate the CDB

当我们通过shutdown abort的方式关闭PDB时,事实上我们做了什么?这个简单的题目,如果不加限定条件,答案是不确定的

让我们首先来看看在Oracle 12.1.0.1 版本中的表现。

通过10046的跟踪,可以清楚的找到事实真相:

[oracle@12c01db trace]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Dec 1 15:19:44 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select con_id,name,open_mode from v$pdbs;

    CON_ID NAME 			  OPEN_MODE
---------- ------------------------------ ----------
	 2 PDB$SEED			  READ ONLY
	 3 YHEM 			  MOUNTED

SQL> alter pluggable database YHEM open;

Pluggable database altered.

SQL> alter session set container=YHEM;

Session altered.

SQL> alter session set events '10046 trace name context forever,level 12';

Session altered.

SQL> shutdown immediate;
Pluggable Database closed.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@12c01db trace]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Dec 1 15:21:05 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> alter session set container=YHEM;

Session altered.

SQL> startup
Pluggable Database opened.
SQL> alter session set events '10046 trace name context forever,level 12';

Session altered.

SQL> shutdown abort;
Pluggable Database closed.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

对比两个跟踪文件,可以清晰的看到,在后台两种关闭方式事实上都被转换成immediate的方式关闭数据库,无论是归档模式还是非归档模式表现相同:

[oracle@12c01db trace]$ grep -i pluggable eygle_ora_14095.trc
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE
[oracle@12c01db trace]$ grep -i pluggable eygle_ora_14115.trc
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE


在跟踪文件中的这一段代码如下:

=====================
PARSING IN CURSOR #140136925772400 len=40 dep=0 uid=0 oct=227 lid=0 tim=67757313673 hv=1239515853 ad='9346b320' sqlid='65jadw14y30qd'
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE
END OF STMT
PARSE #140136925772400:c=0,e=215,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=67757313673
CLOSE #140136925778208:c=0,e=3,dep=1,type=0,tim=67757313767
=====================

在这个版本中的CDB中,标准的命令不包含ABORT选项:

SQL> alter pluggable database YHEM CLOSE;

Pluggable database altered.

SQL> alter pluggable database YHEM open;

Pluggable database altered.

SQL> alter pluggable database YHEM CLOSE ABORT;
alter pluggable database YHEM CLOSE ABORT
                                    *
ERROR at line 1:
ORA-00922: missing or invalid option

所以在12.1.0.1版本中,这个问题的答案应该选择C。


历史上的今天...
    >> 2011-12-01文章:
    >> 2009-12-01文章:
    >> 2008-12-01文章:
    >> 2007-12-01文章:
           繁忙的一周 装修的进展
    >> 2006-12-01文章:
    >> 2005-12-01文章:
           我的DBA飞走了

By eygle on 2016-12-01 15:08 | Comments (0) | Backup&Recovery | Oracle12c/11g | 3216 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com