Oracle Study -- RAW Device application in Oracle

Source: Internet
Author: User

Oracle Study -- RAW Device application in Oracle

1. What is a raw device)

A bare device is a raw partition or raw logical volume that has not been created for a file system. An application accesses it directly through a character device driver. How to read and write data on the device depends on the application that uses it. Because operations on bare devices do not pass through the unix buffer, data is directly transferred between the Oracle data BUFFER (buffer cache) and the disk, therefore, the use of bare devices can improve I/O performance to a certain extent, and is suitable for systems with large I/O volumes. In addition, in OPS/RAC (Oracle Parallel Server/Real Application Cluster) environments, multiple nodes simultaneously access the same database, therefore, control file, data file, and redo log must all be created on the raw device.

2. available space for bare Devices

Different UNIX systems do not have the same management of bare devices. In particular, Some UNIX systems need to retain a certain amount of space in the header of each bare device, applications cannot overwrite this part when using a bare device; otherwise, it may cause damage to the bare device. Therefore, the actual available space of a bare device is the space allocated to the bare device and then the reserved space of this part of the operating system. The following is a list of commonly used unix OS Reserved Size:

Unix OS Reserved Size
----------------------------
SUN Solaris 0
HP-UX 0
Ibm aix 4 k
Tru64 UNIX 64 k
Linux 0

3. dd command

For read/write bare devices on UNIX, commands such as cp, cpio, and tar cannot be used. dd is required. Below are some simple descriptions of common dd parameters, for more information, see the UNIX user manual or use the man dd command.
Dd [operand = value...]
If = file specifies the input file. The default value is standard input.
Of = file specifies the output file. The default value is standard output.
Bs = n set the size of the input and output blocks to n Bytes. You can also use "k" as the unit.
Skip = n skip n input blocks before copying. The default value is 0.
Seek = n skip n blocks from the output file header before copying. The default value is 0.
Count = n indicates the number of copies. By default, the copy ends with the input file.

4. Create available data file space on raw

SQL> CREATE TABLESPACE ts_test DATAFILE '/dev/rlv_data' SIZE 8180 k;
The value specified by SIZE must be less than or equal to 8180 k; otherwise, the statement will fail:
ORA-01119: error in creating database file '/dev/rlv_data'
ORA-27042: not enough space on raw partition to fullfill request
The maximum value is calculated as follows:
8192 k (raw device size)-4 k (OS _RESERVED_SIZE)-8 k (DB_BLOCK_SIZE) = 8180 k
Why do we need to subtract a DB_BLOCK_SIZE? This is because when ORACLE creates a DATAFILE, in addition to the SIZE specified in the command, it also adds a BLOCK to the file Header, which is called "Oracle OS Header Block ", contains the logical block size and number of file blocks of the file. This is not exclusive to DATAFILE on raw device. If you create a DATAFILE on the file system and specify a SIZE of KB, the file size you can see using the ls-l or dir command will be 1008 k (DB_BLOCK_SIZE = 8 K ).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.