Create Oracle File Directories
For this example installation, external drive volumes named u01, u02, u03 will be used for the installation. On Mac OS X, external drives are mounted automatically by the automounter daemon, after being partitioned and erased by the Disk Utility. These disk volumes are located under the /Volumes directory once they are mounted by Mac OS X. Mac OS X can easily work with volume and directory names containing space characters if the HFS+ file system is used for a volume; it is recommended that spaces not be used in volume names/directories that will be used for Oracle files. The Oracle database software operates as any other UNIX application and is not as forgiving when dealing with these issues as Mac OS X!
Change the ownership of each of the top-level mount points and dump directories:
oracle% sudo mkdir /Volumes/u01/prod1
oracle% sudo mkdir /Volumes/u01/udump
oracle% sudo mkdir /Volumes/u01/cdump
oracle% sudo mkdir /Volumes/u01/bdump
oracle% sudo mkdir /Volumes/u02/prod1
oracle% sudo mkdir /Volumes/u03/prod1
oracle% sudo chown -R oracle:dba /Volumes/u01
oracle% sudo chown -R oracle:dba /Volumes/u02
oracle% sudo chown -R oracle:dba /Volumes/u03
Add the following info to the /Users/oracle/.bashrc file and add "source
.bashrc" to the .bash_profile file so that you won't have to manually execute Oracle's
ulimit -c unlimited # max size of core dump file is unlimited
ulimit -d unlimited # maximum data file size
ulimit -s 65536 # set stacksize to 64Mb
ulimit -u 500 # max number of processes
ulimit -n 10000 # max number of open files
If you choose to use a different shell, like
/bin/tcsh, then add the following
limit settings to the .tcshrc file within the /Users/oracle directory:
limit coredumpsize unlimited
limit datasize unlimited
limit memoryuse unlimited
limit stacksize 64M
limit maxproc 500
limit descriptors 10000
I also recommend putting these values into the into the /private/var/root/.tcshrc file that will be used by the root account if you use the default
tcsh shell. I have set the maximum number of processes to 500 and number of open files to 10000 because Mac OS X reports hard limits of 532 and 12288, respectively, on my Titanium Powerbook G4. These parameters don't cause problems if they are set higher than necessary; they only set maximum limits for resource usage. Feel free to adjust them lower if you like.
Update the /etc/profile file with the following environment variable enhancements:
export TNS_ADMIN PATH ORACLE_HOME SRCHOME ORACLE_SID DYLD_LIBRARY_PATH
CLASSPATH LD_LIBRARY_PATH ORACLE_OWNER ORAENV_ASK TERM NLS_LANG
You can verify the
ulimit settings by using the
ulimit command while logged
in as the oracle UNIX user; this should show results similar to the following.
[G4:/Volumes/u01] oracle% ulimit -a -H
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (Kbytes, -l) unlimited
max memory size (Kbytes, -m) unlimited
open files (-n) 10000
pipe size (512 bytes, -p) 1
stack size (Kbytes, -s) 65536
cpu time (seconds, -t) unlimited
max user processes (-u) 500
virtual memory (Kbytes, -v) 9007199254806527
Note: If the hard process limits have not previously been set by root, then the oracle account will only be able to make changes up to the soft limit. This fact will probably affect the "max user processes" parameter more than any other, because it has a soft limit of 100. On a test server, this will not generally be an issue, but on a production server, you may commonly have a need for more than 100 user processes because each user or application logged into the server will generally spawn a new oracle process unless some type of connection pooling is implemented in the application.
The startup script listed below will set these process limits as the root user before invoking the database startup commands via an oracle UNIX account subshell process that will then use the limits specified in the .bashrc file.
If you want to avoid rebooting in order to get the higher values for the hard limits, put the
tcsh version of the limit commands into the /private/var/root/.tcshrc file. Then open a new terminal session as root before executing the
su - oracle command.
Create the Database Startup Script
The Oracle instructions for Developer Release 1 specify the use of the
allup.sh script to be run manually to start up the database, and the use of the
alldown.sh script to shut down the database before the Mac OS X server is shut down. This startup/shutdown procedure should be automated to ensure that the database can be started up or shut down unattended. Automating this task will ensure database availability upon server startup and prevent a known issue with datafile corruption if the database is not shut down properly before Mac OS X shuts down.
Unfortunately, it is not currently possible to run a shut down script with Mac OS X, so for now this task will still need to be performed manually. The startup script presented here does contain the shutdown code, in preparation for Apple's update of Mac OS X beyond version 10.2.2 to correct this issue. Two files are used by the Mac OS X SystemStarter in order to run scripts or applications upon system startup. The first file is either a binary executable or, more commonly, an executable shell script located within a directory with the same name as the executable file within /Library/StartupItems. The second file is a configuration property list file named StartupParameters.plist, located within the same directory as the startup script. This property list file contains the text describing the item to be started, along with dependencies and services provided.
Create an Oracle directory within /Library/StartupItems and put the executable script listed in Listing #1 into this directory. This script should be given the name of the enclosing directory, which will be Oracle (not Oracle.sh). Note: Some Mac OS X books (not written by O'Reilly!) incorrectly give examples of installing startup scripts in the path /System/Library/StartupItems/*. The directory paths under /System/Library/StartupItems and /Network/Library/StartupItems are reserved for startup scripts created and installed by Apple as part of the core operating system. The path under /Library/StartupItems is available for developers and system administrators to use for additional startup scripts that they may add to the server. For more details about the startup process, please see Chapter 4 of the Inside Mac OS X: System Overview book.
oracle% sudo mkdir /Library/StartupItems/Oracle
oracle% sudo chmod 700 /Library/StartupItems/Oracle/Oracle
oracle% sudo chown root:wheel /Library/StartupItems/Oracle/Oracle
oracle% sudo cp Oracle_startup /Library/StartupItems/Oracle/Oracle
oracle% sudo cp StartupParameters.plist /Library/StartupItems/Oracle/StartupParameters.plist
oracle% sudo chown root:wheel /Library/StartupItems/Oracle/StartupParameters.plist
Listing #1 -- filename: /Library/StartupItems/Oracle/Oracle