File Dumps(ORACLE各類檔案轉儲)
File Dumps(ORACLE各類檔案轉儲)
dump 2010-02-26 23:18:10 閱讀9 評論0 字號:大中小
Columns
To dump the internal representation of columns use the DUMP built-in function
DUMP (column_value, format)
where format is
|
For example
SELECT DUMP (1001,16) FROM dual;
returns
Typ=2 Len=3: c2,b,2
To output a column in hexadecimal use the 'XXXXXXXX' format mask e.g.
SELECT TO_CHAR (65536,'XXXXXXXX') FROM dual;
returns
10000
Database Blocks
The syntax used for dumping database blocks changed when Oracle8 was introduced
Oracle 7 and below
In Oracle7, blocks are identified by a file number and a block number. These must be converted into a data block address. The block can then be dumped using the ALTER SESSION command.
COLUMN decimalDBA new_value decimalDBA SELECT dbms_utility.make_data_block_address (&file,&block) decimalDBA FROM dual; ALTER SESSION SET EVENTS 'immediate trace name blockdump level &decimalDBA';
Oracle 8 and above
In Oracle8 and above, blocks are uniquely identified by an absolute file number and a block number. The syntax of the ALTER SYSTEM command has been extended to include block dumps
To dump a block
ALTER SYSTEM DUMP DATAFILE absolute_file_number BLOCK block_number;
To dump a range of blocks
ALTER SYSTEM DUMP DATAFILE absolute_file_number BLOCK MIN minimum_block_number BLOCK MAX maximum_block_number;
The DATAFILE clause can specify an absolute file number of a datafile name. If the DATAFILE clause specifies a datafile name, the blocks can also be dumped from a closed database e.g.
ALTER SYSTEM DUMP DATAFILE 'file_name' BLOCK block_number;
Normally a symbolic block dump is output. However, this may not be possible if the block has become corrupt. It is possible to output the block dump in hexadecimal.
To dump a block in hexadecimal, enable event 10289
ALTER SESSION SET EVENTS '10289 trace name context forever, level 1';
dump the block(s) using one of the above commands and then disable 10289 again using
ALTER SESSION SET EVENTS '10289 trace name context off';
On Unix systems blocks can also be dumped using the od utility.
dd bs=8k if=filename skip=200 count=4 | od -x
where
- bs is the Oracle block size e.g. 8k
- if is the datafile name
- skip is the number of blocks to skip from the start of the file
- count is the number of blocks to dump
As blocks are written back to the datafiles asynchronously by DBWR, it is possible that changed blocks have not been written back to the disk when they are dumped using operating system utilities.
The probability that a block has been written back to disk can be increased by performing a checkpoint using
ALTER SYSTEM CHECKPOINT;
or a logfile switch using
ALTER SYSTEM SWITCH LOGFILE;
Index Tree Dumps
An index tree can be dumped using
ALTER SESSION SET EVENTS 'immediate trace name treedump level object_id';
where object_id is the object number of the index (in DBA_OBJECTS)
The tree dump includes
- branch block headers
- leaf block headers
- contents of leaf blocks
The following ORADEBUG command has the same effect
ORADEBUG DUMP TREEDUMP object_id
In Oracle 9.2 a treedump may crash if the index has been created by a primary / unique constraint e.g.
CREATE TABLE t1 (c1 NUMBER PRIMARY KEY);
or
CREATE TABLE t1 (c1 NUMBER); ALTER TABLE t1 ADD CONSTRAINT t1pk PRIMARY KEY (c1);
The treedump crashes when ind$.property > 256
This problem can be prevented by creating the index before creating the constraint
Undo Headers
To dump an undo segment header use the command function
ALTER SYSTEM DUMP UNDO_HEADER 'segment_name';
In Oracle 9.0.1 and above, if system managed undo is enabled, the segment name has to be in double quotes and upper case. This is because there is a leading underscore in the segment name.
A list of undo segment IDs and names can be obtained using
SELECT segment_id, segment_name FROM dba_rollback_segs ORDER BY segment_id;
Undo Blocks
To dump an undo block use the equivalent datafile block dump command
For example to dump an undo block in Oracle8 and above use
ALTER SYSTEM DUMP DATABASE absolute_file_number BLOCK block_number;
See for more information
Undo for a Transaction
To dump all the undo written for a specific transaction, first identify the transaction ID using
SELECT xidusn, xidslot, xidsqn FROM v$transaction;
Dump the undo using the transaction ID
ALTER SYSTEM DUMP UNDO BLOCK 'segment_name' XID xidusn xidslot xidsqn;
File Headers
To dump all the datafile headers use
ALTER SESSION SET EVENTS 'immediate trace name file_hdrs level level';
Levels (circa Oracle 8.1.5) are
|
In later versions, level 7 appears to generate additional trace
The following ORADEBUG command has the same effect
ORADEBUG DUMP FILE_HDRS level
Controlfiles
To dump the current latch status use
ALTER SESSION SET EVENTS 'immediate trace name controlf level level';
Levels (circa Oracle 8.1.5) are
|
In later versions, level 15 appears to generate additional trace
The following ORADEBUG command has the same effect
ORADEBUG DUMP CONTROLF level
Redo Log Headers
To dump the redo log headers
ALTER SESSION SET EVENTS 'immediate trace name redohdr level 1';
Levels (circa Oracle 8.1.5) are
|
The following ORADEBUG command has the same effect
ORADEBUG DUMP REDOHDR level
Redo Logs
To identify the current redo log use
SELECT member FROM v$logfile WHERE group# = ( SELECT group# FROM v$log WHERE status = 'CURRENT' );
To dump a redo log file use
ALTER SYSTEM DUMP LOGFILE 'FileName';
e.g.
ALTER SYSTEM DUMP LOGFILE 'R:\Oracle\Oradata\JD92001\Redo01.log';
The syntax of this statement is as follows
ALTER SYSTEM DUMP LOGFILE 'FileName' SCN MIN MinimumSCN SCN MAX MaximumSCN TIME MIN MinimumTime TIME MAX MaximumTime LAYER Layer OPCODE Opcode DBA MIN FileNumber . BlockNumber DBA MAX FileNumber . BlockNumber RBA MIN LogFileSequenceNumber . BlockNumber RBA MAX LogFileSequenceNumber . BlockNumber;
The minimum and maximum SCN is a decimal number
The minimum and maximum time is a decimal number representing the number of seconds since midnight 01Jan1988. These are calculated using the following formula
time = (((((yyyy - 1988)) * 12 + mm - 1) * 31 + dd - 1) * 24 + hh) * 60 + mi) * 60 + ss;
where
|
This is the same formula that is used to represent time within the redo log
The layer and opcode are those used to indicate specific operations within the redo log e.g. LAYER 5 OPCODE 4 is an undo segment header commit operation
Note that there must be spaces around the periods in the DBA and RBA.
See Metalink Note 1031381.6 for further examples
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9606200/viewspace-671511/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 各類檔案管理函式 (轉)函式
- Java —— 檔案類(File 類)Java
- Memory Dumps(ORACLE記憶體結構轉儲)Oracle記憶體
- Oracle:dump轉儲檔案Oracle
- 【靜默】Oracle各類響應檔案何在?Oracle
- Java : File 檔案類操作Java
- Oracle 跟蹤檔案和檔案轉儲(dump)Oracle
- oracle控制檔案轉儲說明Oracle
- oracle 跟蹤檔案和轉儲命令及常用轉儲命令(轉)Oracle
- 轉載 oracle 跟蹤檔案 和轉儲命令Oracle
- oracle 跟蹤檔案和轉儲命令(轉摘)Oracle
- 【JAVA :File類的用法(一)】File類的構造方法-File類建立檔案與資料夾Java構造方法
- oracle日誌檔案頭轉儲說明Oracle
- oracle資料檔案頭轉儲說明Oracle
- 轉儲 控制檔案
- 程式執行資訊的非登錄檔儲存類(ini 檔案操作類) (轉)
- oracle 跟蹤檔案和轉儲命令詳解Oracle
- 除錯Go語言的核心轉儲(Core Dumps)除錯Go
- oracle檔案管理之 control fileOracle
- Android掃描檔案並統計各類檔案數目Android
- Java如何建立臨時檔案並列印File各種屬性Java
- dump 轉儲檔案內容
- 轉儲日誌檔案頭
- ORACLE UTL_FILE檔案包的應用,檔案I/O操作Oracle
- 使用dbms_file_transfer轉換ASM檔案ASM
- Oracle引數檔案 各引數解釋Oracle
- Oracle 各種檔案丟失的恢復Oracle
- vbs類生成xml檔案(轉)XML
- Oracle Control File(控制檔案)的內容Oracle
- Oracle 快照控制檔案(snapshot control file)Oracle
- oracle檔案遷移之datafile,relog file,tempfileOracle
- Oracle快照控制檔案(snapshot control file)Oracle
- oracle利用utl_file包來讀寫檔案Oracle
- linux下的各項配置檔案(轉)Linux
- UNIX系統下各檔案的作用(轉)
- PHP 自定義session儲存 FILE 方式類PHPSession
- oracle10g 資料檔案頭data file header(file header)OracleHeader
- JAVA程式設計學習記錄(File類檔案操作)Java程式設計