Backup&Recovery · Oracle12c/11g
2016-12-01
Oracle 12c 多租户:PDB 支持 abort 关闭么?
在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 数据库升级 - Pre-Upgrade Information Tool
- 2011-12-01 Oracle官方Patch Set / Bugs Fixed 文档参考列表
- 2011-12-01 Oracle 9.2.0.4 ORA-600 KSSRMP1 案例一则
- 2009-12-01 10.2.0.4 RAC CRS-0184错误 CRS 无法启动案例
- 2008-12-01 珍惜当下,命运无常 - 纪念一位朋友的离开
- 2007-12-01 繁忙的一周 装修的进展
- 2006-12-01 "中国软件技术大会"和朋友们在一起
- 2006-12-01 糟糕的"中国软件技术大会"开幕式
- 2005-12-01 我的DBA飞走了
- 2005-12-01 Oracle HowTo:如何通过RMAN进行裸设备和文件系统之间的数据文件迁移