设为首页 收藏本站
查看: 919|回复: 0

[经验分享] oracle技术之oracle基于backup control 的完全恢复

[复制链接]
发表于 2018-9-25 12:42:13 | 显示全部楼层 |阅读模式
  误删除表空间(有备份),利用备份的控制文件恢复
  一、模拟环境
  07:59:14 SQL> select count(*) from scott.dept2;
  COUNT(*)
  ----------
  12
  07:59:50 SQL> drop tablespace lxtbs1 including contents and datafiles;
  Tablespace dropped.
  07:59:56 SQL> shutdown immediate
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  08:00:58 SQL> !
  Fri Mar 23 18:50:06 2012
  drop tablespace cuug including contents and datafiles
  Fri Mar 23 18:50:08 2012
  Deleted file /u01/app/oracle/oradata/anny/cuug01.dbf
  Completed: drop tablespace cuug including contents and datafiles
  二、转储所有数据文件
  [oracle@cuug14 ~]$ cp /orabak/orcl/cold_bak/*.dbf /disk1/oradata/orcl
  08:03:26 SQL> recover database until time '2012-02-12 07:59:53' using backup controlfile;
  ORA-01034: ORACLE not available
  08:04:12 SQL> startup mount
  ORACLE instance started.
  Total System Global Area  167772160 bytes

  Fixed>
  Variable>  Database Buffers           88080384 bytes
  Redo Buffers                2973696 bytes
  Database mounted.
  三、recover  database
  08:04:36 SQL> recover database until time '2012-02-12 07:59:53' using backup controlfile;
  ORA-00279: change 831098 generated at 02/12/2012 06:32:28 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_6_775023202.log
  ORA-00280: change 831098 for thread 1 is in sequence #6
  08:04:45 Specify log: {=suggested | filename | AUTO | CANCEL}
  auto
  ORA-00279: change 832010 generated at 02/12/2012 07:55:37 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_1_775036537.log
  ORA-00280: change 832010 for thread 1 is in sequence #1
  ORA-00279: change 832995 generated at 02/12/2012 07:58:39 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_2_775036537.log
  ORA-00280: change 832995 for thread 1 is in sequence #2
  ORA-00278: log file '/arch/orcl/arch_1_1_775036537.log' no longer needed for this recovery
  ORA-00279: change 832997 generated at 02/12/2012 07:58:40 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_3_775036537.log
  ORA-00280: change 832997 for thread 1 is in sequence #3
  ORA-00278: log file '/arch/orcl/arch_1_2_775036537.log' no longer needed for this recovery
  ORA-00279: change 833000 generated at 02/12/2012 07:58:43 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_4_775036537.log
  ORA-00280: change 833000 for thread 1 is in sequence #4
  ORA-00278: log file '/arch/orcl/arch_1_3_775036537.log' no longer needed for this recovery
  ORA-00279: change 833017 generated at 02/12/2012 07:59:13 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_5_775036537.log
  ORA-00280: change 833017 for thread 1 is in sequence #5
  ORA-00278: log file '/arch/orcl/arch_1_4_775036537.log' no longer needed for this recovery
  ORA-00279: change 833019 generated at 02/12/2012 07:59:14 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_6_775036537.log
  ORA-00280: change 833019 for thread 1 is in sequence #6
  ORA-00278: log file '/arch/orcl/arch_1_5_775036537.log' no longer needed for this recovery
  ORA-00308: cannot open archived log '/arch/orcl/arch_1_6_775036537.log'
  ORA-27037: unable to obtain file status
  Linux Error: 2: No such file or directory
  Additional information: 3
  四、利用当前日志组恢复
  08:04:52 SQL> select name from v$archived_log;
  NAME
  ------------------------------------------------------------------------------------------------------------------------
  /arch/orcl/arch_1_9_771838300.log
  /arch/orcl/arch_1_10_771838300.log
  /arch/orcl/arch_1_11_771838300.log
  /arch/orcl/arch_1_12_771838300.log
  /arch/orcl/arch_1_13_771838300.log
  /arch/orcl/arch_1_14_771838300.log
  /arch/orcl/arch_1_15_771838300.log
  /arch/orcl/arch_1_16_771838300.log
  /arch/orcl/arch_1_17_771838300.log
  /arch/orcl/arch_1_18_771838300.log
  /arch/orcl/arch_1_19_771838300.log
  /arch/orcl/arch_1_20_771838300.log
  /arch/orcl/arch_1_21_771838300.log
  /arch/orcl/arch_1_4_775023202.log
  /arch/orcl/arch_1_5_775023202.log
  /arch/orcl/arch_1_1_775036537.log
  /arch/orcl/arch_1_2_775036537.log
  NAME
  ------------------------------------------------------------------------------------------------------------------------
  /arch/orcl/arch_1_3_775036537.log
  /arch/orcl/arch_1_4_775036537.log
  /arch/orcl/arch_1_5_775036537.log
  20 rows selected.
  08:05:06 SQL> select member from v$logfile;
  MEMBER
  ------------------------------------------------------------------------------------------------------------------------
  /disk2/oradata/orcl/redo03.log
  /disk2/oradata/orcl/redo02.log
  /disk2/oradata/orcl/redo01.log
  08:05:25 SQL> select * from v$log;
  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
  ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
  1          1          5   52428800          1 YES INACTIVE                833017 2012-02-12 07:59:13
  3          1          6   52428800          1 NO  CURRENT                 833019 2012-02-12 07:59:14
  2          1          4   52428800          1 YES INACTIVE                833000 2012-02-12 07:58:43
  08:05:59 SQL> recover database until time '2012-02-12 07:59:53' using backup controlfile;
  ORA-00279: change 833019 generated at 02/12/2012 07:59:14 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_6_775036537.log
  ORA-00280: change 833019 for thread 1 is in sequence #6
  08:06:07 Specify log: {=suggested | filename | AUTO | CANCEL}
  /disk2/oradata/orcl/redo03.log
  Log applied.
  Media recovery complete.

  08:06:13 SQL>>
  Database>  08:06:40 SQL> select name from v$datafile;
  NAME
  ------------------------------------------------------------------------------------------------------------------------
  /disk1/oradata/orcl/system01.dbf
  /disk1/oradata/orcl/undotbs01.dbf
  /disk1/oradata/orcl/sysaux01.dbf
  /disk1/oradata/orcl/users01.dbf
  /disk1/oradata/orcl/example01.dbf
  /u01/app/oracle/product/10.2.0/db_1/dbs/MISSING00006
  6 rows selected.
  08:06:48 SQL> !
  [oracle@cuug14 ~]$ ls /u01/app/oracle/product/10.2.0/db_1/dbs/
  hc_orcl.dat  initdw.ora  init.ora  initorcl.ora  lkORCL  orapworcl  spfileorcl.ora
  [oracle@cuug14 ~]$ ls -a /u01/app/oracle/product/10.2.0/db_1/dbs/
  .  ..  hc_orcl.dat  initdw.ora  init.ora  initorcl.ora  lkORCL  orapworcl  spfileorcl.ora
  08:08:29 SQL> col file_name for a50
  08:08:35 SQL> select file_id,file_name,tablespace_name from dba_data_files;
  FILE_ID FILE_NAME                                          TABLESPACE_NAME
  ---------- -------------------------------------------------- ------------------------------
  4 /disk1/oradata/orcl/users01.dbf                    USERS
  3 /disk1/oradata/orcl/sysaux01.dbf                   SYSAUX
  2 /disk1/oradata/orcl/undotbs01.dbf                  UNDOTBS1
  1 /disk1/oradata/orcl/system01.dbf                   SYSTEM
  6 /u01/app/oracle/product/10.2.0/db_1/dbs/MISSING000 LXTBS1
  06
  5 /disk1/oradata/orcl/example01.dbf                  EXAMPLE
  6 rows selected.
  五、利用备份的datafile 再做完全恢复

  08:08:59 SQL>>  alter tablespace lxtbs1 offline
  *
  ERROR at line 1:
  ORA-01191: file 6 is already offline - cannot do a normal offline
  ORA-01111: name for data file 6 is unknown - rename to correct file
  ORA-01110: data file 6: '/u01/app/oracle/product/10.2.0/db_1/dbs/MISSING00006'

  08:09:58 SQL>>
  Database>  08:10:05 SQL> !
  [oracle@cuug14 ~]$ cp /orabak/orcl/cold_bak/lxtbs01.dbf /disk1/oradata/orcl/

  08:11:32 SQL>>
  Tablespace>
  08:11:44 SQL>>  alter tablespace lxtbs1 online
  *
  ERROR at line 1:
  ORA-01190: control file or data file 6 is from before the last RESETLOGS
  ORA-01110: data file 6: '/disk1/oradata/orcl/lxtbs01.dbf'
  08:11:58 SQL> recover datafile 6;
  ORA-00279: change 831098 generated at 02/12/2012 06:32:28 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_6_775023202.log
  ORA-00280: change 831098 for thread 1 is in sequence #6
  08:12:19 Specify log: {=suggested | filename | AUTO | CANCEL}
  auto
  ORA-00279: change 832010 generated at 02/12/2012 07:55:37 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_1_775036537.log
  ORA-00280: change 832010 for thread 1 is in sequence #1
  ORA-00279: change 832995 generated at 02/12/2012 07:58:39 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_2_775036537.log
  ORA-00280: change 832995 for thread 1 is in sequence #2
  ORA-00278: log file '/arch/orcl/arch_1_1_775036537.log' no longer needed for this recovery
  ORA-00279: change 832997 generated at 02/12/2012 07:58:40 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_3_775036537.log
  ORA-00280: change 832997 for thread 1 is in sequence #3
  ORA-00278: log file '/arch/orcl/arch_1_2_775036537.log' no longer needed for this recovery
  ORA-00279: change 833000 generated at 02/12/2012 07:58:43 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_4_775036537.log
  ORA-00280: change 833000 for thread 1 is in sequence #4
  ORA-00278: log file '/arch/orcl/arch_1_3_775036537.log' no longer needed for this recovery
  ORA-00279: change 833017 generated at 02/12/2012 07:59:13 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_5_775036537.log
  ORA-00280: change 833017 for thread 1 is in sequence #5
  ORA-00278: log file '/arch/orcl/arch_1_4_775036537.log' no longer needed for this recovery
  ORA-00279: change 833019 generated at 02/12/2012 07:59:14 needed for thread 1
  ORA-00289: suggestion : /arch/orcl/arch_1_6_775036537.log
  ORA-00280: change 833019 for thread 1 is in sequence #6
  ORA-00278: log file '/arch/orcl/arch_1_5_775036537.log' no longer needed for this recovery
  Log applied.
  Media recovery complete.

  08:12:35 SQL>>
  Database>  08:12:42 SQL> select * from scott.dept2;
  DEPTNO DNAME          LOC
  ---------- -------------- -------------
  10 ACCOUNTING     NEW YORK
  20 RESEARCH       DALLAS
  30 SALES          CHICAGO
  40 OPERATIONS     BOSTON
  10 ACCOUNTING     NEW YORK
  20 RESEARCH       DALLAS
  30 SALES          CHICAGO
  40 OPERATIONS     BOSTON
  10 ACCOUNTING     NEW YORK
  20 RESEARCH       DALLAS
  30 SALES          CHICAGO
  40 OPERATIONS     BOSTON
  12 rows selected.
  oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-601831-1-1.html 上篇帖子: oracle技术之Oracle 跟踪事件(一) 下篇帖子: Oracle教程之Oracle 跟踪事件(二)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表