Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

11

主题
1#
发表于 2013-6-4 00:13:35 | 查看: 3478| 回复: 2
  1. SQL> select * from v$version;

  2. BANNER
  3. ----------------------------------------------------------------
  4. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
  5. PL/SQL Release 10.2.0.4.0 - Production
  6. CORE    10.2.0.4.0      Production
  7. TNS for Linux: Version 10.2.0.4.0 - Production
  8. NLSRTL Version 10.2.0.4.0 - Production
复制代码
session a:
  1. SQL> select * from v$mystat where rownum=1;

  2.        SID STATISTIC#      VALUE
  3. ---------- ---------- ----------
  4.        159          0          1

  5. SQL> set autot on stat
  6. SQL> select * from m;

  7.         ID NAME
  8. ---------- ----------
  9.          2 cyx
  10.          1 cyx


  11. Statistics
  12. ----------------------------------------------------------
  13.           0  recursive calls
  14.           0  db block gets
  15.          24  consistent gets
  16.           0  physical reads
  17.           0  redo size
  18.         630  bytes sent via SQL*Net to client
  19.         492  bytes received via SQL*Net from client
  20.           2  SQL*Net roundtrips to/from client
  21.           0  sorts (memory)
  22.           0  sorts (disk)
  23.           2  rows processed
复制代码
session b:
  1. SQL> insert into m values(3,'cyx');

  2. 1 row created.
复制代码
没有提交

session a:
  1. SQL> select * from m;

  2.         ID NAME
  3. ---------- ----------
  4.          2 cyx
  5.          1 cyx


  6. Statistics
  7. ----------------------------------------------------------
  8.           0  recursive calls
  9.           0  db block gets
  10.          26  consistent gets
  11.           0  physical reads
  12.         [color=Red] 64  redo size[/color]
  13.         630  bytes sent via SQL*Net to client
  14.         492  bytes received via SQL*Net from client
  15.           2  SQL*Net roundtrips to/from client
  16.           0  sorts (memory)
  17.           0  sorts (disk)
  18.           2  rows processed

  19. SQL> /

  20.         ID NAME
  21. ---------- ----------
  22.          2 cyx
  23.          1 cyx


  24. Statistics
  25. ----------------------------------------------------------
  26.           0  recursive calls
  27.           0  db block gets
  28.          26  consistent gets
  29.           0  physical reads
  30.          [color=Red]64  redo size[/color]
  31.         630  bytes sent via SQL*Net to client
  32.         492  bytes received via SQL*Net from client
  33.           2  SQL*Net roundtrips to/from client
  34.           0  sorts (memory)
  35.           0  sorts (disk)
  36.           2  rows processed
复制代码
执行了两遍,都产生了redo,构造cr块产生redo??请高手们帮忙解释下
2#
发表于 2013-6-4 08:12:44


INSTANCE_NAME
----------------
MACDBN

SQL>
SQL>
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

SQL>
SQL> create table maclean(t1 int ,t2 varchar2(20));

Table created.

SQL> insert into maclean values (1,'ABC');

1 row created.

SQL> /

1 row created.

SQL> commit;

Commit complete.

SQL> select * from maclean;

        T1 T2
---------- --------------------
         1 ABC
         1 ABC

SQL> /

        T1 T2
---------- --------------------
         1 ABC
         1 ABC

SQL> insert into maclean values(3,'ABC');

1 row created.





session B:





SQL> exec dbms_stats.gather_table_stats(user,'MACLEAN');

PL/SQL procedure successfully completed.



SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    2012825

SQL> select * from maclean;

        T1 T2
---------- --------------------
         1 ABC
         1 ABC


Execution Plan
----------------------------------------------------------
Plan hash value: 2568761675

-----------------------------------------------------------------------------
| Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |         |     2 |    14 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| MACLEAN |     2 |    14 |     2   (0)| 00:00:01 |
-----------------------------------------------------------------------------


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          6  consistent gets
          0  physical reads
        108  redo size
        654  bytes sent via SQL*Net to client
        523  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          2  rows processed
                  
SQL> commit;

Commit complete.

SQL> alter system dump logfile '+DATA/macdb/onlinelog/group_1.269.816597463';


System altered.

SQL> SQL>
SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/s01/diag/rdbms/macdbn/MACDBN/trace/MACDBN_ora_7310.trc                  
                  

                  
                  2012825==>1EB699  大于scn 1EB699的是相关redo

                  
SQL> select name from obj$ where obj#=77452;

NAME
------------------------------
MACLEAN


                  
                  OP:4.1
                  
REDO RECORD - Thread:1 RBA: 0x00003b.00004c01.0010 LEN: 0x006c VLD: 0x05
SCN: 0x0000.001eb69c SUBSCN:  1 06/05/2013 08:47:34
(LWN RBA: 0x00003b.00004c01.0010 LEN: 0001 NST: 0001 SCN: 0x0000.001eb69c)
CHANGE #1 TYP:0 CLS:1 AFN:1 DBA:0x00415fd1 OBJ:77452 SCN:0x0000.001e9cf7 SEQ:1 OP:4.1 ENC:0 RBL:0
Block cleanout record, scn:  0x0000.001eb69c ver: 0x01 opt: 0x01, entries follow...

REDO RECORD - Thread:1 RBA: 0x00003b.00004c05.0010 LEN: 0x006c VLD: 0x05
SCN: 0x0000.001eb6a1 SUBSCN:  1 06/05/2013 08:47:39
(LWN RBA: 0x00003b.00004c05.0010 LEN: 0001 NST: 0001 SCN: 0x0000.001eb6a1)
CHANGE #1 TYP:0 CLS:1 AFN:1 DBA:0x00415fd1 OBJ:77452 SCN:0x0000.001eb69c SEQ:1 OP:4.1 ENC:0 RBL:0
Block cleanout record, scn:  0x0000.001eb6a1 ver: 0x01 opt: 0x01, entries follow...                  


OP:4.1 是 Transaction Block-Block Cleanout


Layer 4 : Transaction Block

Opcode 1 : Block Cleanout
Opcode 2 : Physical Cleanout
Opcode 3 : Single Array Change
Opcode 4 : Multiple Changes to an Array
Opcode 5 : Format Block

回复 只看该作者 道具 举报

3#
发表于 2013-6-5 11:18:02
谢谢刘大,精辟

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-11-16 15:56 , Processed in 0.066100 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569