重建控制檔案,並且不乾淨的關閉資料庫測試
重建控制檔案,並且不乾淨的關閉資料庫測試:
資料庫SHUTDOWN ABORT,刪除CONTROLFILE
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 419430400 bytes
Fixed Size 2021248 bytes
Variable Size 171968640 bytes
Database Buffers 243269632 bytes
Redo Buffers 2170880 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "XUEXI" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/oradata/xuexi/redo01.log' SIZE 50M,
9 GROUP 2 '/oradata/xuexi/redo02.log' SIZE 50M,
10 GROUP 3 '/oradata/xuexi/redo03.log' SIZE 50M,
11 GROUP 4 '/oradata/XUEXI/onlinelog/o1_mf_4_8yqwxqsh_.log' SIZE 50M,
12 GROUP 5 (
13 '/oradata/XUEXI/onlinelog/o1_mf_5_8yqx1d59_.log',
14 '/oradata/XUEXI/onlinelog/o1_mf_5_8yqx1gvx_.log'
15 ) SIZE 50M,
16 GROUP 7 (
17 '/oradata/XUEXI/onlinelog/o1_mf_7_8zl9m1ro_.log',
18 '/oradata/XUEXI/onlinelog/o1_mf_7_8zl9m3gj_.log',
19 '/oradata/logfile07.log'
20 ) SIZE 100M
21 -- STANDBY LOGFILE
22 DATAFILE
23 '/oradata/xuexi/system01.dbf',
24 '/oradata/xuexi/undotbs01.dbf',
25 '/oradata/xuexi/sysaux01.dbf',
26 '/oradata/xuexi/users01.dbf',
27 '/oradata/xuexi/XUEXI/datafile/o1_mf_tomf_8yqwrdoj_.dbf',
28 '/oradata/xuexi/omf2.dbf',
29 '/oradata/xuexi/XUEXI/datafile/testimp01.dbf',
30 '/oradata/xuexi/XUEXI/datafile/testimp011.dbf',
31 '/oradata/xuexi/XUEXI/datafile/testo1.dbf',
32 '/oradata/xuexi/XUEXI/datafile/testo2.dbf'
33 CHARACTER SET AL32UTF8
34 ;
Control file created.
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted
SQL> recover database ;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;
ORA-00279: change 1917689 generated at 10/04/2013 21:15:57 needed for thread 1
ORA-00289: suggestion : /archive/1_102_822387818.dbf
ORA-00280: change 1917689 for thread 1 is in sequence #102
Specify log: {
auto
ORA-00308: cannot open archived log '/archive/1_102_822387818.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log '/archive/1_102_822387818.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
顯然這裡缺少102這個歸檔,因為他是當前日誌檔案,所以我們需要把日誌複製到歸檔目錄下,但是那個日誌是102呢,這樣就可以確定
[oracle@localhost bdump]$ tail -n 4000 alert_xuexi.log |grep Current
Current log# 4 seq# 100 mem# 0: /oradata/XUEXI/onlinelog/o1_mf_4_8yqwxqsh_.log
Current log# 4 seq# 100 mem# 0: /oradata/XUEXI/onlinelog/o1_mf_4_8yqwxqsh_.log
Current log# 5 seq# 101 mem# 0: /oradata/XUEXI/onlinelog/o1_mf_5_8yqx1d59_.log
Current log# 5 seq# 101 mem# 1: /oradata/XUEXI/onlinelog/o1_mf_5_8yqx1gvx_.log
Current log# 7 seq# 102 mem# 0: /oradata/XUEXI/onlinelog/o1_mf_7_8zl9m1ro_.log
Current log# 7 seq# 102 mem# 1: /oradata/XUEXI/onlinelog/o1_mf_7_8zl9m3gj_.log
Current log# 7 seq# 102 mem# 2: /oradata/logfile07.log
可以確認/oradata/logfile07.log就是需要的歸檔
cp /oradata/logfile07.log /archive/1_102_822387818.dbf
SQL> recover database using backup controlfile
ORA-00279: change 1917689 generated at 10/04/2013 21:15:57 needed for thread 1
ORA-00289: suggestion : /archive/1_102_822387818.dbf
ORA-00280: change 1917689 for thread 1 is in sequence #102
Specify log: {
AUTO
完成後即可
當然也快手動輸入你確認的當前歸檔如下:
SQL> recover database using backup controlfile
ORA-00279: change 1917689 generated at 10/04/2013 21:15:57 needed for thread 1
ORA-00289: suggestion : /archive/1_102_822387818.dbf
ORA-00280: change 1917689 for thread 1 is in sequence #102
Specify log: {
/oradata/logfile07.log
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;
SQL> alter database open resetlogs;
Database altered.
Log applied.
Media recovery complete.
alter database backup controlfile to trace 全文
/opt/oracle/admin/xuexi/udump/xuexi_ora_5686.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /opt/oracle/product/10.2.0/db_1
System name: Linux
Node name: localhost.localdomain
Release: 2.6.18-164.el5
Version: #1 SMP Tue Aug 18 15:51:48 EDT 2009
Machine: x86_64
Instance name: xuexi
Redo thread mounted by this instance: 1
Oracle process number: 18
Unix process pid: 5686, image: (TNS V1-V3)
*** SERVICE NAME:(SYS$USERS) 2013-10-04 21:38:20.304
*** SESSION ID:(146.91) 2013-10-04 21:38:20.304
*** 2013-10-04 21:38:20.304
-- 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=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="xuexi"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/archive'
-- LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='REGISTER 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 "XUEXI" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/oradata/xuexi/redo01.log' SIZE 50M,
GROUP 2 '/oradata/xuexi/redo02.log' SIZE 50M,
GROUP 3 '/oradata/xuexi/redo03.log' SIZE 50M,
GROUP 4 '/oradata/XUEXI/onlinelog/o1_mf_4_8yqwxqsh_.log' SIZE 50M,
GROUP 5 (
'/oradata/XUEXI/onlinelog/o1_mf_5_8yqx1d59_.log',
'/oradata/XUEXI/onlinelog/o1_mf_5_8yqx1gvx_.log'
) SIZE 50M,
GROUP 7 (
'/oradata/XUEXI/onlinelog/o1_mf_7_8zl9m1ro_.log',
'/oradata/XUEXI/onlinelog/o1_mf_7_8zl9m3gj_.log',
'/oradata/logfile07.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/oradata/xuexi/system01.dbf',
'/oradata/xuexi/undotbs01.dbf',
'/oradata/xuexi/sysaux01.dbf',
'/oradata/xuexi/users01.dbf',
'/oradata/xuexi/XUEXI/datafile/o1_mf_tomf_8yqwrdoj_.dbf',
'/oradata/xuexi/omf2.dbf',
'/oradata/xuexi/XUEXI/datafile/testimp01.dbf',
'/oradata/xuexi/XUEXI/datafile/testimp011.dbf',
'/oradata/xuexi/XUEXI/datafile/testo1.dbf',
'/oradata/xuexi/XUEXI/datafile/testo2.dbf'
CHARACTER SET AL32UTF8
;
-- 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 '/archive/1_1_822350387.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822350760.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822330757.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822350003.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822349246.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822350252.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822374325.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822387818.dbf';
-- 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 TEMP1 ADD TEMPFILE '/oradata/xuexi/temp011.dbf'
SIZE 19922944 REUSE AUTOEXTEND ON NEXT 8192 MAXSIZE 5120M;
-- End of tempfile additions.
--
-- 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 "XUEXI" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/oradata/xuexi/redo01.log' SIZE 50M,
GROUP 2 '/oradata/xuexi/redo02.log' SIZE 50M,
GROUP 3 '/oradata/xuexi/redo03.log' SIZE 50M,
GROUP 4 '/oradata/XUEXI/onlinelog/o1_mf_4_8yqwxqsh_.log' SIZE 50M,
GROUP 5 (
'/oradata/XUEXI/onlinelog/o1_mf_5_8yqx1d59_.log',
'/oradata/XUEXI/onlinelog/o1_mf_5_8yqx1gvx_.log'
) SIZE 50M,
GROUP 7 (
'/oradata/XUEXI/onlinelog/o1_mf_7_8zl9m1ro_.log',
'/oradata/XUEXI/onlinelog/o1_mf_7_8zl9m3gj_.log',
'/oradata/logfile07.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/oradata/xuexi/system01.dbf',
'/oradata/xuexi/undotbs01.dbf',
'/oradata/xuexi/sysaux01.dbf',
'/oradata/xuexi/users01.dbf',
'/oradata/xuexi/XUEXI/datafile/o1_mf_tomf_8yqwrdoj_.dbf',
'/oradata/xuexi/omf2.dbf',
'/oradata/xuexi/XUEXI/datafile/testimp01.dbf',
'/oradata/xuexi/XUEXI/datafile/testimp011.dbf',
'/oradata/xuexi/XUEXI/datafile/testo1.dbf',
'/oradata/xuexi/XUEXI/datafile/testo2.dbf'
CHARACTER SET AL32UTF8
;
-- 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 '/archive/1_1_822350387.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822350760.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822330757.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822350003.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822349246.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822350252.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822374325.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/archive/1_1_822387818.dbf';
-- 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;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP1 ADD TEMPFILE '/oradata/xuexi/temp011.dbf'
SIZE 19922944 REUSE AUTOEXTEND ON NEXT 8192 MAXSIZE 5120M;
-- End of tempfile additions.
--
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-773925/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 重建Oracle資料庫控制檔案Oracle資料庫
- 如何以最快方式乾淨的關閉資料庫?資料庫
- 關於資料庫丟失控制檔案的測試資料庫
- 使用NORESETLOGS重建控制檔案恢復資料庫資料庫
- 使用RESETLOGS重建控制檔案恢復資料庫資料庫
- 如何以最快方式乾淨的關閉資料庫? (文件 ID 1577321.1)資料庫
- 資料庫非正常關閉後重建控制檔案,OPEN時為何需要執行介質恢復?資料庫
- 使用RESETLOGS重建控制檔案恢復資料庫(二)資料庫
- 前幾天手工刪除測試資料庫並重建的指令碼資料庫指令碼
- 重建控制檔案時,與資料檔案相關的Checkpoint資訊來自何處
- 含read only表空間的資料庫的控制檔案重建資料庫
- 重建控制檔案
- 重建控制檔案--
- 用重建控制檔案的方法修改oracle資料檔案路徑Oracle
- Oracle 控制檔案的重建Oracle
- Oracle重建控制檔案Oracle
- DataGuard重建控制檔案
- oracle 重建控制檔案Oracle
- 請教關於利用跟蹤檔案重建控制檔案
- 丟失一個控制檔案並恢復資料庫資料庫
- 如何重建RAC的控制檔案
- ORACLE控制檔案的重建 (轉)Oracle
- oracle控制檔案與資料庫啟動的關係Oracle資料庫
- dbms_backup_restore包恢復控制檔案,資料檔案,歸檔檔案的測試案例REST
- 利用trace重建控制檔案
- win10防毒軟體怎麼關閉乾淨_win10自帶的防毒軟體如何關閉乾淨Win10防毒
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- 重建控制檔案, 資料檔案檢查點SCN到底來自哪裡?
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- RAC環境下單例項啟動Oracle資料庫重建控制檔案案例單例Oracle資料庫
- 為資料庫新增控制檔案資料庫
- 控制檔案恢復測試
- oracle 關閉資料檔案的擴充套件Oracle套件
- RAC環境重建控制檔案
- 控制檔案重建以及備份
- 錯誤 5173:不能使檔案與不同的資料庫相關,測試過,能行。資料庫
- 資料庫關閉資料庫
- 重建控制檔案的恢復(noresetlogs)