ITPub博客

首页 > 数据库 > Oracle > BBED 修改文件头 解决 ORA-01190

BBED 修改文件头 解决 ORA-01190

原创 Oracle 作者:yewushang 时间:2014-02-11 21:03:15 0 删除 编辑
问题:ORA-01190: control file or data file 6 is from before the last RESETLOGS

1.mount状态下

点击(此处)折叠或打开

  1. alter database backup controlfile to trace.


2.找到udump  ls -lrt最后一个是最新的

3.关闭数据库 启动到nomount


点击(此处)折叠或打开

  1. SQL> CREATE CONTROLFILE REUSE DATABASE \"YWS\" RESETLOGS NOARCHIVELOG
  2. 2 MAXLOGFILES 16
  3. 3 MAXLOGMEMBERS 3
  4. 4 MAXDATAFILES 100
  5. 5 MAXINSTANCES 8
  6. 6 MAXLOGHISTORY 292
  7. 7 LOGFILE
  8. 8 GROUP 1 '/u01/oracle/oradata/yws/redo01.log' SIZE 50M,
  9. 9 GROUP 2 '/u01/oracle/oradata/yws/redo02.log' SIZE 50M,
  10. 10 GROUP 3 '/u01/oracle/oradata/yws/redo03.log' SIZE 50M
  11. 11 -- STANDBY LOGFILE
  12. 12 DATAFILE
  13. 13 '/u01/oracle/oradata/yws/system01.dbf',
  14. 14 '/u01/oracle/oradata/yws/undotbs01.dbf',
  15. 15 '/u01/oracle/oradata/yws/sysaux01.dbf',
  16. 16 '/u01/oracle/oradata/yws/users01.dbf',
  17. 17 '/u01/oracle/oradata/yws/yws.dbf'
  18. 18 CHARACTER SET WE8ISO8859P1
  19. 19 ;
  20. Control file created.
  21. SQL> alter database open;
  22. alter database open
  23. *
  24. ERROR at line 1:
  25. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
  26. SQL> alter database open resetlogs;
  27. Database altered.

4.原来备份的数据文件 拿回来覆盖现在的数据文件

点击(此处)折叠或打开

  1. [oracle@lk oradata]$ mv yws.dbf yws
  2. [oracle@lk yws]$ pwd
  3. /u01/oracle/oradata/yws

5.开库报错

点击(此处)折叠或打开

  1. SQL> startup
  2. ORACLE instance started.

  3. Total System Global Area 243269632 bytes
  4. Fixed Size 1218748 bytes
  5. Variable Size 83887940 bytes
  6. Database Buffers 155189248 bytes
  7. Redo Buffers 2973696 bytes
  8. Database mounted.
  9. ORA-01190: control file or data file 6 is from before the last RESETLOGS
  10. ORA-01110: data file 6: '/u01/oracle/oradata/yws/yws.dbf'


各数据文件头中resetlogs的信息如下:

点击(此处)折叠或打开

  1. Fhrls:resetlogs scn值
  2. Fhrlc:resetlogs count值
  3. fhrlc_i:resetlogs count 转换成10进制的值


  4. reset logs count and scn: The counter with the SCN is called the Reset Log Stamp,
  5. and is a unique identification. The counter is in fact a timestamp





点击(此处)折叠或打开

  1. SQL> select resetlogs_change#, to_char(resetlogs_time,'mm/dd/yyyy hh24:mi:ss') time from v$database;

  2. RESETLOGS_CHANGE# TIME
  3. ----------------- -------------------
  4.            501518 12/22/2013 17:51:25

  5. SQL> select hxfil,fhrls change#,fhrlc_i,fhrlc time from x$kcvfh;

  6.      HXFIL CHANGE# FHRLC_I TIME
  7. ---------- ---------------- ---------- --------------------
  8.          1 501518 834861085 12/22/2013 17:51:25
  9.          2 501518 834861085 12/22/2013 17:51:25
  10.          3 501518 834861085 12/22/2013 17:51:25
  11.          4 501518 834861085 12/22/2013 17:51:25
  12.          6 446075 829960901 10/28/2013 00:41:41

6.bbed修改文件头

点击(此处)折叠或打开

  1. BBED> modify /x 993ac3 dba 6,1 offset 112
  2. Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
  3.  File: /u01/oracle/oradata/yws/yws.dbf (6)
  4.  Block: 1 Offsets: 112 to 623 Dba:0x01800001
  5. ------------------------------------------------------------------------
  6.  993ac331 7bce0600 00000000 00000000 00000000 00000000 00000000 07000000
  7.  00000000 06000000 00000000 00000000 00000000 00000000 00000000 00000000
  8.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  9.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  10.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  11.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  12.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 07000000
  13.  03005957 53000000 00000000 00000000 00000000 00000000 00000000 00000000
  14.  06000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  15.  00000000 00000000 00000000 00000000 74ef8421 01000000 00000000 00000000
  16.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  17.  00000000 00000000 00000000 00000000 00000000 72a50700 00000000 d0f3c231
  18.  01000a00 34000000 867e0000 1000d1bf 02000000 00000000 00000000 00000000
  19.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  20.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  21.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

  22.  <32 bytes per line>

  23. BBED> dump dba 6,1 offset 112
  24.  File: /u01/oracle/oradata/yws/yws.dbf (6)
  25.  Block: 1 Offsets: 112 to 623 Dba:0x01800001
  26. ------------------------------------------------------------------------
  27.  993ac331 7bce0600 00000000 00000000 00000000 00000000 00000000 07000000
  28.  00000000 06000000 00000000 00000000 00000000 00000000 00000000 00000000
  29.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  30.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  31.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  32.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  33.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 07000000
  34.  03005957 53000000 00000000 00000000 00000000 00000000 00000000 00000000
  35.  06000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  36.  00000000 00000000 00000000 00000000 74ef8421 01000000 00000000 00000000
  37.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  38.  00000000 00000000 00000000 00000000 00000000 72a50700 00000000 d0f3c231
  39.  01000a00 34000000 867e0000 1000d1bf 02000000 00000000 00000000 00000000
  40.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  41.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  42.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

  43.  <32 bytes per line>




  44. BBED> dump dba 1,1 offset 116
  45.  File: /u01/oracle/oradata/yws/system01.dbf (1)
  46.  Block: 1 Offsets: 116 to 627 Dba:0x00400001
  47. ------------------------------------------------------------------------
  48.  fab40700 00000000 00000000 00000000 00000000 00000420 6a000000 6b48c331
  49.  67000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  50.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  51.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  52.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  53.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  54.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 06005359
  55.  5354454d 00000000 00000000 00000000 00000000 00000000 00000000 01000000
  56.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  57.  00000000 00000000 0a000a00 c5327831 7bce0600 00000000 00000000 00000000
  58.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  59.  00000000 00000000 00000000 00000000 fbb40700 0000b4bf af3ac331 0100bd0c
  60.  01000000 02000000 10000000 02000000 00000000 00000000 00000000 00000000
  61.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  62.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  63.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

  64.  <32 bytes per line>





  65. BBED> modify /x fab407 dba 6,1 offset 116
  66.  File: /u01/oracle/oradata/yws/yws.dbf (6)
  67.  Block: 1 Offsets: 116 to 627 Dba:0x01800001
  68. ------------------------------------------------------------------------
  69.  fab40700 00000000 00000000 00000000 00000000 00000000 07000000 00000000
  70.  06000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  71.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  72.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  73.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  74.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  75.  00000000 00000000 00000000 00000000 00000000 00000000 07000000 03005957
  76.  53000000 00000000 00000000 00000000 00000000 00000000 00000000 06000000
  77.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  78.  00000000 00000000 00000000 74ef8421 01000000 00000000 00000000 00000000
  79.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  80.  00000000 00000000 00000000 00000000 72a50700 00000000 d0f3c231 01000a00
  81.  34000000 867e0000 1000d1bf 02000000 00000000 00000000 00000000 00000000
  82.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  83.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  84.  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

  85.  <32 bytes per line>

  86. BBED> sum apply;
  87. Check value for File 6, Block 1:
  88. current = 0x0748, required = 0x0748

7.重建控制文件

点击(此处)折叠或打开

  1. SQL> alter database backup controlfile to trace;

  2. Database altered.

  3. SQL> shutdown immediate;
  4. ORA-01109: database not open

  5. SQL> CREATE CONTROLFILE REUSE DATABASE \"YWS\" RESETLOGS NOARCHIVELOG
  6.   2 MAXLOGFILES 16
  7.   3 MAXLOGMEMBERS 3
  8.   4 MAXDATAFILES 100
  9.   5 MAXINSTANCES 8
  10.   6 MAXLOGHISTORY 292
  11.   7 LOGFILE
  12.   8 GROUP 1 '/u01/oracle/oradata/yws/redo01.log' SIZE 50M,
  13.   9 GROUP 2 '/u01/oracle/oradata/yws/redo02.log' SIZE 50M,
  14.  10 GROUP 3 '/u01/oracle/oradata/yws/redo03.log' SIZE 50M
  15.  11 -- STANDBY LOGFILE
  16.  12 DATAFILE
  17.  13 '/u01/oracle/oradata/yws/system01.dbf',
  18.  14 '/u01/oracle/oradata/yws/undotbs01.dbf',
  19.  15 '/u01/oracle/oradata/yws/sysaux01.dbf',
  20.  16 '/u01/oracle/oradata/yws/users01.dbf',
  21.  17 '/u01/oracle/oradata/yws/yws.dbf'
  22.  18 CHARACTER SET WE8ISO8859P1
  23.  19 ;

  24. Control file created.

8.查询


SQL> select hxfil,fhrls change#,fhrlc_i,fhrlc time from x$kcvfh;


     HXFIL CHANGE#             FHRLC_I TIME
---------- ---------------- ---------- --------------------
         1 505082            834878105 12/22/2013 22:35:05
         2 505082            834878105 12/22/2013 22:35:05
         3 505082            834878105 12/22/2013 22:35:05
         4 505082            834878105 12/22/2013 22:35:05
         6 505082            834878105 12/22/2013 22:35:05

点击(此处)折叠或打开

  1. Errors in file /u01/oracle/admin/yws/udump/yws_ora_13792.trc:
  2. ORA-00600: internal error code, arguments: [2662], [0], [505089], [0], [505116], [4194313], [], []
  3. Sun Dec 22 23:50:14 2013
  4. SMON: enabling cache recovery
  5. Sun Dec 22 23:50:16 2013
  6. Errors in file /u01/oracle/admin/yws/udump/yws_ora_13792.trc:
  7. ORA-00600: internal error code, arguments: [2662], [0], [505089], [0], [505116], [4194313], [], []
  8. Sun Dec 22 23:50:16 2013
  9. Error 600 happened during db open, shutting down database
  10. USER: terminating instance due to error 600
  11. Instance terminated by USER, pid = 13792
  12. ORA-1092 signalled during: alter database open resetlogs...



8.开库


点击(此处)折叠或打开

  1. SQL> conn / as sysdba
  2. Connected to an idle instance.
  3. SQL> startup
  4. ORACLE instance started.

  5. Total System Global Area 243269632 bytes
  6. Fixed Size 1218748 bytes
  7. Variable Size 83887940 bytes
  8. Database Buffers 155189248 bytes
  9. Redo Buffers 2973696 bytes
  10. Database mounted.
  11. ORA-01113: file 1 needs media recovery
  12. ORA-01110: data file 1: '/u01/oracle/oradata/yws/system01.dbf'


  13. SQL> recover datafile 1;
  14. Media recovery complete.
  15. SQL> alter database open;
  16. alter database open
  17. *
  18. ERROR at line 1:
  19. ORA-01113: file 2 needs media recovery
  20. ORA-01110: data file 2: '/u01/oracle/oradata/yws/undotbs01.dbf'


  21. SQL> recover database;
  22. Media recovery complete.
  23. SQL> alter database open;

  24. Database altered.

  25. SQL>



  26. 成功open。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29477587/viewspace-1079790/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-02-09

  • 博文量
    53
  • 访问量
    275746