这篇文章将为大家详细讲解有关神谕中转储日志文件方法有哪些,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
转储日志文件
有时工作需要可能需要转储重做日志文件,帮助解决问题。
这个命令需要改变系统系统权限。
数据库可以是在nomount,mount,open状态。
可以倾销在线重做日志,也可以倾销归档文件。
甚至可以倾销其他数据的文件,但是操作系统要一致。
dump的几种方法:
1.转储基于数据库管理员(数据块)的记录
地址)
2.基于角色访问权限转储记录(重做数据块
地址)
3.基于视交叉上核转储记录
4.根据时间转储记录
5.基于图层和转储记录
操作码
6.转储文件头信息
7.转储整个日志文件:
1.To dump records based in DBA (Data Block Address)
更改系统转储日志文件'文件名'
工商管理学博士(工商管理博士)
最小文件数。布洛克诺
数据库管理员最大文件数布洛克诺.
倾销出指定范围数据块的重做记录。
数据库版本:
SQL!sqlplus -V
SQL*Plus:版本11.2.0.1.0生产
SQL sho用户
用户是"明"
结构化查询语言设置第300行
a30的结构化查询语言列b
结构化查询语言选择
DBMS _ rowid。rowid _ relative _ fno(rowid)
文件id,
DBMS _ rowid。行id _ block _ number(行id)块id,行id,
测试。*来自
测试;
文件标识块标识行标识甲乙
- - -
- -
7 1683
一明
更新一行:
结构化查询语言更新测试集
b='明说明说'其中a=1;
更新了一行。
结构化查询语言选择
lg.group#,lg.sequence#,lg.bytes/1024/1024/1024 G,
lg.members,lgf.member,lg.archived,
lg。来自五美元日志水准仪的状态,v美元日志LG,其中
LG。group #=lgf。组#;
组#序列#组成员成员弧状态
- - -
------ ----------
------------------------- --- ---------
3 36 .048828125 1
/tpdata/oradata/ogg1/redo03.log NO CURRENT
2 35 .048828125 1
/tpdata/oradata/ogg1/redo02.log YES INACTIVE
1 34 .048828125 1 /tpdata/oradata/ogg1/redo01.log YES INACTIVE
SQL> alter system dump logfile
'/tpdata/oradata/ogg1/redo03.log' dba min 7 1683 dba
max 7 1683;
System altered.
SQL> select tracefile from v$process
where addr in (
select paddr from v$session where sid in (select sid from
v$mystat));
TRACEFILE
---------------------------------------------------------------------------------------------
/tpsys/app/oracle/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_2647.trc
[oracle@oggtest1 ~]$ more /tpsys/app/oracle/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_2647.trc
Trace file
/tpsys/app/oracle/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_2647.trc
Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining
and Real Application Testing options
ORACLE_HOME =
/tpsys/app/oracle/product/11.2.0/db_1
System name: Linux
Node name: oggtest1
Release: 2.6.32-358.el6.x86_64
Version: #1 SMP Tue Jan 29 11:47:41 EST 2013
Machine: x86_64
Instance name: ogg1
Redo thread mounted by this instance: 1
Oracle process number: 29
Unix process pid: 2647, image:
oracle@oggtest1 (TNS V1-V3)
*** 2018-05-31 23:35:34.677
*** SESSION ID:(38.36) 2018-05-31
23:35:34.677
*** CLIENT ID:() 2018-05-31 23:35:34.677
*** SERVICE NAME:(SYS$USERS) 2018-05-31
23:35:34.677
*** MODULE NAME:(sqlplus@oggtest1 (TNS
V1-V3)) 2018-05-31 23:35:34.677
*** ACTION NAME:() 2018-05-31
23:35:34.677
Log read is SYNCHRONOUS though
disk_asynch_io is enabled!
DUMP OF REDO FROM FILE
'/tpdata/oradata/ogg1/redo03.log'
Opcodes *.*
DBAs: (file # 7, block # 1683) thru (file #
7, block # 1683)
data块的起点和终点(thru),这里我只dump了1683号一个块。
RBAs: 0x000000.00000000.0000 thru
0xffffffff.ffffffff.ffff
SCNs: scn: 0x0000.00000000 thru scn:
0xffff.ffffffff
Times: creation thru eternity
FILE HEADER:
Compatibility Vsn = 186646528=0xb200000
Db ID=4132820558=0xf655d64e, Db Name='OGG1'
Activation ID=4132850254=0xf6564a4e
Control Seq=3130=0xc3a, File size=102400=0x19000
File Number=3, Blksiz=512, File Type=2 LOG
descrip:"Thread 0001, Seq# 0000000036,
SCN 0x000000158f45-0xffffffffffff"
thread: 1 nab: 0xffffffff seq: 0x00000024
hws: 0x1 eot: 1 dis: 0
resetlogs count: 0x38d85a12 scn:
0x0000.000e6c20 (945184)
prev resetlogs count: 0x296b946b scn: 0x0000.00000001
(1)
Low scn: 0x0000.00158f45 (1412933) 05/31/2018 23:05:04
Next scn: 0xffff.ffffffff 01/01/1988
00:00:00
Enabled scn: 0x0000.000e6c20 (945184)
09/03/2017 05:28:50
Thread closed scn: 0x0000.00158f45 (1412933)
05/31/2018 23:05:04
Disk cksum: 0x471d Calc cksum: 0x471d
Terminal recovery stop scn: 0x0000.00000000
Terminal recovery 01/01/1988 00:00:00
Most recent redo scn: 0x0000.00000000
Largest LWN: 0 blocks
End-of-redo stream : No
Unprotected mode
Miscellaneous flags: 0x800000
Thread internal enable indicator: thr: 0,
seq: 0 scn: 0x0000.00000000
REDO RECORD - Thread:1 RBA: 0x000024.00000ad6.0010 LEN: 0x01f4 VLD: 0x05
SQL>
SELECT TO_NUMBER('24','XXXXXXXXXXXXXXXX') FROM DUAL; TO_NUMBER('23','XXXXXXXXXXXXXXXX')---------------------------------- 36 SQL>
SELECT TO_NUMBER('00000ad6','XXXXXXXXXXXXXXXX') FROM DUAL; TO_NUMBER('1E3A','XXXXXXXXXXXXXXXX')------------------------------------ 277436号日志,redo块number是2774,就是我们dump的redo log
SCN: 0x0000.0015939d SUBSCN: 1 05/31/2018 23:33:53
CHANGE #1 TYP:0 CLS:17 AFN:3
DBA:0x00c00080 OBJ:4294967295 SCN:0x0000.0015932b
SEQ:1 OP:5.2 ENC:0 RBL:0
ktudh redo: slt: 0x000e sqn: 0x00000355
flg: 0x0012 siz: 160 fbi: 0
uba: 0x00c00211.010e.03 pxid: 0x0000.000.00000000
CHANGE #2 TYP:0 CLS:18 AFN:3
DBA:0x00c00211 OBJ:4294967295 SCN:0x0000.0015932a
SEQ:1 OP:5.1 ENC:0 RBL:0
ktudb redo: siz: 160 spc: 7794 flg:
0x0012 seq: 0x010e rec: 0x03
xid: 0x0001.00e.00000355
ktubl redo: slt: 14 rci: 0 opc: 11.1
[objn: 75382 objd: 75382 tsn: 8]
Undo type: Regular undo Begin trans Last buffer split: No
Temp Object: No
Tablespace Undo: No
0x00000000 prev ctl uba: 0x00c00211.010e.02
prev ctl max cmt scn: 0x0000.00158bd7 prev tx cmt scn: 0x0000.00158be6
txn start scn: 0xffff.ffffffff logon user: 95 prev brb: 12583426 prev bcl: 0 BuExt idx: 0
flg2: 0
KDO undo record:
KTB Redo
op: 0x03 ver: 0x01
compat bit: 4 (post-11) padding: 1
op: Z
KDO Op code: URP row dependencies
Disabled
##下面这部分是修改前的数据,上面和下面这一部分其实是undo的信息
xtype: XA flags:
0x00000000 bdba: 0x01c00693 hdba: 0x01c00692
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 0 ckix: 0
ncol: 2 nnew: 1 size: -12
col 1: [ 4] 6d 69 6e 67 ##4是长度,6d 69 6e
67是修改前的值
修改前的值:SQL> select
utl_raw.cast_to_varchar2(replace('6d,69,6e,67',',')) value from dual; VALUE------------------------------------------------------------------------------------------------------ming
CHANGE #3 TYP:0 CLS:1 AFN:7 DBA:0x01c00693 OBJ:75382 SCN:0x0000.0015673a SEQ:1 OP:11.5 ENC:0 RBL:0
SQL>
SELECT TO_NUMBER('01c00693','XXXXXXXXXXXXXXXX') FROM DUAL; TO_NUMBER('01C00693','XXXXXXXXXXXXXXXX')---------------------------------------- 29361811 SQL>
select2 dbms_utility.data_block_address_block(29361811) "BLOCK",3 dbms_utility.data_block_address_file(29361811) "FILE"4 from dual; BLOCK FILE---------- ---------- 1683 77号数据文件的1693块就是我dump的块。 75382就是我们操作的test表的object_id OP code是11.5,在DML的操作代码中,11.5代表update row piece
KTB Redo
op: 0x01 ver: 0x01
compat bit: 4 (post-11) padding: 1
op: F xid: 0x0001.00e.00000355 uba: 0x00c00211.010e.03
KDO Op code: URP row dependencies
Disabled
xtype: XA flags: 0x00000000 bdba: 0x01c00693 hdba: 0x01c00692
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 2
ckix: 0
ncol: 2 nnew: 1 size:
12
col 1: [16] 6d 69 6e 67 73 68 75 6f 6d 69 6e 67 73 68 75 6f
Bdba是更新的块的地址,所以跟DBA:0x01c00693一样也就是显而易见的了;Hdba是更新的块所在的段的地址。SQL> SELECT TO_NUMBER('01c00692','XXXXXXXXXXXXXXXX') FROM DUAL; TO_NUMBER('01C00692','XXXXXXXXXXXXXXXX')---------------------------------------- 29361810SQL> select 2 dbms_utility.data_block_address_block(29361810) "BLOCK", 3 dbms_utility.data_block_address_file(29361810) "FILE" 4 from dual; BLOCK FILE---------- ---------- 1682 7TEST表所在的段的信息:SQL> select
owner,segment_name,segment_type,header_file,header_block from
dba_segments where segment_name='TEST' and tablespace_name='TEST';OWNER SEGMENT_NAME SEGMENT_TYPE HEADER_FILE HEADER_BLOCK------- -------------- ------------ ----------- ------------MING TEST TABLE 7 1682两者是一致的 itli: 2 该事务正在使用第二个事务槽。tabn: 0 该块上第一个表。Flag是0x2c,代表没有出现行迁移,包括first data piece,last data piecehe head piece
of row.ncol: 2 该记录有2行nnew:1 修改了1列(b那一列)size: 12 修改列长度增加了12(从4变成16)修改后的值:SQL> select utl_raw.cast_to_varchar2(replace('6d,69,6e,67,73,68,75,6f,6d,69,6e,67,73,68,75,6f',','))
valuefrom dual; VALUE-----------------------------------------------------------------------------------------------------------------------------mingshuomingshuo
CHANGE #4 MEDIA RECOVERY MARKER
SCN:0x0000.00000000 SEQ:0 OP:5.20 ENC:0
session number = 1
serial number = 15
执行事务的会话信息:SQL>
SELECT SID,SERIAL# FROM V$SESSION WHERE SID=( select userenv('SID') FROM
DUAL); SID SERIAL#----------
---------- 1 15
transaction name =
version 186646784
audit sessionid 151083
Client Id =
END OF REDO DUMP
----- Redo read statistics for thread 1
-----
Read rate (SYNC): 1419Kb in 0.01s =>
138.57 Mb/sec
Total redo bytes: 2047Kb Longest record:
13Kb, moves: 1/2688 moved: 0Mb (0%)
Longest LWN: 504Kb, reads: 240
Last redo scn: 0x0000.001593c8 (1414088)
Change vector header moves = 261/4848
(5%)
----------------------------------------------
2. To dump records based on RBA (Redo Block Address)
ALTER SYSTEM DUMP LOGFILE 'filename'
RBA MIN seqno . blockno
RBA MAX seqno . blockno;
RBA实际就是块的变化在redo log中的记录位置。所以这里是dump出指定范围的redo块的redo记录。
3. To dump records based on SCN
ALTER SYSTEM DUMP LOGFILE 'filename'
SCN MIN minscn
SCN MAX maxscn;
Dump出指定范围SCN的redo记录
4. To dump records based on time
ALTER SYSTEM DUMP LOGFILE 'filename'
TIME MIN value
TIME MAX value;
这里的value实际是时间范围,确切说是redo dump time。
下面给出一个时间转变为redo dump time的脚本:
/* Formatted on2011/8/8 23:00:53 (QP5 SET ECHO OFF REM NAME: TFSTM2RD.SQL REMUSAGE:"@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 timeformat. 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_HOURREDO_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 purposesonly. It is NOT REM supported by Oracle World Wide TechnicalSupport. REM The script. has been tested and appears towork as intended. REM You should always run new scripts on a testinstance initially. REM------------------------------------------------------------------------ REM Main text ofscript. follows:
UNDEFINE redo_day UNDEFINE redo_hhmiss
ACCEPT redo_day PROMPT "Enter day ACCEPT redo_hhmiss PROMPT "Enter time
COLUMN redo_year NEW_VALUE redo_year COLUMN redo_month NEW_VALUE redo_month COLUMN redo_day NEW_VALUE redo_day FORMAT9999 COLUMN redo_hour NEW_VALUE redo_hour COLUMN redo_min NEW_VALUE redo_min FORMAT9999 COLUMN redo_sec NEW_VALUE redo_sec FORMAT9999 COLUMN redo_time NEW_VALUE redo_time
SETVERIFY OFF
SELECT TO_NUMBER ( TO_CHAR ( TO_DATE 'YYYY')) redo_year, TO_NUMBER ( TO_CHAR ( TO_DATE 'MM')) redo_month, TO_NUMBER ( TO_CHAR ( TO_DATE 'DD')) redo_day, TO_NUMBER ( TO_CHAR ( TO_DATE 'HH24')) redo_hour, TO_NUMBER ( TO_CHAR ( TO_DATE 'MI')) redo_min, TO_NUMBER ( TO_CHAR ( TO_DATE 'SS')) redo_sec FROM DUAL;
SELECT ( ( ( ( ( (&redo_year - 1988)) + (&redo_day - 1)) * 24 + (&redo_hour)) * 60 + (&redo_min)) * 60 + (&redo_sec) redo_time FROM |
5. To dump records based on layer and opcode
ALTER SYSTEM DUMP LOGFILE 'filename'
LAYER value
OPCODE value;
Layer和opcode是用来dump出特定类型的redo记录的。
6. Dump the file header information
Dump出所有在线日志的header信息:
alter session set events 'immediate trace name redohdr level 10';
dump出归档日志的header信息:
ALTER SYSTEM DUMP LOGFILE 'filename' RBA MIN 1 1 RBA MAX 1 1;
在线日志:
SQL> alter session set events Session altered.
[oracle@oggtest1 trace]$ more Trace file Oracle Database 11g Enterprise Edition With the Partitioning, OLAP, Data Mining ORACLE_HOME = System name: Linux Node name: oggtest1 Release: 2.6.32-358.el6.x86_64 Version: #1 SMP Tue Jan 29 11:47:41 EST 2013 Machine: x86_64 Instance name: ogg1 Redo thread mounted by this instance: 1 Oracle process number: 29 Unix process pid: 3048, image:
*** 2018-06-01 01:31:40.458 *** SESSION ID:(38.38) 2018-06-01 *** CLIENT ID:() 2018-06-01 01:31:40.458 *** SERVICE NAME:(SYS$USERS) 2018-06-01 *** MODULE NAME:(sqlplus@oggtest1 (TNS *** ACTION NAME:() 2018-06-01
DUMP OF LOG FILES: 3 logs in database LOG FILE #1: name #3: /tpdata/oradata/ogg1/redo01.log Thread 1 redo log links: forward: 2 siz: 0x19000 seq: 0x00000022 hws: 0x3 bsz: Archive links: fwrd: 0 back: 0 Prev scn: Low scn: 0x0000.00151fff 05/30/2018 21:31:05 Next scn: 0x0000.00154ded 05/30/2018 22:54:33 FILE HEADER: Compatibility Vsn = 186646528=0xb200000 Db ID=4132820558=0xf655d64e, Db Name='OGG1' Activation ID=4132850254=0xf6564a4e Control Seq=3105=0xc21, File size=102400=0x19000 File Number=1, Blksiz=512, File Type=2 LOG redo log key is redo log key flag is 5 descrip:"Thread 0001, Seq# 0000000034, thread: 1 nab: 0x12c7e seq: 0x00000022 hws: reset logs count: 0x38d85a12 scn: Low scn: 0x0000.00151fff 05/30/2018 21:31:05 Next scn: 0x0000.00154ded 05/30/2018 Enabled scn: 0x0000.000e6c20 09/03/2017 Thread closed scn: 0x0000.00151fff Disk cksum: 0xdeda Calc cksum: 0xdeda Terminal Terminal Recovery Stamp 01/01/1988 00:00:00 Most recent redo scn: 0x0000.00000000 Largest LWN: 2048 blocks Miscellaneous flags: 0x800000 Thread internal enable indicator: thr: 0, LOG FILE #2: name #2: /tpdata/oradata/ogg1/redo02.log Thread 1 redo log links: forward: 3 siz: 0x19000 seq: 0x00000023 hws: 0x5 bsz: Archive links: fwrd: 0 back: 0 Prev scn: Low scn: 0x0000.00154ded 05/30/2018 22:54:33 Next scn: 0x0000.00158f45 05/31/2018 FILE HEADER: Compatibility Vsn = 186646528=0xb200000 Db ID=4132820558=0xf655d64e, Db Name='OGG1' Activation ID=4132850254=0xf6564a4e Control Seq=3130=0xc3a, File size=102400=0x19000 File Number=2, Blksiz=512, File Type=2 LOG redo log key is redo log key flag is 5 descrip:"Thread 0001, Seq# 0000000035, thread: 1 nab: 0x13ea0 seq: 0x00000023 hws: reset logs count: 0x38d85a12 scn: Low scn: 0x0000.00154ded 05/30/2018 22:54:33 Next scn: 0x0000.00158f45 05/31/2018 Enabled scn: 0x0000.000e6c20 09/03/2017 Thread closed scn: 0x0000.0015680b Disk cksum: 0xb8e7 Calc cksum: 0xb8e7 Terminal Recovery Stop scn: 0x0000.00000000 Terminal Recovery Stamp 01/01/1988 00:00:00 Most recent redo scn: 0x0000.00000000 Largest LWN: 2048 blocks Miscellaneous flags: 0x800000 Thread internal enable indicator: thr: 0, LOG FILE #3: name #1: /tpdata/oradata/ogg1/redo03.log Thread 1 redo log links: forward: 0 siz: 0x19000 seq: 0x00000024 hws: 0x1 bsz: Archive links: fwrd: 0 back: 0 Prev scn: Low scn: 0x0000.00158f45 05/31/2018 23:05:04 Next scn: 0xffff.ffffffff 01/01/1988 FILE HEADER: Compatibility Vsn = 186646528=0xb200000 Db ID=4132820558=0xf655d64e, Db Name='OGG1' Activation ID=4132850254=0xf6564a4e Control Seq=3130=0xc3a, File size=102400=0x19000 File Number=3, Blksiz=512, File Type=2 LOG redo log key is redo log key flag is 5 descrip:"Thread 0001, Seq# 0000000036, thread: 1 nab: 0xffffffff seq: 0x00000024 reset logs count: 0x38d85a12 scn: Low scn: 0x0000.00158f45 05/31/2018 23:05:04 Next scn: 0xffff.ffffffff 01/01/1988 Enabled scn: 0x0000.000e6c20 09/03/2017 Thread closed scn: 0x0000.00158f45 Disk cksum: 0x471d Calc cksum: 0x471d Terminal Recovery Stop scn: 0x0000.00000000 Terminal Recovery Stamp 01/01/1988 00:00:00 Most recent redo scn: 0x0000.00000000 Largest LWN: 0 blocks Miscellaneous flags: 0x800000 Thread internal enable indicator: thr: 0, |
7. Dump an entire log file:
ALTER SYSTEM DUMP LOGFILE 'filename';
Dump出指定日志的所有内容。
关于“oracle中dump logfile方法有哪些”这篇文章就分享到这里了,希望
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/81851.html