Bo's Oracle Station

查看: 1689|回复: 0

课程第36次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-12-29 20:43:53 | 显示全部楼层 |阅读模式
关于rowid和块号:
  1. SQL> select  t.*, t.rowid  from t2057 t;

  2.          A ROWID
  3. ---------- ------------------
  4.          1 AAAVVuAAEAAAADGAAA
  5.          2 AAAVVuAAEAAAADGAAB
  6.          3 AAAVVuAAEAAAADGAAC
  7.          4 AAAVVuAAEAAAADGAAD
  8.          5 AAAVVuAAEAAAADGAAE

  9. SQL> select  3*64+6 from dual;

  10.     3*64+6
  11. ----------
  12.        198

  13. SQL> select  dbms_rowid.rowid_block_number(rowid) from t2057;

  14. DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
  15. ------------------------------------
  16.                                  198
  17.                                  198
  18.                                  198
  19.                                  198
  20.                                  198

  21. SQL>
复制代码

破坏物理坏块:
  1. #!/bin/sh
  2. v_dbname=orcl
  3. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/srvctl stop database -d $v_dbname -o abort"
  4. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
  5. conn / as sysdba
  6. startup mount exclusive
  7. EOF

  8. rm -f /home/oracle/example01.dbf 2>/dev/null

  9. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  10. backup as copy datafile 5 format '/home/oracle/example01.dbf';
  11. EOF

  12. dd if=/dev/zero of=/home/oracle/example01.dbf bs=8192 count=1 seek=175 conv=notrunc

  13. su - oracle -c "export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid ; export ORACLE_SID=+ASM ; /u01/app/oracle/product/11.2.0/grid/bin/asmcmd" <<EOF
  14. rm -f +data/$v_dbname/DATAFILE/example*
  15. EOF

  16. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  17. run {
  18. set maxcorrupt for datafile 5 to 1;
  19. backup as copy  datafilecopy '/home/oracle/example01.dbf' format '+data';
  20. }
  21. EOF

  22. sleep 3

  23. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  24. delete noprompt datafilecopy '/home/oracle/example01.dbf';
  25. switch datafile 5 to copy;
  26. EOF


  27. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
  28. conn / as sysdba
  29. alter database open;
  30. EOF

复制代码

逻辑坏块:
  1. SQL> create tablespace tbslog  datafile '+Data' size 10M nologging ;

  2. Tablespace created.

  3. SQL> conn hr/oracle_4U
  4. Connected.
  5. SQL> create table tlog ( a  number  , b varchar2(20))  tablespace tbslog;

  6. Table created.

  7. SQL> insert into tlog values (12411.29, 'Auchenia' ) ;

  8. 1 row created.

  9. SQL> commit;

  10. Commit complete.
复制代码
  1. [oracle@station76 ~]$ rman target /

  2. Recovery Manager: Release 11.2.0.4.0 - Production on Thu Dec 26 11:07:31 2019

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

  4. connected to target database: ORCL (DBID=1554722616)

  5. RMAN> backup tablespace tbslog;

  6. Starting backup at 2019-12-26:11:08:55
  7. using target database control file instead of recovery catalog
  8. allocated channel: ORA_SBT_TAPE_1
  9. channel ORA_SBT_TAPE_1: SID=204 device type=SBT_TAPE
  10. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  11. allocated channel: ORA_SBT_TAPE_2
  12. channel ORA_SBT_TAPE_2: SID=136 device type=SBT_TAPE
  13. channel ORA_SBT_TAPE_2: Oracle Secure Backup
  14. channel ORA_SBT_TAPE_1: starting full datafile backup set
  15. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  16. input datafile file number=00007 name=+DATA/orcl/datafile/tbslog.289.1028026985
  17. channel ORA_SBT_TAPE_1: starting piece 1 at 2019-12-26:11:09:19
  18. channel ORA_SBT_TAPE_1: finished piece 1 at 2019-12-26:11:09:54
  19. piece handle=4nukcsuv_1_1 tag=TAG20191226T110918 comment=API Version 2.0,MMS Version 10.4.0.4
  20. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
  21. Finished backup at 2019-12-26:11:09:54

  22. RMAN>
复制代码
  1. SQL> create index ilog_a on tlog (a ) ;

  2. Index created.

  3. SQL> create index ilog_b on tlog(b) ;

  4. Index created.

  5. SQL> insert /*+ append */ into tlog select  * from tlog;

  6. 1 row created.

  7. SQL> commit;

  8. Commit complete.

  9. SQL> select a, b, dbms_rowid.rowid_block_number(rowid) from tlog;

  10.          A B                    DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
  11. ---------- -------------------- ------------------------------------
  12.   12411.29 Auchenia                                              135
  13.   12411.29 Auchenia                                              136

  14. SQL> conn / as sysdba
  15. Connected.
  16. SQL> alter tablespace tbslog offline immediate ;

  17. Tablespace altered.

  18. SQL>
复制代码
  1. ASMCMD> cd datafile
  2. ASMCMD> ls
  3. SYSAUX.282.1026941797
  4. SYSTEM.283.1026941797
  5. TBSLOG.289.1028026985
  6. TBSTRANS1.261.1027718433
  7. TBSTRANS2.262.1027718497
  8. UNDOTBS1.281.1026941797
  9. USERS.265.1028025845
  10. ASMCMD> rm TBSLOG.289.1028026985
  11. ASMCMD> ls
  12. SYSAUX.282.1026941797
  13. SYSTEM.283.1026941797
  14. TBSTRANS1.261.1027718433
  15. TBSTRANS2.262.1027718497
  16. UNDOTBS1.281.1026941797
  17. USERS.265.1028025845
  18. ASMCMD>
复制代码
  1. [oracle@station76 ~]$ rman target /

  2. Recovery Manager: Release 11.2.0.4.0 - Production on Thu Dec 26 11:28:08 2019

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

  4. connected to target database: ORCL (DBID=1554722616)

  5. RMAN> restore  tablespace tbslog;

  6. Starting restore at 2019-12-26:11:28:22
  7. using target database control file instead of recovery catalog
  8. allocated channel: ORA_DISK_1
  9. channel ORA_DISK_1: SID=11 device type=DISK
  10. allocated channel: ORA_DISK_2
  11. channel ORA_DISK_2: SID=76 device type=DISK
  12. allocated channel: ORA_DISK_3
  13. channel ORA_DISK_3: SID=144 device type=DISK
  14. allocated channel: ORA_DISK_4
  15. channel ORA_DISK_4: SID=204 device type=DISK
  16. allocated channel: ORA_DISK_5
  17. channel ORA_DISK_5: SID=15 device type=DISK
  18. allocated channel: ORA_DISK_6
  19. channel ORA_DISK_6: SID=79 device type=DISK
  20. allocated channel: ORA_DISK_7
  21. channel ORA_DISK_7: SID=138 device type=DISK
  22. allocated channel: ORA_DISK_8
  23. channel ORA_DISK_8: SID=203 device type=DISK
  24. allocated channel: ORA_SBT_TAPE_1
  25. channel ORA_SBT_TAPE_1: SID=16 device type=SBT_TAPE
  26. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  27. allocated channel: ORA_SBT_TAPE_2
  28. channel ORA_SBT_TAPE_2: SID=17 device type=SBT_TAPE
  29. channel ORA_SBT_TAPE_2: Oracle Secure Backup

  30. channel ORA_SBT_TAPE_1: starting datafile backup set restore
  31. channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
  32. channel ORA_SBT_TAPE_1: restoring datafile 00007 to +DATA/orcl/datafile/tbslog.289.1028026985
  33. channel ORA_SBT_TAPE_1: reading from backup piece 4nukcsuv_1_1
  34. channel ORA_SBT_TAPE_1: piece handle=4nukcsuv_1_1 tag=TAG20191226T110918
  35. channel ORA_SBT_TAPE_1: restored backup piece 1
  36. channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:35
  37. Finished restore at 2019-12-26:11:29:31

  38. RMAN> recover tablespace tbslog;

  39. Starting recover at 2019-12-26:11:30:00
  40. using channel ORA_DISK_1
  41. using channel ORA_DISK_2
  42. using channel ORA_DISK_3
  43. using channel ORA_DISK_4
  44. using channel ORA_DISK_5
  45. using channel ORA_DISK_6
  46. using channel ORA_DISK_7
  47. using channel ORA_DISK_8
  48. using channel ORA_SBT_TAPE_1
  49. using channel ORA_SBT_TAPE_2

  50. starting media recovery
  51. media recovery complete, elapsed time: 00:00:01

  52. Finished recover at 2019-12-26:11:30:03

  53. RMAN>
复制代码
物理坏块有应激性响应,而逻辑坏块没有:
QQ图片20191229214415.png

QQ图片20191229214415.png

但是会汇总到support workbench(incidnet , problem ) [注意和DRA中的 failure 的区别, 虽然它们都来自ADR]
QQ图片20191229214415.png


在Support Workbench中最重要的东西就是Problem:
QQ图片20191229214415.png

打包:
QQ图片20191229214415.png

/u01/app/oracle/product/11.2.0/dbhome_1/station76.example.com_orcl/sysman/emd/state/ORA1578_20191226115728_COM_1.zip
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-8 21:38 , Processed in 0.122497 second(s), 27 queries .

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