Use the following steps to create an Oracle database that uses shared Raw I/O devices instead of files.
- Determine the minimum number and sizes of files that you will need to create your database, including control files, tablespaces and redologs. You can create a mixed setup with some of those items as files and others on Raw I/O devices. All of the Raw I/O devices must use shared disk partitions.
- Create a Raw I/O setup with the necessary number of Raw I/O devices.
a. Create the raw devices with the same size or larger than you are going to specify for the Oracle database creation.
b. Create raw device mappings in the system initialization file(i.e. boot.local or rc.local) using the raw command. You should add meaningful comments to identify which raw device represents which Oracle file. This is done so that the mapping can be re-established in the case of a re-boot of the system. These mappings should be removed from the file manually once the Raw I/O device is under LifeKeeper protection.
- Make the raw devices writable for the Oracle database using the following command:
chown oracle:dba /dev/raw[0-9]*
where the owner and group are specific to your Oracle instance’s configuration.
- Activate the raw device settings by executing the file that contains the mappings.
- If you already have a database creation script, go directly to Step 6. If not, you may use one of the Oracle Java GUI tools, dbassist or dbca, to generate your database creation scripts. Using either tool, you must choose to “Save As Script”. Do not choose to create the database.
Notes:
- In dbca, the “New Database” template must be selected to generate scripts. Change filenames to shared devices and adjust the values for your configuration if necessary.
- The DB creation process should not be started at this point! The dbassist tool checks to see if the file specified for each tablespace already exists and will not proceed if it does. The dbca tool prompts to confirm that it will overwrite the files but fails on raw devices. In either case, you are unable to use raw devices directly from these tools.
- The database creation scripts (either the existing ones or those created by dbassist or dbca) must be edited. The desired filename (including the path) must be replaced with the full path name of the Raw I/O device. The affected files should include (at minimum) the file’s database creation file (for the CREATE DATABASE command) and tablespace creation file (for the CREATE TABLESPACE command). Depending on what options you selected in dbassist or dbca, there may more files to be edited. Also, edit the initialization file to change the control files to Raw I/O devices, if desired. The initialization file is located in the directory with the creation script. The result looks like this for the data file:
. . .
CREATE DATABASE “LK”
maxdatafiles 254
maxinstances 8
maxlogfiles 32
character set US7ASCII
national character set US7ASCII
DATAFILE ‘/dev/raw/raw1’ SIZE 260M AUTOEXTEND ON NEXT 10240K
logfile ‘/ora/LK/redo01.log’ SIZE 500K,
‘/ora/LK/redo02.log’ SIZE 500K,
‘/ora/LK/redo03.log’ SIZE 500K;
. . .
The Raw I/O device must be the minimum size required by Oracle for the data that will be stored.
- Now create the database by running the script that you created in step #5.
- Be sure to check the create log for any database or tablespace errors that may have occurred.
- If you have trouble creating the database with the creation scripts, or you want to add tablespaces on raw devices later, you must create the database with the applicable tool (i.e. dbassist or dbca). Then, add the Raw I/O device data files by executing a command similar to the following from the sql utility:
tablespace RAWTS
DATAFILE ‘/dev/raw/raw217’ SIZE 50M REUSE
DEFAULT STORAGE (INITIAL 50K NEXT 50K
MINEXTENTS 1 MAXEXTENTS 4) ONLINE
- Add udev rules to make the raw device permissions and ownership persistent across reboots, switchovers and failovers.
In the Linux 2.6 kernel, the udev system is the default method through which the kernel controls the creation of the special files such as raw devices. When used by Oracle, raw devices require specific ownership and permission settings. These specific settings conflict with the kernel default settings. Addressing the specific settings requires the use of udev rules to set the ownership of the raw device to the Oracle user and Oracle group used with the LifeKeeper protected Oracle SID.
Note: In some OS distributions, rules for creating devices and rules for setting device permissions must be separate. Check your OS distribution udev documentation for more information.
The following are example udev rules that may work for your OS distribution:
KERNEL==“raw10”, RUN+=”/bin/chown oracle:oinstall /dev/raw/raw10”
KERNEL==“raw[3-5]*”, OWNER=“oracle”, GROUP=“oinstall”, MODE=“660”
The udev rules created must be applied to all nodes in the LifeKeeper cluster prior to bringing the resource hierarchy into service.
Post your comment on this topic.