[20180626]延迟块清除与只读表.txt

简介: [20180626]延迟块清除与只读表.txt --//以前测试过延迟块清除与只读表空间的情况.今天测试只读表的情况. --//链接:[20150409]只读表空间与延迟块清除.

[20180626]延迟块清除与只读表.txt

--//以前测试过延迟块清除与只读表空间的情况.今天测试只读表的情况.
--//链接:[20150409]只读表空间与延迟块清除.txt

1.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create table deptx as select * from dept ;
Table created.

SCOTT@book> select rowid,ora_rowscn,deptx.* from deptx ;
ROWID                ORA_ROWSCN       DEPTNO DNAME          LOC
------------------ ------------ ------------ -------------- -------------
AAAWFJAAEAAAALTAAA  13277186635           10 ACCOUNTING     NEW YORK
AAAWFJAAEAAAALTAAB  13277186635           20 RESEARCH       DALLAS
AAAWFJAAEAAAALTAAC  13277186635           30 SALES          CHICAGO
AAAWFJAAEAAAALTAAD  13277186635           40 OPERATIONS     BOSTON

SCOTT@book> @ rowid AAAWFJAAEAAAALTAAA
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     90441          4        723          0  0x10002D3           4,723                alter system dump datafile 4 block 723 ;

SCOTT@book> update deptx set dname=lower(dname);
4 rows updated.

SCOTT@book> @ &r/xid
XIDUSN_XIDSLOT_XIDSQN
------------------------------
10.20.20473

C70                                                                    XIDUSN XIDSLOT XIDSQN UBAFIL UBABLK UBASQN UBAREC STATUS USED_UBLK USED_UREC XID              ADDR             START_DATE          FLAG
---------------------------------------------------------------------- ------ ------- ------ ------ ------ ------ ------ ------ --------- --------- ---------------- ---------------- ------------------- ----
ALTER SYSTEM DUMP UNDO BLOCK '_SYSSMU10_1197734989$' XID 10 20 20473;      10      20  20473      3    952   3879     41 ACTIVE         1         1 0A001400F94F0000 0000000081B91F18 2018-06-27 08:44:56 3587
ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU10_1197734989$';
ALTER SYSTEM DUMP DATAFILE 3 BLOCK 952;

SCOTT@book> alter system flush buffer_cache;
System altered.

SCOTT@book> alter system flush buffer_cache;
System altered.

SCOTT@book> commit ;
Commit complete.

2.设置deptx只读:
SCOTT@book> alter table deptx read only;
Table altered.

SCOTT@book> alter system dump datafile 4 block 723 ;
System altered.

--//检查转储文件.
Block header dump:  0x010002d3
Object id on Block? Y
seg/obj: 0x16149  csc: 0x03.1761ca4b  itc: 3  flg: E  typ: 1 - DATA
     brn: 0  bdba: 0x10002d0 ver: 0x01 opc: 0
     inc: 0  exflg: 0

Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0xffff.000.00000000  0x00000000.0000.00  C---    0  scn 0x0003.1761ca4b
0x02   0x000a.014.00004ff9  0x00c003b8.0f27.29  ----    4  fsc 0x0000.00000000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
bdba: 0x010002d3
data_block_dump,data header at 0x7f36be75ee7c
===============
tsiz: 0x1f80
hsiz: 0x1a
pbl: 0x7f36be75ee7c
     76543210
flag=--------
ntab=1
nrow=4
frre=-1
fsbo=0x1a
fseo=0x1f24
avsp=0x1f0a
tosp=0x1f0a
0xe:pti[0]  nrow=4  offs=0
0x12:pri[0] offs=0x1f66
0x14:pri[1] offs=0x1f50
0x16:pri[2] offs=0x1f3c
0x18:pri[3] offs=0x1f24
block_row_dump:
tab 0, row 0, @0x1f66
tl: 26 fb: --H-FL-- lb: 0x2  cc: 3
col  0: [ 2]  c1 0b
col  1: [10]  61 63 63 6f 75 6e 74 69 6e 67
col  2: [ 8]  4e 45 57 20 59 4f 52 4b
tab 0, row 1, @0x1f50
....
tl: 24 fb: --H-FL-- lb: 0x2  cc: 3
col  0: [ 2]  c1 29
col  1: [10]  6f 70 65 72 61 74 69 6f 6e 73
col  2: [ 6]  42 4f 53 54 4f 4e
end_of_block_dump
End dump data blocks tsn: 4 file#: 4 minblk 723 maxblk 723

--//注意看下划线内容.没有更新itl槽信息.

3.再次访问数据块看看.
SCOTT@book> set autot traceonly
SCOTT@book> select rowid,ora_rowscn,deptx.* from deptx ;
Execution Plan
----------------------------------------------------------
Plan hash value: 428208148
---------------------------------------------------------------------------
| Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |       |     4 |   168 |     3   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| DEPTX |     4 |   168 |     3   (0)| 00:00:01 |
---------------------------------------------------------------------------
Note
-----
   - dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
         19  recursive calls
          0  db block gets
         36  consistent gets
          8  physical reads
        116  redo size
       1017  bytes sent via SQL*Net to client
        520  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          5  sorts (memory)
          0  sorts (disk)
          4  rows processed
--//可以看看有日志产生.

SCOTT@book> set autot off
SCOTT@book> alter system flush buffer_cache;
System altered.

SCOTT@book> alter system dump datafile 4 block 723 ;
System altered.

--//检查转储文件.
Block header dump:  0x010002d3
Object id on Block? Y
seg/obj: 0x16149  csc: 0x03.1761ddd9  itc: 3  flg: E  typ: 1 - DATA
     brn: 0  bdba: 0x10002d0 ver: 0x01 opc: 0
     inc: 0  exflg: 0

Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0xffff.000.00000000  0x00000000.0000.00  C---    0  scn 0x0003.1761ca4b
0x02   0x000a.014.00004ff9  0x00c003b8.0f27.29  C-U-    0  scn 0x0003.1761dceb
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
bdba: 0x010002d3
data_block_dump,data header at 0x7f1ee9b3ba7c
===============
tsiz: 0x1f80
hsiz: 0x1a
pbl: 0x7f1ee9b3ba7c
     76543210
flag=--------
ntab=1
nrow=4
frre=-1
fsbo=0x1a
fseo=0x1f24
avsp=0x1f0a
tosp=0x1f0a
0xe:pti[0]  nrow=4  offs=0
0x12:pri[0] offs=0x1f66
0x14:pri[1] offs=0x1f50
0x16:pri[2] offs=0x1f3c
0x18:pri[3] offs=0x1f24
block_row_dump:
tab 0, row 0, @0x1f66
tl: 26 fb: --H-FL-- lb: 0x0  cc: 3
col  0: [ 2]  c1 0b
col  1: [10]  61 63 63 6f 75 6e 74 69 6e 67
col  2: [ 8]  4e 45 57 20 59 4f 52 4b
tab 0, row 1, @0x1f50
...
tl: 24 fb: --H-FL-- lb: 0x0  cc: 3
col  0: [ 2]  c1 29
col  1: [10]  6f 70 65 72 61 74 69 6f 6e 73
col  2: [ 6]  42 4f 53 54 4f 4e
end_of_block_dump
End dump data blocks tsn: 4 file#: 4 minblk 723 maxblk 723
--//注意下划线,可以发现即使表deptx设置只读,itl信息一样更新.

SCOTT@book> select rowid,ora_rowscn,deptx.* from deptx ;
ROWID                ORA_ROWSCN       DEPTNO DNAME          LOC
------------------ ------------ ------------ -------------- -------------
AAAWFJAAEAAAALTAAA  13277191403           10 accounting     NEW YORK
AAAWFJAAEAAAALTAAB  13277191403           20 research       DALLAS
AAAWFJAAEAAAALTAAC  13277191403           30 sales          CHICAGO
AAAWFJAAEAAAALTAAD  13277191403           40 operations     BOSTON

SCOTT@book>  @ &r/scn16 13277191403
C20                  WRAP           BASE
-------------------- -------------- --------------
13277191403                       3       1761dceb
--//可以发现即使只读表,一样会更新的scn信息.scn也能与上面的事务对上.

4.另外注意的问题.
SCOTT@book> delete from deptx ;
delete from deptx
            *
ERROR at line 1:
ORA-12081: update operation not allowed on table "SCOTT"."DEPTX"

--//只读表虽然不允许dml语句,但是ddl一样可以执行.
SCOTT@book> drop table deptx;
Table dropped.

SCOTT@book> flashback table deptx to before drop;
Flashback complete.

SCOTT@book> select rowid,ora_rowscn,deptx.* from deptx ;
ROWID                ORA_ROWSCN       DEPTNO DNAME          LOC
------------------ ------------ ------------ -------------- -------------
AAAWFJAAEAAAALTAAA  13277191403           10 accounting     NEW YORK
AAAWFJAAEAAAALTAAB  13277191403           20 research       DALLAS
AAAWFJAAEAAAALTAAC  13277191403           30 sales          CHICAGO
AAAWFJAAEAAAALTAAD  13277191403           40 operations     BOSTON

5.总结:
--//对于只读表出现延迟块清除时,会修改数据块(即使是只读表),

相关实践学习
部署高可用架构
本场景主要介绍如何使用云服务器ECS、负载均衡SLB、云数据库RDS和数据传输服务产品来部署多可用区高可用架构。
负载均衡入门与产品使用指南
负载均衡(Server Load Balancer)是对多台云服务器进行流量分发的负载均衡服务,可以通过流量分发扩展应用系统对外的服务能力,通过消除单点故障提升应用系统的可用性。 本课程主要介绍负载均衡的相关技术以及阿里云负载均衡产品的使用方法。
目录
相关文章
|
5月前
|
API 索引
主机磁盘使用率超过85%导致es索引变为只读模式
主机磁盘使用率超过85%导致es索引变为只读模式
172 0
|
11月前
|
计算机视觉 索引 Windows
视频操作_01视频读写:视频读写+读取视频+保存视频
在OpenCV中我们要获取一个视频,需要创建一个VideoCapture对象
137 0
mode:类型非常多 r:只读 从头部开始读 io.UnsupportedOperation: not writable w:写入 每次都是从头部开始写 原有的内容
mode:类型非常多 r:只读 从头部开始读 io.UnsupportedOperation: not writable w:写入 每次都是从头部开始写 原有的内容
|
SQL 数据库
数据库页已标记为 RestorePending,可能表明磁盘已损坏。要从此状态恢复,请执行还原操作。
错误提示: 消息 829,级别 21,状态 1,第 1 行 数据库 ID 15,页 (1:21826) 已标记为 RestorePending,可能表明磁盘已损坏。要从此状态恢复,请执行还原操作。 引起原因: RestorePending一般是在进行页恢复的过程中出现的,就是在进行了restore操作之后但还没有进行recovery操作之前页的状态。
2393 0
|
索引
[20180425]为什么走索引逻辑读反而高.txt
[20180425]为什么走索引逻辑读反而高.txt --//别人问的问题,自己测试看看,开始以为array设置太小.还是通过例子说明问题. 1.环境: SCOTT@book> @ ver1 PORT_STRING                    VE...
1013 0
|
存储 关系型数据库 Oracle
|
测试技术 数据库管理
[20170428]延迟块清除测试.txt
[20170428]延迟块清除测试.txt --//做一个延迟块清除测试,前面的测试太乱了,思路非常不清楚. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION      ...
701 0