1、在库完好的时候先备份一下controlfile以备不时之需
SQL>alter database backup controlfile to trace;
SQL>exit;
$cd $ORACLE_BASE/admin/$ORACLE_SID/udump
$ls -ltrh | tail -1
-rw-r----- 1 oinstall 8.4K Nov 26 18:49 wending_ora_10819.trc
找最新的那个trace文件,里头即有重建controlfile的语句。
这里先记着,看一下就知道咋回事了。注意:RMAN的设置将回到默认值。
1、重建controlfile
注意:如果日志文件也坏了,那么把下面语句中的NORESETLOGS换成RESETLOGS。
SQL>STARTUP NOMOUNT
SQL>CREATE CONTROLFILE REUSE DATABASE "WENDING"NORESETLOGSFORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'/orahome/oradata/WENDING/redo011.log',
'/u01/oradata/WENDING/redo012.log'
) SIZE 100M,
GROUP 2 (
'/orahome/oradata/WENDING/redo021.log',
'/u01/oradata/WENDING/redo022.log'
) SIZE 100M,
GROUP 3 (
'/orahome/oradata/WENDING/redo031.log',
'/u01/oradata/WENDING/redo032.log'
) SIZE 100M,
GROUP 4 (
'/orahome/oradata/WENDING/redo041.log',
'/u01/oradata/WENDING/redo042.log'
) SIZE 100M,
GROUP 5 (
'/orahome/oradata/WENDING/redo051.log',
'/u01/oradata/WENDING/redo052.log'
) SIZE 100M,
GROUP 6 (
'/orahome/oradata/WENDING/redo061.log',
'/u01/oradata/WENDING/redo062.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/orahome/oradata/WENDING/system01.dbf',
'/orahome/oradata/WENDING/undotbs01.dbf',
'/orahome/oradata/WENDING/sysaux01.dbf',
'/orahome/oradata/WENDING/users01.dbf',
'/u01/oradata/WENDING/wending_user01.dbf',
'/u01/oradata/WENDING/wending_log01.dbf',
'/u01/oradata/WENDING/wending_index01.dbf'
CHARACTER SET ZHS16GBK;
2、打开数据库,两种情况
2.1、redologs都完好,那么NORESETLOGS方式打开数据库
SQL>RECOVER DATABASE
SQL>ALTER SYSTEM ARCHIVE LOG ALL;
SQL>ALTER DATABASE OPEN;
2.2、redologs也损坏了,那么RESETLOGS方式打开数据库
SQL>RECOVER DATABASE USING BACKUP CONTROLFILE
SQL>ALTER DATABASE OPEN RESETLOGS;
3、最后重建临时表空间
SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/orahome/oradata/WENDING/temp01.dbf'
SIZE 1024M REUSE AUTOEXTEND ON NEXT 10485760 MAXSIZE 32767M;
阅读(1534) | 评论(0) | 转发(0) |