檢視檔案頭SCN號:
SQL> select file#, checkpoint_change# from v;
FILE# CHECKPOINT_CHANGE#
1 18120070
2 18120070
3 18120070
4 18120070
5 18120070
6 18120070
7 18120070
8 18120070
9 18120070
10 18120070
11 18121207
FILE# CHECKPOINT_CHANGE#
12 18121196
12 rows selected.
檢視控制檔案SCN號:
SQL> select file#, checkpoint_change# from v;
FILE# CHECKPOINT_CHANGE#
1 18120070
2 18120070
3 18120070
4 18120070
5 18120070
6 18120070
7 18120070
8 18120070
9 18120070
10 18120070
11 18121207
FILE# CHECKPOINT_CHANGE#
12 18121196
12 rows selected.
SQL>
當資料檔案SCN號大於控制檔案scn號,即會發生控制檔案太久的提示,
當資料檔案SCN號小於控制檔案scn號時, 則提示mediea recovery提示
當資料檔案sCN號等於控制檔案scn號,正常啟動例項
SQL> alter database backup controlfile to trace as '/u01/Oracle/admin/ora9i/udump/';
Database altered.
SQL>
/u01/Oracle/oradata/ora9i
[oracle@test ora9i]$ rm control0*
[oracle@test ora9i]$
SQL> shutdown immediate;
ORA-00210: cannot open the specified controlfile
ORA-00202: controlfile: '/u01/Oracle/oradata/ora9i/'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
修改備份檔案使用第一個sql
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA9I" NORESETLOGS ARCHIVELOG
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 '/u01/Oracle/oradata/ora9i/' SIZE 100M,
GROUP 2 '/u01/Oracle/oradata/ora9i/' SIZE 100M,
GROUP 3 '/u01/Oracle/oradata/ora9i/' SIZE 100M
DATAFILE
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/',
'/u01/Oracle/oradata/ora9i/app1_'
CHARACTER SET ZHS16GBK
;
# Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := _BACKUP_ONFIG('CONTROLFILE AUTOBACKUP','ON');
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
ALTER DATABASE OPEN;
# Commands to add tempfiles to temporary tablespaces.
# Online tempfiles have complete space information.
# Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/Oracle/oradata/ora9i/' REUSE;
# End of tempfile additions.
#