DBA Tips Archive for Oracle

  


Install Oracle Database 10g R1 on Linux using ASM - (RHEL 4)

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. Hardware Overview
  3. About CentOS 4.0 Enterprise Linux
  4. Downloading CentOS 4.0 Enterprise Linux
  5. Installing CentOS 4.0 Enterprise Linux
  6. Operating System Configuration
  7. Disk Configuration - (Internal Disk for ORACLE_HOME)
  8. Configuring the Oracle User
  9. Disk Configuration - (External Disks for ASM)
  10. Installing the Oracle10g Database Software
  11. Applying the 10.1.0.4 Database Patchset
  12. Configure Oracle Net
  13. Creating the Oracle Database
  14. Creating / Altering Tablespaces
  15. Setting up Automatic Database Starting & Stopping
  16. Miscellaneous Options
  17. About the Author



Overview

This article is a comprehensive guide for installing Oracle Database 10g Release 1 on the Red Hat Enterprise Linux 4 (RHEL4) operating environment.

Please keep in mind that this article should not be considered a substitution for completely reading and understanding the official installation guide and release notes from Oracle. The following links can be used to download the official installation guides for Oracle10g Release 1 (10.1.0):

  Oracle Database 10g Release 1 (10.1) Documentation
  Oracle Database Quick Installation Guide 10g Release 1 (10.1.0.3) for Linux x86 - (B10814-01)
Here is a short introduction to some of the configuration parameters that will be used for installing the Oracle Database Software and creating a fully functional Oracle10g database:


By the time you finish this article, the following will be configured:


The following is a list of items NOT covered in this article:


  Although this article is titled and introduced to work with Red Hat Enterprise Linux 4.0, I will actually be using a Red Hat Linux clone named CentOS. To read more about about CentOS, please visit their website at www.centos.org. I will also provide additional details about CentOS along with installation instructions later in this article.



Hardware Overview

For the purpose of this document, I will be utilizing a Pentium 4 (32-bit Clone) running CentOS Release 4.0. The Pentium 4 server will be connected to a Sun StorEDGE D1000 Dual Channel Disk Array with access to one channel containing six 9.1GB / 10000 RPM / UltraSCSI disk drives for a total disk array capacity of 54GB. The disk array is connected to the Pentium 4 server using a Dual Differential Ultra/Wide SCSI (X6541A) host adapter.

The Pentium 4 server and Sun StorEDGE D1000 Disk Array are configured as follows:

Machine Name: linux3.idevelopment.info
IP Address: 192.168.1.107
Processor: Pentium 4 - (1.8 GHz.)
Operation Environment: CentOS Release 4 - (32-bit)
Memory: 1 GB
Internal Disks: 2 x 40GB IDE hard drives identified as follows:
  • /dev/hda
  • /dev/hdb
D1000 Disk Array: 6 x 9.1GB Ultra SCSI hard drives identified as follows:
  • /dev/sda
  • /dev/sdb
  • /dev/sdc
  • /dev/sdd
  • /dev/sde
  • /dev/sdf


After discussing the hardware being utilized for this article, I end this section by describing how each of the disks will be used for the database software installation and database:

Device Type Size - (GB) Usage Mount Point /
ASM Disk Group
hda Internal 40 CentOS Release 4 Operating System /
hdb Internal 40 Oracle 10g Database Software.
  • ORACLE_BASE: /u01/app/oracle
  • ORACLE_HOME: /u01/app/oracle/product/10.1.0/db_1
/u01
sda D1000 Disk Array 9.1 ASM Disk Group 1 TESTDB_DATA1
sdb D1000 Disk Array 9.1 ASM Disk Group 1 TESTDB_DATA1
sdc D1000 Disk Array 9.1 ASM Disk Group 1 TESTDB_DATA1
sdd D1000 Disk Array 9.1 ASM Disk Group 2 TESTDB_DATA2
sde D1000 Disk Array 9.1 ASM Disk Group 2 TESTDB_DATA2
sdf D1000 Disk Array 9.1 ASM Disk Group 2 TESTDB_DATA2



About CentOS 4.0 Enterprise Linux

Although I have used Red Hat Fedora and Red Hat Enterprise Linux in the past, I wanted to switch to a Linux environment that would guarantee all of the functionality contained with Oracle -- and have it for free! This is where CentOS comes in. The CentOS Linux project takes the Red Hat 4.0 source RPMs, and compiles them into a free clone of the Red Hat Enterprise Server 4.0 product. This provides a free and stable version of the Red Hat Enterprise 4.0 operating environment for testing different Oracle configurations. Over the past year, I have been moving away from Fedora as I need a stable environment that is not only free, but as close to the actual Oracle supported operating system as possible. While CentOS is not the only project performing the same functionality, I tend to stick with it as it is stable and has been around for a long time. Here is a list of others that perform the same functionality as CentOS:

    CentOS
    Pink Tie Linux
    White Box Enterprise Linux
    Lineox Enterprise Linux
    Tao Linux



Downloading CentOS 4.0 Enterprise Linux

Use the following link(s) to download CentOS Release 4.0:
   CentOS Release 4.0 - Downloads
        Disk1    (629,634 KB)
        Disk2    (651,234 KB)
        Disk3    (649,554 KB)
        Disk4    (232,380 KB)


  If you are downloading the above ISO files to a MS Windows machine, there are many options for burning these images (ISO files) to a CD. You may already be familiar with and have the proper software to burn images to CD. If you are not familiar with this process and do not have the required software to burn images to CD, here are just two (of many) software packages that can be used:

  UltraISO
  Magic ISO Maker



Installing CentOS 4.0 Enterprise Linux

This section provides a summary of the screens used to install CentOS 4.0. For more detailed installation instructions, it is possible to use the manuals from Red Hat Linux http://www.redhat.com/docs/manuals/. I would suggest, however, that the instructions I have provided below be used for this Oracle10g configuration.

After downloading and burning the CentOS 4.0 images (ISO files) to CD, insert Disk #1 into the server (linux3 in this example), power it on, and answer the installation screen prompts as noted below.

Boot Screen

The first screen is the CentOS Linux boot screen. At the boot: prompt, hit [Enter] to start the installation process.
Media Test
When asked to test the CD media, tab over to [Skip] and hit [Enter]. If there were any errors, the media burning software would have warned us. After several seconds, the installer should then detect the video card, monitor, and mouse. The installer then goes into GUI mode.
Welcome to CentOS Linux
At the welcome screen, click [Next] to continue.
Language / Keyboard / Mouse Selection
The next three screens prompt you for the Language, Keyboard, and Mouse settings. Make the appropriate selections for your configuration.
Upgrade Examine - (Optional)
If the installer detects an already installed version of CentOS 4.0 Linux, it will prompt to either perform a fresh install (which will overwrite the current old install) or to Upgrade an existing installation. Select the first option which is to Install CentOS 4.0 and click [Next] to continue.
Installation Type
Choose the [Custom] option and click [Next] to continue.
Disk Partitioning Setup
Select [Automatically partition] and click [Next] continue.

If the installer detects a previous installation of Linux on this machine, the next screen will ask if you want to "remove" or "keep" old partitions. Select the option to [Remove all partitions on this system].

NOTE: In this screen, ensure that ONLY the [hda] drive is selected for this installation in the "Select the drive(s) to use for this installation" window. The installer will check all available drives to perform the installation on. I will be using these drives for Oracle specific tasks to be described later in this article. All disk configuration operations will be performed manually to bring the second internal IDE drive and the SCSI disks in the array online.

I also keep the checkbox [Review (and modify if needed) the partitions created] selected. Click [Next] to continue.

You will then be prompted with a dialog window asking if you really want to remove all partitions. Click [Yes] to acknowledge this warning.

Partitioning
The installer will then allow you to view (and modify if needed) the disk partitions it automatically selected. In most cases, the installer will choose 100MB for /boot, double the amount of RAM for swap, and the rest going to the root (/) partition. I like to have a minimum of 1GB for swap. For the purpose of this install, I will accept all automatically preferred sizes. (Including 2GB for swap since I have 1GB of RAM installed.)

For RHEL 4, the installer will create the disk configuration described above but will create it using the Logical Volume Manager (LVM). For example, it will partition the first hard drive (/dev/hda for my configuration) into two partitions - one for the /boot partition (/dev/hda1) and the remainder of the disk dedicate to a LVM named VolGroup00 (/dev/hda2). The LVM Volume Group (VolGroup00) is then partitioned into two LVM partitions - one for the root file system (/) and another for swap. I basically check that it created at least 1GB of swap. Since I have 1GB of RAM installed, the installer created 2GB of swap. Saying that, I just accept the default disk layout.

NOTE: When I selected the Automatic partitioning option, the installer attempted to create partitions and file systems on the second internal IDE drive (/dev/hdb) and all six SCSI disks (/dev/sd[a-f]) in the array by using my previous disk configuration options. The option to create partitions (and file systems) on these disks MUST be deleted as I will be manually performing these actions later in this article. This is especially important for the six SCSI disks since they cannot contain partitions (or file systems) in order to be discovered and configured as ASM disks. First, I selected to [Delete] the RAID Device I had created in the previous install named md0. I then clicked on the second internal IDE drive partition (/dev/hdb1) and removed the option to create the ext3 file system. (This marks the disk with a single Free entry with free space of 38167 MB). Last, I had to remove all partition and file system options for the six SCSI disks. By default, the installer selected to configure them with "software RAID" on the first partition. Click on the disk partition for all six disks and [Delete] them. When all complete, the only partitions that should be created are the two partitions on the first IDE disk (/dev/hda1 and /dev/hda2) described earlier in this section.

Boot Loader Configuration
The installer will use the GRUB boot loader by default. To use the GRUB boot loader, accept all default values and click [Next] to continue.
Network Configuration
I made sure to install the NIC interface (network card) in the Linux server before starting the operating system installation. This screen should have successfully detected all network devices.

First, make sure that the network device(s) are checked to [Active on boot]. If you have two network cards, the installer may choose to not activate the second one (eth1). For this installation, I am only using one network interface - eth0.

Second, [Edit] eth0 as follows:

eth0:
- Check off the option to [Configure using DHCP]
- Leave the [Activate on boot] checked
- IP Address: 192.168.1.107
- Netmask: 255.255.255.0

Continue by setting your hostname manually. I used "linux3" for this node. Finish this dialog off by supplying your gateway and DNS servers.

Firewall
On this screen, make sure to check [No firewall] and click [Next] to continue.

You will then need to confirm the Warning dialog box. Click [Proceed] to continue with the installation.

Additional Language Support / Time Zone
The next two screens allow you to select additional language support and time zone information. In almost all cases, you can accept the defaults.
Set Root Password
Select a root password and click [Next] to continue.
Package Group Selection
Scroll down to the bottom of this screen and select [Everything] under the Miscellaneous section. Click [Next] to continue.

On some RHEL 4 installations, you will not get the "Package Group Selection" screen by default. Instead, you are asked to simply "Install default software packages" or "Customize software packages to be installed". Select the option to "Customize software packages to be installed" and click [Next] to continue. This will then bring up the "Package Group Selection" screen. Now, scroll down to the bottom of this screen and select [Everything] under the "Miscellaneous" section. Click [Next] to continue.

About to Install
This screen is basically a confirmation screen. Click [Next] to start the installation. During the installation process, you will be asked to switch disks to Disk #2, Disk #3 and then Disk #4. With the official release of RHEL 4, it will ask for Disk #1 after completing with Disk #4. CentOS 4.0 does not ask for Disk #1 again.
Congratulations
And that's it. You have successfully installed CentOS 4.0 Linux. The installer will eject the CD from the CD-ROM drive. Take out the CD and click [Exit] to reboot the system.

When the system boots into Linux for the first time, it will prompt you with another Welcome screen. The following wizard allows you to configure the date and time, add any additional users, testing the sound card, and to install any additional CDs. The only screens I care about are the time and date and display resolution settings. As for the others, simply run through them as there is nothing additional that needs to be installed (at this point anyways!). If everything was successful, you should now be presented with the login screen.



Operating System Configuration

This section describes the steps and requirements that should be performed by the DBA as it relates to the Linux operating system before performing the Oracle Database 10g software. Keep in mind that the following steps need to be performed by the root user account.

Login as root

% su -


RAM Memory

Installing Oracle Database 10g on Linux requires a minimum of 512MB of memory. I highly recommend installing at least 1GB of memory when running Oracle 10g. Although 512MB will work, it is extremely tight.

To check the amount of memory you have installed, type:

# cat /proc/meminfo | grep MemTotal
MemTotal:      1035324 kB


Swap Space

The following is Oracle's requirement for swap space:

Available RAM Swap Space Required
Between 1 GB and 2 GB 1.5 times the size of RAM
Between 2 GB and 8 GB Equal to the size of RAM
More than 8 GB .75 times the size of RAM

(An inadequate amount of swap during the installation will cause the Oracle Universal Installer to either "hang" or "die")

To check the amount of memory you have, type:

# cat /proc/meminfo | grep MemTotal
MemTotal:      1035324 kB

To check the amount of swap you have allocated, type:

# cat /proc/meminfo | grep SwapTotal
SwapTotal:     2031608 kB

  If you have less than 1GB of memory (between your RAM and SWAP), you can add temporary swap space by creating a temporary swap file. This way you do not have to use a raw device or even more drastic, rebuild your system.

As root, make a file that will act as additional swap space, let's say about 500MB:
# dd if=/dev/zero of=tempswap bs=1k count=500000

Now we should change the file permissions:
# chmod 600 tempswap

Finally we format the "partition" as swap and add it to the swap space:
# mke2fs tempswap
# mkswap tempswap
# swapon tempswap


Checking /tmp Directory

Ensure enough disk space in the /tmp directory. An amount of disk space equal to 400 MB (or greater) needs to be available for the Oracle Database installation.

To check the amount of free disk available in the /tmp directory, type:

# df -h /tmp
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       35G  6.2G   27G  19% /

  If 1 GB or more is not available in /tmp, you can create a "tmp" directory in another file system, then set the environment variables TMP (used by Oracle) and TMPDIR (used by operating system programs like the linker "ld" and library archiver "ar") to point to this location. For example:
# mkdir /u01/app/oracle/tmp
# TEMP=/u01/app/oracle/tmp; export TEMP
# TMPDIR=/u01/app/oracle/tmp; export TMPDIR


Checking Kernel Parameters

This section documents the checks and modifications to the Linux kernel that should be made by the DBA to support Oracle Database 10g. Before detailing these individual kernel parameters, it is important to fully understand the key kernel components that are used to support the Oracle Database environment.

The kernel parameters and shell limits presented in this section are recommended values only as documented by Oracle. For production database systems, Oracle recommends that you tune these values to optimize the performance of the system.

Verify that the kernel parameters shown in this section are set to values greater than or equal to the recommended values. Also note that when setting the four semaphore values that all four values need to be entered on one line.

Shared Memory Overview

Shared memory allows processes to access common structures and data by placing them in a shared memory segment. This is the fastest form of Inter-Process Communications (IPC) available - mainly due to the fact that no kernel involvement occurs when data is being passed between the processes. Data does not need to be copied between processes.

Oracle makes use of shared memory for its Shared Global Area (SGA) which is an area of memory that is shared by all Oracle backup and foreground processes. Adequate sizing of the SGA is critical to Oracle performance since it is responsible for holding the database buffer cache, shared SQL, access paths, and so much more.

To determine all current shared memory limits, use the following:

# ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1

The following list describes the kernel parameters that can be used to change the shared memory configuration for the server:

  • shmmax - Defines the maximum size (in bytes) for a shared memory segment. The Oracle SGA is comprised of shared memory and it is possible that incorrectly setting shmmax could limit the size of the SGA. When setting shmmax, keep in mind that the size of the SGA should fit within one shared memory segment. The default value for shmmax is 32MB. This is often too small to configure the Oracle SGA. I generally set the shmmax parameter to 2GB as per Oracle's recommendation. An inadequate shmmax setting could result in the following:
    ORA-27123: unable to attach to shared memory segment

  • shmmni - This kernel parameter is used to set the maximum number of shared memory segments system wide. The default value for this parameter is 4096. This value is sufficient and typically does not need to be changed.

  • shmall - This parameter controls the total amount of shared memory (in pages) that can be used at one time on the system. The default size for shmall is 2097152 and is adequate for our Oracle10g installation. The value of this parameter should always be at least:

    ceil(SHMMAX/PAGE_SIZE)

  • shmmin - This parameter controls the minimum size (in bytes) for a shared memory segment. The default value for shmmin is 1 and is adequate for our Oracle10g installation.
Semaphores Overview
After the DBA has configured the shared memory settings, it is time to take care of configuring the semaphores. The best way to describe a semaphore is as a counter that is used to provide synchronization between processes (or threads within a process) for shared resources like shared memory. Semaphore sets are supported in System V where each one is a counting semaphore. When an application requests semaphores, it does so using "sets".

To determine all current semaphore limits, use the following:

# ipcs -ls

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

The following list describes the kernel parameters that can be used to change the semaphore configuration for the server:

  • semmsl - This kernel parameter is used to control the maximum number of semaphores per semaphore set. Oracle recommends setting semmsl to the largest PROCESS instance parameter setting in the init.ora file for all databases on the Linux system plus 10. Also, Oracle recommends setting the semmsl to a value of no less than 100.

  • semmni - This kernel parameter is used to control the maximum number of semaphore sets in the entire Linux system. Oracle recommends setting semmni to a value of no less than 100.

  • semmns - This kernel parameter is used to control the maximum number of semaphores (not semaphore sets) in the entire Linux system. Oracle recommends setting the semmns to the sum of the PROCESSES instance parameter setting for each database on the system, adding the largest PROCESSES twice, and then finally adding 10 for each Oracle database on the system. Use the following calculation to determine the maximum number of semaphores that can be allocated on a Linux system. It will be the lesser of:
    SEMMNS  -or-  (SEMMSL * SEMMNI)

  • semopm - This kernel parameter is used to control the number of semaphore operations that can be performed per semop system call. The semop system call (function) provides the ability to do operations for multiple semaphores with one semop system call. A semaphore set can have the maximum number of semmsl semaphores per semaphore set and is therefore recommended to set semopm equal to semmsl in some situations. Oracle recommends setting the semopm to a value of no less than 100.
Oracle10g Required Kernel Parameter Settings
The Oracle10g documentation defines the following parameters and limits that should be validated before creating an Oracle database.

Parameter Recommended Value Default Value How to Check
shmmax 2147483648 33554432 cat /proc/sys/kernel/shmmax
shmmni 4096 4096 cat /proc/sys/kernel/shmmni
shmall 2097152 2097152 cat /proc/sys/kernel/shmall
shmmin 1 1 ipcs -lm | grep "min seg size"
 
semmsl 250 250 cat /proc/sys/kernel/sem | awk '{print $1}'
semmns 32000 32000 cat /proc/sys/kernel/sem | awk '{print $2}'
semopm 100 32 cat /proc/sys/kernel/sem | awk '{print $3}'
semmni 128 128 cat /proc/sys/kernel/sem | awk '{print $4}'
 
file-max 65536 102696 cat /proc/sys/fs/file-max
 
ip_local_port_range 1024   65000 32768   61000 cat /proc/sys/net/ipv4/ip_local_port_range

  If the current value for any parameter is higher than the value listed in this table, do not change the value of that parameter. Also, Oracle strongly recommends to set the local port range ip_local_port_range for outgoing messages to "1024 65000" which is needed for systems with high-usage. This kernel parameter defines the local port range for TCP and UDP traffic to choose from.

Setting Kernel Parameters for Oracle
If the value of any kernel parameter is different to the recommended value, they will need to be modified. For this document, I identified and provide the following values that will need to be added to the /etc/sysctl.conf file which is used during the boot process:
# Kernel Parameters for Oracle10g
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

  After adding the above lines to the /etc/sysctl.conf file, they persist each time the system reboots. If you would like to make these kernel parameter value changes to the current system without having to first reboot, enter the following command:
# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
Review the output from the above command and verify that the values are correct. If the values are not correct, edit the /etc/sysctl.conf to correct the values, re-run the sysctl -p command and verify the values.



Disk Configuration - (Internal Disk for ORACLE_HOME)

As noted in the section "Hardware Overview", I discussed the disks that will be utilized for both the Oracle10g Database Software installation and the physical database files. This section discusses the steps I took to partition (and mount) one of those internal 40GB IDE hard drives that will be used for the Oracle10g Database Software.

The Linux operating system will be installed on one of those disks (/dev/hda) while the second IDE hard disk (/dev/hdb) will be used to store the Oracle10g Database Software. Before using this second disk, I need to first partition the disk and then create a file system (ext3) on the disk. Finally, I need to mount the file system to /u01.

  The steps in this section are completely optional as it is possible to simply create the directory required for installing the Oracle10g Database software off of the root directory. (i.e. mkdir /u01)

This section provides the DBA with detailed instructions for installing and configuring a second hard drive in the Linux environment.

The following steps require use of the root user account:


# [ LOGIN AS ROOT ] # su -
# [ PARTITION ENTIRE DISK ] # fdisk /dev/hdb Command (m for help): p Disk /dev/hdb: 40.0 GB, 40020664320 bytes 16 heads, 63 sectors/track, 77545 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-77545, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-77545, default 77545): 77545 Command (m for help): p Disk /dev/hdb: 40.0 GB, 40020664320 bytes 16 heads, 63 sectors/track, 77545 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hdb1 1 77545 39082648+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
# [ CREATE NEW EXT3 FILE SYSTEM ] # mkfs.ext3 -b 4096 /dev/hdb1 mke2fs 1.35 (28-Feb-2004) max_blocks 4294967295, rsv_groups = 0, rsv_gdb = 1024 Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 4889248 inodes, 9770662 blocks 488533 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=12582912 299 block groups 32768 blocks per group, 32768 fragments per group 16352 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624 Writing inode tables: done inode.i_blocks = 98312, i_size = 4243456 Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
# [ CREATE MOUNT POINT DIRECTORY ] # mkdir /u01
# [ INSERT THE FOLLOWING ENTRY INTO /etc/vfstab ] # echo "/dev/hdb1 /u01 ext3 defaults 1 1" >> /etc/fstab
# [ MOUNT THE NEW FILE SYSTEM ] # mount /u01
# [ CHECK FOR NEW FILE SYSTEM ] # df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 36316784 6537848 27934100 19% / /dev/hda1 101086 9196 86671 10% /boot none 517932 0 517932 0% /dev/shm /dev/hdb1 38468908 81984 36432792 1% /u01



Configuring the Oracle User

This section covers the steps required to create the UNIX groups (oinstall and dba) and user (oracle) that will be used to install the Oracle Database 10g software.

Note that members of the UNIX group oinstall are considered the "owners" of the Oracle software. Members of the dba group can administer Oracle databases, for example starting up and shutting down databases. In this article, we are creating the oracle user account to have both responsibilities!

The UNIX group oinstall is used by organizations that have separate teams responsible for maintaining the Oracle software and the database(s). In situations like this, the group membership prevents unauthorized access to the database by personal who only maintain the Oracle software. At the same time, it also prevents database administrators from making modifications to the database software and the installation's Inventory directory.

The Oracle documentation uses the following definitions when describing the UNIX groups:

If you intend to use the oinstall group during the installation process, then you must set the default group to the one that will be maintaining the database before creating the database or permission problems will arise. In this article, we will be taking care of this issue when we install the database software.

The thing to keep in mind is that the UNIX oinstall group is completely optional and is not required if the same individuals will be maintaining the software and the database. Some consider it unnecessary work which adds another layer of complexity to the maintenance of the installation. In this type of scenario, all that would be required is the UNIX group dba (and assigning dba as the primary UNIX group for the "oracle" user account).

This article (along with other Oracle installation guides on this site) adhere to the Optimal Flexible Architecture (OFA) and create both the oinstall and dba UNIX groups.

  This guide adheres to the Optimal Flexible Architecture (OFA) for naming conventions used in creating the directory structure.

The following steps require use of the root user account:

  1. Create the UNIX Group for the Oracle User Id.
    # groupadd -g 116 oinstall
    # groupadd -g 115 dba

  2. Create the UNIX User for the Oracle Software.
    # mkdir -p /u01/app
    # useradd -u 175 -c "Oracle Software Owner" -d /u01/app/oracle -g oinstall -G dba -m -s /bin/ksh oracle
    
    # passwd oracle
    Changing password for user oracle.
    New UNIX password: ***********
    Retype new UNIX password: ***********
    passwd: all authentication tokens updated successfully.

  3. Verify the oracle UNIX user account. The following command verifies that oinstall is the primary group and dba is the secondary group:
    # id -a oracle
    uid=175(oracle) gid=116(oinstall) groups=116(oinstall),115(dba)

  4. Verify the /usr/local/bin directory exists:
    # mkdir -p /usr/local/bin

  5. Unpackage the contents of the oracle_10g_installation_files_linux.tar archive. After extracting the archive, you will have a new directory called oracle_10g_installation_files_linux that contains all required files. The following set of commands descibe how to extract the file and where to copy/extract all required configuration files.

    The following commands should be run as the newly created oracle user account:

    # su - oracle
    $ id -a
    uid=175(oracle) gid=116(oinstall) groups=115(dba),116(oinstall) context=user_u:system_r:unconfined_t
    
    $ pwd
    /u01/app/oracle
    
    $ tar xvf oracle_10g_installation_files_linux.tar
    oracle_10g_installation_files_linux/
    oracle_10g_installation_files_linux/common.tar
    oracle_10g_installation_files_linux/dbora
    oracle_10g_installation_files_linux/local_bin.tar
    oracle_10g_installation_files_linux/oratab
    oracle_10g_installation_files_linux/profile_oracle
    oracle_10g_installation_files_linux/ldap.ora
    oracle_10g_installation_files_linux/listener.ora
    oracle_10g_installation_files_linux/sqlnet.ora
    oracle_10g_installation_files_linux/tnsnames.ora
    oracle_10g_installation_files_linux/crontabTESTDB.txt
    
    $ cp oracle_10g_installation_files_linux/profile_oracle ~/.profile
    
    $ tar xvf oracle_10g_installation_files_linux/common.tar
    
    $ # LOGIN AS ROOT
    $ su
    
    # cp oracle_10g_installation_files_linux/oratab /etc/oratab
    # chown oracle:oinstall /etc/oratab
    
    # (cd /usr/local/bin && tar xvf ~oracle/oracle_10g_installation_files_linux/local_bin.tar)
    # chown oracle:oinstall /usr/local/bin/coraenv
    # chown oracle:oinstall /usr/local/bin/dbhome
    # chown oracle:oinstall /usr/local/bin/oraenv
    # chown oracle:oinstall /usr/local/bin/oraenv.custom
    
    # # EXIT FROM ROOT
    # exit
    
    $ . ~/.profile
    .profile executed
    $

  6. Create the Oracle product / admin directory.
    $ mkdir /u01/app/oracle/product
    $ mkdir /u01/app/oracle/admin

  7. Verify and modify O/S Shell Limits. Most UNIX shells (i.e. KSH, BASH, CSH, etc) provide certain controls over various resources like the maximum allowable number of open file descriptors or the maximum number of processes available to a single user. To improve the performance and overcome the default shell limits on Linux systems, Oracle recommends increasing the following shell limits for the oracle UNIX user.

    To see all shell limits, run the following as the oracle user:

    $ ulimit -a
    time(cpu-seconds)    unlimited
    file(blocks)         unlimited
    coredump(blocks)     0
    data(kbytes)         unlimited
    stack(kbytes)        10240
    lockedmem(kbytes)    32
    memory(kbytes)       unlimited
    nofiles(descriptors) 1024
    processes            16383

    Setting the Maximum Number of Open File Descriptors for the Oracle User

    Although we have already increased the kernel parameter /proc/sys/fs/file-max in the section "Checking Kernel Parameters", there is still a per user limit on the number of open file descriptors which is set to 1024 by default. To see this, use the ulimit command as the oracle user:
    $ ulimit -n
    1024
    To change this value, we need to modify the file /etc/security/limits.conf as root and make the following changes (or as needs to be done here, add the following lines), respectively:
    # To increase the shell limits for Oracle 10.1.0
    oracle  soft  nproc   2047
    oracle  hard  nproc   16384
    oracle  soft  nofile  4096
    oracle  hard  nofile  63536
      The soft limit in the first line defines the number of file handles that the oracle user will have after logging in. If the oracle user gets error messages related to running out of file handles, then the oracle user can incresae the number of file handles (to 63536 for example) by using the command ulimit -n 63536.

    It is recommended to not set the hard limit for nofile equal to /proc/sys/fs/file-max. Using equals values and if the oracle user uses up all the available file handles, then the entire system would run out of file handles. This could mean that it would not be possible to initiate a new (remote) sessions since the system would not be able to open any PAM modules which are required for performing a login. This is the motivation for setting the hard limit to 63536 and not 65536.

    Setting the pam_limits Parameter

    After configuring the maximum number of open file descriptors, we also need to ensure that the pam_limits is configured correctly in the /etc/pam.d/system-auth file. This is the PAM module that will read the /etc/security/limits.conf file.

    The new entry in the /etc/pam.d/system-auth file should read as follows:

    session required /lib/security/pam_limits.so
    session required /lib/security/pam_unix.so

    Now, re-login to the oracle account since the changes will only become effective for new login sessions:

    # su - oracle
    $ ulimit -n
    4096

    Setting the Maximum Number of Processes for the Oracle User

    Next, we concentrate on configuring the maximum number of processes for the Oracle user. Actually, if you updated the /etc/security/limits.conf file in the previous section, "Maximum Number of Open File Descriptors for the Oracle User", then you have already configured this setting.

    To check the current limit of the maximum number of processes for the oracle user, run the following:

    # su - oracle
    $ ulimit -p   # For KSH
    2047
    $ ulimit -u   # For BASH
    2047

    The changes we already made to the file /etc/security/limits.conf that effect the maximum number of processes for the oracle user are in bold below:

    # To increase the shell limits for Oracle 10.1.0
    oracle  soft  nproc   2047
    oracle  hard  nproc   16384
    oracle  soft  nofile  4096
    oracle  hard  nofile  63536

    Making Changes Permanent

    The final step in this section is to make the settings we have made for the shell limits permanent. Performing this depends on the UNIX shell you will be using for the oracle account.

    • For the Bourne, BASH, or Korn shell, add the following lines to the /etc/profile file (or the /etc/profile.local file on SuSE systems):
      if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
          ulimit -p 16384
          ulimit -n 65536
        else
          ulimit -u 16384 -n 65536
        fi
      fi

    • For the C or tcsh shell, add the following lines to the /etc/csh.login file (or the /etc/csh.login.local file on SUSE systems):
      if ( $USER == "oracle" ) then
        limit maxproc 16384
        limit descriptors 65536
      endif



Disk Configuration - (External Disks for ASM)

As noted at the beginning of this article, the Oracle database server is connected to an external D1000 SCSI disk array. The database server will have access to six 9.1GB SCSI disks on one SCSI channel. These six disks will be used to store all physical Oracle database files (data, online redo logs, control files, archived redo logs) managed by Automatic Storage Management (ASM).


Introduction to ASM

In this section, we will configure Automatic Storage Management (ASM) to be used as the file system / volume manager for all Oracle physical database files (data, online redo logs, control files, archived redo logs).

ASM was introduced in Oracle10g and is used to alleviate the DBA from having to manage individual files and drives. ASM is built into the Oracle kernel and provides the DBA with a way to manage thousands of disk drives 24x7 for both single and clustered instances of Oracle. All of the files and directories to be used for Oracle will be contained in a disk group. ASM automatically performs load balancing in parallel across all available disk drives to prevent hot spots and maximize performance, even with rapidly changing data usage patterns.

I start this section by first discussing the ASMLib libraries and its associated driver for Linux plus other methods for configuring ASM with Linux. Next, I will provide instructions for downloading the ASM drivers (ASMLib Release 2.0) specific to our Linux kernel. (These libraries/driver are available from OTN) Lastly, I will install and configure the ASM drivers while finishing off the section with a demonstration of how I created the ASM disks.

If you would like to learn more about the ASMLib, visit http://www.oracle.com/technology/tech/linux/asmlib/install.html

The next section, "Methods for Configuring ASM with Linux", discusses the two methods for using ASM on Linux and is for reference only!


(FOR REFERENCE ONLY!) - Methods for Configuring ASM with Linux

  This section is nothing more than a reference that describes the two different methods for configuring ASM on Linux. The commands in this section are not meant to be run on the Oracle database server being configured in this article!

When I first started this article, I wanted to focus on using ASM for all database files. I was curious to see how well ASM worked (load balancing / fault tolerance) with this test configuration. There are two different methods to configure ASM on Linux:

In this article, I will be using the "ASM with ASMLib I/O" method. Oracle states (in Metalink Note 275315.1) that "ASMLib was provided to enable ASM I/O to Linux disks without the limitations of the standard UNIX I/O API". I plan on performing several tests in the future to identify the performance gains in using ASMLib. Those performance metrics and testing details are out of scope of this article and therefore will not be discussed.

Before discussing the installation and configuration details of ASMLib, I thought it would be interesting to talk briefly about the second method "ASM with Standard Linux I/O". If you were to use this method, (which is a perfectly valid solution, just not the method we will be implementing in this article), you should be aware that Linux does not use RAW devices by default. Every Linux RAW device you want to use must be bound to the corresponding block device using the RAW driver. For example, if you wanted to use the partitions that will be created in the "Creating Partitions for ASM" section, (/dev/sda1, /dev/sdb1, /dev/sdc1, /dev/sdd1, /dev/sde1, /dev/sdf1), you would need to perform the following tasks:

  1. Edit the file /etc/sysconfig/rawdevices as follows:
    # raw device bindings
    # format:    
    #           
    # example: /dev/raw/raw1 /dev/sda1
    #          /dev/raw/raw2 8 5
    /dev/raw/raw1 /dev/sda1
    /dev/raw/raw2 /dev/sdb1
    /dev/raw/raw3 /dev/sdc1
    /dev/raw/raw4 /dev/sdd1
    /dev/raw/raw5 /dev/sde1
    /dev/raw/raw6 /dev/sdf1
    The RAW device bindings will be created on each reboot.

  2. You would then want to change ownership of all raw devices to the "oracle" user account:
    # chown oracle:dba /dev/raw/raw1; chmod 660 /dev/raw/raw1
    # chown oracle:dba /dev/raw/raw2; chmod 660 /dev/raw/raw2
    # chown oracle:dba /dev/raw/raw3; chmod 660 /dev/raw/raw3
    # chown oracle:dba /dev/raw/raw4; chmod 660 /dev/raw/raw4
    # chown oracle:dba /dev/raw/raw5; chmod 660 /dev/raw/raw5
    # chown oracle:dba /dev/raw/raw6; chmod 660 /dev/raw/raw6

  3. The last step is to reboot the server to bind the devices or simply restart the rawdevices service:
    # service rawdevices restart

Like I mentioned earlier, the above example was just to demonstrate that there is more than one method for using ASM with Linux. Now let's move on to the method that will be used for this article, "ASM with ASMLib I/O".


Create Disk Partitions

Before any of the disks can be discovered by ASM, they need to be properly partitioned and configured. Before providing the details on how to partition all six disks, here are some things to keep in mind with regards to configuring disks for ASM:

The following table lists the individual partitions that will be created on the six disks contained in the disk array and what files will be contained on them.

Oracle ASM Disk Configuration
File System Type Partition Size Mount Point File Types
ASM /dev/sda1 9.1 GB ORCL:TESTDB_DATA1 Oracle Database Files
ASM /dev/sdb1 9.1 GB ORCL:TESTDB_DATA1 Oracle Database Files
ASM /dev/sdc1 9.1 GB ORCL:TESTDB_DATA1 Oracle Database Files
ASM /dev/sdd1 9.1 GB ORCL:TESTDB_DATA2 Oracle Database Files
ASM /dev/sde1 9.1 GB ORCL:TESTDB_DATA2 Oracle Database Files
ASM /dev/sdf1 9.1 GB ORCL:TESTDB_DATA2 Oracle Database Files
Total   54.6 GB    

Like shown in the table, all disks within the D1000 disk array are SCSI disks and shows up as the SCSI devices /dev/sda - /dev/sdf. The fdisk command is used for creating (and removing) partitions. Before creating the new partitions, it is important to remove any existing partitions (if they exist) on each of the drives. The following is an example of how to remove all partitions on the disk /dev/sda and then create a single new Linux partition. Perform the following actions on all disks in the disk array (/dev/sda - /dev/sdf):

# fdisk /dev/sda
Command (m for help): p

Disk /dev/sda: 9056 MB, 9056904704 bytes
64 heads, 32 sectors/track, 8637 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        8637     8844272   be  Solaris boot


Command (m for help): d
Selected partition 1


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8637, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-8637, default 8637): 8637


Command (m for help): p

Disk /dev/sda: 9056 MB, 9056904704 bytes
64 heads, 32 sectors/track, 8637 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        8637     8844272   83  Linux


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


  After creating all required partitions, you should now inform the kernel of the partition changes using the following syntax as the "root" user account:
# partprobe

# fdisk -l /dev/sda
Disk /dev/sda: 9056 MB, 9056904704 bytes
64 heads, 32 sectors/track, 8637 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        8637     8844272   83  Linux

  Perform the above fdisk tasks on all six disks in the D1000 disk array!


Upgrade the Linux Kernel

The CentOS 4.0 release I downloaded came equipped with the 2.6.9-5.0.3.EL kernel. This version will not work with the ASMLib libraries that are available from the Oracle Technology Network. Oracle only provides libraries for the 2.6.9-5.0.5.EL kernel and thus requires we upgrade the kernel. This can be done using the yum utility as follows:
# uname -a
Linux linux3 2.6.9-5.0.3.EL #1 Sat Feb 19 18:26:49 CST 2005 i686 i686 i386 GNU/Linux


# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-centos4


# yum update kernel-*
Setting up Update Process
Setting up Repos
addons                    100% |=========================|  951 B    00:00
base                      100% |=========================| 1.1 kB    00:00
update                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================|  991 B    00:00
MD Read   : ################################################## 2/2
addons    : ################################################## 2/2
primary.xml.gz            100% |=========================| 532 kB    00:02
MD Read   : ################################################## 1405/1405
base      : ################################################## 1404/1404
primary.xml.gz            100% |=========================|  46 kB    00:00
MD Read   : ################################################## 105/105
update    : ################################################## 105/105
primary.xml.gz            100% |=========================| 7.3 kB    00:00
MD Read   : ################################################## 26/26
extras    : ################################################## 26/26
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for kernel-smp-devel to pack into transaction set.
kernel-smp-devel-2.6.9-5. 100% |=========================| 612 kB    00:01
---> Package kernel-smp-devel.i686 0:2.6.9-5.0.5.EL set to be updated
---> Downloading header for kernel-hugemem-devel to pack into transaction set.
kernel-hugemem-devel-2.6. 100% |=========================| 620 kB    00:01
---> Package kernel-hugemem-devel.i686 0:2.6.9-5.0.5.EL set to be updated
---> Downloading header for kernel-doc to pack into transaction set.
kernel-doc-2.6.9-5.0.5.EL 100% |=========================|  92 kB    00:00
---> Package kernel-doc.noarch 0:2.6.9-5.0.5.EL set to be updated
---> Downloading header for kernel to pack into transaction set.
kernel-2.6.9-5.0.5.EL.i68 100% |=========================| 119 kB    00:00
---> Package kernel.i686 0:2.6.9-5.0.5.EL set to be installed
---> Downloading header for kernel-devel to pack into transaction set.
kernel-devel-2.6.9-5.0.5. 100% |=========================| 605 kB    00:01
---> Package kernel-devel.i686 0:2.6.9-5.0.5.EL set to be installed
---> Downloading header for kernel-sourcecode to pack into transaction set.
kernel-sourcecode-2.6.9-5 100% |=========================| 1.5 MB    00:07
---> Package kernel-sourcecode.noarch 0:2.6.9-5.0.5.EL set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
  Install: kernel.i686 0:2.6.9-5.0.5.EL - update
  Install: kernel-devel.i686 0:2.6.9-5.0.5.EL - update
  Update: kernel-doc.noarch 0:2.6.9-5.0.5.EL - update
  Update: kernel-hugemem-devel.i686 0:2.6.9-5.0.5.EL - update
  Update: kernel-smp-devel.i686 0:2.6.9-5.0.5.EL - update
  Update: kernel-sourcecode.noarch 0:2.6.9-5.0.5.EL - update
Total download size: 66 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): kernel-smp-devel-2 100% |=========================| 3.6 MB    00:10
(2/6): kernel-hugemem-dev 100% |=========================| 3.6 MB    00:11
(3/6): kernel-doc-2.6.9-5 100% |=========================| 2.0 MB    00:06
(4/6): kernel-2.6.9-5.0.5 100% |=========================| 9.5 MB    00:29
(5/6): kernel-devel-2.6.9 100% |=========================| 3.6 MB    00:10
(6/6): kernel-sourcecode- 100% |=========================|  44 MB    02:12
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating: kernel-sourcecode 100 % done 1/10
Updating: kernel-smp-devel 100 % done 2/10
Updating: kernel-hugemem-devel 100 % done 3/10
Updating: kernel-doc 100 % done 4/10
Installing: kernel 100 % done 5/10
Installing: kernel-devel 100 % done 6/10
Completing update for kernel-smp-devel  - 7/10
Completing update for kernel-hugemem-devel  - 8/10
Completing update for kernel-doc  - 9/10
Completing update for kernel-sourcecode  - 10/10

Installed: kernel.i686 0:2.6.9-5.0.5.EL kernel-devel.i686 0:2.6.9-5.0.5.EL
Updated: kernel-doc.noarch 0:2.6.9-5.0.5.EL kernel-hugemem-devel.i686 0:2.6.9-5.0.5.EL kernel-smp-devel.i686 0:2.6.9-5.0.5.EL kern
el-sourcecode.noarch 0:2.6.9-5.0.5.EL
Complete!


# uname -a
Linux linux3 2.6.9-5.0.5.EL #1 Tue Apr 19 23:50:27 BST 2005 i686 i686 i386 GNU/Linux


Downloading the ASMLib Packages

We continue this section by downloading the ASMLib libraries and driver from OTN. We need to download the version for the Linux kernel and number of processors on the machine. We are using kernel 2.6.9 while the machine I am using is a single processor node:
# uname -a
Linux linux3 2.6.9-5.0.5.EL #1 Tue Apr 19 23:50:27 BST 2005 i686 i686 i386 GNU/Linux

  If you do not currently have an account with Oracle OTN, you will need to create one. This is a FREE account!


  Oracle ASMLib Downloads

  oracleasm-2.6.9-5.0.5.EL-2.0.0-1.i686.rpm - (Driver for "up" kernels)
  oracleasmlib-2.0.0-1.i386.rpm - (Userspace library)
  oracleasm-support-2.0.0-1.i386.rpm - (Driver support files)


Installing ASMLib Packages

This installation needs to be performed as the root user account:
$ su -
# rpm -Uvh oracleasm-support-2.0.0-1.i386.rpm \
           oracleasmlib-2.0.0-1.i386.rpm \
           oracleasm-2.6.9-5.0.5.EL-2.0.0-1.i686.rpm
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [ 33%]
   2:oracleasm-2.6.9-5.0.5.E########################################### [ 67%]
   3:oracleasmlib           ########################################### [100%]


Configuring and Loading the ASMLib Packages

Now that we downloaded and installed the ASMLib Packages for Linux, we now need to configure and load the ASM kernel module. This task needs to be run as the root user account:
$ su -
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting  without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [dba]: dba
Start Oracle ASM library driver on boot (y/n) [y]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [  OK  ]
Scanning system for ASM disks: [  OK  ]


Creating ASM Disks for Oracle

At this point, we have already created a single Linux partition on each of the disks within the D1000 disk array. Our last task is to create the ASM Disks.

  If you are repeating this article using the same hardware (actually, the same disks within the D1000 disk array), you may get a failure when attempting to create the ASM disks. If you do receive a failure, try listing all ASM disks using
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6
As you can see, the results show that I have six volumes already defined. If you have the six volumes already defined from a previous run, go ahead and remove them using the following commands. After removing the previously created volumes, use the "oracleasm createdisk" commands (below) to create the volumes.
# /etc/init.d/oracleasm deletedisk VOL1
Removing ASM disk "VOL1" [  OK  ]
# /etc/init.d/oracleasm deletedisk VOL2
Removing ASM disk "VOL2" [  OK  ]
# /etc/init.d/oracleasm deletedisk VOL3
Removing ASM disk "VOL3" [  OK  ]
# /etc/init.d/oracleasm deletedisk VOL4
Removing ASM disk "VOL4" [  OK  ]
# /etc/init.d/oracleasm deletedisk VOL5
Removing ASM disk "VOL5" [  OK  ]
# /etc/init.d/oracleasm deletedisk VOL6
Removing ASM disk "VOL6" [  OK  ]

$ su -
# /etc/init.d/oracleasm createdisk VOL1 /dev/sda1
Marking disk "/dev/sda1" as an ASM disk [  OK  ]

# /etc/init.d/oracleasm createdisk VOL2 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk [  OK  ] 

# /etc/init.d/oracleasm createdisk VOL3 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk [  OK  ]

# /etc/init.d/oracleasm createdisk VOL4 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk [  OK  ]

# /etc/init.d/oracleasm createdisk VOL5 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk [  OK  ] 

# /etc/init.d/oracleasm createdisk VOL6 /dev/sdf1
Marking disk "/dev/sdf1" as an ASM disk [  OK  ]


Although not required, I like to perform a scandisk to recognize the new volumes:

# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks [  OK  ]


We can now test that the ASM disks were successfully created by using the following command as the root user account:

# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6



Installing the Oracle10g Database Software


Obtain the Oracle10g Database Software

The first step is to obtain the Oracle10g database software. You may already have the Oracle10g database software on CD-ROM. If you do not, the software can be downloaded from Oracle's OTN site - http://otn.oracle.com.

  If you do not currently have an account with Oracle OTN, you will need to create one. This is a FREE account!

Download the Oracle Database 10g Release 1 (10.1.0.3) Software for Linux x86:

  Oracle Database 10g Release 1 (10.1.0.3) (Enterprise/Standard Edition for Linux x86)

After downloading the file, place it in a temporary directory (i.e. /u01/app/oracle/orainstall) as the oracle UNIX user account. To extract the file, use the following:

$ id -a
uid=175(oracle) gid=116(oinstall) groups=115(dba),116(oinstall) context=user_u:system_r:unconfined_t

$ mkdir -p /u01/app/oracle/orainstall
$ mv ~/ship.db.lnx32.cpio.gz /u01/app/oracle/orainstall
$ cd /u01/app/oracle/orainstall
$ gunzip ship.db.lnx32.cpio.gz
$ cpio -idmv < ship.db.lnx32.cpio

  Some browsers will uncompress the files but leave the extension the same (gz) when downloading. If the above steps do not work for you, try skipping the un-compressing step (without changing the filename) and then extracting the file using cpio:
$ cpio -idmv < ship.db.lnx32.cpio.gz
        

After successfully un-compressing and extracting the downloaded file, it will create a directory named Disk1 containing the Oracle10g Installation files:

/Disk1


X Windows Server Requirement

Beginning with Oracle version 8i, the Oracle Universal Installer (OUI) is a Java application and uses a JRE (Java runtime Environment) shipped on the media. Other Java applications that utilize the JRE are the Database Configuration Assistant and the Oracle Net Assistant. The JRE shipped by Oracle is the only one supported to run with these applications. Installations can no longer be performed using character mode.

  You must install the Oracle database software from an X windows workstation, an X terminal, or a PC or other system with X server software installed.


Database Software Installation Steps

  1. From a workstation (running X Windows or Solaris/Linux) telnet to the target Database Server as the "oracle" account.

      If you are using Hummingbird's Exceed X-Windows emulator while installing and using Oracle10g, set the window manager to run in "Native" mode so that Microsoft windows functions as the window manager. See your Exceed documentation for instructions on configuring the window manager.

  2. Set your DISPLAY variable on the Linux database server to point to your local workstation:
    $ DISPLAY=<your local workstation>:0.0
    $ export DISPLAY
    For example:
    $ DISPLAY=melody:0
    $ export DISPLAY

  3. To determine if your X-Windows system is properly working on your local workstation, try starting a small X-Windows application:
    $ xclock
       

  4. After validating that you can re-direct X-Windows applications to your local workstation, you are almost ready to start the Oracle Universal Installer.

    If you are using a CD-ROM to install the Oracle databse software, insert Disk 1 (of 1) of the Oracle10g, Release 1 (10.1.0.3.0) for Linux x86. On most systems, the CD-ROM will be mounted automatically by the Volume Manager. If not, you can perform the following as the root UNIX user account:

    $ su -
    # mkdir -p /media/cdrom
    # mount -r -t iso9660 /dev/cdrom /media/cdrom
    In the above example, /media/cdrom is the CD-ROM mount point directory and /dev/cdrom is the device name for the CD-ROM device.

    If you downloaded and extracted the software to a temporary directory (I used /u01/app/oracle/orainstall for this article), there is nothing to mount. Just take note of the directory that contains the runInstaller executable. For this article, the OUI executable will be located in /u01/app/oracle/orainstall/Disk1/runInstaller:

    $ ls -l /u01/app/oracle/orainstall/Disk1/runInstaller
    -rwxrwxr-x  1 oracle oinstall 2152 Dec 20 17:04 /u01/app/oracle/orainstall/Disk1/runInstaller*

  5. Run the Oracle Universal Installer (OUI). Before running the OUI, however, verify the following:

    • Verify you are logged in as the "oracle" UNIX user account.
    • If you are using a CD-ROM to install the Oracle database software, the OUI should be run while in a directory other than the CD-ROM. (From Oracle's home directory for example.)
    • The umask for your session should be set to the value "022".
    • Set the DISPLAY environment variable to the X server you will be working from. (For example, the X server on your workstation or PC)
    • Ensure that the /tmp directory has at least 400MB of space. If you determined that the /tmp directory had insufficient free disk space when checking the hardware requirements, enter the following commands to set the TMP and TMPDIR environment variables. Specify a directory on a file system with sufficient free disk space. For example:
      $ TMP=/directory
      $ TMPDIR=/directory
      $ export TEMP TMPDIR
    • Verify that the environment variables ORACLE_BASE and ORACLE_SID are appropriately set before running the OUI.
    • Unset the environment variables ORACLE_HOME and TNS_ADMIN before running the OUI.

    # su - oracle
    
    $ id -a
    uid=175(oracle) gid=116(oinstall) groups=115(dba),116(oinstall) context=user_u:system_r:unconfined_t
    
    $ pwd
    /u01/app/oracle
    
    $ umask
    022
    
    $ echo $TMP
    /tmp
    
    $ echo $TMPDIR
    /tmp
    
    $ df -k /tmp
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
                          36316784   6622352  27849596  20% /
    
    $ echo $ORACLE_BASE
    /u01/app/oracle
    
    $ echo $ORACLE_SID
    TESTDB
    
    $ unset ORACLE_HOME
    $ unset TNS_ADMIN
    
    $ /u01/app/oracle/orainstall/Disk1/runInstaller -ignoreSysPrereqs
    Starting Oracle Universal Installer...
    
    Checking installer requirements...
    
    Checking operating system version: must be redhat-2.1, redhat-3, SuSE-9, SuSE-8 or UnitedLinux-1.0
                                       Failed <<<<
    
    >>> Ignoring required pre-requisite failures. Continuing...
    
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2005-05-10_02-24-47PM. Please wait ...
    Oracle Universal Installer, Version 10.1.0.3.0 Production

    Oracle10g Database Software Installation Screen Responses
    Screen Name Response
    Welcome Screen Click <Next>
    Specify Inventory directory and credentials Accept the default values:
       Full path of inventory directory: /u01/app/oracle/oraInventory
       Operating System group name: oinstall
    Click <Next>
    Root Script Window - Run orainstRoot.sh Open a new console window on the node you are performing the install on as the "root" user account.

    Navigate to the /u01/app/oracle/oraInventory directory and run orainstRoot.sh.

    Go back to the OUI and acknowledge the dialog window.

    Specify File Locations Leave the default value for the Source directory. In most cases, the OUI will select the correct destination name and ORACLE_HOME. I always prefer to use the values I have documented below:
       Source Path: /u01/app/oracle/orainstall/Disk1/stage/products.xml
       Destination Name: OraDb10g_home1
       Destination Path: /u01/app/oracle/product/10.1.0/db_1
    Click <Next>
    Select Installation Types For this example, I selected to do an Enterprise Edition install. You can also make a choice to do a Standard Edition or a Custom install.
       Enterprise Edition (877MB)
       Standard Edition (840MB)
       Custom
    Click <Next>
    Product-specific Prerequisite Checks   The OUI then presents the dialog "Product-specific Prerequisite Checks". During the check procedures on CentOS 4.0, you will get a warning while checking operating system certification:

    Check complete. The overall result of this check is: Failed   Failed <<<< Problem: This Oracle software is not certified on the current operating system. Recommendation: Make sure you are installing the software on the correct platform.

    You can safely ignore this error/failure.

    You will not need to acknowledge any of these warnings in this dialog as the installer simply bypasses them and goes to the next screen.

    Select Database Configuration This dialog provides the option to have the OUI create a database. Since I will be applying the latest database patch to this install, (10.1.0.4.0), I will forgo the creation of the database and select the option to not create a starter database:
       Database Configuration: Do not create a starter database
    Click <Next>
    Summary Click <Install> to start the installation process.

  6. At the end of the installation, linking, and setup phase, you will be prompted to run a configuration script as the root user before the installation can proceed. Leave this window up, and go to /u01/app/oracle/product/10.1.0/db_1 and run the root.sh script:
    $ cd /u01/app/oracle/product/10.1.0/db_1
    $ su
    Password: *******
    
    # ./root.sh
    Running Oracle10 root.sh script...
    
    The following environment variables are set as:
        ORACLE_OWNER= oracle
        ORACLE_HOME=  /u01/app/oracle/product/10.1.0/db_1
    
    Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin
    The file "dbhome" already exists in /opt/bin.  Overwrite it? (y/n) [n]: n
    The file "oraenv" already exists in /opt/bin.  Overwrite it? (y/n) [n]: n
    The file "coraenv" already exists in /opt/bin.  Overwrite it? (y/n) [n]: n
    
    Creating /etc/oratab file...
    Adding entry to /etc/oratab file...
    Entries will be added to the /etc/oratab file as needed by
    Database Configuration Assistant when a database is created
    Finished running generic part of root.sh script.
    Now product-specific root actions will be performed.
    /var/opt/oracle does not exist. Creating it now.
    /etc/oracle does not exist. Creating it now.
    Successfully accumulated necessary OCR keys.
    Creating OCR keys for user 'root', privgrp 'root'..
    Operation successful.
    Oracle Cluster Registry for cluster has been initialized
    
    Adding to inittab
    Checking the status of Oracle init process...
    Expecting the CRS daemons to be up within 600 seconds.
    CSS is active on these nodes.
            linux3
    CSS is active on all nodes.
    Oracle CSS service is installed and running under init(1M)
    
    # exit
    $
    After successfully running the root.sh script, go back to the dialog window from the Oracle Universal Installer and click "OK" to continue.

  7. The last screen of a successful Oracle10g database installation is the "End of Installation" screen. The OUI provides you with several URLs that will be activated by the OUI:

    The following J2EE Applications have been deployed and are accessible at the URLs listed below.
    
    Ultra Search URL:
    http://linux3:5620/ultrasearch
    
    Ultra Search Administration Tool URL:
    http://linux3:5620/ultrasearch/admin
    
    iSQL*Plus URL:
    http://linux3:5560/isqlplus
    
    iSQL*Plus DBA URL:
    http://linux3:5560/isqlplus/dba

    Click the <Exit> button to exit from the Oracle Universal Installer.



Applying the 10.1.0.4 Database Patchset

At the time of this writing, the latest patchset for Oracle10g running on Linux x86 (32-bit) is 10.1.0.4 (also known as patch 4163362).

Downloading the Patchset

The Oracle 10.1.0.4 patchset will need to be downloaded from the Oracle Metalink website (http://metalink.oracle.com).

  Access to Oracle Metalink requires a valid login and CSI number.

After logging in to the Oracle Metalink website, click on the "Patches & Updates" tab on the top menu and use the following to download the correct database patchset:

  1. On the "Patches & Updates" screen, select the link for Simple Search.

  2. From the Simple Search screen, select the "Product or Family" option in the Search By pull-down listing. In the text field to the right, enter "RDBMS Server".

  3. In the Release option, select "Oracle 10.1.0.4".

  4. For the Patch Type option, select "Patchset/Minipack".

  5. Finally, for the Platform or Language option, select "Linux x86".

  6. When all of the options are filled out, click the "Go" button.

  7. This will bring up the available patchsets in the Results section. For the purpose of this article, I will be downloading and installing patch: 4163362. Select this patchset in the Results section and then click the Download button to start the download process.

      The file name of the patchset to download is p4163362_10104_LINUX.zip (last updated 28-MAR-2005) and is 571MB in size. This may take some time to download.


Applying the Patchset

As the oracle user account, extract the patch file to a temporary directory:
$ id -a
uid=175(oracle) gid=116(oinstall) groups=115(dba),116(oinstall) context=user_u:system_r:unconfined_t

$ mkdir -p /u01/app/oracle/orapatch
$ mv p4163362_10104_LINUX.zip /u01/app/oracle/orapatch
$ cd /u01/app/oracle/orapatch
$ unzip p4163362_10104_LINUX.zip

  You must install the Oracle database patch from an X windows workstation, an X terminal, or a PC or other system with X server software installed.

If you are not installing the patch software from the local system, enter the following command to direct X applications to display on the workstation / PC you are running on:

$ DISPLAY=<your_local_workstation>:0.0 ; export DISPLAY

In this example, your_local_workstation is the host name or IP address of the system that you want to use to display the Installer (your workstation or PC).

Before starting the OUI to install the patch set, we need to stop all listeners and other processes running in the Oracle home directory. If you have been following the instructions in this article, the only process running should be the Cluster Ready Services (CRS). To stop this process, use the following as the root UNIX user account:

$ su -
# /etc/init.d/init.cssd stop
Shutting down CRS daemon.
Shutting down EVM daemon.
Shutting down CSS daemon.
Shutdown request successfully issued.
# exit

Once all processes running in the Oracle home directory are stopped, we can now start the patch installation process. To do this, navigate to the directory where you extracted the patch set to and run the OUI installer as the oracle UNIX user account:

$ id -a
uid=175(oracle) gid=116(oinstall) groups=115(dba),116(oinstall) context=user_u:system_r:unconfined_t

$ cd /u01/app/oracle/orapatch/Disk1
$ ./runInstaller

Oracle 10.1.0.4.0 Patchset Installation Screen Responses
Screen Name Response
Welcome Screen Click <Next>
Specify File Locations Leave the default value for the Source directory. By default, it should be pointing to the products.xml file from the stage directory where you unpacked the patch set files.

In most cases, the OUI will also select the correct destination name and ORACLE_HOME that you want to update with this patch set.

Here are the settings I used for this article:
   Source Path: /u01/app/oracle/orapatch/Disk1/stage/products.xml
   Destination Name: OraDb10g_home1
   Destination Path: /u01/app/oracle/product/10.1.0/db_1
Click <Next>

Summary On the Summary screen, click <Install> to start the installation process.

At the end of the patch set installation, linking, and setup phase, you will be prompted to run a configuration script as the root user before the installation can proceed. Leave this window up, and go to /u01/app/oracle/product/10.1.0/db_1 and run the root.sh script:

$ cd /u01/app/oracle/product/10.1.0/db_1

$ su
Password: *******

# ./root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/10.1.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin
The file "dbhome" already exists in /opt/bin.  Overwrite it? (y/n) [n]: n
The file "oraenv" already exists in /opt/bin.  Overwrite it? (y/n) [n]: n
The file "coraenv" already exists in /opt/bin.  Overwrite it? (y/n) [n]: n

Adding entry to /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
clscfg: EXISTING configuration version 2 detected.
clscfg: version 2 is 10G Release 1.
Successfully accumulated necessary OCR keys.
clscfg: Arguments check out successfully.

NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Starting Oracle CSS service under init(1M)
Startup will be queued to init within 30 seconds.
Expecting the CRS daemons to be up within 120 seconds.
CSS is active on these nodes.
        linux3
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

# exit
After successfully running the root.sh script, go back to the dialog window from the Oracle Universal Installer and click "OK" to continue. On the End of Installation screen, click Exit, then click Yes to exit from the Installer.

The Oracle Database 10g Patch Set 2 has now been successfully applied!



Configure Oracle Net

The Database Configuration Assistant (DBCA) requires the Oracle TNS Listener process to be configured and running on the database server before it can create the database.

Bring up the Network Configuration Assistant (NETCA) and run through the process of creating a new TNS listener process and to also configure the node for local access.

To start the NETCA, run the following GUI utility as the oracle UNIX user account:

$ netca &

Oracle Network Configuration Installation Screen Responses
Screen Name Response
Type of Configuration Select Listener configuration.
Listener Configuration - Next 6 Screens The following screens are now like any other normal listener configuration. You can simply accept the default parameters for the next six screens:
   What do you want to do: Add
   Listener name: LISTENER
   Selected protocols: TCP
   Port number: 1521
   Configure another listener: No
   Listener configuration complete! [ Next ]
You will be returned to this Welcome (Type of Configuration) Screen.
Type of Configuration Select Naming Methods configuration.
Naming Methods Configuration The following screens are:
   Selected Naming Methods: Local Naming
   Naming Methods configuration complete! [ Next ]
You will be returned to this Welcome (Type of Configuration) Screen.
Type of Configuration Click Finish to exit the NETCA.

The Oracle TNS listener process should now be running:

$ ps -ef | grep lsnr | grep -v 'grep' | awk '{print $9}'
LISTENER



Creating the Oracle Database

We will be using the Oracle Database Configuration Assistant (DBCA) to create a database / instance named TESTDB.

Before executing the Database Configuration Assistant, make sure that $ORACLE_HOME and $PATH are set appropriately for the $ORACLE_BASE/product/10.1.0/db_1 environment.

  If you have been following this article, you will notice that I entered TESTDB as the $ORACLE_SID environment variable and more importantly, as an entry in the file /var/opt/oracle/oratab. This causes a problem with the DBCA when it attempts to create a database (TESTDB) with the same name. To get around this, before attempting to create the TESTDB database, I first use the operation to Delete the TESTDB database within the DBCA. All instructions for this are provided below.

To start the database creation process, run the following as the oracle UNIX user account:

$ dbca &

Oracle Database Configuration Assistant Screen Responses
Screen Name Response
Welcome Screen Click <Next>
Operations Select Delete a Database.
Click <Next>
Database From the available databases listed, select TESTDB.
Click <Finish>.

When prompted to ask if you want to proceed, answer Yes.

You are then prompted one last time indicating that it could not determine the database files for the SID TESTDB. Acknowledge this prompt by answering OK to proceed.

When the delete process has completed, it prompts if you would like perform another operation. Click Yes.

Operations Select Create a Database.
Click <Next>
Database Templates Select Custom Database.
Click <Next>
Database Identification Select:
   Global Database Name: TESTDB.IDEVELOPMENT.INFO
   SID Prefix: TESTDB

  I used idevelopment.info for the database domain. You may use any domain. Keep in mind that this domain does not have to be a valid DNS domain.

Click <Next>

Management Option Leave the default options here which is to Configure the Database with Enterprise Manager.
Click <Next>
Database Credentials I selected to Use the Same Password for All Accounts. Enter the password (twice) and make sure the password does not start with a digit number.
Click <Next>
Storage Options For this article, we will select to use Automatic Storage Management (ASM).
Click <Next>
Create ASM Instance With the exception of supplying the SYS password I wanted to use for this instance, all other options I used were the defaults. This includes the default for all ASM parameters and then to use default parameter file (IFILE): {ORACLE_BASE}/admin/+ASM/pfile/init.ora.

You will then be prompted with a dialog box asking if you want to create and start the ASM instance. Select the OK button to acknowledge this dialog.

The OUI will now create and start the ASM instance on the database server.

ASM Disk Groups We will be configuring two ASM disk groups in this section.

To start, click the Create New button. This will bring up the "Create Disk Group" window with the six volumes we configured earlier using ASMLib.

If the volumes we created earlier in this article do not show up in the "Select Member Disks" window: (ORCL:VOL1, ORCL:VOL2, ORCL:VOL3, ORCL:VOL4, ORCL:VOL5, and ORCL:VOL6) then click on the "Change Disk Discovery Path" button and input "ORCL:VOL*". All six volumes should have a status of "PROVISIONED".

  If after changing the Disk Discovery Path you still do not see the six external disks as CANDIDATEs, click on the "Show All" radio button. If the disks show up under this window with a Header Status of MEMBER, then it is possible that these disks were part of an ASM instance and an old disk group. (This can happen if you are trying to go through this article a second time after already configuring the disks for ASM!) If this is the case, then ASM metadata has been left on the disk and will need to be removed. Note that you cannot simply select the disks that have a Header Status of MEMBER to be used for our new disk group as this will give errors like in the following:

  ORA-15018: diskgroup cannot be created
  ORA-15033: disk '/asmdisks/disk1' belongs to diskgroup "TESTDB_DATA1"
  ORA-15033: disk '/asmdisks/disk2' belongs to diskgroup "TESTDB_DATA1"
  ...

To remove the ASM metadata from the disks, first cancel out of the "Create Disk Group" dialog and get back to the "ASM Disk Groups" window. Then as the UNIX root account, change to the directory we created named "/asmdisks" and perform the following:

  dd if=/dev/zero of=/asmdisks/disk1 bs=8192 count=100
  dd if=/dev/zero of=/asmdisks/disk2 bs=8192 count=100
  dd if=/dev/zero of=/asmdisks/disk3 bs=8192 count=100
  dd if=/dev/zero of=/asmdisks/disk4 bs=8192 count=100
  dd if=/dev/zero of=/asmdisks/disk5 bs=8192 count=100
  dd if=/dev/zero of=/asmdisks/disk6 bs=8192 count=100

From the "ASM Disk Groups" windows, click on the "Create New" button. This should bring up all six disks with a Header Status of "CANDIDATE".

I will be creating two ASM disk groups: TESTDB_DATA1 and TESTDB_DATA2. For the first group, enter the name TESTDB_DATA1 for the "Disk Group Name", and check the first three volumes ORCL:VOL1, ORCL:VOL2, ORCL:VOL3.

After verifying all values in this window are correct, click the OK button. This will present the "ASM Disk Group Creation" dialog. When the ASM Disk Group Creation process is finished, you will be returned to the "ASM Disk Groups" window and all three disks will have a status of "PROVISIONED".

Now, let's create the second disk group by clicking the Create New button again. You will notice that the only candiates are the three remaining disks (that were not provisioned in the previous step. Select these three disks and name the Disk Group Name TESTDB_DATA2. Click OK on this dialog after all information has been entered. The OUI will create the second disk group and return you to the ASM Disk Groups screen and all three disks should now have a status of "PROVISIONED".

Select the checkbox next to the newly created Disk Group Name TESTDB_DATA1 and TESTDB_DATA2 and click <Next> to continue.

Database File Locations I selected to use the default which is Use Oracle-Managed Files:
   Database Area: +TESTDB_DATA1.
Click <Next>
Recovery Configuration I selected to use the default for the Flash Recovery Area which is +TESTDB_DATA2. I did, however, increase the size of the Flash Area to 6GB (6144 M Bytes).

On this screen, you can also enable Archiving.
Click <Next>

Database Content I left all of the Database Components (and destination tablespaces) set to their default value.
Click <Next>
Initialization Parameters Change any parameters for your environment. I left them all at their default settings.
Click <Next>
Database Storage Change any parameters for your environment. I left them all at their default settings.
Click <Next>
Creation Options Keep the default option Create Database selected and click Finish to start the database creation process.

Click OK on the "Confirmation" screen.

End of Database Creation At the end of the database creation, exit from the DBCA.

When the Oracle Database Configuration Assistant has completed, you will have a fully functional Oracle10g database running!

  I like to review the log files that were created by the DBCA process. For the purpose of the example in this article, my log files were created in /u01/app/oracle/admin/TESTDB/create.



Creating / Altering Tablespaces

When creating the Oracle database, we left all tablespaces set to their default size. Since I am using a large set of drives for the storage, I like to make a sizable testing database.

This section provides several optional SQL commands I used to modify and create all tablespaces for my testing database. Please keep in mind that the database file names (OMF files) I used in this example may differ from what Oracle creates for your environment.

$ sqlplus "/ as sysdba"

SQL> create user scott identified by tiger default tablespace users;
SQL> grant dba, resource, connect to scott;

SQL> alter database datafile '+TESTDB_DATA1/testdb/datafile/users.264.557955193' resize 1024m;
SQL> alter tablespace users add datafile '+TESTDB_DATA1' size 1024m autoextend off;

SQL> create tablespace indx datafile '+TESTDB_DATA1' size 1024m
  2  autoextend on next 50m maxsize unlimited
  3  extent management local autoallocate
  4  segment space management auto;

SQL> -- SYSTEM Tablespace
SQL> alter database datafile '+TESTDB_DATA1/testdb/datafile/system.260.557955125' resize 800m;

SQL> -- SYSAUX Tablespace
SQL> alter database datafile '+TESTDB_DATA1/testdb/datafile/sysaux.262.557955173' resize 500m;

SQL> alter tablespace undotbs1 add datafile '+TESTDB_DATA1' size 1024m
  2  autoextend on next 50m maxsize 2048m;

SQL> alter database tempfile '+TESTDB_DATA1/testdb/tempfile/temp.263.557955183' resize 1024m;

Here is a snapshot of the tablespaces I have defined for my test database environment:

SQL> @dba_tablespaces

Status    Tablespace Name TS Type      Ext. Mgt.  Seg. Mgt.    Tablespace Size    Used (in bytes) Pct. Used
--------- --------------- ------------ ---------- --------- ------------------ ------------------ ---------
ONLINE    INDX            PERMANENT    LOCAL      AUTO           1,073,741,824             65,536         0
ONLINE    SYSAUX          PERMANENT    LOCAL      AUTO             524,288,000        224,329,728        43
ONLINE    SYSTEM          PERMANENT    LOCAL      MANUAL           838,860,800        451,084,288        54
ONLINE    UNDOTBS1        UNDO         LOCAL      MANUAL         1,283,457,024        113,836,032         9
ONLINE    USERS           PERMANENT    LOCAL      AUTO           2,147,483,648            131,072         0
ONLINE    TEMP            TEMPORARY    LOCAL      MANUAL         1,073,741,824         23,068,672         2
                                                            ------------------ ------------------ ---------
avg                                                                                                      18
sum                                                              6,941,573,120        812,515,328

6 rows selected.



Setting up Automatic Database Starting Stopping

Included in the file you downloaded and extracted earlier in this article (oracle_10g_installation_files_linux.tar) is a utility called dbora that may be used to automatically start and stop the Oracle database and all other Oracle routines. The dbora script may differ on every database server only slightly as each database server has different requirements for handling Apache, TNS listener and other agents. The dbora script should be place in /etc/init.d.

The dbora utility has been implemented to utilize the Oracle supplied scripts $ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbshut. This utility (dbora) will be run by the UNIX init process, and reads the /etc/oratab file to dynamically determine which database(s) to start and stop.

Here is how to install the dbora file:

$ su
# cp /u01/app/oracle/oracle_10g_installation_files_linux/dbora /etc/init.d
# cd /etc/init.d
# chmod 755 dbora
# chown root:root dbora

# ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
# ln -s /etc/init.d/dbora /etc/rc6.d/K10dbora
# exit


The next step is to edit the /etc/oratab file to allow the dbora script to automatically start and stop databases. Simply alter the final field in the +ASM and TESTDB entry from N to Y. NOTE: Ensure that the ASM instance is started BEFORE any databases that are making use of disk groups contained in it.

...
+ASM:/u01/app/oracle/product/10.1.0/db_1:Y
TESTDB:/u01/app/oracle/product/10.1.0/db_1:Y
... 

  No changes needed to be made to the dbshut or dbstart scripts located in the $ORACLE_HOME/bin directory.


The final step to manually edit the script /etc/inittab so that the entry to respawn init.cssd comes before running the runlevel 3.


  Bug: 3458327 - Automatic Startup On Reboot Fails When Database Uses ASM

This bug is "NOT" fixed in the 10.1.0.4.0 Patch Set!!!!!!

If you have been following this article and applied the 10.1.0.4 patchset (and modified the /etc/inittab file to force init.cssd to run (actually to respaen) before running runlevel 3), this bug should not affect you. If you are using 10.1.0.3 (and below), however, this bug may not allow the Oracle ASM instance to start, which will also prevent any other instances that have disk groups within that ASM instance to start. As they exist, the dbstart and dbshut scripts are not ASM aware with 10.1.0.3 and below. Even with patchset 10.1.0.4.0, we had to manually modify the /etc/inittab script. When the dbora script attempts to start the ASM database, even after the ocssd.bin is up and running, you will receive the error:

ORA-29701: unable to connect to Cluster Manager

The problem is simply a matter of ordering of when services are started and that is why we needed to modify the /etc/inittab file. Upon entering a certain runlevel (e.g. runlevel 3), init starts all the 'respawn lines' AFTER the 'wait' lines have finished. It is important to understand that the S96init.cssd lines does not actually start the CSSD, it merely removes the 'NORUN' line. Then S99dbora tries to start the instances (and fails). Then, finally, init starts the CSSD.

Note that I used /etc/rc5.d/S99 to start the dbora script. You should make note that the dbora script MUST run after the /etc/init.d/init.cssd if you are starting an ASM instance. For Linux, the OUI places the start for init.cssd as /etc/rc3.d/S96init.cssd.

You will also notice that I had to put a sleep 120 in the dbora script before starting any databases/instances. The dbora script will sleep for 120 seconds to ensure that ocssd.bin daemon is running before starting any ASM instances.



Miscellaneous Options


Oracle DBA Scripts

Included in the file you downloaded and extracted earlier in this article (oracle_10g_installation_files_linux.tar) is a set of DBA scripts that were extracted to /u01/app/oracle/dba_scripts/sql. This directory is included in the environment variable $ORACLE_PATH which is like a $PATH directory for SQL*Plus and other Oracle tools.

To start using these scripts, simply login to SQL*Plus from any directory as a DBA user. There is a Help script (help.sql) that can be used to identify all scripts that are available. Here is an example session:

$ sqlplus system/manager

SQL> @help.sql
========================================
DDL Examples
========================================
cr_clob.sql
cr_clob_8.sql
cr_dimension.sql
cr_index.sql

... <snip> ...

========================================
Tuning
========================================
perf_db_block_buffer_usage.sql
perf_explain_plan.sql
perf_file_io.sql
perf_file_io_7.sql
perf_file_io_efficiency.sql


SQL> @dba_tablespaces

Status    Tablespace Name TS Type      Ext. Mgt.  Seg. Mgt.    Tablespace Size    Used (in bytes) Pct. Used
--------- --------------- ------------ ---------- --------- ------------------ ------------------ ---------
ONLINE    INDX            PERMANENT    LOCAL      AUTO           1,073,741,824             65,536         0
ONLINE    SYSAUX          PERMANENT    LOCAL      AUTO             524,288,000        224,329,728        43
ONLINE    SYSTEM          PERMANENT    LOCAL      MANUAL           838,860,800        451,084,288        54
ONLINE    UNDOTBS1        UNDO         LOCAL      MANUAL         1,283,457,024        113,836,032         9
ONLINE    USERS           PERMANENT    LOCAL      AUTO           2,147,483,648            131,072         0
ONLINE    TEMP            TEMPORARY    LOCAL      MANUAL         1,073,741,824         23,068,672         2
                                                            ------------------ ------------------ ---------
avg                                                                                                      18
sum                                                              6,941,573,120        812,515,328

6 rows selected.


Enterprise Manager - Database Console

During the database creation section, I asked for DBCA to create the Enterprise Manager Database Console application. In almost all cases, the DBCA will automatically start the OEM Database Console application. To check for the process, type the following:
$ emctl status dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.1.0.4
Copyright (c) 1996, 2004 Oracle Corporation.  All rights reserved.
http://linux3:5500/em/console/aboutApplication
Oracle Enterprise Manager 10g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.1.0/db_1/linux3_TESTDB/sysman/log
If you recieve something similar to the above output, then OEM Database Console is running. If you need to manually start this application, login as the UNIX oracle user account and type the following:
$ emctl start dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.1.0.4
Copyright (c) 1996, 2004 Oracle Corporation.  All rights reserved.
http://linux3:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .............. started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.1.0/db_1/linux3_TESTDB/sysman/log
The OEM DB Console application may take several minutes to start.

Once the DB Console application is up and running, point your web browser to http://<Database_Server>:5500/em as in the following:

http://linux3.idevelopment.info:5500/em

  The emctl start dbconsole command can be placed in the /etc/init.d/dbora script to be stopped and started when the database server is cycled.


Change Oracle Database Environment

In some cases, you may have more than one database running on your single database server. It is even possible to be using two different databases running on different releases of the Oracle Database software. (i.e. Oracle 8.1.7, Oracle 9.2.0, and 10.1.0). For example, you may have two database - ORA920 (using Oracle release 9.2.0) and TESTDB (using Oracle release 10.1.0). Whatever the case may be, you need an efficient way to modify your environment variables to switch between these two databases. This requires you update environment variables like ORACLE_HOME, ORACLE_SID, PATH, LD_LIBRARY_PATH, etc. Although this can be done manually at the command line, it can get old real quick. Instead you can use a single command line script to switch between all database environments declared in your /etc/oratab file.

If you have been following along with this article, the required scripts for switching your Oracle database environment is already included. From the command prompt, simply run the following:

$ . oraenv
ORACLE_SID = [ORA920] ? TESTDB
Notice that in the above example, we didn't just run the oraenv script, but rather, we sourced it by using a dot followed by a space and then the script name oraenv. When sourcing the oraenv script, it will prompt you for the ORACLE_SID, (defined in your /etc/oratab file), you want to switch to. In the above example, if an entry exists for TESTDB, then all required environment variables would be reset to access this database.


Bug: 4147463

If you have been following this article and applied the 10.1.0.4 patchset, this bug should affect you. If you are using 10.1.0.3 (and below), however, this bug may hang your database instance, not allowing connections to succeed. The bug seems to loose the mapping of the instance to the SGA with the error appearing in a trace file similar to the following:
kstwlb: SGA is no longer mapped
AUM timeouts: MQL_TUNE(300s) TUR_TUNE(60s) SESS_EXPRN(1800s) QRY_EXPRN(1800s) 
  SLOT_PERIOD(600s) MQL_CUSHION(300s) KSUCKI_FG_PERIOD(150s) 
  MMNL_EXPRN(1200s) KTTSINFO(300s)



About the Author

Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.



Copyright (c) 1998-2014 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Sunday, 18-Mar-2012 22:11:26 EDT
Page Count: 111930