Chinaunix首页 | 论坛 | 博客
  • 博客访问: 518654
  • 博文数量: 101
  • 博客积分: 1635
  • 博客等级: 上尉
  • 技术积分: 1282
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-05 01:51
文章分类

全部博文(101)

文章存档

2019年(2)

2018年(16)

2013年(14)

2012年(69)

我的朋友

分类: Oracle

2018-10-18 11:21:01

oradebug setmypid
ALTER SESSION SET EVENTS 'immediate trace name controlf level 3';
oradebug close_trace
ordebug tracefile_name




***************************************************************************
DATABASE ENTRY
***************************************************************************
 (size = 316, compat size = 316, section max = 1, section in-use = 1,
  last-recid= 0, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 1, numrecs = 1)
 07/23/2015 15:43:08
 DB Name "ORACLEOG"
 Database flags = 0x00404000 0x00001000
 Controlfile Creation Timestamp  07/23/2015 15:43:09
 Incmplt recovery scn: 0x0000.00000000
 Resetlogs scn: 0x0000.00000001 Resetlogs Timestamp  07/23/2015 15:43:08
 Prior resetlogs scn: 0x0000.00000000 Prior resetlogs Timestamp  01/01/1988 00:00:00
 Redo Version: compatible=0xb200400
 #Data files = 4, #Online files = 4
 Database checkpoint: Thread=1 scn: 0x0000.0016d38b
 Threads: #Enabled=1, #Open=0, Head=0, Tail=0
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
 Max log members = 3, Max data members = 1
 Arch list: Head=0, Tail=0, Force scn: 0x0000.0015aee3scn: 0x0000.00000000
 Activation ID: 2293285836
 SCN compatibility 1
 Auto-rollover enabled
 Controlfile Checkpointed at scn:  0x0000.0016d073 09/06/2015 14:44:08
size =316 ---表示一个database entry record 记录是316 byte大小
compat size---这两部分表示database entry所占用的空间大小,单位是byte。
section max--表示该部分内容最大可用的section个数。
section in-use---表示目前正在被使用的section数目。
extent =1--表示该section片断占据的extent个数。
blkno =1---表示该section片断占据的 block个数。
numrecs=1---表示该section片断占据的record记录数目


Resetlogs scn: 0x0000.00000001 --表示resetlogs scn值,转换后即为下面的timestamp值
Resetlogs Timestamp  07/23/2015 15:43:08
Prior resetlogs scn: 0x0000.00000000 --这表示上次resetlogs时的scn值,转换后即为下面的timestamp值。
Prior resetlogs Timestamp  01/01/1988 00:00:00
Redo Version: compatible=0xb200400 --数据库版本转换为11204
Database checkpoint: Thread=1 scn: 0x0000.0016d38b --表示数据库 Thread checkpoint scn值。
Force scn: 0x0000.0015aee3scn: 0x0000.00000000 表示force scn,在数据库或文件进行恢复时,会更新force scn.
 Controlfile Checkpointed at scn:  0x0000.0016d073 09/06/2015 14:44:08
 --表示控制文件检查点scn,不过这不是最新的值,该值是比较旧的。当手工切换时或者手工触发检查点,该值会更新。
 
 ***************************************************************************
CHECKPOINT PROGRESS RECORDS
***************************************************************************
 (size = 8180, compat size = 8180, section max = 11, section in-use = 0,
  last-recid= 0, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 2, numrecs = 11)
THREAD #1 - status:0x1 flags:0x0 dirty:0
low cache rba:(0xffffffff.ffffffff.ffff) on disk rba:(0x60.514.0)
on disk scn: 0x0000.0016d278 09/06/2015 14:50:03
resetlogs scn: 0x0000.00000001 07/23/2015 15:43:08
heartbeat: 889679177 mount id: 2297212409
THREAD #2 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
THREAD #3 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
THREAD #4 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
THREAD #5 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
THREAD #6 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
THREAD #7 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
THREAD #8 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0




 status:0x1---表示该redolog状态(01表示active,2 current 0 inactive)
 dirty:0 ---表示redo log所记录的脏块数目,不过是data block.
low cache rba:(0xffffffff.ffffffff.ffff)---表示low rba值,该值是实例恢复的起点。
on disk rba:(0x60.514.0)--表示 on disk rba值,即实例恢复时,必须要恢复到的一个值。
on disk scn: 0x0000.0016d278 09/06/2015 14:50:03--表示on disk rba处的scn值
resetlogs scn: 0x0000.00000001 07/23/2015 15:43:08--表示上次数据库resetlogs打开时的scn值。
heartbeat: 889679177 --这里是一个心跳值,每秒钟都会变化一次,通过该机制来判断disk的状态。
mount id: 2297212409--表示磁盘加载时的一个标示,该值没有太大的实际意义。
检查点结构中,我们重点关注是: low cache rba ,on disk rba ,on disk scn.


REDO THREAD RECORDS
***************************************************************************
 (size = 256, compat size = 256, section max = 8, section in-use = 1,
  last-recid= 0, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 9, numrecs = 8)
THREAD #1 - status:0xf thread links forward:0 back:0
 #logs:3 first:1 last:3 current:2 last used seq#:0xb3
 enabled at scn: 0x0000.000e2006 09/14/2018 11:30:48
 disabled at scn: 0x0000.00000000 01/01/1988 00:00:00
 opened at 09/14/2018 11:31:55 by instance orcl
Checkpointed at scn:  0x0000.004c7c6d 10/15/2018 08:20:22
 thread:1 rba:(0xb3.2.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
 log history: 178
 restore point keep sequence: 0




SQL> select * from v$log;


    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
         1          1        178   52428800        512          1 NO  INACTIVE               5004799 15-OCT-18      5012589 15-OCT-18
         2          1        179   52428800        512          1 NO  CURRENT                5012589 15-OCT-18   2.8147E+14
         3          1        177   52428800        512          1 NO  INACTIVE               4971240 15-OCT-18      5004799 15-OCT-18


其中
rba: redo block address
 thread:1 rba:(0xb3.2.10) --b3转成十进制179 








LOG FILE #1: 
  name #1: /home/oracle/app/oradata/oracleogg/redo01.log
 Thread 1 redo log links: forward: 2 ---下一组将被写入的redolog 是第二组 backward: 0
 siz: 0x19000--redo logfile大小 seq: 0x0000005e --当前的sequence号 hws: 0x3 bsz: 512--block size大小 nab: 0x161fc flg: 0x0 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.0015aee3--表示上组redo log写入时的起始scn值。
 Low scn: 0x0000.00161276 08/29/2015 10:07:26--表示该redo log写入时的起始scn值。
 Next scn: 0xffff.ffffffff 01/01/1988 00:00:00--表示该redo log下一个scn值为无穷大,因为oracle不知道什么时候停止,
 所以会将该值设置为无穷大,同时也说明该redo是current redo.
 
 data file records section解析
***************************************************************************
DATA FILE RECORDS
***************************************************************************
 (size = 520, compat size = 520, section max = 100, section in-use = 4,
  last-recid= 66, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 11, numrecs = 100)
DATA FILE #1: 
  name #7: /u01/app/oracle/oradata/orcl/system01.dbf
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
 tablespace 0, index=1 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:264 scn: 0x0000.004c7c6d 10/15/2018 08:20:22
 Stop scn: 0xffff.ffffffff 09/14/2018 11:31:46
 Creation Checkpointed at scn:  0x0000.00000007 08/24/2013 11:37:33
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
 Offline scn: 0x0000.000e2005 prev_range: 0
 Online Checkpointed at scn:  0x0000.000e2006 09/14/2018 11:30:48
 thread:1 rba:(0x1.2.0)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000
 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED 
 Plugged readony: NO
 Plugin scnscn: 0x0000.00000000
 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Online move state: 0
对关键的地方分析:
 tablespace 0  ---表示对应的v$tablespace.ts#号是0
 index=1 krfil=1  --表示对应的数据文件号和相对文件号编号均为1.
 Checkpoint cnt:264  --表示检查点计数,在数据库open时用于判断datafile是否过旧。
 scn: 0x0000.004c7c6d 10/15/2018 08:20:22  表示datafile checkpoin scn的值
 Stop scn: 0xffff.ffffffff 09/14/2018 11:31:46 表示数据文件的stop scn,值设置成无穷大,说明数据库处于打开状态(非正常关闭的时候也是最大值)。
 Creation Checkpointed at scn:  0x0000.00000007 08/24/2013 11:37:33 --表示该创建datafile的scn值。
 Offline scn: 0x0000.000e2005 --数据文件offline时的scn值(每次数据库关闭,都会更新该值)。
 Online Checkpointed at scn:  0x0000.000e2006  --数据文件online时的checkppin scn的值(每次数据库open的时候,更新该值) 
 thread:1 rba:(0x1.2.0)  --线程rba的信息。
++++++++++++++TEMP FILE RECORDS 解析++++++++++
***************************************************************************
 (size = 56, compat size = 56, section max = 100, section in-use = 1,
  last-recid= 35, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 90, numrecs = 100)
TEMP FILE #1: External File #201  --可以看到对于tempfile,其文件号对应的是201
  name #8: /u01/app/oracle/oradata/orcl/temp01.dbf              ---tempfile文件名
creation size=2560 block size=8192 status=0x1e head=8 tail=8 dup=1 ---这里分别表示其大小和block size以及状态。
 tablespace 3, index=5 krfil=1 prev_file=0   ---表示其文件号是 5,在temp表空间里面对应的是1.
 unrecoverable scn: 0x0000.000e205e 09/14/2018 11:30:50


***************************************************************************
RMAN CONFIGURATION RECORDS
***************************************************************************
 (size = 1108, compat size = 1108, section max = 50, section in-use = 0,
  last-recid= 0, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 91, numrecs = 50)


对于rman,我们可以使用controlfile来当catalog库(默认是这样),对于多个数据库环境,可以考虑创建单独的catalog库。




++++++++++++MTTR RECORDS解析++++++++++
***************************************************************************
 (size = 100, compat size = 100, section max = 8, section in-use = 1,
  last-recid= 0, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 160, numrecs = 8)
MTTR record for thread 1
MTTR statistics status: 1
Init time: Avg: 3735000 us, Times measured: 2  --初始化的平均时间3.73s
File open time: Avg: 10000 us, Times measured: 7 --文件打开平均时间0.001秒
Log block read time: Avg: 20 us, Times measured: 65536   --log block平均读取时间
Data block read/claim time: Avg: 170 us, Times measured: 1000  ---数据块的平均读取时间
Data block write time: Avg: 390 us  ---数据块的平均写入时间
1000 change vector apply time: Avg: 0 us, Times measured: 1
Ratio Information:
# of log blocks measured: 413575
# of data blocks measured: 3089
# of change vectors measured: 333576




什么是MTTR?该特性其实是10gR2版本引入的,意在降低实例恢复的时间。通过参数fast_start_mttr_target来进行控制,不过该参数并不是硬性控制,这个跟
logfile大小以及系统的io能力都有一定的关系。该值的取值范围是1~3600,单位是秒。
通常来讲不建议将该值设置的过低,因为那样可能会引起频繁checkpoint write操作。




+++++++++++INCARNATION RECORDS的解析++++++++++++
***************************************************************************
 (size = 56, compat size = 56, section max = 292, section in-use = 2,
  last-recid= 2, old-recno = 1, last-recno = 2)
 (extent = 1, blkno = 141, numrecs = 292)
Earliest record:
 RECID #1 Recno 1 Record timestamp 
  Resetlogs scn and time scn: 0x0000.00000001 08/24/13 11:37:30
  Previous Resetlogs scn and time scn: 0x0000.00000000 01/01/88 00:00:00
 Incarnation (parent inc#, flag)=(0, 0)
Latest record:
 RECID #2 Recno 2 Record timestamp 
  Resetlogs scn and time scn: 0x0000.000e2006 09/14/18 11:30:48
  Previous Resetlogs scn and time scn: 0x0000.00000001 08/24/13 11:37:30
 Incarnation (parent inc#, flag)=(1, 2)


从上面内容,我么可以看到controfile dump仅列出了最旧和最新的incarnation信息(因为我们的dumplevel为3)
RECID #2 Recno 2 --记录对应的incarnation编号
Resetlogs scn and time scn: 0x0000.000e2006  该次resetlogs操作对应的scn值。
Previous Resetlogs scn and time scn: 0x0000.00000001  ---上一次resetlogs时的scn值。
resetlogs打开之后,incarnation值需要加1


RMAN>  list incarnation;




List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORCL     1514596582       PARENT  1          24-AUG-13
2       2       ORCL     1514596582       CURRENT 925702     14-SEP-18


阅读(1865) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~