oracle ORA-01207:文件比控制文件更新 - 旧的控制文件

前端之家收集整理的这篇文章主要介绍了oracle ORA-01207:文件比控制文件更新 - 旧的控制文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
sql> startup
ORACLE instance started.

Total System Global Area 956198912 bytes
Fixed Size 2234120 bytes
Variable Size 620759288 bytes
Database Buffers 327155712 bytes
Redo Buffers 6049792 bytes
Database mounted.
ORA-01122: database file 1 Failed verification check
ORA-01110: data file 1: '+DATA2/orcl/datafile/system.256.917734557'
ORA-01207: file is more recent than control file - old control file


启动数据库报错。


先执行如下命令生成controlfile trace

sql> alter database backup controlfile to trace as '/home/oracle/control.sql';

查看文件内容如下:

  1. [oracle@hadoop01 ~]$ cat control.trc
  2. -- The following are current System-scope REDO Log Archival related
  3. -- parameters and can be included in the database initialization file.
  4. --
  5. -- LOG_ARCHIVE_DEST=''
  6. -- LOG_ARCHIVE_DUPLEX_DEST=''
  7. --
  8. -- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
  9. --
  10. -- DB_UNIQUE_NAME="orcl"
  11. --
  12. -- LOG_ARCHIVE_CONFIG='SEND,RECEIVE,NODG_CONFIG'
  13. -- LOG_ARCHIVE_MAX_PROCESSES=4
  14. -- STANDBY_FILE_MANAGEMENT=MANUAL
  15. -- STANDBY_ARCHIVE_DEST=?/dbs/arch
  16. -- FAL_CLIENT=''
  17. -- FAL_SERVER=''
  18. --
  19. -- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
  20. -- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
  21. -- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
  22. -- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
  23. -- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
  24. -- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
  25. -- LOG_ARCHIVE_DEST_STATE_1=ENABLE
  26.  
  27. --
  28. -- Below are two sets of sql statements,each of which creates a new
  29. -- control file and uses it to open the database. The first set opens
  30. -- the database with the NORESETLOGS option and should be used only if
  31. -- the current versions of all online logs are available. The second
  32. -- set opens the database with the RESETLOGS option and should be used
  33. -- if online logs are unavailable.
  34. -- The appropriate set of statements can be copied from the trace into
  35. -- a script file,edited as necessary,and executed when there is a
  36. -- need to re-create the control file.
  37. --
  38. -- Set #1. NORESETLOGS case
  39. --
  40. -- The following commands will create a new control file and use it
  41. -- to open the database.
  42. -- Data used by Recovery Manager will be lost.
  43. -- Additional logs may be required for media recovery of offline
  44. -- Use this only if the current versions of all online logs are
  45. -- available.
  46.  
  47. -- After mounting the created controlfile,the following sql
  48. -- statement will place the database in the appropriate
  49. -- protection mode:
  50. -- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
  51.  
  52. STARTUP NOMOUNT
  53. CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
  54. MAXLOGFILES 192
  55. MAXLOGMEMBERS 3
  56. MAXDATAFILES 1024
  57. MAXINSTANCES 32
  58. MAXLOGHISTORY 292
  59. LOGFILE
  60. GROUP 1 (
  61. '+DATA/orcl/onlinelog/group_1.262.917467235','+DATA/orcl/onlinelog/group_1.263.917467239'
  62. ) SIZE 50M BLOCKSIZE 512,GROUP 2 (
  63. '+DATA/orcl/onlinelog/group_2.264.917467241','+DATA/orcl/onlinelog/group_2.265.917467245'
  64. ) SIZE 50M BLOCKSIZE 512,GROUP 3 (
  65. '+DATA/orcl/onlinelog/group_3.269.917467587','+DATA/orcl/onlinelog/group_3.270.917467591'
  66. ) SIZE 50M BLOCKSIZE 512,GROUP 4 (
  67. '+DATA/orcl/onlinelog/group_4.271.917467595','+DATA/orcl/onlinelog/group_4.272.917467599'
  68. ) SIZE 50M BLOCKSIZE 512
  69. -- STANDBY LOGFILE
  70. DATAFILE
  71. '+DATA2/orcl/datafile/system.256.917734557','+DATA2/orcl/datafile/sysaux.257.917734593','+DATA2/orcl/datafile/undotbs1.259.917734633','+DATA2/orcl/datafile/users.263.917734657','+DATA2/orcl/datafile/example.258.917734617','+DATA2/orcl/datafile/undotbs2.261.917734647','+DATA2/orcl/datafile/users.260.917734639'
  72. CHARACTER SET AL32UTF8
  73. ;
  74.  
  75. -- Commands to re-create incarnation table
  76. -- Below log names MUST be changed to existing filenames on
  77. -- disk. Any one log file from each branch can be used to
  78. -- re-create incarnation records.
  79. -- ALTER DATABASE REGISTER LOGFILE '+DATA2';
  80. -- ALTER DATABASE REGISTER LOGFILE '+DATA2';
  81. -- Recovery is required if any of the datafiles are restored backups,-- or if the last shutdown was not normal or immediate.
  82. RECOVER DATABASE
  83.  
  84. -- All logs need archiving and a log switch is needed.
  85. ALTER SYSTEM ARCHIVE LOG ALL;
  86.  
  87. -- Database can now be opened normally.
  88. ALTER DATABASE OPEN;
  89.  
  90. -- Commands to add tempfiles to temporary tablespaces.
  91. -- Online tempfiles have complete space information.
  92. -- Other tempfiles may require adjustment.
  93. ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/orcl/tempfile/temp.266.917467257' REUSE;
  94. -- End of tempfile additions.
  95. --
  96. -- Set #2. RESETLOGS case
  97. --
  98. -- The following commands will create a new control file and use it
  99. -- to open the database.
  100. -- Data used by Recovery Manager will be lost.
  101. -- The contents of online logs will be lost and all backups will
  102. -- be invalidated. Use this only if online logs are damaged.
  103.  
  104. -- After mounting the created controlfile,the following sql
  105. -- statement will place the database in the appropriate
  106. -- protection mode:
  107. -- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
  108.  
  109. STARTUP NOMOUNT
  110. CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
  111. MAXLOGFILES 192
  112. MAXLOGMEMBERS 3
  113. MAXDATAFILES 1024
  114. MAXINSTANCES 32
  115. MAXLOGHISTORY 292
  116. LOGFILE
  117. GROUP 1 (
  118. '+DATA/orcl/onlinelog/group_1.262.917467235','+DATA/orcl/onlinelog/group_2.265.917467245'
  119. ) SIZE 50M BLOCKSIZE 512
  120. -- STANDBY LOGFILE
  121. DATAFILE
  122. '+DATA2/orcl/datafile/system.256.917734557',-- or if the last shutdown was not normal or immediate.
  123. RECOVER DATABASE USING BACKUP CONTROLFILE
  124.  
  125. -- Create log files for threads other than thread one.
  126. ALTER DATABASE ADD LOGFILE THREAD 2
  127. GROUP 3 (
  128. '+DATA/orcl/onlinelog/group_3.269.917467587','+DATA/orcl/onlinelog/group_3.270.917467591'
  129. ) SIZE 50M BLOCKSIZE 512 REUSE,'+DATA/orcl/onlinelog/group_4.272.917467599'
  130. ) SIZE 50M BLOCKSIZE 512 REUSE;
  131.  
  132. -- Database can now be opened zeroing the online logs.
  133. ALTER DATABASE OPEN RESETLOGS;
  134.  
  135. -- Commands to add tempfiles to temporary tablespaces.
  136. -- Online tempfiles have complete space information.
  137. -- Other tempfiles may require adjustment.
  138. ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/orcl/tempfile/temp.266.917467257' REUSE;
  139. -- End of tempfile additions.
  140. --
修改control.sql文件保留如下部分:
  1. STARTUP NOMOUNT;
  2. CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
  3. MAXLOGFILES 192
  4. MAXLOGMEMBERS 3
  5. MAXDATAFILES 1024
  6. MAXINSTANCES 32
  7. MAXLOGHISTORY 292
  8. LOGFILE
  9. GROUP 1 (
  10. '+DATA/orcl/onlinelog/group_1.262.917467235','+DATA2/orcl/datafile/users.260.917734639'
  11. CHARACTER SET AL32UTF8
  12. ;
  13.  
  14. RECOVER DATABASE
  15.  
  16. ALTER SYSTEM ARCHIVE LOG ALL;
  17.  
  18. ALTER DATABASE OPEN;

然后sqlplus 执行control.sql文件,报如下错误

ERROR at line 1:
ORA-01503: CREATE CONTROLFILE Failed
ORA-12720: operation requires database is in EXCLUSIVE mode

因为是rac环境,所以需要做进一步操作。

alter system set cluster_database=FALSE scope=spfile sid='*';
shutdown immediate;

完成上面两步之后再次执行control.sql

  1. sql> @control
  2. ORACLE instance started.
  3.  
  4. Total System Global Area 956198912 bytes
  5. Fixed Size 2234120 bytes
  6. Variable Size 620759288 bytes
  7. Database Buffers 327155712 bytes
  8. Redo Buffers 6049792 bytes
  9.  
  10. Control file created.
  11.  
  12. ORA-00283: recovery session canceled due to errors
  13. ORA-00264: no recovery required
  14.  
  15.  
  16.  
  17. System altered.
  18.  
  19.  
  20. Database altered.
  21.  

执行:

alter system set cluster_database=true scope=spfile sid='*';
shutdown immediate;

恢复rac环境

然后srvctl start database -d orcl 即可

猜你在找的Oracle相关文章