Oracle Dump Redo Log File 说明

2024-04-04 02:38
文章标签 oracle 说明 file log dump redo

本文主要是介绍Oracle Dump Redo Log File 说明,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 

一. dump redo 说明

            关于Dump redo log 的示例,MOS 上的文档:[ID 1031381.6] 有详细说明。Dump 有两种方式:

            (1)使用'alter session' 命令dumpredo header。

            (2)使用'alter system dump logfile' 命令dump logfile contents。

 

            可以在mount,nomout和open状态下使用如上命令,并且使用以上命令需要'alter system' 的权限。 可以使用该命令dump onlie redo log 或者归档文件。 当操作系统系统相同的情况下,还可以dump其他db的log 文件。

 

有如下dump 方法:

            1.To dump records based in DBA (Data Block Address)

            2.To dump records based on RBA (Redo Block Address)

            3.To dump records based on SCN

            4.To dump records based on time

            5.To dump records based on layer and opcode

            6.Dump the file header information

            7.Dump an entire log file:

 

 

二. 具体使用示例

2.1  To dump records based on DBA  (Data Block Address)

关于DBA的说明,参考:

            Oracle rdba和 dba 说明

            http://blog.csdn.net/tianlesoftware/article/details/6529346

 

            根据DBA进行dump,主要是根据file和block 号来进行dump。 这个的block 是一个范围值。

 

11g命令格式如下:

ALTER SYSTEM DUMP LOGFILE 'filename'  DBA MIN fileno . blockno    DBA MAX fileno . blockno;

 

如果是Oracle 10g,需要省略'.',即格式如下:

ALTER SYSTEM DUMP LOGFILE 'filename'  DBA MIN fileno  blockno    DBA MAX fileno  blockno;

 

否则会报:  ORA-01963: Must specify a block number 错误。

 

 

如:

SYS@anqing1(rac1)> select * fromv$version where rownum=1;   

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - Prod

 

SQL>select distinct dbms_rowid.rowid_relative_fno(rowid) rel_fno,

dbms_rowid.rowid_block_number(rowid)blockno from ta;

 

  REL_FNO    BLOCKNO

---------- ----------

        1     294608

        1     294609

        1     294612

        1     294614

        1     294621

        1     294635

        1     294643

        1     294654

        1     294656

        1     294657

        6      10385

 

  REL_FNO    BLOCKNO

---------- ----------

        6      10393

        6      10410

         6     10411

        6      10415

        6      10416

        6      10458

        6      10461

        6      10464

        6      10465

        6      10468

        6      10472

 

确定log file 位置:

SYS@anqing1(rac1)> selecta.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

 

   GROUP# STATUS           MEMBER

---------- --------------------------------------------------------------------

        3 INACTIVE         +DATA/anqing/onlinelog/redo03.log

        2 INACTIVE        +DATA/anqing/onlinelog/redo02.log

        1 CURRENT         +DATA/anqing/onlinelog/group_1.277.751552735

        1 CURRENT         +FRA/anqing/onlinelog/group_1.426.751552739

        4 CURRENT         +DATA/anqing/onlinelog/group_4.282.751560131

        5 INACTIVE        +DATA/anqing/onlinelog/group_5.283.751560139

 

6 rows selected.

 

SYS@anqing1(rac1)> alter system dump logfile'+data/anqing/onlinelog/redo02.log'  dbamin 6  10458    dba max 6 10472;

System altered.

 

SYS@anqing1(rac1)> oradebug setmypid

Statement processed.

SYS@anqing1(rac1)> oradebug tracefile_name

/u01/app/oracle/admin/anqing/udump/anqing1_ora_30373.trc

SYS@anqing1(rac1)>

 

[oracle@rac1 ~]$cat /u01/app/oracle/admin/anqing/udump/anqing1_ora_30373.trc

/u01/app/oracle/admin/anqing/udump/anqing1_ora_30373.trc

Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - Production

With the Partitioning, Real ApplicationClusters, OLAP, Data Mining

and Real Application Testing options

ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1

System name:    Linux

Node name:      rac1

Release:        2.6.18-194.el5

Version:        #1 SMP Tue Mar 16 21:52:43 EDT 2010

Machine:        i686

Instance name: anqing1

Redo thread mounted by this instance: 1

Oracle process number: 28

Unix process pid: 30373, image: oracle@rac1(TNS V1-V3)

 

*** 2011-08-08 22:10:37.053

*** ACTION NAME:() 2011-08-08 22:10:37.052

*** MODULE NAME:(sqlplus@rac1 (TNS V1-V3))2011-08-08 22:10:37.052

*** SERVICE NAME:(SYS$USERS) 2011-08-0822:10:37.052

*** SESSION ID:(127.27077) 2011-08-0822:10:37.052

 

DUMP OF REDO FROM FILE'+data/anqing/onlinelog/redo02.log'

 Opcodes *.*

 DBAs: (file # 6, block # 10458) thru (file #6, block # 10472)

 RBAs: 0x000000.00000000.0000 thru0xffffffff.ffffffff.ffff

 SCNs: scn: 0x0000.00000000 thru scn:0xffff.ffffffff

 Times: creation thru eternity

 FILEHEADER:

       Compatibility Vsn = 169870336=0xa200400

       Db ID=715014091=0x2a9e3fcb, Db Name='ANQING'

       Activation ID=682502900=0x28ae2af4

       Control Seq=4261=0x10a5, File size=102400=0x19000

       File Number=2, Blksiz=512, File Type=2 LOG

 descrip:"Thread0001, Seq# 0000000119, SCN 0x0000006ab1bc-0x0000006e0c84"

 thread: 1 nab: 0x18ffd seq: 0x00000077 hws:0x2 eot: 0 dis: 0

 resetlogs count: 0x2ccbc8df scn:0x0000.000704fa (460026)

 resetlogs terminal rcv count: 0x0 scn:0x0000.00000000

 prevresetlogs count: 0x2ebbfe8f scn: 0x0000.0006ce7b (446075)

 prevresetlogs terminal rcv count: 0x0 scn: 0x0000.00000000

 Low scn: 0x0000.006ab1bc (6992316) 07/30/2011 05:39:17

 Nextscn: 0x0000.006e0c84 (7212164) 08/03/2011 14:14:34

 Enabled scn: 0x0000.000704fa (460026)05/19/2011 12:38:55

 Thread closed scn: 0x0000.006ab1bc (6992316)07/30/2011 05:39:17

 Diskcksum: 0xd530 Calc cksum: 0xd530

 Terminal recovery stop scn: 0x0000.00000000

 Terminal recovery  01/01/1988 00:00:00

 Mostrecent redo scn: 0x0000.00000000

 Largest LWN: 1874 blocks

 End-of-redo stream : No

 Unprotected mode

 Miscellaneous flags: 0x0

 Thread internal enable indicator: thr: 0, seq:0 scn: 0x0000.00000000

 

REDO RECORD - Thread:1 RBA:0x000077.00000cd6.017c LEN: 0x0048 VLD: 0x01

SCN: 0x0000.006ac8a9 SUBSCN:  1 07/30/2011 08:28:08

CHANGE #1 MEDIA RECOVERY MARKERSCN:0x0000.00000000 SEQ:  0 OP:18.3

Reuse redo entry

Range reuse: tsn=1 base=8542185 nblks=8

 

REDO RECORD - Thread:1 RBA:0x000077.00006e99.0078 LEN: 0x0044 VLD: 0x01

SCN: 0x0000.006b7ae1 SUBSCN:  1 07/31/2011 06:18:10

CHANGE #1 MEDIA RECOVERY MARKERSCN:0x0000.00000000 SEQ:  0 OP:17.4

Datafile resize marker - file: 2 old size:153600 new size: 156160

 

REDO RECORD - Thread:1 RBA:0x000077.00007884.017c LEN: 0x0048 VLD: 0x01

SCN: 0x0000.006b8d16 SUBSCN:  1 07/31/2011 08:33:09

CHANGE #1 MEDIA RECOVERY MARKERSCN:0x0000.00000000 SEQ:  0 OP:18.3

Reuse redo entry

Range reuse: tsn=1 base=8542217 nblks=1024

*** 2011-08-08 22:10:54.783

END OF REDO DUMP

----- Redo read statistics for thread 1-----

Read rate (ASYNC): 51197Kb in 17.78s =>2.81 Mb/sec

Total physical reads: 51197Kb

Longest record: 8Kb, moves: 0/85186 (0%)

Change moves: 30223/143291 (21%), moved:5Mb

Longest LWN: 937Kb, moves: 6/66426 (0%),moved: 0Mb

Last redo scn: 0x0000.006e087b (7211131)

----------------------------------------------

[oracle@rac1 ~]$

 

 

2.2. To dumprecords based on RBA (Redo Block Address)

            在第一节里是根据日志的block number进行dump的,也可以根据日志的sequence#进行dump。

 

格式如下:

ALTER SYSTEM DUMP LOGFILE 'filename' RBA MIN seqno .blockno RBA MAX seqno . blockno;

 

SYS@anqing1(rac1)> alter system dump logfile'+data/anqing/onlinelog/redo02.log'  rbamin 121 10458  rba max 125 10472;

System altered.

 

其他信息的查看参考第一节。

 

2.3. To dumprecords based on SCN

            可以直接根据SCN 的值来dump redo log。

 

格式如下:

ALTER SYSTEM DUMP LOGFILE 'filename' SCN MIN minscn SCNMAX maxscn;

 

SYS@anqing1(rac1)> select current_scn from v$database;

CURRENT_SCN

-----------

    7479813

 

SYS@anqing1(rac1)> alter system dump logfile'+data/anqing/onlinelog/redo02.log' scn min 7479801 scn max 7479813;

System altered.

 

也可以使用该命令来检查dumpfile,如:

SQL> ALTER SYSTEM DUMP LOGFILE 'filename' SCN MIN 1SCN MAX 1;

如果以上语句成功执行,则archivelog 没有问题。

 

2.4. To dumprecords based on time.

            根据时间来dump。

 

格式如下:

ALTER SYSTEM DUMP LOGFILE 'filename' TIME MIN value TIMEMAX value;

 

如:

ALTER SYSTEM DUMP LOGFILE '+data/anqing/onlinelog/redo02.log'         TIME MIN 299425687 TIMEMAX 299458800;

 

            注意这里的时间是用redo dump time。 关于redo time 和date 的转换,网上有个脚本。 据说这个脚本出自metalink,但是我在MOS 上搜了一下,没有看到这个脚本的内容。

 

脚本1: date to redodump time

/* Formatted on2011/8/8 23:00:53 (QP5 v5.163.1008.3004) */

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 (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 FORMAT9999

COLUMN redo_hour NEW_VALUE redo_hour FORMAT 9999

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 ('&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;

 

脚本2: redo dump time todate

/* Formatted on2011/8/8 23:02:31 (QP5 v5.163.1008.3004) */

SET ECHO OFF

REM NAME:   TFSRD2TM.SQL

REMUSAGE:"@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 readabledate.

REM

REM------------------------------------------------------------------------

REM EXAMPLE:

REM   Enter redo time ? 273845105

REM

REM   REDO_YEAR REDO_MONTH REDO_DAY REDO_HOURREDO_MIN REDO_SEC

REM   --------- ---------- -------- ----------------- --------

REM        1996         7      8       12       5  5

REM

REM------------------------------------------------------------------------

REM DISCLAIMER:

REM   This script. is provided for educationalpurposes only. 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_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 FORMAT9999

COLUMN redo_hour NEW_VALUE redo_hour FORMAT 9999

COLUMN redo_min  NEW_VALUE redo_min FORMAT9999

COLUMN redo_sec  NEW_VALUE redo_sec FORMAT9999

 

SETVERIFY 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;

 

 

2.5. To dumprecords based on layer and opcode.

            LAYER and OPCODE are used to dump alllog records for a particular type of redo record, such as all dropped row pieces.

格式如下:

ALTER SYSTEM DUMP LOGFILE 'filename' LAYER value OPCODEvalue;

 

示例: 

            SQL>ALTERSYSTEM DUMP LOGFILE '+data/anqing/onlinelog/redo02.log'         LAYER 11 OPCODE 3;

 

 

2.6. Dump the file header information:

如果是dump onlineredo log 的header 信息,命令如下:

   SQL>altersession set events 'immediate trace name redohdr level 10';

 

如果是dump 归档文件的header 信息,命令如下:

   SQL>ALTERSYSTEM DUMP LOGFILE 'filename' RBA MIN 1 1 RBA MAX 1 1;

 

2.7. Dump anentire log file:

Dump 整个log 文件,命令如下:

SQL>ALTER SYSTEM DUMP LOGFILE 'filename';

 

示例:

SQL>ALTER SYSTEM DUMP LOGFILE ' +data/anqing/onlinelog/redo02.log';

 

 

 

 

-------------------------------------------------------------------------------------------------------

QQ:492913789

Email:ahdba@qq.com

Blog:  http://www.cndba.cn/dave

Weibo:   http://weibo.com/tianlesoftware

Twitter:  http://twitter.com/tianlesoftware

Facebook: http://www.facebook.com/tianlesoftware

Linkedin: http://cn.linkedin.com/in/tianlesoftware

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群: 83829929(满) DBA5群: 142216823(满) 

DBA6 群:158654907(满)  聊天 群:40132017(满)   聊天2群:69087192(满)

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

这篇关于Oracle Dump Redo Log File 说明的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/874604

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

内核启动时减少log的方式

内核引导选项 内核引导选项大体上可以分为两类:一类与设备无关、另一类与设备有关。与设备有关的引导选项多如牛毛,需要你自己阅读内核中的相应驱动程序源码以获取其能够接受的引导选项。比如,如果你想知道可以向 AHA1542 SCSI 驱动程序传递哪些引导选项,那么就查看 drivers/scsi/aha1542.c 文件,一般在前面 100 行注释里就可以找到所接受的引导选项说明。大多数选项是通过"_

git使用的说明总结

Git使用说明 下载安装(下载地址) macOS: Git - Downloading macOS Windows: Git - Downloading Windows Linux/Unix: Git (git-scm.com) 创建新仓库 本地创建新仓库:创建新文件夹,进入文件夹目录,执行指令 git init ,用以创建新的git 克隆仓库 执行指令用以创建一个本地仓库的

log4j2相关配置说明以及${sys:catalina.home}应用

${sys:catalina.home} 等价于 System.getProperty("catalina.home") 就是Tomcat的根目录:  C:\apache-tomcat-7.0.77 <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" /> 2017-08-10

android应用中res目录说明

Android应用的res目录是一个特殊的项目,该项目里存放了Android应用所用的全部资源,包括图片、字符串、颜色、尺寸、样式等,类似于web开发中的public目录,js、css、image、style。。。。 Android按照约定,将不同的资源放在不同的文件夹中,这样可以方便的让AAPT(即Android Asset Packaging Tool , 在SDK的build-tools目

Oracle type (自定义类型的使用)

oracle - type   type定义: oracle中自定义数据类型 oracle中有基本的数据类型,如number,varchar2,date,numeric,float....但有时候我们需要特殊的格式, 如将name定义为(firstname,lastname)的形式,我们想把这个作为一个表的一列看待,这时候就要我们自己定义一个数据类型 格式 :create or repla

ORACLE 11g 创建数据库时 Enterprise Manager配置失败的解决办法 无法打开OEM的解决办法

在win7 64位系统下安装oracle11g,在使用Database configuration Assistant创建数据库时,在创建到85%的时候报错,错误如下: 解决办法: 在listener.ora中增加对BlueAeri-PC或ip地址的侦听,具体步骤如下: 1.启动Net Manager,在“监听程序”--Listener下添加一个地址,主机名写计

Oracle Start With关键字

Oracle Start With关键字 前言 旨在记录一些Oracle使用中遇到的各种各样的问题. 同时希望能帮到和我遇到同样问题的人. Start With (树查询) 问题描述: 在数据库中, 有一种比较常见得 设计模式, 层级结构 设计模式, 具体到 Oracle table中, 字段特点如下: ID, DSC, PID; 三个字段, 分别表示 当前标识的 ID(主键), DSC 当

oracle分页和mysql分页

mysql 分页 --查前5 数据select * from table_name limit 0,5 select * from table_name limit 5 --limit关键字的用法:LIMIT [offset,] rows--offset指定要返回的第一行的偏移量,rows第二个指定返回行的最大数目。初始行的偏移量是0(不是1)。   oracle 分页 --查前1-9

Adblock Plus官方规则Easylist China说明与反馈贴(2015.12.15)

-------------------------------特别说明--------------------------------------- 视频广告问题:因Adblock Plus的局限,存在以下现象,优酷、搜狐、17173黑屏并倒数;乐视、爱奇艺播放广告。因为这些视频网站的Flash播放器被植入了检测代码,而Adblock Plus无法修改播放器。 如需同时使用ads