20 answers to questions about bare devices and Oracle
GuideA bare device, also called a raw partition, is a special character device that is not formatted and not read by Unix through a file system. A bare device can be bound to either a partition or a disk. This article collects 20 questions and answers from bare devices and Oracle.1. What is a bare device?
A bare device, also called a raw partition, is a special character device that is not formatted and not read by Unix through a file system. It is read and written by the application. It is not buffered by the file system.
2. How to identify bare devices?In the Unix/dev directory, there are many files, including two categories: character device files and block device files. Special files of character devices perform I/O operations without passing through the buffer zone of the operating system, while special files of Block devices are used to transmit packets of fixed length with peripherals. Only one character is transmitted at a time when special character files and peripherals perform I/o operations. For special files on a block device, the cache mechanism is used to transmit a whole piece of data at a time between the peripherals and the memory. Bare devices use special character files. In the/dev directory, you can see many such files.
3. What are the benefits of using bare devices?Because the bare device does not pass through the Unix operating system, data is transmitted directly from Disk to Oracle. Therefore, the bare device is used for database applications with frequent reads and writes, it can greatly improve the performance of the database system. Of course, this is true when the disk I/O is very large and the disk I/O is already known as a system bottleneck. If the disk read/write operation is so frequent that the disk read/write operation becomes the bottleneck of the system, the use of bare devices can greatly improve the performance, up to or even up to 40%, which is very obvious. In addition, because the original partition is used and the file system management method is not used, the overhead for Unix file system maintenance is also gone, for example, I-node maintenance is not required, idle blocks, which can also improve the performance.
4. How can I determine whether to use a bare device?To determine whether a bare device is used, consider the following: first, the database system itself needs to be well optimized. Optimization is a topic of some technologies, which is hard to be described simply. Second, use Unix commands to identify whether there is a disk read/write bottleneck. For example, commands such as Unix vmstat and sar can be well identified. If you decide to use bare devices, you need to have free partitions on the disk. Otherwise, you need to add a new disk or re-plan the original system.
5. What systems must use bare devices?If you use the Oracle Parallel Server option, you must use bare devices to store all data files, control files, and redo log files. Only by placing these files on bare devices can all Oracle instances read the files in the database. This is determined by the characteristics of Unix operating systems. Another case is that if you want to use asynchronous I/O, you must also use bare devices on Some Unix systems. For more information about Unix, see.
6. Can I use the first partition of a disk as a bare device?Yes, but not recommended. The old version of Unix is a bank. The first partition of a disk often contains some information about the disk and some control information about the logical volume. If these parts are overwritten by bare devices, the disk will become unrecognizable and cause system crash. This is not the case for newer Unix versions because they use more complex technologies to manage disk and logical volume information. However, unless you are sure not to use the first partition of the disk as a bare device.
7. Can I use the entire bare device as an Oracle data file?No. The data file size must be slightly smaller than the actual size of the bare device. At least two oracle blocks must be empty.
8. Which user should the bare device belong?The root user should create bare devices and distribute them to Oracle users for use. At the same time, it should be included in the group where the Oracle user is located (generally DBA ).
9. How do I specify a bare device when creating a data file?There is no big difference with a common file. In the same way, you can write the detailed path of the bare device in single quotes. For example, to create a tablespace, use two bare devices, each of which is 30 mb and the Oracle block is 4 kb. Run the following command:
Create tablespace RAW_TS
DATAFILE '/dev/raw1' size 30712 k
DATAFILE '/dev/raw2' size 30712 k;
10. What is the relationship between the size of Oracle blocks and bare devices?Oracle must be a multiple of the physical block size on the bare device.
11. How to back up data on bare devices?On bare devices, you cannot use Unix utilities for backup. The only way is to use the most basic Unix Command: DD for backup. For example, dd if =/dev/raw1 of =/dev/rmt0 bs = 16 k. For detailed dd syntax, refer to the unix manual or the online help. You can also back up the data files on the bare device to the disk with dd, and then use the Unix utility for further processing.
12. If I do not use the Oracle Parallel Server option, can I use a file system for some data files in the database and a bare device for the other part?Yes. However, this will make the backup process more complex.
13. Should I put online redo log files on bare devices?This is an excellent choice. Online redo log files are frequently written and suitable for storing on bare devices. If you use the parallel server option, the online redo log file must be placed on the bare device.
14. Can I put the archive log file on a bare device?No. Archive log files must be stored on the conventional Unix file system or directly on the tape.
15. Can I place multiple data files on a bare device?No. Therefore, you must be very careful when setting bare devices. If it is too small, the space will soon be used up. If it is too large, the space will be wasted.
16. Should I put several bare devices on the same physical disk?This is not good. Because the bare device is used to increase the disk read/write speed. However, placing multiple bare devices on the same physical disk will lead to read/write competition, which is not conducive to improving the I/O speed. Try to distribute bare devices to different physical disks, preferably to different disk controllers. This is the best choice.
17. Do I need to define all bare devices as the same size?This is not mandatory, but dividing it into the same size is advantageous for database management.
18. Do I need to change the Unix core parameters to use bare devices on Unix?No. However, you can reduce the buffer size. If no other application runs on the same Unix machine. Since bare devices are used, Unix system buffers are no longer used.
19. Is there any way to improve the read/write speed at the operating system level?RAID (cheap redundant disk array) is also a very effective method, especially for systems with very frequent reads and writes.
20. After considering all the above aspects, is there any way to improve the performance?This requires optimizing Oracle and purchasing more disks and disk controllers to distribute I/O to different disks.
From: http://www.chinaunix.net/old_jh/19/272188.html
Address: http://www.linuxprobe.com/linux-raw.html