[20171208]rman与truncate3.txt

[20171208]rman与truncate3.txt

--//前几天测试truncate表依旧备份一部分信息,测试几次确定备份8extent.当时的测试几个extents是相邻的.
--//今天补充测试如果数据分布是离散的,情况是否一样?

1.环境:
SCOTT@book> @ &r/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

CREATE TABLESPACE T01 DATAFILE
  '/mnt/ramdisk/book/T01.dbf' SIZE 21M AUTOEXTEND OFF
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;

create table t01a tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('A',26,'A') name from dual connect by level<=100;
create table t02  tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('B',26,'B') name from dual connect by level<=2e4;
create table t01b tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('A',26,'A') name from dual connect by level<=100;
create table t03  tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('C',26,'C') name from dual connect by level<=2e4;
create table t01c tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('A',26,'A') name from dual connect by level<=100;
create table t04  tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('D',26,'D') name from dual connect by level<=2e4;
create table t01d tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('A',26,'A') name from dual connect by level<=100;
create table t05  tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('E',26,'E') name from dual connect by level<=2e4;
create table t01e tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('A',26,'A') name from dual connect by level<=100;

drop table t01a purge ;
drop table t01b purge ;
drop table t01c purge ;
drop table t01d purge ;
drop table t01e purge ;

create table t01 tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('Z',26,'Z') name from dual connect by level<=1e5;

SCOTT@book> column PARTITION_NAME noprint
SCOTT@book> select * from dba_extents where segment_name='T01' order by block_id;
OWNER  SEGMENT_NAME SEGMENT_TYPE       TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID   BYTES BLOCKS RELATIVE_FNO
------ ------------ ------------------ --------------- --------- ------- -------- ------- ------ ------------
SCOTT  T01          TABLE              T01                     0       7      128   65536      8            7
SCOTT  T01          TABLE              T01                     1       7      264   65536      8            7
SCOTT  T01          TABLE              T01                     2       7      400   65536      8            7
SCOTT  T01          TABLE              T01                     3       7      536   65536      8            7
SCOTT  T01          TABLE              T01                     4       7      672   65536      8            7
SCOTT  T01          TABLE              T01                     5       7      680   65536      8            7
SCOTT  T01          TABLE              T01                     6       7      688   65536      8            7
SCOTT  T01          TABLE              T01                     7       7      696   65536      8            7
SCOTT  T01          TABLE              T01                     8       7      704   65536      8            7
SCOTT  T01          TABLE              T01                     9       7      712   65536      8            7
SCOTT  T01          TABLE              T01                    10       7      720   65536      8            7
SCOTT  T01          TABLE              T01                    11       7      728   65536      8            7
SCOTT  T01          TABLE              T01                    12       7      736   65536      8            7
SCOTT  T01          TABLE              T01                    13       7      744   65536      8            7
SCOTT  T01          TABLE              T01                    14       7      752   65536      8            7
SCOTT  T01          TABLE              T01                    15       7      760   65536      8            7
SCOTT  T01          TABLE              T01                    16       7      768 1048576    128            7
SCOTT  T01          TABLE              T01                    17       7      896 1048576    128            7
SCOTT  T01          TABLE              T01                    18       7     1024 1048576    128            7
SCOTT  T01          TABLE              T01                    19       7     1152 1048576    128            7
20 rows selected.

--//这样表T01的数据分布相对离散.看看做truncate备份那些信息.
truncate table t01 ;
alter system checkpoint;
alter system checkpoint;
alter system checkpoint;

2.备份:
RMAN> backup datafile 7 format '/home/oracle/backup/T1z_%U';

Starting backup at 2017-12-08 09:23:26
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/mnt/ramdisk/book/T01.dbf
channel ORA_DISK_1: starting piece 1 at 2017-12-08 09:23:26
channel ORA_DISK_1: finished piece 1 at 2017-12-08 09:23:27
piece handle=/home/oracle/backup/T1z_hfsljh0e_1_1 tag=TAG20171208T092326 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2017-12-08 09:23:27

$ strings -t d T1z_hfsljh0e_1_1 | grep ZZZZZ|wc
   9978   26939  440925

$ strings -t d T1z_hfsljh0e_1_1 | grep ZZZZZ|head -1
1082678 K 000174ZZZZZZZZZZZZZZZZZZZZZZZZZZ,

$ strings -t d T1z_hfsljh0e_1_1 | grep BBBB|head -1
1148214 K 000174BBBBBBBBBBBBBBBBBBBBBBBBBB,

$ strings -t d T1z_hfsljh0e_1_1 | grep CCCC|head -1
2262326 K 000174CCCCCCCCCCCCCCCCCCCCCCCCCC,

$ strings -t d T1z_hfsljh0e_1_1 | grep ZZZZZ|tail  -1
5775323  009807ZZZZZZZZZZZZZZZZZZZZZZZZZZ

--//实际上也可以看出确实是8个extents.与前面测试记数一致.

SCOTT@book> drop table t01 purge ;
Table dropped.

SCOTT@book> create table t01 tablespace t01 as select rownum id ,to_char(rownum,'FM000000')||lpad('Z',26,'Z') name from dual connect by level<=1e5;
Table created.

SCOTT@book> select rowid,t01.* from t01 where id in (174,009807,9978);
ROWID                      ID NAME
------------------ ---------- --------------------------------
AAAWMlAAHAAAACDACt        174 000174ZZZZZZZZZZZZZZZZZZZZZZZZZZ
AAAWMlAAHAAAAK/AAA       9807 009807ZZZZZZZZZZZZZZZZZZZZZZZZZZ
AAAWMlAAHAAAAK/ACr       9978 009978ZZZZZZZZZZZZZZZZZZZZZZZZZZ

SCOTT@book> @ &r/rowid AAAWMlAAHAAAACDACt
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     90917          7        131        173  0x1C00083           7,131                alter system dump datafile 7 block 131 ;

SCOTT@book> @ &r/rowid AAAWMlAAHAAAAK/AAA
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     90917          7        703          0  0x1C002BF           7,703                alter system dump datafile 7 block 703 ;

SCOTT@book> @ &r/rowid AAAWMlAAHAAAAK/ACr
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     90917          7        703        171  0x1C002BF           7,703                alter system dump datafile 7 block 703 ;

SCOTT@book> column PARTITION_NAME noprint
SCOTT@book> select * from dba_extents where segment_name='T01' order by block_id;
OWNER  SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID    FILE_ID   BLOCK_ID      BYTES     BLOCKS RELATIVE_FNO
------ ------------ ------------ --------------- --------- ---------- ---------- ---------- ---------- ------------
SCOTT  T01          TABLE        T01                     0          7        128      65536          8            7
SCOTT  T01          TABLE        T01                     1          7        264      65536          8            7
SCOTT  T01          TABLE        T01                     2          7        400      65536          8            7
SCOTT  T01          TABLE        T01                     3          7        536      65536          8            7
SCOTT  T01          TABLE        T01                     4          7        672      65536          8            7
SCOTT  T01          TABLE        T01                     5          7        680      65536          8            7
SCOTT  T01          TABLE        T01                     6          7        688      65536          8            7
SCOTT  T01          TABLE        T01                     7          7        696      65536          8            7
SCOTT  T01          TABLE        T01                     8          7        704      65536          8            7
SCOTT  T01          TABLE        T01                     9          7        712      65536          8            7
SCOTT  T01          TABLE        T01                    10          7        720      65536          8            7
SCOTT  T01          TABLE        T01                    11          7        728      65536          8            7
SCOTT  T01          TABLE        T01                    12          7        736      65536          8            7
SCOTT  T01          TABLE        T01                    13          7        744      65536          8            7
SCOTT  T01          TABLE        T01                    14          7        752      65536          8            7
SCOTT  T01          TABLE        T01                    15          7        760      65536          8            7
SCOTT  T01          TABLE        T01                    16          7        768    1048576        128            7
SCOTT  T01          TABLE        T01                    17          7        896    1048576        128            7
SCOTT  T01          TABLE        T01                    18          7       1024    1048576        128            7
SCOTT  T01          TABLE        T01                    19          7       1152    1048576        128            7
20 rows selected.

--//确实是8块.也就是即使truncate表,rman在做备份也要选择前8个extent做备份.
--//好像数据做的不够离散,EXTENT_ID=4,5,6,7还是连续的,不过我觉得应该能说明问题.EXTENT_ID=0,1之间间隔128块(1M)呢.

时间: 2024-09-20 18:01:18

[20171208]rman与truncate3.txt的相关文章

[20171130]关于rman备份疑问.txt

[20171130]关于rman备份疑问.txt --//前面测试太乱,重新做一些rman as copy相关测试. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------------------------------------------------

[20171206]rman与truncate.txt

[20171206]rman与truncate.txt --//昨天下班在回家的路上,突然想起以前遇到的问题,就是truncate表后,rman做备份时会备份多少truncate表的信息, --//当时在itpub上,还存在讨论,就是rman会备份空block吗?参考链接:http://www.itpub.net/thread-2050864-9-1.html --//zergduan兄还开了SR,答复如下: 终于有回复了 经过dump的确认,unused block compression 特

[20171031]rman xxx Failure.txt

[20171031]rman xxx Failure.txt --//简单测试 List Failure, Advise Failure and Repair Failure命令在11g下,也许以后工作需要. --//虽然我自己很少使用这个命令,感觉这个有点傻瓜化. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ ----

[20171101]rman to destination.txt

[20171101]rman to destination.txt --//国庆放假,看了一些rman方面的书,看到一个不常用的参数to destination,测试看看. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ------------------------------------

[20170626]rman merge例子.txt

[20170626]rman merge例子.txt 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- -------------------------------------------------------------------------------- x86_64/Linux

[20130803]ORACLE 12C RMAN 功能增强.txt

[20130803]ORACLE 12C RMAN 功能增强.txt 在oracle 12c rman中可以直接输入sql语句,缺点就是仅仅输出最大仅仅80列,不知道如何调整. d:\tmp>rman target sys/xxxx@test01p Recovery Manager: Release 12.1.0.1.0 - Production on Fri Aug 2 22:53:49 2013 Copyright (c) 1982, 2013, Oracle and/or its affi

[20130412]rman备份文件大小.txt

[20130412]rman备份文件大小.txt 记得以前看rman的书,rman仅仅备份已经格式话的块,如果这样一个表被truncate后,即使空间回收了.但是在rman备份时,备份大小不会变化太多,这些前面使用的块一定会备份.实际的测试情况是,备份文件会变小. 测试的链接:http://space.itpub.net/267265/viewspace-750049 如果是索引删除的情况呢?自己不能凭想象,还是做测试来看看. 1.测试环境: SQL> @verBANNER-----------

[20171031]rman merge例子2.txt

[20171031]rman merge例子2.txt --//以前做的测试 [20170626]rman merge例子.txt --//链接 http://blog.itpub.net/267265/viewspace-2141253/ --//不断应用日志,常用的方式如下: 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER --------------------------

Oracle数据库rman备份计划及恢复

原文:http://www.cnblogs.com/vijayfly/p/5045175.html 1.rman完全恢复的前提条件:历史的datafile,controlfile和spfile备份,加上完整的archivelog和完好的redolog. 2.rman备份脚本: a.RMAN 0级备份命令: run{ allocate channel c1 type disk; allocate channel c2 type disk; allocate channel c3 type disk