dump日誌檔案
使用ALTER SYSTEM DUMP LOGFILE可以DUMP線上日誌檔案。也可以使用ALTER SESSION命令去DUMP REDO LOG頭的資訊。在資料庫處於NOMOUNT、MOUNT或者OPEN狀態的時候都可以使用���面的命令。當作業系統是相同的情況下,可以透過客戶端去DUMP另外一個資料庫的REDO LOG。REDO LOG的資訊會被寫入一個TRACE檔案。
可以用下面的方法去DUMP線上日誌:
l 透過DBA(Data Block Address)去DUMP記錄
l 透過RBA(Redo Block Address)去DUMP記錄
l 根據事件點去DUMP記錄
l 根據層次和操作碼去DUMP記錄
l DUMP檔案頭資訊
l DUMP整個LOG檔案
根據DBA DUMP線上日誌記錄:
DUMP跟某個/某些資料塊相關的REDO LOG記錄,DUMP出來的資訊只和這些資料塊相關,命令如下:
ALTER SYSTEM DUMP LOGFILE 'filename'
DBA MIN fileno . blockno
DBA MAX fileno . blockno;
比如:
ALTER SYSTEM DUMP LOGFILE
'u01/oracle/V7323/dbs/arch1_76.dbf'
DBA MIN 5 . 31125
DBA MAX 5 . 31150;
這個命令DUMP出5號檔案的31125-31150塊相關的記錄。
根據RBA DUMP線上日誌記錄
透過REDO地址的範圍DUMP線上日誌的記錄,語法如下:
ALTER SYSTEM DUMP LOGFILE 'filename'
RBA MIN seqno . blockno
RBA MAX seqno . blockno;
比如說:
ALTER SYSTEM DUMP LOGFILE 'u01/oracle/V7323/dbs/arch1_76.dbf'
RBA MIN 2050 . 13255
RBA MAX 2255 . 15555;
根據時間點DUMP線上日誌記錄
可以透過時間範圍來DUMP在某段時間內產生的REDO 記錄,語法如下:
ALTER SYSTEM DUMP LOGFILE 'filename'
TIME MIN value
TIME MAX value;
比如:
ALTER SYSTEM DUMP LOGFILE
'u01/oracle/V7323/dbs/arch1_76.dbf'
TIME MIN 299425687
TIME MAX 299458800;
下面的指令碼可以在REDO DUMP TIME和DATE型別之間進行相互轉換:
REDO DUMP TIME轉 Date格式:
SET ECHO off
REM NAME: TFSTM2RD.SQL
REM USAGE:"@path/tfstm2rd"
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM None.
REM ------------------------------------------------------------------------
REM AUTHOR:
REM Anonymous
REM Copyright 1996, Orqacle Corporation
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Converts a standard date into redo dump time format.
REM ------------------------------------------------------------------------
REM EXAMPLE:
REM Enter day (DD/MM/YYYY) ? 08/07/1996
REM Enter time (HH24:MI:SS) ? 12:05:05
REM
REM REDO_YEAR REDO_MONTH REDO_DAY REDO_HOUR REDO_MIN REDO_SEC
REM --------- ---------- -------- --------- -------- --------
REM 1996 7 8 12 5 5
REM
REM EDO_TIME
REM ----------
REM 273845105
REM
REM ------------------------------------------------------------------------
REM DISCLAIMER:
REM This script. is provided for educational purposes only. It is NOT
REM supported by Oracle World Wide Technical Support.
REM The script. has been tested and appears to work as intended.
REM You should always run new scripts on a test instance initially.
REM ------------------------------------------------------------------------
REM Main text of script. follows:
undefine redo_day
undefine redo_hhmiss
accept redo_day prompt "Enter day (DD/MM/YYYY) ? "
accept redo_hhmiss prompt "Enter time (HH24:MI:SS) ? "
column redo_year new_value redo_year format 9999
column redo_month new_value redo_month format 9999
column redo_day new_value redo_day format 9999
column redo_hour new_value redo_hour format 9999
column redo_min new_value redo_min format 9999
column redo_sec new_value redo_sec format 9999
column redo_time new_value redo_time
set verify off
select
to_number(to_char(to_date('&redo_day &redo_hhmiss',
'DD/MM/YYYY HH24:MI:SS'),'YYYY')) redo_year,
to_number(to_char(to_date('&redo_day &redo_hhmiss',
'DD/MM/YYYY HH24:MI:SS'),'MM')) redo_month,
to_number(to_char(to_date('&redo_day &redo_hhmiss',
'DD/MM/YYYY HH24:MI:SS'),'DD')) redo_day,
to_number(to_char(to_date('&redo_day &redo_hhmiss',
'DD/MM/YYYY HH24:MI:SS'),'HH24')) redo_hour,
to_number(to_char(to_date('&redo_day &redo_hhmiss',
'DD/MM/YYYY HH24:MI:SS'),'MI')) redo_min,
to_number(to_char(to_date('&redo_day &redo_hhmiss',
'DD/MM/YYYY HH24:MI:SS'),'SS')) redo_sec
from dual;
select ( ( ( ( ( ( &redo_year - 1988 )
) * 12
+ ( &redo_month - 1 )
) * 31
+ ( &redo_day - 1 )
) * 24
+ ( &redo_hour )
) * 60
+ ( &redo_min )
) * 60
+ ( &redo_sec ) redo_time
from dual;
以下是使用該指令碼的例子:
Enter day (DD/MM/YYYY) ? 08/07/1996
Enter time (HH24:MI:SS) ? 12:05:05
REDO_YEAR REDO_MONTH REDO_DAY REDO_HOUR REDO_MIN REDO_SEC
--------- ---------- -------- --------- -------- --------
1996 7 8 12 5 5
REDO_TIME
----------
273845105
以下指令碼是將 REDO DUMP TIME轉為日期格式:
SET ECHO off
REM NAME: TFSRD2TM.SQL
REM USAGE:"@path/tfsrd2tm"
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM None.
REM ------------------------------------------------------------------------
REM AUTHOR:
REM Anonymous
REM Copyright 1996, Oracle Corporation
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Will convert redo dump time into a readable date.
REM
REM ------------------------------------------------------------------------
REM EXAMPLE:
REM Enter redo time ? 273845105
REM
REM REDO_YEAR REDO_MONTH REDO_DAY REDO_HOUR REDO_MIN REDO_SEC
REM --------- ---------- -------- --------- -------- --------
REM 1996 7 8 12 5 5
REM
REM ------------------------------------------------------------------------
REM DISCLAIMER:
REM This script. is provided for educational purposes only. It is NOT
REM supported by Oracle World Wide Technical Support.
REM The script. has been tested and appears to work as intended.
REM You should always run new scripts on a test instance initially.
REM ------------------------------------------------------------------------
REM Main text of script. follows:
undefine redo_time
accept redo_time prompt "Enter redo time ? "
column redo_year new_value redo_year format 9999
column redo_month new_value redo_month format 9999
column redo_day new_value redo_day format 9999
column redo_hour new_value redo_hour format 9999
column redo_min new_value redo_min format 9999
column redo_sec new_value redo_sec format 9999
set verify off
select
trunc(trunc(trunc(trunc(trunc(&redo_time/60)/60)/24)/31)/12)+1988
redo_year,
mod(trunc(trunc(trunc(trunc(&redo_time/60)/60)/24)/31),12)+1 redo_month,
mod(trunc(trunc(trunc(&redo_time/60)/60)/24),31)+1 redo_day,
mod(trunc(trunc(&redo_time/60)/60),24) redo_hour,
mod(trunc(&redo_time/60),60) redo_min,
mod(&redo_time,60) redo_sec
from dual;
執行的例子如下:
Enter redo time ? 273845105
REDO_YEAR REDO_MONTH REDO_DAY REDO_HOUR REDO_MIN REDO_SEC
--------- ---------- -------- --------- -------- --------
1996 7 8 12 5 5
.
根據層次(LAYER)和操作程式碼(OPCODE)DUMP記錄
根據LAYER和OPCODE可以DUMP某種型別的記錄。命令格式如下:
ALTER SYSTEM DUMP LOGFILE 'filename'
LAYER value
OPCODE value;
比如:
ALTER SYSTEM DUMP LOGFILE
'u01/oracle/V7323/dbs/arch1_76.dbf'
LAYER 11
OPCODE 3;
DUMP檔案頭的資訊
使用下列命令可以DUMP檔案頭的資訊:
alter session set events 'immediate trace name redohdr level 10';
DUMP整個RED LOG
使用下列命令可以匯出整個REDO LOG:
ALTER SYSTEM DUMP LOGFILE 'filename';
比如:
ALTER SYSTEM DUMP LOGFILE 'u01/oracle/V7323/dbs/arch1_76.dbf';
ALTER SYSTEM DUMP LOGFILE ‘檔名’命令即可以DUMP線上日誌檔案,也可以DUMP歸檔日誌檔案。
對於Oracle7或以前的資料庫,Oracle可以把歸檔日誌直接寫入磁帶。Oracle也支援從磁碟或者磁帶上讀取歸檔日誌,如果從磁碟上讀取歸檔日誌,檔名的格式是:
D:MINIDISK:DATASET
DataSet是檔名,比如:
ALTER SYSTEM DUMP LOGFILE
'D:GOLDDBA.230.230.READPASS.MULTPASS:L123.ORA';
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-586828/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【MySQL日誌】MySQL日誌檔案初級管理MySql
- java專案日誌配置檔案Java
- 日誌檔案過大清理
- sybase iq日誌檔案管理
- MySQL InnoDB日誌檔案配置MySql
- SpringBoot指定日誌檔案和日誌Profile功能Spring Boot
- Laravel 指定日誌檔案記錄任意日誌Laravel
- 探究MySQL中的日誌檔案MySql
- 日誌檔案使用小結(轉)
- mysql的日誌檔案詳解MySql
- lumen 日誌按天生成檔案
- tempdb日誌檔案暴增分析
- nginx日誌配置檔案說明Nginx
- linux 日誌log檔案 截斷Linux
- 操作日誌記錄(包括輸出至自定義日誌檔案)
- 在Linux中,有一堆日誌檔案,如何刪除7天前的日誌檔案?Linux
- Linux檔案系統與日誌分析Linux
- Java實時讀取日誌檔案Java
- 限制 Apache日誌檔案大小的方法Apache
- selenium-日誌檔案的使用(十二)
- zabbix agent 日誌檔案輪詢分析
- 12c日誌檔案路徑
- SQL語句收縮日誌檔案SQL
- linux檔案系統和日誌分析Linux
- Linux 日誌檔案系統如何工作Linux
- 三個例項演示 Java Thread Dump 日誌分析Javathread
- 【Oracle】歸檔日誌管理-設定歸檔日誌路徑以及歸檔日誌冗餘Oracle
- go開發屬於自己的日誌庫-檔案日誌庫實現Go
- SLF4J記錄日誌&&日誌檔案的滾動策略__SpringBootSpring Boot
- Linux下日誌檔案過大解決方案Linux
- MySQL技術內幕之“日誌檔案”MySql
- springboot使用logback記錄日誌,配置檔案Spring Boot
- Django實現web端tailf日誌檔案DjangoWebAI
- Linux--檔案系統與日誌分析Linux
- Android測試日誌檔案抓取與分析Android
- VSCode:更舒服地檢視日誌檔案VSCode
- Mysql慢查詢日誌檔案轉ExcelMySqlExcel
- 如何使用 logrotate 命令保持日誌檔案更新logrotate
- Laravel 日誌檔案許可權問題Laravel