1.sql>sqlplus / as sysdba 2.sql>startup ORACLE 例程已经启动。 Total System Global Area 293601280 bytes Fixed Size 1248624 bytes Variable Size 121635472 bytes Database Buffers 167772160 bytes Redo Buffers 2945024 bytes 数据库装载完毕。 ORA-01122: 数据库文件 1 验证失败 ORA-01110: 数据文件 1: 'F:/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/ORCLDW/SYSTEM01.DBF' ORA-01207: 文件比控制文件更新 - 旧的控制文件 3.sql>alter database backup controlfile to trace as 'f:/aa'; 数据库已更改。 4.sql>shutdown immediate 如果数据库是打开状态,则关闭 ORA-01109: 数据库未打开 已经卸载数据库 5.sql>startup nomount; ORACLE 例程已经启动。 Total System Global Area 105979576 bytes Fixed Size 454328 bytes Variable Size 79691776 bytes Database Buffers 25165824 bytes Redo Buffers 667648 bytes7.Editplus之类的编辑器打开在第四步生成的f:/aa文件;
其实在这个文件中的已经告诉你咋样恢复你的数据库了,找到STARTUP NOMOUNT字样,然后下面可以看到类似语句,这个文件有好几个类似的生成控制文件语句,主要针对不懂的环境执行不同的语句,象我的数据库没有做任何备份,也不是在归档模式,就执行这句
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' SIZE 50M BLOCKSIZE 512,GROUP 2 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG' SIZE 50M BLOCKSIZE 512,GROUP 3 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG' SIZE 50M BLOCKSIZE 512 DATAFILE 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF','E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF','E:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF','E:\APP\ADMINISTRATOR\ORADATA\ORCL\GDZC_DATA01.DBF','E:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS02.DBF' CHARACTER SET AL32UTF8;完整的如下:
-- The following are current System-scope REDO Log Archival related -- parameters and can be included in the database initialization file. -- -- LOG_ARCHIVE_DEST='' -- LOG_ARCHIVE_DUPLEX_DEST='' -- -- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T -- -- DB_UNIQUE_NAME="orcl" -- -- LOG_ARCHIVE_CONFIG='SEND,RECEIVE,NODG_CONFIG' -- LOG_ARCHIVE_MAX_PROCESSES=4 -- STANDBY_FILE_MANAGEMENT=MANUAL -- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS -- FAL_CLIENT='' -- FAL_SERVER='' -- -- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST' -- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY' -- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC' -- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY' -- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME' -- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)' -- LOG_ARCHIVE_DEST_STATE_1=ENABLE -- -- Below are two sets of sql statements,each of which creates a new -- control file and uses it to open the database. The first set opens -- the database with the NORESETLOGS option and should be used only if -- the current versions of all online logs are available. The second -- set opens the database with the RESETLOGS option and should be used -- if online logs are unavailable. -- The appropriate set of statements can be copied from the trace into -- a script file,edited as necessary,and executed when there is a -- need to re-create the control file. -- -- Set #1. NORESETLOGS case -- -- The following commands will create a new control file and use it -- to open the database. -- Data used by Recovery Manager will be lost. -- Additional logs may be required for media recovery of offline -- Use this only if the current versions of all online logs are -- available. -- After mounting the created controlfile,the following sql -- statement will place the database in the appropriate -- protection mode: -- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' SIZE 50M BLOCKSIZE 512,GROUP 3 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF','E:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\MISSING00005','E:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\MISSING00006','E:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS02.DBF' CHARACTER SET AL32UTF8 ;-- WARNING! The above command will not work due to the MISSING files. -- Edit the command to have the correct name,or delete the name. -- Take files offline to match current control file. ALTER DATABASE DATAFILE 'E:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\MISSING00005' OFFLINE; ALTER DATABASE DATAFILE 'E:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\MISSING00006' OFFLINE; -- Commands to re-create incarnation table -- Below log names MUST be changed to existing filenames on -- disk. Any one log file from each branch can be used to -- re-create incarnation records. -- ALTER DATABASE REGISTER LOGFILE 'E:\APP\ADMINISTRATOR\RECOVERY_AREA\ORCL\ARCHIVELOG\2018_01_16\O1_MF_1_1_%U_.ARC'; -- Recovery is required if any of the datafiles are restored backups,-- or if the last shutdown was not normal or immediate. RECOVER DATABASE -- Database can now be opened normally. ALTER DATABASE OPEN; -- No tempfile entries found to add. -- -- Set #2. RESETLOGS case -- -- The following commands will create a new control file and use it -- to open the database. -- Data used by Recovery Manager will be lost. -- The contents of online logs will be lost and all backups will -- be invalidated. Use this only if online logs are damaged. -- After mounting the created controlfile,the following sql -- statement will place the database in the appropriate -- protection mode: -- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' SIZE 50M BLOCKSIZE 512,or delete the name. -- Commands to re-create incarnation table -- Below log names MUST be changed to existing filenames on -- disk. Any one log file from each branch can be used to -- re-create incarnation records. -- ALTER DATABASE REGISTER LOGFILE 'E:\APP\ADMINISTRATOR\RECOVERY_AREA\ORCL\ARCHIVELOG\2018_01_16\O1_MF_1_1_%U_.ARC'; -- Recovery is required if any of the datafiles are restored backups,-- or if the last shutdown was not normal or immediate. RECOVER DATABASE USING BACKUP CONTROLFILE -- Database can now be opened zeroing the online logs. ALTER DATABASE OPEN RESETLOGS; -- No tempfile entries found to add. --每个数据库执行出来的结果都不一样,一定要按照自己备份出来的控制语句来执行,然后就是按照控制sql语句后面没有注释的命令只执行即可。