[20190510]rman備份的疑問7.txt

lfree發表於2019-05-10

[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章