zoukankan      html  css  js  c++  java
  • OCP-1Z0-053-V13.02-684题

    684. Your database is running in ARCHIVELOG mode. You have been taking backups of all the data files and control files regularly.  

    You are informed that some important tables in  the BILLING tablespace have been dropped on February 28, 2007 at 10.30 AM and must be recovered.

    You decide to perform an incomplete recovery using the following command:

    SQL> RECOVER DATABASE UNTIL TIME ‘2007-02-28:10:15:00’;

    Identify the files that must be restored to recover the missing tables successfully.

    A.Restore the backup of all the data files.

    B.Restore the backup of all the  data files and the control file.

    C.Restore the backup of only the data files that  contain the dropped tables.

    D.Restore the backup of all the data files belonging to the tablespace containing the dropped tables.

    Answer: D 
    答案解析:
    你的数据库运行在归档模式,并且定期备份了所有的数据文件和控制文件。
    你被通知一些在BILLING表空间的重要的表在ebruary 28, 2007 at 10.30 AM丢失,并且要求恢复。
    你决定使用以下命令执行不完全恢复SQL> RECOVER DATABASE UNTIL TIME ‘2007-02-28:10:15:00’;

    从以下实验中看出,如果是recover database,则必须先restore databse  ,则是restore所有备份的数据文件。

    此题应该选A

    第一步:创建测试表,并插入数据
    10:43:49 scott@TESTDB>create table dept_new as select * from dept;

    Table created.

    10:44:05 scott@TESTDB>select * from dept_new;

        DEPTNO DNAME          LOC
    ---------- -------------- -------------
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON

    10:44:15 scott@TESTDB>insert into dept_new values (50,'IT','CHINA');

    1 row created.

    10:45:07 scott@TESTDB>select * from dept_new;

        DEPTNO DNAME          LOC
    ---------- -------------- -------------
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
            50 IT             CHINA

    第二步:rman备份数据库
    [oracle@rtest ~]$ rman target /

    Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 27 10:45:36 2013

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

    connected to target database: TESTDB (DBID=2617656787)

    RMAN> backup database;

    Starting backup at 27-DEC-13
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=37 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=00001 name=/u01/app/oracle/oradata/testdb/system01.dbf
    input datafile file number=00002 name=/u01/app/oracle/oradata/testdb/sysaux01.dbf
    input datafile file number=00005 name=/u01/app/oracle/oradata/testdb/example01.dbf
    input datafile file number=00003 name=/u01/app/oracle/oradata/testdb/undotbs01.dbf
    input datafile file number=00004 name=/u01/app/oracle/oradata/testdb/users01.dbf
    channel ORA_DISK_1: starting piece 1 at 27-DEC-13
    channel ORA_DISK_1: finished piece 1 at 27-DEC-13
    piece handle=/u01/app/oracle/fast_recovery_area/TESTDB/backupset/2013_12_27/o1_mf_nnndf_TAG20131227T104552_9csth1ns_.bkp tag=TAG20131227T104552 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:02:05
    Finished backup at 27-DEC-13

    Starting Control File and SPFILE Autobackup at 27-DEC-13
    piece handle=/u01/app/oracle/fast_recovery_area/TESTDB/autobackup/2013_12_27/o1_mf_s_835267679_9cstm02l_.bkp comment=NONE
    Finished Control File and SPFILE Autobackup at 27-DEC-13

    第三步:drop表
    10:49:05 scott@TESTDB>select * from dept_new;

        DEPTNO DNAME          LOC
    ---------- -------------- -------------
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
            50 IT             CHINA

    10:49:13 scott@TESTDB>commit;

    Commit complete.

    10:49:30 scott@TESTDB>insert into dept_new values(60,'CLERK','BEIJING');

    1 row created.

    10:50:34 scott@TESTDB>commit;

    Commit complete.

    10:50:55 scott@TESTDB> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

    Session altered.

    10:51:26 scott@TESTDB>select sysdate from dual;

    SYSDATE
    -------------------
    2013-12-27 10:51:34

    10:51:34 scott@TESTDB>drop table dept_new purge;

    Table dropped.

    第四步:恢复
    在mount状态下不完全恢复
    sys@TESTDB>shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    sys@TESTDB>startup mount;
    ORACLE instance started.

    Total System Global Area  309673984 bytes
    Fixed Size                  1364312 bytes
    Variable Size             268439208 bytes
    Database Buffers           33554432 bytes
    Redo Buffers                6316032 bytes
    Database mounted.


    在rman里做restore database
    [oracle@rtest ~]$ rman target /

    Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 27 10:54:59 2013

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

    connected to target database: TESTDB (DBID=2617656787, not open)

    RMAN> restore database;

    Starting restore at 27-DEC-13
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=20 device type=DISK

    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 00001 to /u01/app/oracle/oradata/testdb/system01.dbf
    channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/testdb/sysaux01.dbf
    channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/testdb/undotbs01.dbf
    channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/testdb/users01.dbf
    channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/testdb/example01.dbf
    channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TESTDB/backupset/2013_12_27/o1_mf_nnndf_TAG20131227T104552_9csth1ns_.bkp
    channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TESTDB/backupset/2013_12_27/o1_mf_nnndf_TAG20131227T104552_9csth1ns_.bkp tag=TAG20131227T104552
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:01:56
    Finished restore at 27-DEC-13

    RMAN> 


    在sqlplus里面做recover database until  time
    sys@TESTDB>alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

    Session altered.

    sys@TESTDB>select sysdate from dual;

    SYSDATE
    -------------------
    2013-12-27 10:58:12

    sys@TESTDB>recover database until time '2013-12-27:10:51:34';          
    Media recovery complete.
    sys@TESTDB>alter database open resetlogs;

    Database altered.

    sys@TESTDB>select * from scott.dept_new;

        DEPTNO DNAME          LOC
    ---------- -------------- -------------
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
            50 IT             CHINA
            60 CLERK          BEIJING

    6 rows selected.

  • 相关阅读:
    Apache日志分析
    iptables日志探秘
    php与其他一些相关工具的安装步骤分享
    ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_830_0.MYI' (Errcode: 13)
    一些可能需要的正则
    restful api的简单理解
    认识MySQL Replication
    如何处理缓存失效、缓存穿透、缓存并发等问题
    经典算法mark
    php常用的一些代码
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316250.html
Copyright © 2011-2022 走看看