How to Choose Size of Datafile on Raw Device

zhanglei_itput發表於2010-03-31

How to Choose Size of Datafile on Raw Device

一、目標
goal: How to choose size of datafile on raw device

二、NOTE
When a datafile on raw device is created, its size (e.i. the number you use in the CREATE TABLESPACE statement) has to be less than the size of the raw device.

三、描述
Let us assume this:
- size of the raw device is N bytes
- size of the database block is D bytes
- size of the Logical Volume Control Block (LVCB) is L bytes

Note: Provided the raw device is a standard UNIX partition, then consider L=0.
Otherwise (e.i. you use Logical Volume Manager and the raw device is a Logical
volume), the size of L will be platform. dependent.
For example:

 On AIX  : size of LVCB is 4k  ... choose L=4096
 On Tru64: size of LVCB is 64k ... choose L=65536

Check the OS vendor for details regarding the configuration.

To compute size of the datafile, distract both L (size of the LVCB, that may be
stored at the head of the Logical volume) and D (one database block, that is
used as an OS file header) from N (size of the raw device).

Then round the result down to the size of a database block.

Use this query to get the result:

SQL> select trunc((N-L-D)/D)*D  "SIZE" from dual;

Example:

I would like to create a raw datafile on a Logical volume /dev/vg00/rkamtest of
size 1000000 bytes, on AIX. Size of the database block is 8k.

SQL> select trunc((1000000-4096-8192)/8192)*8192 "SIZE" from dual&
#059;

      SIZE
----------
    983040

Then the size I will use is 983040:

SQL> CREATE TABLESPACE test DATAFILE '/dev/vg00/rkamtest' size 983040;

參考文獻:
1. How to Choose Size of Datafile on Raw Device [ID 153897.1]

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9252210/viewspace-630899/,如需轉載,請註明出處,否則將追究法律責任。

相關文章