利用trace重建控制檔案
Oracle提供兩種方式備份控制檔案:
1.生成可以重建控制檔案的指令碼
2.備份二進位制的控制檔案
獲得可以重建控制檔案的指令碼:
Oracle提供如下命令:
alter database backup controlfile to trace;
操作過程:
[oracle@standby tools]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Oct 16 08:56:13 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> alter database backup controlfile to trace;
Database altered.
SQL> @gettrcname
TRACE_FILE_NAME
--------------------------------------------------------------------------------
/opt/oracle/admin/primary/udump/primary_ora_2135.trc
trace檔案內容:
[oracle@standby tools]$ more /opt/oracle/admin/primary/udump/primary_ora_2135.trc
/opt/oracle/admin/primary/udump/primary_ora_2135.trc
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
ORACLE_HOME = /opt/oracle/product/9.2.0
System name: Linux
Node name: standby
Release: 2.4.21-4.EL
Version: #1 Fri Oct 3 18:13:58 EDT 2003
Machine: i686
Instance name: primary
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 2135, image: oracle@standby (TNS V1-V3)
*** SESSION ID:(11.6) 2004-10-16 09:00:03.830
*** 2004-10-16 09:00:03.830
# 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.dbf
# REMOTE_ARCHIVE_ENABLE=TRUE
# LOG_ARCHIVE_START=TRUE
# LOG_ARCHIVE_MAX_PROCESSES=2
# STANDBY_FILE_MANAGEMENT=MANUAL
# STANDBY_ARCHIVE_DEST=?/dbs/arch
# FAL_CLIENT=''
# FAL_SERVER=''
#
# LOG_ARCHIVE_DEST_1='LOCATION=/opt/oracle/oradata/primary/archive'
# LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'
# LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM SYNC'
# LOG_ARCHIVE_DEST_1='REGISTER NOALTERNATE NODEPENDENCY'
# LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED'
# 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 the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PRIMARY" NORESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 '/opt/oracle/oradata/primary/redo01.log' SIZE 10M,
GROUP 2 '/opt/oracle/oradata/primary/redo02.log' SIZE 10M,
GROUP 3 '/opt/oracle/oradata/primary/redo03.log' SIZE 10M
-- STANDBY LOGFILE
DATAFILE
'/opt/oracle/oradata/primary/system01.dbf',
'/opt/oracle/oradata/primary/undotbs01.dbf',
'/opt/oracle/oradata/primary/users01.dbf'
CHARACTER SET ZHS16GBK
;
# 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 '/opt/oracle/oradata/primary/temp01.dbf'
SIZE 41943040 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
# End of tempfile additions.
#
# Set #2. RESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# The contents of online logs will be lost and all backups will
# be invalidated. Use this only if online logs are damaged.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PRIMARY" RESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 '/opt/oracle/oradata/primary/redo01.log' SIZE 10M,
GROUP 2 '/opt/oracle/oradata/primary/redo02.log' SIZE 10M,
GROUP 3 '/opt/oracle/oradata/primary/redo03.log' SIZE 10M
-- STANDBY LOGFILE
DATAFILE
'/opt/oracle/oradata/primary/system01.dbf',
'/opt/oracle/oradata/primary/undotbs01.dbf',
'/opt/oracle/oradata/primary/users01.dbf'
CHARACTER SET ZHS16GBK
;
# 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 TEMP ADD TEMPFILE '/opt/oracle/oradata/primary/temp01.dbf'
SIZE 41943040 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
# End of tempfile additions.
#
編輯這個trace檔案,我們就可以獲得建立控制檔案的指令碼.
根據資料庫不同狀況,你可以選擇是使用RESETLOGS/NORESETLOGS來重建控制檔案.
我們獲得以下指令碼:
[oracle@standby tools]$ cat createctlf.sql
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PRIMARY" NORESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 '/opt/oracle/oradata/primary/redo01.log' SIZE 10M,
GROUP 2 '/opt/oracle/oradata/primary/redo02.log' SIZE 10M,
GROUP 3 '/opt/oracle/oradata/primary/redo03.log' SIZE 10M
-- STANDBY LOGFILE
DATAFILE
'/opt/oracle/oradata/primary/system01.dbf',
'/opt/oracle/oradata/primary/undotbs01.dbf',
'/opt/oracle/oradata/primary/users01.dbf'
CHARACTER SET ZHS16GBK
;
RECOVER DATABASE
ALTER SYSTEM ARCHIVE LOG ALL;
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/primary/temp01.dbf'
SIZE 41943040 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
執行這個指令碼即可重建控制檔案:
[oracle@standby tools]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Oct 16 09:20:24 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> set echo on
SQL> @createctlf
SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area 135337420 bytes
Fixed Size 452044 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "PRIMARY" NORESETLOGS ARCHIVELOG
2 -- SET STANDBY TO MAXIMIZE PERFORMANCE
3 MAXLOGFILES 5
4 MAXLOGMEMBERS 3
5 MAXDATAFILES 100
6 MAXINSTANCES 1
7 MAXLOGHISTORY 226
8 LOGFILE
9 GROUP 1 '/opt/oracle/oradata/primary/redo01.log' SIZE 10M,
10 GROUP 2 '/opt/oracle/oradata/primary/redo02.log' SIZE 10M,
11 GROUP 3 '/opt/oracle/oradata/primary/redo03.log' SIZE 10M
12 -- STANDBY LOGFILE
13 DATAFILE
14 '/opt/oracle/oradata/primary/system01.dbf',
15 '/opt/oracle/oradata/primary/undotbs01.dbf',
16 '/opt/oracle/oradata/primary/users01.dbf'
17 CHARACTER SET ZHS16GBK
18 ;
Control file created.
SQL> RECOVER DATABASE
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required
SQL> ALTER SYSTEM ARCHIVE LOG ALL;
System altered.
SQL> ALTER DATABASE OPEN;
Database altered.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/primary/temp01.dbf'
2 SIZE 40M REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
Tablespace altered.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14710393/viewspace-754980/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Controlfile 重建控制檔案 noresetlogs, resetlogs..
- oracle快速拿到重建控制檔案語句的方法二Oracle
- oracle清理trace、alert、aud、listener等日誌檔案Oracle
- Oracle清理trace、alert、aud、listener.log檔案Oracle
- 惡意軟體PE檔案重建指南
- Oracle 控制檔案Oracle
- 運用Log和Trace檔案排除Oracle Net問題Oracle
- 分析及格式化trace檔案 - TKPROF (Transient Kernel Profiler)
- 2.6.4 指定控制檔案
- oracle ebs 根據請求id找到對應trace 檔案Oracle
- CPL檔案利用介紹
- 利用RMAN備份重建資料庫資料庫
- 對專案版本自動控制——利用gitversionGit
- 利用msfvenom生成木馬檔案
- 利用MATLAB產生COE檔案Matlab
- 控制檔案損壞處理
- ORACLE 控制檔案(Control Files)概述Oracle
- 利用pearcmd實現裸檔案包含
- Excel VBA 利用FileSystemObject處理檔案ExcelObject
- oracle 資料庫lsnrctl監聽的日誌路徑和trace檔案Oracle資料庫
- 【RMAN】Oracle中如何備份控制檔案?備份控制檔案的方式有哪幾種?Oracle
- 【/proc/檔案淺析】另類辦法恢復資料檔案和控制檔案
- windwos檔案控制代碼數限制
- 把“點檔案”放到版本控制中
- Linux中利用csvquote處理csv檔案Linux
- laravel利用artisan建立view檢視檔案LaravelView
- Pyinstaller利用spec檔案打包的使用模板
- PHP檔案包含漏洞(利用phpinfo)復現PHP
- 利用java建立檔案或者資料夾Java
- linux 利用rsync實現檔案增量同步Linux
- 利用hints控制outline
- oracle 控制檔案及引數檔案何時自動備份Oracle
- C# 好程式碼學習筆記(1):檔案操作、讀取檔案、Debug/Trace 類、Conditional條件編譯、CLSC#筆記編譯
- 重建共享(db或asm)密碼檔案 in Oracle 19c RAC-20220209ASM密碼Oracle
- 利用-flat.vmdk檔案恢復ESXI虛擬機器的vmdk檔案虛擬機
- 與控制檔案有關的恢復
- 使用git不希望檔案被版本控制Git
- Oracle 控制檔案損壞解決方案Oracle
- PowerDesigner: 利用sql指令碼檔案逆生成模型SQL指令碼模型