如何檢視Oracle11g控制檔案裡面的內容
控制檔案(Control File)是Oracle的物理檔案之一,它記錄了資料庫的名字、資料檔案的位置等資訊。控制檔案的重要性在於,一旦控制檔案損壞,資料庫將會當機。控制檔案是一個很小的二進位制檔案,使用者不能編輯控制檔案,控制檔案的修改由Oracle自動完成。那麼,我們能夠檢視控制檔案裡面的具體資訊嗎?答案是可以的,我們可以透過轉儲檔案來獲得控制檔案的詳細資訊。
1.生成控制檔案的轉儲檔案
2.查詢生成的轉儲檔案
我們知道,使用者生成的TRACE檔案儲存在udump目錄下。在Oracle10g中,udump路徑是$ORACLE_HOME/admin/SID/udump,而Oracle11g則大不一樣。我們可以透過檢視user_dump_dest引數來定位udump目錄的具體位置。
然後,我們使用ls命令找到最近生成的TRACE檔案,就是圖示的HOEGH_ora_304.trc檔案。
3.檢視控制檔案具體資訊
現在,我們就可以透過more命令來檢視控制檔案的具體資訊了。
我們可以看到轉儲檔案裡包含了資料庫的名字、資料檔案的位置等資訊,並且按照是否需要resetlogs分別給出了建立控制檔案的sql語句。控制檔案非常重要,我們可以把它備份下來以防萬一。
~~~~~~~ the end~~~~~~~~~
hoegh
2016.05.09
1.生成控制檔案的轉儲檔案
點選(此處)摺疊或開啟
-
SQL> select * from v$version;
-
-
BANNER
-
--------------------------------------------------------------------------------
-
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
-
PL/SQL Release 11.2.0.3.0 - Production
-
CORE 11.2.0.3.0 Production
-
TNS for Linux: Version 11.2.0.3.0 - Production
-
NLSRTL Version 11.2.0.3.0 - Production
-
-
SQL> alter database backup controlfile to trace ;
-
-
Database altered.
-
- SQL>
我們知道,使用者生成的TRACE檔案儲存在udump目錄下。在Oracle10g中,udump路徑是$ORACLE_HOME/admin/SID/udump,而Oracle11g則大不一樣。我們可以透過檢視user_dump_dest引數來定位udump目錄的具體位置。
點選(此處)摺疊或開啟
-
SQL> show parameter user_dump_dest
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
- user_dump_dest string /u01/app/oracle/diag/rdbms/hoegh/HOEGH/trace
- SQL>
點選(此處)摺疊或開啟
-
[oracle@hoegh trace]$ ls -ltr
-
total 1332
-
此處省略三百字
-
-rw-r----- 1 oracle oinstall 932 May 9 21:26 HOEGH_mmon_4805.trm
-
-rw-r----- 1 oracle oinstall 9750 May 9 21:26 HOEGH_mmon_4805.trc
-
-rw-r----- 1 oracle oinstall 4562 May 9 21:28 HOEGH_dbrm_4789.trm
-
-rw-r----- 1 oracle oinstall 80534 May 9 21:28 HOEGH_dbrm_4789.trc
-
-rw-r----- 1 oracle oinstall 97 May 9 21:29 HOEGH_ora_304.trm
- -rw-r----- 1 oracle oinstall 12786 May 9 21:29 HOEGH_ora_304.trc
現在,我們就可以透過more命令來檢視控制檔案的具體資訊了。
點選(此處)摺疊或開啟
-
[oracle@hoegh trace]$ more HOEGH_ora_304.trc
-
Trace file /u01/app/oracle/diag/rdbms/hoegh/HOEGH/trace/HOEGH_ora_304.trc
-
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
-
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-
ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
-
System name: Linux
-
Node name: hoegh.example.com
-
Release: 2.6.18-164.el5PAE
-
Version: #1 SMP Thu Sep 3 02:28:20 EDT 2009
-
Machine: i686
-
VM name: VMWare Version: 6
-
Instance name: HOEGH
-
Redo thread mounted by this instance: 1
-
Oracle process number: 26
-
Unix process pid: 304, image: oracle@hoegh.example.com (TNS V1-V3)
-
-
*** 2016-05-09 21:29:07.246
-
-- 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="HOEGH"
-
--
-
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-
-- LOG_ARCHIVE_MAX_PROCESSES=4
-
-- STANDBY_FILE_MANAGEMENT=MANUAL
-
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-
-- FAL_CLIENT=''
-
-- FAL_SERVER=''
-
--
-
-- LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
-
'
-
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-
-- LOG_ARCHIVE_DEST_1='NOREGISTER 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 "HOEGH" NORESETLOGS NOARCHIVELOG
-
MAXLOGFILES 16
-
MAXLOGMEMBERS 3
-
MAXDATAFILES 100
-
MAXINSTANCES 8
-
MAXLOGHISTORY 292
-
LOGFILE
-
GROUP 1 '/u01/app/oracle/oradata/HOEGH/redo01.log' SIZE 50M BLOCKSIZE 512,
-
GROUP 2 '/u01/app/oracle/oradata/HOEGH/redo02.log' SIZE 50M BLOCKSIZE 512,
-
GROUP 3 '/u01/app/oracle/oradata/HOEGH/redo03.log' SIZE 50M BLOCKSIZE 512
-
-- STANDBY LOGFILE
-
DATAFILE
-
'/u01/app/oracle/oradata/HOEGH/system01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/sysaux01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/undotbs01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/users01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/example01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/test01.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 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
-
arch1_1_762197622.dbf';
-
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
-
arch1_1_860888149.dbf';
-
-- Recovery is required if any of the datafiles are restored backups,
-
-- or if the last shutdown was not normal or immediate.
-
RECOVER DATABASE
-
-- 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/app/oracle/oradata/HOEGH/temp01.dbf'
-
SIZE 30408704 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.
-
-- 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 "HOEGH" RESETLOGS NOARCHIVELOG
-
MAXLOGFILES 16
-
MAXLOGMEMBERS 3
-
MAXDATAFILES 100
-
MAXINSTANCES 8
-
MAXLOGHISTORY 292
-
LOGFILE
-
GROUP 1 '/u01/app/oracle/oradata/HOEGH/redo01.log' SIZE 50M BLOCKSIZE 512,
-
GROUP 2 '/u01/app/oracle/oradata/HOEGH/redo02.log' SIZE 50M BLOCKSIZE 512,
-
GROUP 3 '/u01/app/oracle/oradata/HOEGH/redo03.log' SIZE 50M BLOCKSIZE 512
-
-- STANDBY LOGFILE
-
DATAFILE
-
'/u01/app/oracle/oradata/HOEGH/system01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/sysaux01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/undotbs01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/users01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/example01.dbf',
-
'/u01/app/oracle/oradata/HOEGH/test01.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 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
-
arch1_1_762197622.dbf';
-
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
-
arch1_1_860888149.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 TEMP ADD TEMPFILE '/u01/app/oracle/oradata/HOEGH/temp01.dbf
~~~~~~~ the end~~~~~~~~~
hoegh
2016.05.09
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-2104257/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 檢視控制檔案內容
- git檢視檔案內容Git
- 檢視檔案內容的特殊方法
- Linux常用命令!如何檢視檔案內容?Linux
- Linux 檢視檔案內容——bat 命令LinuxBAT
- git檢視指定提交檔案的內容Git
- 檢視檔案內容的特殊方法(轉)
- linux 檢視檔案內容的命令Linux
- 檢視檔案內容時,附加行號
- Oracle 控制檔案內容Oracle
- Linux如何檢視檔案包含內容?常用指令有哪些?Linux
- Linux常用命令之如何檢視檔案內容?Linux
- Linux檔案內容檢視相關命令Linux
- Git檢視暫存區index檔案內容GitIndex
- 【shell 指令碼】檢視*.gz 檔案的內容指令碼
- Linux 檔案內容檢視工具介紹Linux
- Linux如何檢視檔案內容?Linux常用命令Linux
- 在Linux中,如何檢視檔案內容?列出幾種方法。Linux
- elasticsearch裡面的內容搜尋Elasticsearch
- [android]快速檢視apk內androidmanifest檔案內容AndroidAPK
- goldengate trail檔案內容檢視工具logdumpGoAI
- Linux檢視檔案內容常用命令Linux
- 選擇性地檢視檔案的方法 head tail sed 檢視檔案部分內容 (轉)AI
- 如何看spfilesid.ora檔案裡面內容
- 控制檔案包含哪些基本內容
- 【Linux】檢視二進位制檔案內容_hexdumpLinux
- 常用的7個Linux檔案內容檢視命令!Linux
- Linux基楚操作指引【檢視版本、檢視路徑、檢視內容、編輯檔案】Linux
- 11gR2 OCRDUMP檢視OCR/OLR檔案的內容
- java檔案相關(檔案追加內容、檔案內容清空、檔案內容讀取)Java
- Sql Server資料庫如何去掉內容裡面的Html標籤SQLServer資料庫HTML
- Linux學習之常用的Linux檔案內容檢視命令!Linux
- Oracle Control File(控制檔案)的內容Oracle
- 如何檢視EBS 檔案版本
- 在vue裡,下載自定義內容的檔案Vue
- 如何使用htmlq提取html檔案內容HTML
- 如何編輯PDF檔案的內容?
- Oracle 12C R2-新特性-新增兩個檢視:方便檢視trace檔案和內容Oracle