【12C考题精解】OCP 1z0-060 QUESTION 8: Recovery of a Tablespace in the CDB

QUESTION 8

Your multitenant container (CDB) containing three pluggable databases (PDBs) is running in ARCHIVELOG mode. You find that the SYSAUX tablespace is corrupted in the root container. The steps to recover the tablespace are as follows:
   1. Mount the CDB.
   2. Close all the PDBs.
   3. Open the database.
   4. Apply the archive redo logs.
   5. Restore the data file.
   6. Take the SYSAUX tablespace offline.
   7. Place the SYSAUX tablespace online.
   8. Open all the PDBs with RESETLOGS.
   9. Open the database with RESETLOGS.
   10. Execute the command SHUTDOWN ABORT.
Which option identifies the correct sequence to recover the SYSAUX tablespace?

A. 6,5,4,7
B. 10,1,2,5,8
C. 10,1,2,5,4,9,8
D. 10,1,5,8,10

【题目示意】
本题考察的是CDB中的SYSAUX表空间完全恢复。

【解析】
在数据库已经open的情况下,某些非关键数据文件发生损坏。只需要在保证数据库其他数据文件可用的状态下,对损坏的文件或损坏文件所在的表空间进行restore和recover操作。不需要关闭数据库,再进行恢复。在restore之前,要求表空间处于offline状态。

【实验】
1.修改数据库为归档模式

[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Aug 11 14:58:41 2014

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

Connected to an idle instance.

[email protected]> startup
ORACLE instance started.

Total System Global Area 2121183232 bytes
Fixed Size          2290360 bytes
Variable Size        1308626248 bytes
Database Buffers      805306368 bytes
Redo Buffers            4960256 bytes
Database mounted.
Database opened.
[email protected]> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[email protected]> startup mount
ORACLE instance started.

Total System Global Area 2121183232 bytes
Fixed Size                 2290360 bytes
Variable Size        1308626248 bytes
Database Buffers             805306368 bytes
Redo Buffers            4960256 bytes
Database mounted.
[email protected]> alter database archivelog;

Database altered.

[email protected]> alter database open;

Database altered.

[email protected]> alter system switch logfile;

System altered.

2.使用RMAN备份数据库

[email protected]> !rman

Recovery Manager: Release 12.1.0.1.0 - Production on Mon Aug 11 15:00:13 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: DBSTYLE (DBID=2767578829)

RMAN> backup database;

Starting backup at 11-AUG-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=50 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/DBSTYLE/undotbs01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/DBSTYLE/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/DBSTYLE/sysaux01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/DBSTYLE/users01.dbf
channel ORA_DISK_1: starting piece 1 at 11-AUG-14
channel ORA_DISK_1: finished piece 1 at 11-AUG-14
piece handle=/u01/app/oracle/fast_recovery_area/DBSTYLE/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtj5z5_.bkp tag=TAG20140811T150021 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00008 name=/u01/app/oracle/oradata/DBSTYLE/DBS/sysaux01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/DBSTYLE/DBS/system01.dbf
input datafile file number=00009 name=/u01/app/oracle/oradata/DBSTYLE/DBS/DBS_users01.dbf
channel ORA_DISK_1: starting piece 1 at 11-AUG-14
channel ORA_DISK_1: finished piece 1 at 11-AUG-14
piece handle=/u01/app/oracle/fast_recovery_area/DBSTYLE/FDD32A078F321802E0430A50A8C0F4FF/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtjz65_.bkp tag=TAG20140811T150021 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/app/oracle/oradata/DBSTYLE/pdbseed/sysaux01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/DBSTYLE/pdbseed/system01.dbf
channel ORA_DISK_1: starting piece 1 at 11-AUG-14
channel ORA_DISK_1: finished piece 1 at 11-AUG-14
piece handle=/u01/app/oracle/fast_recovery_area/DBSTYLE/FDD22BF463BC0F53E0430A50A8C0EDD2/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtk68h_.bkp tag=TAG20140811T150021 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 11-AUG-14

Starting Control File and SPFILE Autobackup at 11-AUG-14
piece handle=/u01/app/oracle/fast_recovery_area/DBSTYLE/autobackup/2014_08_11/o1_mf_s_855327661_9yjtkff8_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 11-AUG-14

RMAN> list backup;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    2.09G      DISK        00:00:16     11-AUG-14
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20140811T150021
        Piece Name: /u01/app/oracle/fast_recovery_area/DBSTYLE/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtj5z5_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1564193    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/system01.dbf
  3       Full 1564193    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/sysaux01.dbf
  5       Full 1564193    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/undotbs01.dbf
  6       Full 1564193    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    762.73M    DISK        00:00:04     11-AUG-14
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20140811T150021
        Piece Name: /u01/app/oracle/fast_recovery_area/DBSTYLE/FDD32A078F321802E0430A50A8C0F4FF/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtjz65_.bkp
  List of Datafiles in backup set 2
  Container ID: 3, PDB Name: DBS
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  7       Full 1563088    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/DBS/system01.dbf
  8       Full 1563088    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/DBS/sysaux01.dbf
  9       Full 1563088    11-AUG-14 /u01/app/oracle/oradata/DBSTYLE/DBS/DBS_users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    761.49M    DISK        00:00:04     11-AUG-14
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20140811T150021
        Piece Name: /u01/app/oracle/fast_recovery_area/DBSTYLE/FDD22BF463BC0F53E0430A50A8C0EDD2/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtk68h_.bkp
  List of Datafiles in backup set 3
  Container ID: 2, PDB Name: PDB$SEED
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1539785    10-JUL-14 /u01/app/oracle/oradata/DBSTYLE/pdbseed/system01.dbf
  4       Full 1539785    10-JUL-14 /u01/app/oracle/oradata/DBSTYLE/pdbseed/sysaux01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    17.20M     DISK        00:00:00     11-AUG-14
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20140811T150101
        Piece Name: /u01/app/oracle/fast_recovery_area/DBSTYLE/autobackup/2014_08_11/o1_mf_s_855327661_9yjtkff8_.bkp
  SPFILE Included: Modification time: 11-AUG-14
  SPFILE db_unique_name: DBSTYLE
  Control File Included: Ckp SCN: 1565204      Ckp time: 11-AUG-14

3.删除sysaux01.dbf数据文件,模拟sysaux表空间损坏

[[email protected] DBSTYLE]$ rm -f sysaux01.dbf

4.使用RMAN进行restore操作,此时由于表空间没有离线,因此无法进行restore

RMAN> restore tablespace sysaux;

Starting restore at 11-AUG-14
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DBSTYLE/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBSTYLE/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtj5z5_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/11/2014 15:18:45
ORA-19870: error while restoring backup piece /u01/app/oracle/fast_recovery_area/DBSTYLE/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtj5z5_.bkp
ORA-19573: cannot obtain exclusive enqueue for datafile 3

5.将SYSAUX表空间离线,此时需要使用offline immediate命令

[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Aug 11 15:01:27 2014

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, Oracle Label Security, OLAP, Advanced Analytics
and Real Application Testing options

[email protected]> alter tablespace sysaux offline;
alter tablespace sysaux offline
*
ERROR at line 1:
ORA-01116: error in opening database file 3
ORA-01110: data file 3: ‘/u01/app/oracle/oradata/DBSTYLE/sysaux01.dbf‘
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

[email protected]> alter tablespace sysaux offline immediate;

Tablespace altered.

[email protected]> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME            STATUS
------------------------------ ---------
SYSTEM                 ONLINE
SYSAUX                 OFFLINE
UNDOTBS1               ONLINE
TEMP                   ONLINE
USERS                  ONLINE

6.再次使用RMAN恢复表空间

RMAN> restore tablespace sysaux;

Starting restore at 11-AUG-14
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DBSTYLE/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBSTYLE/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtj5z5_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBSTYLE/backupset/2014_08_11/o1_mf_nnndf_TAG20140811T150021_9yjtj5z5_.bkp tag=TAG20140811T150021
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 11-AUG-14

RMAN> recover tablespace sysaux;

Starting recover at 11-AUG-14
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 11-AUG-14

RMAN> alter tablespace sysaux online;

Statement processed

RMAN>

7.SYSAUX表空间恢复正常

[email protected]> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME            STATUS
------------------------------ ---------
SYSTEM                 ONLINE
SYSAUX                 ONLINE
UNDOTBS1               ONLINE
TEMP                   ONLINE
USERS                  ONLINE

[email protected]>

【小结】
无论CDB或者PDB,如果是非关键表空间发生损坏,对数据库影响最小的处理方法就是,让损坏的表空间离线,然后进行restore和recovery,进而使表空间恢复正常。因此A选项最合理。

【答案】 A



相关参考
http://docs.oracle.com/database/121/BRADV/rcmcomre.htm#BRADV89773



更多精彩文章,请访问作者个人博客:www.dbstyle.net

【12C考题精解】OCP 1z0-060 QUESTION 8: Recovery of a Tablespace in the CDB

时间: 2024-10-05 22:16:18

【12C考题精解】OCP 1z0-060 QUESTION 8: Recovery of a Tablespace in the CDB的相关文章

【12C考题精解】OCP 1z0-060 QUESTION 3: Managing the SYSAUX Tablespace

QUESTION 3 Which two statements are true about the use of the procedures listed in the v$sysaux_occupants.move_procedure column? A. The procedure maybe used for some component store locate component data to the SYSAUX tablespace from its current tabl

【Q&A】12C OCP 1z0-060 QUESTION 1: About Managing Temporary Tablespaces in a CDB

QUESTION 1 Your multitenant container (CDB) contains two pluggable databases (PDB), HR_PDB and ACCOUNTS_PDB, both of which use the CDB tablespace. The temp file is called temp01.tmp. A user issues a query on a table on one of the PDBs and receives th

[已读]JavaScript编程精解

译者汤姆大叔,应该很多人都知道,他写了一系列的关于闭包与作用域理解的文章,但是由于创建了一些我不理解的新名词,我不爱看. <JavaScript编程精解>算是买得比较早的一本书,那会大肆搜罗js基础书籍,这本应该是在我看完<javascript高级程序设计(第二版)>之后,紧接着看的,金玉在前,所以,原谅我对它的印象不够好,另外,我没有耐心按照书中生态圈的例子一点一点敲代码,对很多人提到的这本书的趣味性也就没有体会. 关于内容,首先,它不适合没有基础的读者看,会有一点难看懂.第二,

【SSH2(实践篇)】--Struts2拦截器精解

上篇博客对Struts2的体系结构做了初步的了解,Struts2是以WebWork作为处理核心,并采用拦截器的机制来处理用户的请求,同时它还集成了Struts1丰富的标签库.另外上篇博客还对Struts2的配置使用进行了初步的介绍,下面将会集中讨论Struts2的拦截器. 一.拦截器 1.拦截器小介 拦截器的功能类似于web.xml文件中的Filter,能对用户的请求进行拦截,通过拦截用户的请求来实现对页面的控制.拦截器是在Struts-core-2.2.3.jar中进行配置的,原始的拦截器是在

《Cocos2d-x游戏开发实战精解》学习笔记3--在Cocos2d-x中播放声音

<Cocos2d-x游戏开发实战精解>学习笔记1--在Cocos2d中显示图像 <Cocos2d-x游戏开发实战精解>学习笔记2--在Cocos2d-x中显示一行文字 之前的内容主要都是介绍如何在屏幕上显示图像,事实上除了图像之外,音乐的播放也可以被理解为一种显示的方式,本节将学习在Cocos2d-x中播放声音的方法. (1)在HelloWorld.h中对HelloWorld类进行如下定义: class HelloWorld : public Cocos2d::Layer { pu

Storm流计算从入门到精通之技术篇(高并发策略、批处理事务、Trident精解、运维监控、企业场景)

对这个课程有兴趣的可以加我qq2059055336和我联系 Storm是什么? 为什么学习Storm? Storm是Twitter开源的分布式实时大数据处理框架,被业界称为实时版Hadoop. 随着越来越多的场景对Hadoop的MapReduce高延迟无法容忍,比如网站统计.推荐系统.预警系统.金融系统(高频交易.股票)等等, 大数据实时处理解决方案(流计算)的应用日趋广泛,目前已是分布式技术领域最新爆发点,而Storm更是流计算技术中的佼佼者和主流. 按照storm作者的说法,Storm对于实

软测之魂核心测试设计精解

Metasploit渗透测试手册.pdf: http://www.t00y.com/file/80348123 [计算机软件测试(原书第二版)].Cem.Kaner等.扫描版.pdf: http://www.t00y.com/file/80346316 [走出技术分析的陷阱].孙大莹.扫描版.pdf: http://www.t00y.com/file/60741464 [项目自动化之道-如何建构.部署.监控Java应用].Mike.Clark.pdf: http://www.t00y.com/f

《Cocos2d-x游戏开发实战精解》学习笔记1--在Cocos2d中显示图像

Cocos2d-x中的图像是通过精灵类来显示的.在Cocos2d-x中游戏中的每一个角色.怪物.道具都可以理解成是一个精灵,游戏背景作为一种特殊的单位将其理解成是一个精灵也没有什么不妥.在源文件本章目录下的项目ChapterThree03就展示了使用Cocos2d-x实现简单游戏开始界面的方法,主要就是通过精灵类来显示图像,其关键代码如范例3-5所示. [范例3-5 在Cocos2d-x中显示图像] Size size = Director::getInstance()->getVisibleS

Android更新Ui进阶精解(二)

<代码里的世界> 用文字札记描绘自己 android学习之路 转载请保留出处 by Qiao http://blog.csdn.net/qiaoidea/article/details/45115047 Android更新Ui进阶精解(一) android ui线程检查机制 Android更新Ui进阶精解(二) android 线程更新UI机制 1.回顾 第一篇讲了对Ui线程更新的方法和见解,然后接着讲了线程检查机制,这里来详细分析下更新Ui的核心--Android中消息系统模型.当然,这里要