ITPub博客

首页 > 数据库 > Oracle > [20190510]rman备份的疑问7.txt

[20190510]rman备份的疑问7.txt

原创 Oracle 作者:lfree 时间:2019-05-10 10:57:10 0 删除 编辑

[20190510]rman备份的疑问7.txt


--//上午测试rman备份时备份文件大小回缩的测试.链接:

--//http://blog.itpub.net/267265/viewspace-2643804/ => [20190509]rman备份的疑问5.txt 

--//自己又认真会看自己以前写的文章:

--//http://blog.itpub.net/267265/viewspace-2148246/=>[20171204]关于rman备份疑问4.txt 

--//突然有所感悟,rman的备份input buffer是否并非完全按照文档的结束那样,每个备份文件对应2M.(当文件数量大于4时)

--//而是总的input buffer=16M,然后根据备份文件集的数量平均分配.

--//我前面测试是一个备份集合5个文件的情况,如果一个备份集合3个文件.


--//一个备份集文件数量小于等于4,每个文件分配4个缓存,每个input buffer memory=1M.

--//每个文件input buffer memory 按照 floor(16/N)*1024


--//一个备份集文件数量大于4与小于等于8,每个文件分配4个缓存,每个input buffer memory=512K.

--//按照 floor(16/N*1024/512)*512


--//一个备份集文件数量大于8,每个文件分配4个缓存,每个input buffer memory=512K.

--//按照 floor(16/8*1024)= 2M


--//output buffer 4个,每个1M.


--//比较难表达.还是通过测试说明问题.

--//如果N=3, floor(16/3)1024

--//如果N=5, floor(16/N*1024/512)*512 = 3072.


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


$ cat d3.sql

drop tablespace t01 including contents and datafiles;

drop tablespace t02 including contents and datafiles;

drop tablespace t03 including contents and datafiles;


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

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

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


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

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

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


alter system checkpoint;

alter system checkpoint;

alter system checkpoint;


--//修改rman配置:

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 512 K;


using target database control file instead of recovery catalog

old RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 256 K;

new RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 512 K;

new RMAN configuration parameters are successfully stored

--//主要目的减慢备份速度。这样2秒读取1M.


RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;

new RMAN configuration parameters:

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;

new RMAN configuration parameters are successfully stored


RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;

old RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

new RMAN configuration parameters are successfully stored


RMAN> report schema;


Report of database schema for database with db_unique_name BOOK


List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

---- -------- -------------------- ------- ------------------------

1    760      SYSTEM               ***     /mnt/ramdisk/book/system01.dbf

2    1160     SYSAUX               ***     /mnt/ramdisk/book/sysaux01.dbf

3    865      UNDOTBS1             ***     /mnt/ramdisk/book/undotbs01.dbf

4    128      USERS                ***     /mnt/ramdisk/book/users01.dbf

5    346      EXAMPLE              ***     /mnt/ramdisk/book/example01.dbf

6    6        TEA                  ***     /mnt/ramdisk/book/tea01.dbf

7    16       UNDOTBS1             ***     /mnt/ramdisk/book/undotbs02.dbf

8    16       UNDOTBS1             ***     /mnt/ramdisk/book/undotbs03.dbf

9    11       T01                  ***     /mnt/ramdisk/book/T01.dbf

10   11       T02                  ***     /mnt/ramdisk/book/T02.dbf

11   11       T03                  ***     /mnt/ramdisk/book/T03.dbf


List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

---- -------- -------------------- ----------- --------------------

1    414      TEMP                 4096        /mnt/ramdisk/book/temp01.dbf


2.测试脚本:

--//测试备份3个数据文件的作为一个备份集合的情况:


$ cat t3.sh

#! /bin/bash

rman target / <<EOF  >> /tmp/t6.txt &

backup  datafile 9,10,11 format '/home/oracle/backup/t123_%t_%U' ;

quit

EOF

echo "sleep $1  "

sleep $1

sqlplus -s scott/book <<EOF

set numw 12

update t01 set name=lower(name) where mod(id,100)=0;

update t02 set name=lower(name) where mod(id,100)=0;

update t03 set name=lower(name) where mod(id,100)=0;

commit;

alter system checkpoint;

alter system checkpoint;

alter system checkpoint;

alter system checkpoint;

@ &r/scn

EOF


--//备份时手工执行如下命令:

--//$ echo -e  'aaaaa\n' 'bbbbb\n' 'ccccc\n' | xargs  -I{} -P 3 bash -c "strings -t d /home/oracle/backup/t123_* | grep {} | head -1" | sort -n


--//如果在一个备份集3个数据文件,每个数据文件前面1M是os,文件头,位图区.需要2秒完成(前面我设置disk rate 512).这样至少6秒才读取到表数据.

--//我分别测试延迟1,2,3,4,5的情况,实际上你可以不用等备份结束(当然备份文件集也不存在了,我按ctrl+c中断).

--//只要出现小写aaaaa,bbbbb,ccccc就ok了.

--//注意每次测试完成,执行d3.txt脚本,删除重新建立表空间等,重新测试.


3.测试:

$ . t3.sh 1

--//$ echo -e  'aaaaa\n' 'bbbbb\n' 'ccccc\n' | xargs  -I{} -P 3 bash -c "strings -t d /home/oracle/backup/t123_* | grep {} | head -1" | sort -n

3150022  000100aaaaaaaaaaaaaaaaaaaaaaaaaa,

4198598  000100bbbbbbbbbbbbbbbbbbbbbbbbbb,

5247174  000100cccccccccccccccccccccccccc,


$ . t3.sh 2

5247174  000100cccccccccccccccccccccccccc,

16771561        & 083700bbbbbbbbbbbbbbbbbbbbbbbbbb,

18871501 1 104800aaaaaaaaaaaaaaaaaaaaaaaaaa,


$ . t3.sh 3

5247174  000100cccccccccccccccccccccccccc,

16771561        & 083700bbbbbbbbbbbbbbbbbbbbbbbbbb,

18871501 1 104800aaaaaaaaaaaaaaaaaaaaaaaaaa,


$ . t3.sh 4

17820137        & 083700cccccccccccccccccccccccccc,

18871501 1 104800aaaaaaaaaaaaaaaaaaaaaaaaaa,

19920077 1 104800bbbbbbbbbbbbbbbbbbbbbbbbbb,


$ . t3.sh 5

 $ echo -e  'aaaaa\n' 'bbbbb\n' 'ccccc\n' | xargs  -I{} -P 3 bash -c "strings -t d /home/oracle/backup/t123_* | grep {} | head -1" | sort -n

17820137        & 083700cccccccccccccccccccccccccc,

18871501 1 104800aaaaaaaaaaaaaaaaaaaaaaaaaa,

19920077 1 104800bbbbbbbbbbbbbbbbbbbbbbbbbb,


--//实际上查询如下也可以确定:

  SELECT set_count

        ,device_type

        ,TYPE

        ,filename

        ,buffer_size

        ,buffer_count

        ,open_time

        ,close_time

    FROM v$backup_async_io

   WHERE set_count = 78

ORDER BY set_count

        ,TYPE

        ,open_time

        ,close_time;


SET_COUNT DEVICE_TYPE TYPE      FILENAME                                           BUFFER_SIZE BUFFER_COUNT OPEN_TIME           CLOSE_TIME

--------- ----------- --------- -------------------------------------------------- ----------- ------------ ------------------- -------------------

       78 DISK        AGGREGATE                                                              0            0 2019-05-10 09:50:08 2019-05-10 09:51:14

       78 DISK        INPUT     /mnt/ramdisk/book/T01.dbf                              1048576            5 2019-05-10 09:50:08 2019-05-10 09:51:14

       78 DISK        INPUT     /mnt/ramdisk/book/T02.dbf                              1048576            5 2019-05-10 09:50:08 2019-05-10 09:51:14

       78 DISK        INPUT     /mnt/ramdisk/book/T03.dbf                              1048576            5 2019-05-10 09:50:10 2019-05-10 09:51:14

       78 DISK        OUTPUT    /home/oracle/backup/t123_1007891408_2eu16cug_1_1       1048576            4 2019-05-10 09:50:08 2019-05-10 09:51:14

--//注意OPEN_TIME(filename=/mnt/ramdisk/book/T03.dbf).自己真笨!!根本不需要这么复杂的分析.每个输入缓存的总数量就是5.

--//输出缓存的总数量就是4.每个1M.

--//顺便附上rman的记录:

RMAN>

Starting backup at 2019-05-10 09:50:07

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=212 device type=DISK

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

input datafile file number=00010 name=/mnt/ramdisk/book/T02.dbf

input datafile file number=00011 name=/mnt/ramdisk/book/T03.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-10 09:50:08

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

channel ORA_DISK_1: finished piece 1 at 2019-05-10 09:51:23

piece handle=/home/oracle/backup/t123_1007891408_2eu16cug_1_1 tag=TAG20190510T095007 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15

channel ORA_DISK_1: throttle time: 0:01:06

Finished backup at 2019-05-10 09:51:23

--//备份启动2019-05-10 09:50:08,而 /mnt/ramdisk/book/T03.dbf的打开是延迟了2秒(OPEN_TIME=2019-05-10 09:50:10)


4.分析:

--//字母a b c 前数字对应id,行号.注意看的数字:100,83700,104800仅仅出现3种.表的建立方式一样的,出现在块中位置也应该一样.

COTT@book> select DBMS_ROWID.ROWID_BLOCK_NUMBER(rowid) block ,t01.* from t01 where id in (100,83700,104800);

     BLOCK         ID NAME

---------- ---------- ----------------------------------------

       131        100 000100aaaaaaaaaaaaaaaaaaaaaaaaaa

       642      83700 083700aaaaaaaaaaaaaaaaaaaaaaaaaa

       770     104800 104800aaaaaaaaaaaaaaaaaaaaaaaaaa


--//131*8192/1024/1024=1.0234375 0.0234375*1024*1024/8192 = 3

--//为什么是3,因为128,129,130 都是assm的位图区.130是段头(三级位图).也就是131前面3块没有aaaa字符串.

SCOTT@book> select SEGMENT_NAME,HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='T01';

SEGMENT_NAME         HEADER_FILE HEADER_BLOCK

-------------------- ----------- ------------

T01                            9          130


--//642*8192/1024/1024 = 5.01562500000000000000, 0.015625*1024*1024/8192 = 2

--//770*8192/1024/1024 = 6.01562500000000000000  0.015625*1024*1024/8192 = 2 


--//画一个表格(出现小写首次位置在数据文件中):

延迟时间     t01    t02   t03 

------------------------------

1             1     1       1 

2             6     5       1

3             6     5       1 

4             6     6       5

5             6     6       5 

------------------------------


--//总之不是一上来各个缓存全部装满,而是慢慢平衡到每个文件5M的input buffer.


--//我自己测试6个数据文件的情况:

  SELECT set_count

        ,device_type

        ,TYPE

        ,filename

        ,buffer_size

        ,buffer_count

        ,open_time

        ,close_time

    FROM v$backup_async_io

   where set_count=79

ORDER BY set_count

        ,TYPE

        ,open_time

        ,close_time;


 SET_COUNT DEVICE_TYPE TYPE      FILENAME                                            BUFFER_SIZE BUFFER_COUNT OPEN_TIME           CLOSE_TIME

---------- ----------- --------- --------------------------------------------------- ----------- ------------ ------------------- -------------------

        79 DISK        AGGREGATE                                                              0            0 2019-05-10 10:08:58 2019-05-10 10:10:10

        79 DISK        INPUT     /mnt/ramdisk/book/T01.dbf                               524288            5 2019-05-10 10:08:58 2019-05-10 10:10:10

        79 DISK        INPUT     /mnt/ramdisk/book/T02.dbf                               524288            5 2019-05-10 10:08:58 2019-05-10 10:10:10

        79 DISK        INPUT     /mnt/ramdisk/book/T03.dbf                               524288            5 2019-05-10 10:08:59 2019-05-10 10:10:10

        79 DISK        INPUT     /mnt/ramdisk/book/T04.dbf                               524288            5 2019-05-10 10:09:00 2019-05-10 10:10:10

        79 DISK        INPUT     /mnt/ramdisk/book/T05.dbf                               524288            5 2019-05-10 10:09:01 2019-05-10 10:10:10

        79 DISK        INPUT     /mnt/ramdisk/book/T06.dbf                               524288            5 2019-05-10 10:09:02 2019-05-10 10:10:10

        79 DISK        OUTPUT    /home/oracle/backup/t123456_1007892538_2fu16e1q_1_1     1048576           4 2019-05-10 10:08:58 2019-05-10 10:10:10

8 rows selected.

--//512k*5=2.5M.


--//5个数据文件的情况:

SET_COUNT DEVICE_TYPE TYPE      FILENAME                                             BUFFER_SIZE BUFFER_COUNT OPEN_TIME           CLOSE_TIME

--------- ----------- --------- ---------------------------------------------------- ----------- ------------ ------------------- -------------------

       80 DISK        AGGREGATE                                                                0            0 2019-05-10 10:12:34 2019-05-10 10:13:34

       80 DISK        INPUT     /mnt/ramdisk/book/T01.dbf                                 524288            6 2019-05-10 10:12:34 2019-05-10 10:13:34

       80 DISK        INPUT     /mnt/ramdisk/book/T02.dbf                                 524288            6 2019-05-10 10:12:34 2019-05-10 10:13:34

       80 DISK        INPUT     /mnt/ramdisk/book/T03.dbf                                 524288            6 2019-05-10 10:12:35 2019-05-10 10:13:34

       80 DISK        INPUT     /mnt/ramdisk/book/T04.dbf                                 524288            6 2019-05-10 10:12:36 2019-05-10 10:13:34

       80 DISK        INPUT     /mnt/ramdisk/book/T05.dbf                                 524288            6 2019-05-10 10:12:37 2019-05-10 10:13:34

       80 DISK        OUTPUT    /home/oracle/backup/t123456_1007892754_2gu16e8i_1_1      1048576            4 2019-05-10 10:12:34 2019-05-10 10:13:34

7 rows selected.

--//注意看OPEN_TIME时间. 512k*6=3M.


--//10个数据文件的情况:

new RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 512 K;

new RMAN configuration parameters are successfully stored

released channel: ORA_DISK_1


SET_COUNT DEVICE_TYPE TYPE      FILENAME                                             BUFFER_SIZE BUFFER_COUNT OPEN_TIME           CLOSE_TIME

--------- ----------- --------- ---------------------------------------------------- ----------- ------------ ------------------- -------------------

       82 DISK        AGGREGATE                                                                0            0 2019-05-10 10:28:00 2019-05-10 10:30:00

       82 DISK        INPUT     /mnt/ramdisk/book/T01.dbf                                 524288            4 2019-05-10 10:28:00 2019-05-10 10:29:36

       82 DISK        INPUT     /mnt/ramdisk/book/T02.dbf                                 524288            4 2019-05-10 10:28:00 2019-05-10 10:29:37

       82 DISK        INPUT     /mnt/ramdisk/book/T03.dbf                                 524288            4 2019-05-10 10:28:01 2019-05-10 10:29:38

       82 DISK        INPUT     /mnt/ramdisk/book/T04.dbf                                 524288            4 2019-05-10 10:28:02 2019-05-10 10:29:38

       82 DISK        INPUT     /mnt/ramdisk/book/T05.dbf                                 524288            4 2019-05-10 10:28:03 2019-05-10 10:29:38

       82 DISK        INPUT     /mnt/ramdisk/book/T06.dbf                                 524288            4 2019-05-10 10:28:04 2019-05-10 10:29:38

       82 DISK        INPUT     /mnt/ramdisk/book/T07.dbf                                 524288            4 2019-05-10 10:28:05 2019-05-10 10:29:38

       82 DISK        INPUT     /mnt/ramdisk/book/T08.dbf                                 524288            4 2019-05-10 10:28:06 2019-05-10 10:29:38

       82 DISK        INPUT     /mnt/ramdisk/book/T09.dbf                                 524288            4 2019-05-10 10:29:36 2019-05-10 10:30:00

       82 DISK        INPUT     /mnt/ramdisk/book/T10.dbf                                 524288            4 2019-05-10 10:29:37 2019-05-10 10:30:00

       82 DISK        OUTPUT    /home/oracle/backup/ta_1007893680_2iu16f5g_1_1           1048576            4 2019-05-10 10:28:00 2019-05-10 10:30:00

12 rows selected.

--//512k*4=2M.

--//你可以T09,T10的备份分别是2019-05-10 10:29:36,2019-05-10 10:29:37开始的.你可以看出大于8个文件备份的情况.

--//先备份8个完成后在备份剩余2个,并且不会因为最后剩下2个改变BUFFER_SIZE的大小.

--//顺便说一下书中讲的大于8个数据文件的备份不对.

--//链接中提到的http://blog.itpub.net/267265/viewspace-2147878/文档:

■ If the number of files being multiplexed is greater than eight, then RMAN allocates four 

   buffers of size 128KB. This ensures that each file being backed up will account for 512KB 

   of buffer memory.

--//这个不对.没有128K的input buffer memory.


$ strings /home/oracle/backup/ta_1007893680_2iu16f5g_1_1 | tr 'abcdefghij' 'ABCDEFGHIJK' | egrep 'AAAAA|BBBBB|CCCCC|DDDDD|EEEE|FFFF|FFFF|GGGG|HHHH|IIII|JJJJ'| cut -c20-30 | uniq -c

   9978 AAAAAAAAAAA

   9978 BBBBBBBBBBB

   9978 CCCCCCCCCCC

   9978 DDDDDDDDDDD

   9978 EEEEEEEEEEE

   9978 FFFFFFFFFFF

   9978 GGGGGGGGGGG

   9978 HHHHHHHHHHH

  10080 AAAAAAAAAAA

  10080 BBBBBBBBBBB

  10080 CCCCCCCCCCC

  10080 DDDDDDDDDDD

  10080 EEEEEEEEEEE

  10080 FFFFFFFFFFF

  10080 GGGGGGGGGGG

  10080 HHHHHHHHHHH

  10416 AAAAAAAAAAA

  10416 BBBBBBBBBBB

  10416 CCCCCCCCCCC

  10416 DDDDDDDDDDD

  10416 EEEEEEEEEEE

  10416 FFFFFFFFFFF

  10416 GGGGGGGGGGG

  10416 HHHHHHHHHHH

  10752 AAAAAAAAAAA

  10752 BBBBBBBBBBB

  10752 CCCCCCCCCCC

  10752 DDDDDDDDDDD

  10752 EEEEEEEEEEE

  10752 FFFFFFFFFFF

  10752 GGGGGGGGGGG

  10752 HHHHHHHHHHH

  10416 AAAAAAAAAAA

  10416 BBBBBBBBBBB

  10416 CCCCCCCCCCC

  10416 DDDDDDDDDDD

  10416 EEEEEEEEEEE

  10416 FFFFFFFFFFF

  10416 GGGGGGGGGGG

  10416 HHHHHHHHHHH

  10752 AAAAAAAAAAA

  10752 BBBBBBBBBBB

  10752 CCCCCCCCCCC

  10752 DDDDDDDDDDD

  10752 EEEEEEEEEEE

  10752 FFFFFFFFFFF

  10752 GGGGGGGGGGG

  10752 HHHHHHHHHHH

  10416 AAAAAAAAAAA

  10416 BBBBBBBBBBB

  10416 CCCCCCCCCCC

  10416 DDDDDDDDDDD

  10416 EEEEEEEEEEE

  10416 FFFFFFFFFFF

  10416 GGGGGGGGGGG

  10416 HHHHHHHHHHH

  10752 AAAAAAAAAAA

  10752 BBBBBBBBBBB

  10752 CCCCCCCCCCC

  10752 DDDDDDDDDDD

  10752 EEEEEEEEEEE

  10752 FFFFFFFFFFF

  10752 GGGGGGGGGGG

  10752 HHHHHHHHHHH

  10416 AAAAAAAAAAA

  10416 BBBBBBBBBBB

  10416 CCCCCCCCCCC

  10416 DDDDDDDDDDD

  10416 EEEEEEEEEEE

  10416 FFFFFFFFFFF

  10416 GGGGGGGGGGG

  10416 HHHHHHHHHHH

   6022 AAAAAAAAAAA

   6022 BBBBBBBBBBB

   6022 CCCCCCCCCCC

   6022 DDDDDDDDDDD

   6022 EEEEEEEEEEE

   6022 FFFFFFFFFFF

   6022 GGGGGGGGGGG

   6022 HHHHHHHHHHH

   9978 IIIIIIIIIII

   9978 JJJJJJJJJJJ

  10080 IIIIIIIIIII

  10080 JJJJJJJJJJJ

  10416 IIIIIIIIIII

  10416 JJJJJJJJJJJ

  10752 IIIIIIIIIII

  10752 JJJJJJJJJJJ

  10416 IIIIIIIIIII

  10416 JJJJJJJJJJJ

  10752 IIIIIIIIIII

  10752 JJJJJJJJJJJ

  10416 IIIIIIIIIII

  10416 JJJJJJJJJJJ

  10752 IIIIIIIIIII

  10752 JJJJJJJJJJJ

  10416 IIIIIIIIIII

  10416 JJJJJJJJJJJ

   6022 IIIIIIIIIII

   6022 JJJJJJJJJJJ

--//可以发现T09,T10是最后备份的,这也是我强调设置的filesperset最大=8,小数据可以选择4.

--//不然如果单独恢复T09,T10会做大量的无用功.读取前面大量的无关信息.


5.测试脚本如下:

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK  clear;

old RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 512 K;

old RMAN configuration parameters are successfully deleted

released channel: ORA_DISK_1


--//d10.sql

$ cat d10.sql

drop tablespace t01 including contents and datafiles;

drop tablespace t02 including contents and datafiles;

drop tablespace t03 including contents and datafiles;

drop tablespace t04 including contents and datafiles;

drop tablespace t05 including contents and datafiles;

drop tablespace t06 including contents and datafiles;


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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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


alter system checkpoint;

alter system checkpoint;

alter system checkpoint;


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2643892/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2435
  • 访问量
    6215758