Bo's Oracle Station

查看: 1451|回复: 0

课程第32次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-7-27 08:41:38 | 显示全部楼层 |阅读模式
inactive日志组损坏:
1. 日志
  1. Sat Jul 27 08:18:37 2019
  2. SMCO started with pid=34, OS id=5531
  3. Sat Jul 27 09:03:56 2019
  4. alter database clear logfile group 3
  5. Clearing online log 3 of thread 1 sequence number 18
  6. Errors in file /u01/app/oracle/diag/rdbms/rcat/rcat/trace/rcat_ora_9487.trc:
  7. ORA-00313: 无法打开日志组 3 (用于线程 1) 的成员
  8. ORA-00312: 联机日志 3 线程 1: '/u01/app/oracle/oradata/rcat/redo03.log'
  9. ORA-27037: 无法获得文件状态
  10. Linux-x86_64 Error: 2: No such file or directory
  11. Additional information: 3
  12. Errors in file /u01/app/oracle/diag/rdbms/rcat/rcat/trace/rcat_ora_9487.trc:
  13. ORA-00313: 无法打开日志组 3 (用于线程 1) 的成员
  14. ORA-00312: 联机日志 3 线程 1: '/u01/app/oracle/oradata/rcat/redo03.log'
  15. ORA-27037: 无法获得文件状态
  16. Linux-x86_64 Error: 2: No such file or directory
  17. Additional information: 3
  18. Sat Jul 27 09:03:57 2019
  19. Errors in file /u01/app/oracle/diag/rdbms/rcat/rcat/trace/rcat_m000_9759.trc:
  20. ORA-00316: log 3 of thread 1, type 0 in header is not log file
  21. ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/rcat/redo03.log'
  22. Checker run found 2 new persistent data failures
  23. Completed: alter database clear logfile group 3


复制代码
2.处理方法:
  1. select  * from v$log;

  2. select * from v$logfile;

  3. alter database clear logfile group 3;
复制代码

--------------------------active
untitled.png

  1. alter system switch logfile;

  2. select  * from v$log;

  3. select * from v$logfile;

  4. select  * from v_$archived_log a
  5.   order by a."FIRST_CHANGE#" ;

  6. alter database clear logfile group 2;

  7. alter system checkpoint;

  8. alter database clear logfile group 2;
复制代码

-----------------------------current

untitled.png

  1. select  * from v$log;

  2. select * from v$logfile;

  3. alter database clear logfile group 3;

  4. alter system switch logfile;

  5. alter system checkpoint;

  6. alter database clear unarchived logfile group 3;
复制代码
-------------------------------------------------------------10d实验:

用control10d-before.sql,会出现:

   FILE_NAMEFILE_IDTABLESPACE_NAMEBYTESBLOCKSSTATUSRELATIVE_FNOAUTOEXTENSIBLEMAXBYTESMAXBLOCKSINCREMENT_BYUSER_BYTESUSER_BLOCKSONLINE_STATUS
1+DATA/orcl/datafile/example.265.10139609875EXAMPLE36306944044320AVAILABLE5YES3435972198441943028036202086444192ONLINE
2+DATA/orcl/datafile/undotbs1.258.10139608833UNDOTBS111010048013440AVAILABLE3YES34359721984419430264010905190413312ONLINE
3+DATA/orcl/datafile/sysaux.257.10139608832SYSAUX60817408074240AVAILABLE2YES343597219844194302128060712550474112ONLINE
4+DATA/orcl/datafile/system.256.10145042151SYSTEM79691776097280AVAILABLE1YES343597219844194302128079586918497152SYSTEM
5/u01/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING000044USERS AVAILABLE4 RECOVER


-------------------------------------------------------------补救措施:
  1. [oracle@station76 ~]$ . oraenv
  2. ORACLE_SID = [orcl] ? +ASM
  3. The Oracle base remains unchanged with value /u01/app/oracle
  4. [oracle@station76 ~]$ asmcmd
  5. ASMCMD> ls
  6. DATA/
  7. FRA/
  8. ASMCMD> cd data
  9. ASMCMD> ls
  10. ASM/
  11. ORCL/
  12. ASMCMD> cd orcl
  13. ASMCMD> ls
  14. CONTROLFILE/
  15. DATAFILE/
  16. ONLINELOG/
  17. PARAMETERFILE/
  18. TEMPFILE/
  19. spfileorcl.ora
  20. ASMCMD> cd DATAFILE/
  21. ASMCMD> ls
  22. EXAMPLE.265.1013960987
  23. SYSAUX.257.1013960883
  24. SYSTEM.256.1014504215
  25. UNDOTBS1.258.1013960883
  26. USERS.259.1014330935
  27. ASMCMD> pwd
  28. +data/orcl/DATAFILE
  29. ASMCMD> exit
  30. [oracle@station76 ~]$ . oraenv
  31. ORACLE_SID = [+ASM] ? orcl
  32. The Oracle base remains unchanged with value /u01/app/oracle
  33. [oracle@station76 ~]$ sqlplus /nolog

  34. SQL*Plus: Release 11.2.0.4.0 Production on Sat Jul 27 10:53:58 2019

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

  36. SQL> conn / as sysdba
  37. Connected.
  38. SQL> alter database rename file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00004' to '+data/orcl/DATAFILE/USERS.259.1014330935';

  39. Database altered.

  40. SQL> alter tablespace users online ;
  41. alter tablespace users online
  42. *
  43. ERROR at line 1:
  44. ORA-01113: file 4 needs media recovery
  45. ORA-01110: data file 4: '+DATA/orcl/datafile/users.259.1014330935'


  46. SQL> recover datafile 4;
  47. ORA-00279: change 1349300 generated at 07/27/2019 10:31:51 needed for thread 1
  48. ORA-00289: suggestion :
  49. +FRA/orcl/archivelog/2019_07_27/thread_1_seq_111.286.1014720181
  50. ORA-00280: change 1349300 for thread 1 is in sequence #111


  51. Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
  52. auto
  53. Log applied.
  54. Media recovery complete.
  55. SQL>  alter tablespace users online ;

  56. Tablespace altered.

  57. SQL> select  * from hr.t15863
  58.   2  ;

  59.          A
  60. ----------
  61.          1
  62.          2
  63.          3
  64.          4
  65.          5

  66. SQL>
复制代码

Oracle给的set 2 脚本只适用于正常关机(漏掉了until cancel):
aaa.png
实验背景:
ASMCMD> cd orcl
ASMCMD> ls
ARCHIVELOG/
CHANGETRACKING/
CONTROLFILE/
FLASHBACK/
ASMCMD> cd ARCHIVELOG/
ASMCMD> ls
2019_07_27/
ASMCMD> cd 2019_07_27/
ASMCMD> ls
thread_1_seq_107.292.1014719509
thread_1_seq_108.290.1014719511
thread_1_seq_109.289.1014719511
thread_1_seq_110.288.1014719511
thread_1_seq_111.287.1014719515
thread_1_seq_116.285.1014723119
thread_1_seq_117.286.1014723119
thread_1_seq_118.291.1014723121
thread_1_seq_119.297.1014723125
thread_1_seq_120.300.1014723127
thread_1_seq_121.295.1014723131
ASMCMD>
实验过程:
[root@station76 real]# su - oracle
[oracle@station76 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sat Jul 27 11:38:21 2019

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 1553305600 bytes
Fixed Size                  2253544 bytes
Variable Size             956304664 bytes
Database Buffers          587202560 bytes
Redo Buffers                7544832 bytes
ORA-00205: error in identifying control file, check alert log for more info


SQL> !ls
backup1               control10d-before.sql    Desktop    oradiag_oracle  Templates
backup2               control11b.sql           Documents  Pictures        Videos
backupusers.rcv       create_t04209_uname.sql  Downloads  Public
control10d-after.sql  datapumpdir              Music      RMasmcmd.sh

SQL> @control11b.sql

Control file created.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@station76 ~]$ rman target / catalog u76/oracle_4U@rcat

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 27 11:43:32 2019

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

connected to target database: ORCL (DBID=1541741703, not open)
connected to recovery catalog database

RMAN> restore database;

Starting restore at 2019-07-27:11:43:39
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=25 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=26 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=28 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=29 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=30 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=31 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=32 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=33 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=34 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=35 device type=DISK

channel ORA_SBT_TAPE_1: starting datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_1: restoring datafile 00002 to +DATA/orcl/datafile/sysaux.257.1013960883
channel ORA_SBT_TAPE_1: restoring datafile 00003 to +DATA/orcl/datafile/undotbs1.258.1013960883
channel ORA_SBT_TAPE_1: restoring datafile 00004 to +DATA/orcl/datafile/users.259.1014330935
channel ORA_SBT_TAPE_1: reading from backup piece 04u7msab_1_1
channel ORA_SBT_TAPE_2: starting datafile backup set restore
channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_2: restoring datafile 00001 to +DATA/orcl/datafile/system.256.1014504215
channel ORA_SBT_TAPE_2: restoring datafile 00005 to +DATA/orcl/datafile/example.265.1013960987
channel ORA_SBT_TAPE_2: reading from backup piece 03u7msab_1_1
channel ORA_SBT_TAPE_1: piece handle=04u7msab_1_1 tag=1T-WHOLE-INCR0
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:01:06
channel ORA_SBT_TAPE_2: piece handle=03u7msab_1_1 tag=1T-WHOLE-INCR0
channel ORA_SBT_TAPE_2: restored backup piece 1
channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:01:35
Finished restore at 2019-07-27:11:45:38

RMAN> exit


Recovery Manager complete.
[oracle@station76 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sat Jul 27 11:45:52 2019

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

SQL> conn / as sysdba
Connected.
SQL> recover database using backup controlfile;
ORA-00279: change 1374973 generated at 07/27/2019 11:28:11 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-00280: change 1374973 for thread 1 is in sequence #115


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '+FRA'
ORA-17503: ksfdopn:2 Failed to open file +FRA
ORA-15045: ASM file name '+FRA' is not in reference form


ORA-00308: cannot open archived log '+FRA'
ORA-17503: ksfdopn:2 Failed to open file +FRA
ORA-15045: ASM file name '+FRA' is not in reference form


SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@station76 ~]$ rman target / catalog u76/oracle_4U@rcat

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 27 11:48:03 2019

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

connected to target database: ORCL (DBID=1541741703, not open)
connected to recovery catalog database

RMAN> list backup of archivelog sequence 115;


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


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
1876    256.00K    SBT_TAPE    00:00:20     2019-07-27:11:29:30
        BP Key: 1879   Status: AVAILABLE  Compressed: NO  Tag: 1T-WHOLE-INCR0
        Handle: 05u7msc6_1_1   Media: station76-000025

  List of Archived Logs in backup set 1876
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    115     1374894    2019-07-27:11:27:13 1375014    2019-07-27:11:29:07

RMAN> restore archivelog sequence 115;

Starting restore at 2019-07-27:11:48:24
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=27 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=29 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=34 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=32 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=31 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=30 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=28 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=1 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=21 device type=DISK

channel ORA_SBT_TAPE_1: starting archived log restore to default destination
channel ORA_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=115
channel ORA_SBT_TAPE_1: reading from backup piece 05u7msc6_1_1
channel ORA_SBT_TAPE_1: piece handle=05u7msc6_1_1 tag=1T-WHOLE-INCR0
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:35
Finished restore at 2019-07-27:11:49:17

RMAN> exit


Recovery Manager complete.
[oracle@station76 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sat Jul 27 11:49:25 2019

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

SQL> conn / as sysdba
\Connected.
SQL>recover database using backup controlfile;
ORA-00279: change 1374973 generated at 07/27/2019 11:28:11 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_115.258.1014724145
ORA-00280: change 1374973 for thread 1 is in sequence #115


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 1375014 generated at 07/27/2019 11:29:07 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_116.285.1014723119
ORA-00280: change 1375014 for thread 1 is in sequence #116
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_115.258.1014724145' no longer
needed for this recovery


ORA-00279: change 1375284 generated at 07/27/2019 11:31:58 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_117.286.1014723119
ORA-00280: change 1375284 for thread 1 is in sequence #117
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_116.285.1014723119' no longer
needed for this recovery


ORA-00279: change 1375296 generated at 07/27/2019 11:31:58 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_118.291.1014723121
ORA-00280: change 1375296 for thread 1 is in sequence #118
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_117.286.1014723119' no longer
needed for this recovery


ORA-00279: change 1375301 generated at 07/27/2019 11:32:01 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_119.297.1014723125
ORA-00280: change 1375301 for thread 1 is in sequence #119
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_118.291.1014723121' no longer
needed for this recovery


ORA-00279: change 1375309 generated at 07/27/2019 11:32:04 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_120.300.1014723127
ORA-00280: change 1375309 for thread 1 is in sequence #120
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_119.297.1014723125' no longer
needed for this recovery


ORA-00279: change 1375314 generated at 07/27/2019 11:32:07 needed for thread 1
ORA-00289: suggestion :
+FRA/orcl/archivelog/2019_07_27/thread_1_seq_121.295.1014723131
ORA-00280: change 1375314 for thread 1 is in sequence #121
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_120.300.1014723127' no longer
needed for this recovery


ORA-00279: change 1375320 generated at 07/27/2019 11:32:10 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-00280: change 1375320 for thread 1 is in sequence #122
ORA-00278: log file
'+FRA/orcl/archivelog/2019_07_27/thread_1_seq_121.295.1014723131' no longer
needed for this recovery


ORA-00308: cannot open archived log '+FRA'
ORA-17503: ksfdopn:2 Failed to open file +FRA
ORA-15045: ASM file name '+FRA' is not in reference form


SQL> recover database using backup controlfile;
ORA-00279: change 1375320 generated at 07/27/2019 11:32:10 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-00280: change 1375320 for thread 1 is in sequence #122


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL>
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '+DATA/orcl/datafile/system.256.1014504215'


SQL>
以上是set2的错误和局限性:
补救:
  1. SQL> alter database open resetlogs;
复制代码








回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-9 15:55 , Processed in 0.129560 second(s), 27 queries .

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