暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

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

原创 eygle 2016-12-01
641

在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。


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论