ARCHIVELOG模式下使用者管理恢復控制檔案—使用trace檔案重建控制檔案
阿新 • • 發佈:2018-11-10
首先生成控制檔案的sql指令碼
[sql] view plain copy print ?- SQL> alter database backup controlfile to trace as '/u01/app/oracle/controlfile/control.sql';
- 資料庫已更改。
SQL> alter database backup controlfile to trace as '/u01/app/oracle/controlfile/control.sql'; 資料庫已更改。
其實就是生成了一個控制檔案的指令碼,去掉註釋以後這個sql指令碼的內容如下:
[sql] view plain copy print ?- --#1. NORESETLOGS case
- STARTUP NOMOUNT;
- CREATE CONTROLFILE REUSE DATABASE
- MAXLOGFILES 16
- MAXLOGMEMBERS 3
- MAXDATAFILES 100
- MAXINSTANCES 8
- MAXLOGHISTORY 292
- LOGFILE
- GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
- GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
- GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
- DATAFILE
- '/u01/app/oracle/oradata/orcl/system01.dbf',
- '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
- '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
- '/u01/app/oracle/oradata/orcl/users01.dbf',
- '/u01/app/oracle/oradata/orcl/tb1.dbf'
- CHARACTER SET ZHS16GBK;
- RECOVER DATABASE;
- ALTER SYSTEM ARCHIVE LOG ALL;
- ALTER DATABASE OPEN;
- ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
- --#2. RESETLOGS case
- STARTUP NOMOUNT;
- CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
- MAXLOGFILES 16
- MAXLOGMEMBERS 3
- MAXDATAFILES 100
- MAXINSTANCES 8
- MAXLOGHISTORY 292
- LOGFILE
- GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
- GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
- GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
- DATAFILE
- '/u01/app/oracle/oradata/orcl/system01.dbf',
- '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
- '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
- '/u01/app/oracle/oradata/orcl/users01.dbf',
- '/u01/app/oracle/oradata/orcl/tb1.dbf'
- CHARACTER SET ZHS16GBK;
- RECOVER DATABASE USING BACKUP CONTROLFILE;
- ALTER DATABASE OPEN RESETLOGS;
- ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
--#1. NORESETLOGS case
STARTUP NOMOUNT;
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf',
'/u01/app/oracle/oradata/orcl/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl/users01.dbf',
'/u01/app/oracle/oradata/orcl/tb1.dbf'
CHARACTER SET ZHS16GBK;
RECOVER DATABASE;
ALTER SYSTEM ARCHIVE LOG ALL;
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
--#2. RESETLOGS case
STARTUP NOMOUNT;
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf',
'/u01/app/oracle/oradata/orcl/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl/users01.dbf',
'/u01/app/oracle/oradata/orcl/tb1.dbf'
CHARACTER SET ZHS16GBK;
RECOVER DATABASE USING BACKUP CONTROLFILE;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
然後刪除資料庫模擬控制控制檔案丟失
[sql] view plain copy print ?- SQL> conn /as sysdba
- 已連線到空閒例程。
- SQL> startup
- ORACLE 例程已經啟動。
- Total System Global Area 167772160 bytes
- Fixed Size 1266392 bytes
- Variable Size 62917928 bytes
- Database Buffers 100663296 bytes
- Redo Buffers 2924544 bytes
- 資料庫裝載完畢。
- 資料庫已經開啟。
- SQL> conn u1/u1
- 已連線。
- SQL> select * from t;
- ID VALUE
- ---------- ----------
- 1 a
- SQL> insert into t values(2,'b');
- 已建立 1 行。
- SQL> commit;
- 提交完成。
- SQL> select * from t;
- ID VALUE
- ---------- ----------
- 1 a
- 2 b
- SQL> ! rm -rf /u01/app/oracle/oradata/orcl/*.ctl
- SQL> conn /as sysdba
- 已連線。
- SQL> shutdown abort
- ORACLE 例程已經關閉。
SQL> conn /as sysdba
已連線到空閒例程。
SQL> startup
ORACLE 例程已經啟動。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 62917928 bytes
Database Buffers 100663296 bytes
Redo Buffers 2924544 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> conn u1/u1
已連線。
SQL> select * from t;
ID VALUE
---------- ----------
1 a
SQL> insert into t values(2,'b');
已建立 1 行。
SQL> commit;
提交完成。
SQL> select * from t;
ID VALUE
---------- ----------
1 a
2 b
SQL> ! rm -rf /u01/app/oracle/oradata/orcl/*.ctl
SQL> conn /as sysdba
已連線。
SQL> shutdown abort
ORACLE 例程已經關閉。
1、下面就刪除控制檔案用這個指令碼來重建控制檔案。使用noresetlogs。
- SQL> conn /as sysdba
- 已連線到空閒例程。
- SQL> startup nomount
- ORACLE 例程已經啟動。
- Total System Global Area 167772160 bytes
- Fixed Size 1266392 bytes
- Variable Size 62917928 bytes
- Database Buffers 100663296 bytes
- Redo Buffers 2924544 bytes
- SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
- 2 MAXLOGFILES 16
- 3 MAXLOGMEMBERS 3
- 4 MAXDATAFILES 100
- 5 MAXINSTANCES 8
- 6 MAXLOGHISTORY 292
- 7 LOGFILE
- 8 GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
- 9 GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
- 10 GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
- 11 DATAFILE
- 12 '/u01/app/oracle/oradata/orcl/system01.dbf',
- 13 '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
- 14 '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
- 15 '/u01/app/oracle/oradata/orcl/users01.dbf',
- 16 '/u01/app/oracle/oradata/orcl/tb1.dbf'
- 17 CHARACTER SET ZHS16GBK;
- 控制檔案已建立。
- SQL> select status from v$instance;
- STATUS
- ------------
- MOUNTED
- SQL> select * from v$recover_file;
- FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
- ---------- ------- ------- ----------------------------------------------------------------- ---------- --------------
- 1 ONLINE ONLINE 474731 10-10? -11
- 2 ONLINE ONLINE 474731 10-10? -11
- 3 ONLINE ONLINE 474731 10-10? -11
- 4 ONLINE ONLINE 474731 10-10? -11
- 5 ONLINE ONLINE 474731 10-10? -11
- SQL> alter database open;
- alter database open
- *
- 第 1 行出現錯誤:
- ORA-01113: ?? 1 ??????
- ORA-01110: ???? 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
- SQL> RECOVER DATABASE;
- 完成介質恢復。
- SQL> ALTER SYSTEM ARCHIVE LOG ALL;
- 系統已更改。
- SQL> ALTER DATABASE OPEN;
- 資料庫已更改。
- SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
- 表空間已更改。
- SQL> select status from v$instance;
- STATUS
- ------------
- OPEN
- SQL> select * from v$recover_file;
- 未選定行
- SQL> conn u1/u1
- 已連線。
- SQL> select * from t;
- ID VALUE
- ---------- ----------
- 1 a
SQL> conn /as sysdba
已連線到空閒例程。
SQL> startup nomount
ORACLE 例程已經啟動。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 62917928 bytes
Database Buffers 100663296 bytes
Redo Buffers 2924544 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
9 GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
10 GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
11 DATAFILE
12 '/u01/app/oracle/oradata/orcl/system01.dbf',
13 '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
14 '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
15 '/u01/app/oracle/oradata/orcl/users01.dbf',
16 '/u01/app/oracle/oradata/orcl/tb1.dbf'
17 CHARACTER SET ZHS16GBK;
控制檔案已建立。
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> select * from v$recover_file;
FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
---------- ------- ------- ----------------------------------------------------------------- ---------- --------------
1 ONLINE ONLINE 474731 10-10? -11
2 ONLINE ONLINE 474731 10-10? -11
3 ONLINE ONLINE 474731 10-10? -11
4 ONLINE ONLINE 474731 10-10? -11
5 ONLINE ONLINE 474731 10-10? -11
SQL> alter database open;
alter database open
*
第 1 行出現錯誤:
ORA-01113: ?? 1 ??????
ORA-01110: ???? 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
SQL> RECOVER DATABASE;
完成介質恢復。
SQL> ALTER SYSTEM ARCHIVE LOG ALL;
系統已更改。
SQL> ALTER DATABASE OPEN;
資料庫已更改。
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
表空間已更改。
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> select * from v$recover_file;
未選定行
SQL> conn u1/u1
已連線。
SQL> select * from t;
ID VALUE
---------- ----------
1 a
2、重複前面的實驗環境。使用resetlogs。
- SQL> conn /as sysdba
- 已連線到空閒例程。
- SQL> startup nomount;
- ORACLE 例程已經啟動。
- Total System Global Area 167772160 bytes
- Fixed Size 1266392 bytes
- Variable Size 62917928 bytes
- Database Buffers 100663296 bytes
- Redo Buffers 2924544 bytes
- SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
- 2 MAXLOGFILES 16
- 3 MAXLOGMEMBERS 3
- 4 MAXDATAFILES 100
- 5 MAXINSTANCES 8
- 6 MAXLOGHISTORY 292
- 7 LOGFILE
- 8 GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
- 9 GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
- 10 GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
- 11 DATAFILE
- 12 '/u01/app/oracle/oradata/orcl/system01.dbf',
- 13 '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
- 14 '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
- 15 '/u01/app/oracle/oradata/orcl/users01.dbf',
- 16 '/u01/app/oracle/oradata/orcl/tb1.dbf'
- 17 CHARACTER SET ZHS16GBK;
- 控制檔案已建立。
- SQL> select status from v$instance;
- STATUS
- ------------
- MOUNTED
- SQL> select * from v$recover_file;
- FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
- ---------- ------- ------- ----------------------------------------------------------------- ---------- --------------
- 1 ONLINE ONLINE 474731 10-10? -11
- 2 ONLINE ONLINE 474731 10-10? -11
- 3 ONLINE ONLINE 474731 10-10? -11
- 4 ONLINE ONLINE 474731 10-10? -11
- 5 ONLINE ONLINE 474731 10-10? -11
- SQL> select * from v$log;
- GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------------
- 1 1 0 52428800 1 YES UNUSED 0
- 3 1 0 52428800 1 YES CURRENT 0
- 2 1 0 52428800 1 YES UNUSED 0
- SQL> select member from v$logfile;
- MEMBER
- --------------------------------------------------------------------------------
- /u01/app/oracle/oradata/orcl/redo03.log
- /u01/app/oracle/oradata/orcl/redo02.log
- /u01/app/oracle/oradata/orcl/redo01.log
- SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
- ORA-00279: ?? 474731 (? 10/10/2011 02:31:58 ??) ???? 1 ????
- ORA-00289: ??: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_10_10/o1_mf_1_14_%u_.arc
- ORA-00280: ?? 474731 (???? 1) ??? #14 ?
- 指定日誌: {<RET>=suggested | filename | AUTO | CANCEL}
- /u01/app/oracle/oradata/orcl/redo03.log
- ORA-00310: ???????? 12; ???? 14
- ORA-00334: ????: '/u01/app/oracle/oradata/orcl/redo03.log'
- SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
- ORA-00279: ?? 474731 (? 10/10/2011 02:31:58 ??) ???? 1 ????
- ORA-00289: ??: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_10_10/o1_mf_1_14_%u_.arc
- ORA-00280: ?? 474731 (???? 1) ??? #14 ?
- 指定日誌: {<RET>=suggested | filename | AUTO | CANCEL}
- /u01/app/oracle/oradata/orcl/redo01.log
- ORA-00310: ???????? 13; ???? 14
- ORA-00334: ????: '/u01/app/oracle/oradata/orcl/redo01.log'
- SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
- ORA-00279: ?? 474731 (? 10/10/2011 02:31:58 ??) ???? 1 ????
- ORA-00289: ??: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_10_10/o1_mf_1_14_%u_.arc
- ORA-00280: ?? 474731 (???? 1) ??? #14 ?
- 指定日誌: {<RET>=suggested | filename | AUTO | CANCEL}
- /u01/app/oracle/oradata/orcl/redo02.log
- 已應用的日誌。
- 完成介質恢復。
- SQL> select * from v$recover_file;
- 未選定行
- SQL> ALTER DATABASE OPEN RESETLOGS;
- 資料庫已更改。
- SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
- 表空間已更改。
- SQL> select status from v$instance;
- STATUS
- ------------
- OPEN
- SQL> conn u1/u1
- 已連線。
- SQL> select * from t;
- ID VALUE
- ---------- ----------
- 1 a
- 2 b
SQL> conn /as sysdba
已連線到空閒例程。
SQL> startup nomount;
ORACLE 例程已經啟動。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 62917928 bytes
Database Buffers 100663296 bytes
Redo Buffers 2924544 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
9 GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
10 GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
11 DATAFILE
12 '/u01/app/oracle/oradata/orcl/system01.dbf',
13 '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
14 '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
15 '/u01/app/oracle/oradata/orcl/users01.dbf',
16 '/u01/app/oracle/oradata/orcl/tb1.dbf'
17 CHARACTER SET ZHS16GBK;
控制檔案已建立。
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> select * from v$recover_file;
FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
---------- ------- ------- ----------------------------------------------------------------- ---------- --------------
1 ONLINE ONLINE 474731 10-10? -11
2 ONLINE ONLINE 474731 10-10? -11
3 ONLINE ONLINE 474731 10-10? -11
4 ONLINE ONLINE 474731 10-10? -11
5 ONLINE ONLINE 474731 10-10? -11
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------------
1 1 0 52428800 1 YES UNUSED 0
3 1 0 52428800 1 YES CURRENT 0
2 1 0 52428800 1 YES UNUSED 0
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/redo03.log
/u01/app/oracle/oradata/orcl/redo02.log
/u01/app/oracle/oradata/orcl/redo01.log
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
ORA-00279: ?? 474731 (? 10/10/2011 02:31:58 ??) ???? 1 ????
ORA-00289: ??: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_10_10/o1_mf_1_14_%u_.arc
ORA-00280: ?? 474731 (???? 1) ??? #14 ?
指定日誌: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo03.log
ORA-00310: ???????? 12; ???? 14
ORA-00334: ????: '/u01/app/oracle/oradata/orcl/redo03.log'
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
ORA-00279: ?? 474731 (? 10/10/2011 02:31:58 ??) ???? 1 ????
ORA-00289: ??: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_10_10/o1_mf_1_14_%u_.arc
ORA-00280: ?? 474731 (???? 1) ??? #14 ?
指定日誌: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo01.log
ORA-00310: ???????? 13; ???? 14
ORA-00334: ????: '/u01/app/oracle/oradata/orcl/redo01.log'
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
ORA-00279: ?? 474731 (? 10/10/2011 02:31:58 ??) ???? 1 ????
ORA-00289: ??: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_10_10/o1_mf_1_14_%u_.arc
ORA-00280: ?? 474731 (???? 1) ??? #14 ?
指定日誌: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo02.log
已應用的日誌。
完成介質恢復。
SQL> select * from v$recover_file;
未選定行
SQL> ALTER DATABASE OPEN RESETLOGS;
資料庫已更改。
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
表空間已更改。
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> conn u1/u1
已連線。
SQL> select * from t;
ID VALUE
---------- ----------
1 a
2 b
指定RESETLOGS會執行下列操作:歸檔當前的線上重做日誌檔案(如果能訪問到的話),然後清空內容並將日誌檔案序號重置為1(如果線上重做日誌檔案不存在,則重建)。重置控制檔案中關於線上日誌檔案的元資料。更新資料檔案和線上重做日誌檔案中的RESETLOGS SCN和重置時間資訊。
[sql] view plain copy print ?
- SQL> conn /as sysdba
- 已連線。
- SQL> alter system switch logfile;
- 系統已更改。
- SQL> /
- 系統已更改。
- SQL> /
- 系統已更改。
- SQL> select * from v$log;
- GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------------
- 1 1 4 52428800 1 NO CURRENT 474954 10-10月-11
- 2 1 2 52428800 1 YES INACTIVE 474948 10-10月-11
- 3 1 3 52428800 1 YES INACTIVE 474950 10-10月-11