暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 关于表分区

askTom 2018-03-06
539

问题描述

嗨,团队,

我们已经将分区表的initrans值设置为255在我们的exadata框中,该表具有很高的并发性,之后我们注意到巨大的存档生成,这里可以帮助我们这个inittrans值如何与存档生成相关,我们非常确定存档生成的原因是由于高inittrans值。

目前,我们已将其减少到100,我们已使用alter modify命令来执行此操作,这是否有助于我们减少归档生成

专家解答

we are very sure that cause of archive generation is due to high inittrans value

怎么做?你有什么证据?

一旦设置,initrans将为新块更改表的大小,因为我们需要更多的空间来容纳其中的所有ITL。但是您可以从下面的演示中看到,消耗的重做量非常相似。(下面的脚本中的 “mystat” 仅查询v $ mystat,以便您可以看到重做的累计总数,并从前面的每个减去增量)

SQL> create table t1 ( x int, y int );

Table created.

SQL> create table t2 ( x int, y int ) initrans 255;

Table created.

SQL>
SQL> @mystat
Enter value for statname: redo size

NAME                                                              VALUE
------------------------------------------------------------ ----------
redo size                                                        142484
redo size for lost write detection                                    0
redo size for direct writes                                           0

3 rows selected.

SQL> begin
  2   for i in 1 .. 100000 loop
  3     insert into t1 values (i,i);
  4   end loop;
  5  end;
  6  /

PL/SQL procedure successfully completed.

SQL> @mystat
Enter value for statname: redo size

NAME                                                              VALUE
------------------------------------------------------------ ----------
redo size                                                      26343880
redo size for lost write detection                                    0
redo size for direct writes                                           0

3 rows selected.

SQL> begin
  2   for i in 1 .. 100000 loop
  3     insert into t2 values (i,i);
  4   end loop;
  5  end;
  6  /

PL/SQL procedure successfully completed.

SQL> @mystat
Enter value for statname: redo size

NAME                                                              VALUE
------------------------------------------------------------ ----------
redo size                                                      52559260
redo size for lost write detection                                    0
redo size for direct writes                                           0

3 rows selected.

SQL>
SQL> select bytes from user_segments where segment_name in ('T1','T2');

     BYTES
----------
   2097152
   4194304

2 rows selected.

复制


所以在这两种情况下-大约26MB的重做。通过转储随机块可以看到T2的双倍大小

Start dump data blocks tsn: 4 file#:7 minblk 3842 maxblk 3842
Block dump from cache:
Dump of buffer cache at level 4 for pdb=0 tsn=4 rdba=29363970
BH (0x7ffa67f5bb18) file#: 7 rdba: 0x01c00f02 (7/3842) class: 1 ba: 0x7ffa67112000
  set: 9 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 1,28
  dbwrid: 0 obj: 218764 objn: 218764 tsn: [0/4] afn: 7 hint: f
  hash: [0x7ff97e268b28,0x7ff97e268b28] lru: [0x7ffa67f5bd58,0x7ffa67f5ba98]
  ckptq: [NULL] fileq: [NULL]
  objq: [0x7ffa67f5bac0,0x7ffa67f60920] objaq: [0x7ffa67f5c050,0x7ffa67f5bad0]
  st: XCURRENT md: NULL fpin: 'ktspbwh2: ktspfmdb' fscn: 0xd7996562418 tch: 1
  flags: block_written_once
  LRBA: [0x0.0.0] LSCN: [0x0] HSCN: [0xd799656241a] HSUB: [3728]
  Printing buffer operation history (latest change first):
  cnt: 10
  01. sid:15 L192:kcbbic2:bic:FBD     02. sid:15 L191:kcbbic2:bic:FBW   
  03. sid:15 L602:bic1_int:bis:FWC    04. sid:15 L822:bic1_int:ent:rtn  
  05. sid:15 L832:oswmqbg1:clr:WRT    06. sid:15 L930:kubc:sw:mq        
  07. sid:15 L913:bxsv:sw:objq        08. sid:15 L608:bxsv:bis:FBW      
  09. sid:15 L607:bxsv:bis:FFW        10. sid:06 L353:gcur:set:MEXCL    
  11. sid:06 L464:chg1_mn:bic:FMS     12. sid:06 L778:chg1_mn:bis:FMS   
  13. sid:06 L353:gcur:set:MEXCL      14. sid:06 L464:chg1_mn:bic:FMS   
  15. sid:06 L778:chg1_mn:bis:FMS     16. sid:06 L353:gcur:set:MEXCL    
Block dump from disk:
buffer tsn: 4 rdba: 0x01c00f02 (7/3842)
scn: 0xd799656241a seq: 0xf4 flg: 0x04 tail: 0x241a06f4
frmt: 0x02 chkval: 0x99db type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Block header dump:  0x01c00f02
 Object id on Block? Y
 seg/obj: 0x3568c  csc:  0x00000d7996562418  itc: 169  flg: E  typ: 1 - DATA
     brn: 0  bdba: 0x1c00f00 ver: 0x01 opc: 0
     inc: 0  exflg: 0
 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0003.00f.0000c379  0x014021aa.32e7.0d  ----  244  fsc 0x0000.00000000
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x04   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x05   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x06   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x07   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x08   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x09   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x0a   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x0b   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x0c   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
...

0xa1   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa2   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa3   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa4   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa5   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa6   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa7   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa8   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0xa9   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
bdba: 0x01c00f02
复制


查看所有这些ITL,从而为数据留出更少的空间。您还可以看到 (对于8k),我的上限是ITL的170左右。所以设置255是过分的。

如果在事实之后更改initrans,则现有块不变。

但最终,必须问这个问题-为什么您在单个块上有255并发事务?这里的解决方案可能不是initrans,而是使用pctfree 90或类似工具将块展开。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论