[wiki]oracle10g-ubuntu
发表于 : 2005-11-09 12:07
Table of Contents
1. Installation Prep
1.1. Setting up Users
1.2. Create Directories and Set Permissions
1.3. Configuration Changes
1.4. Installation
1.5. Starting/Stopping Services
1. Installation Prep
As a minimum you should have the following things before beginning:
*
500 MB ram
*
1 GB swap partition
*
gcc, make, binutils, lesstif2, libc6, and rpm installed
*You should also make sure dns and/or your /etc/hosts file is set up properly so that your ip address resolves to the correct hostname.
1.1. Setting up Users
You need to create an oracle user and two groups for installing. It's a good idea to make sure they don't exist first:
$grep oinstall /etc/group
$grep dba /etc/group
$grep nobody /etc/group
As long as they're not there, go ahead and create them
#addgroup oinstall
#addgroup dba
#addgroup nobody
#useradd -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle
#usermod -g nobody nobody
1.2. Create Directories and Set Permissions
Note: The oracle directory default is /u01 and /u02. We chose to be a little more FHS compliant and put things in /opt/oracle and /opt/oradata:
#mkdir -p /opt/oracle
#mkdir -p /opt/oradata
#chown -R oracle:oinstall /opt/ora*
#chmod -R 775 /opt/ora*
1.3. Configuration Changes
Begin by adding the following lines to /etc/sysctl.conf:
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
To update the changes you just made, run:
#sysctl -p
Add the following lines to /etc/security/limits.conf file:
* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
Create the following symlinks:
#ln -s /usr/bin/awk /bin/awk
#ln -s /usr/bin/rpm /bin/rpm
#ln -s /usr/bin/basename /bin/basename
Trick the installer by making it think we are running Red-Hat. Add the following to new file /etc/redhat-release:
Red Hat Linux release 2.1 (drupal)
1.4. Installation
Login as oracle and copy the installation files to a temporary directory.
#su oracle
$cp -r /installer/files/here/ `mktemp -d`
Start the installer. Note: if you get an error about the display variable, try restarting gdm and logging in as oracle from there.
$./runInstaller
If everything is working you should see a nice GUI pop upp and you will be prompted twice during the installation to stop and run a script as root. The first is straight forward and just sets permissions for you. When you get to the second prompt to run the root.sh script do the following things first:
#mkdir /etc/rc.d
#ln -s /etc/rc0.d /etc/rc.d/rc0.d
#ln -s /etc/rc2.d /etc/rc.d/rc2.d
#ln -s /etc/rc3.d /etc/rc.d/rc3.d
#ln -s /etc/rc4.d /etc/rc.d/rc4.d
#ln -s /etc/rc5.d /etc/rc.d/rc5.d
#ln -s /etc/rc6.d /etc/rc.d/rc6.d
#ln -s /etc/init.d /etc/rc.d/init.d
#/path/to/root.sh
Oracle installs a service called init.cssd. The root.sh script waits 600 seconds (10 minutes) for the service to be started before going on. You need to do some setting up while it waits for you! The message on the console will show: Expecting the CRS daemons to be up within 600 seconds. There are three things to do. First, the /etc/inittab file needs a line to set the active runlevels to 23 (the Debian defaults) instead of 35 (the Red Hat and Suse defaults). Change it from:
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
to
h1:23:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
Next, the inittab runs /etc/rc.d/init.d/init.cssd. Exit this script and, at line 83, replace:
SU="/bin/su -l"
with
SU="/bin/su"
Finally, make init restart the service:
#init q
The root.sh script should now continue and finish as expected and you should be done with the graphical installer.
1.5. Starting/Stopping Services
At this point you need to add another init script to make oracle startup whenever you reboot. But first, you need to take care of some broken links that the installer creates for you.
#rm /etc/rc2.d/[SK]96*
#rm /etc/rc3.d/[SK]96*
#rm /etc/rc5.d/[SK]96*
#update-rc.d init.cssd defaults 96
Below is the init script that I customized for our needs that starts/stops the instance, listener, and the enterprise management web interface.
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_HOME=/your/oracle/home/goes/here
export ORACLE_SID=oraclesidgoeshere
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracleownergoeshere"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
su $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsole
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
su $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsole
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
Once this is in place, make it executable, and link it to all the runlevels:
#chmod 755 /etc/init.d/oracledb
#update-rc.d oracledb defaults 99
Before we can run this we have to do a couple more customizations. The following files need to have their environment variables changed for your respective setup:
/usr/local/bin/dbhome -- change ORAHOME, ORASID, and ORATAB (/etc/oratab)
$ORACLE_HOME/bin/dbhome -- same as above
$ORACLE_HOME/bin/dbstart -- change ORATAB
$ORACLE_HOME/bin/dbshut -- same as above
For all the databases that you create or want started at boot time you will need to edit the /etc/oratab file. Here is an example:
oracle:/opt/oracle/:N
to
oracle:/opt/oracle:Y
At this point you should be ready to roll. Just reboot and set your ORACLE_HOME, ORACLE_SID, and PATH variables through the command line or through startup file (i.e. .bashrc); also try running sqlplus or logging in through the web interface (http://urlhere.com:5500/em) to test everything. Enjoy
http://csee.wvu.edu/~ccole/oracle10g-ubuntu
1. Installation Prep
1.1. Setting up Users
1.2. Create Directories and Set Permissions
1.3. Configuration Changes
1.4. Installation
1.5. Starting/Stopping Services
1. Installation Prep
As a minimum you should have the following things before beginning:
*
500 MB ram
*
1 GB swap partition
*
gcc, make, binutils, lesstif2, libc6, and rpm installed
*You should also make sure dns and/or your /etc/hosts file is set up properly so that your ip address resolves to the correct hostname.
1.1. Setting up Users
You need to create an oracle user and two groups for installing. It's a good idea to make sure they don't exist first:
$grep oinstall /etc/group
$grep dba /etc/group
$grep nobody /etc/group
As long as they're not there, go ahead and create them
#addgroup oinstall
#addgroup dba
#addgroup nobody
#useradd -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle
#usermod -g nobody nobody
1.2. Create Directories and Set Permissions
Note: The oracle directory default is /u01 and /u02. We chose to be a little more FHS compliant and put things in /opt/oracle and /opt/oradata:
#mkdir -p /opt/oracle
#mkdir -p /opt/oradata
#chown -R oracle:oinstall /opt/ora*
#chmod -R 775 /opt/ora*
1.3. Configuration Changes
Begin by adding the following lines to /etc/sysctl.conf:
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
To update the changes you just made, run:
#sysctl -p
Add the following lines to /etc/security/limits.conf file:
* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
Create the following symlinks:
#ln -s /usr/bin/awk /bin/awk
#ln -s /usr/bin/rpm /bin/rpm
#ln -s /usr/bin/basename /bin/basename
Trick the installer by making it think we are running Red-Hat. Add the following to new file /etc/redhat-release:
Red Hat Linux release 2.1 (drupal)
1.4. Installation
Login as oracle and copy the installation files to a temporary directory.
#su oracle
$cp -r /installer/files/here/ `mktemp -d`
Start the installer. Note: if you get an error about the display variable, try restarting gdm and logging in as oracle from there.
$./runInstaller
If everything is working you should see a nice GUI pop upp and you will be prompted twice during the installation to stop and run a script as root. The first is straight forward and just sets permissions for you. When you get to the second prompt to run the root.sh script do the following things first:
#mkdir /etc/rc.d
#ln -s /etc/rc0.d /etc/rc.d/rc0.d
#ln -s /etc/rc2.d /etc/rc.d/rc2.d
#ln -s /etc/rc3.d /etc/rc.d/rc3.d
#ln -s /etc/rc4.d /etc/rc.d/rc4.d
#ln -s /etc/rc5.d /etc/rc.d/rc5.d
#ln -s /etc/rc6.d /etc/rc.d/rc6.d
#ln -s /etc/init.d /etc/rc.d/init.d
#/path/to/root.sh
Oracle installs a service called init.cssd. The root.sh script waits 600 seconds (10 minutes) for the service to be started before going on. You need to do some setting up while it waits for you! The message on the console will show: Expecting the CRS daemons to be up within 600 seconds. There are three things to do. First, the /etc/inittab file needs a line to set the active runlevels to 23 (the Debian defaults) instead of 35 (the Red Hat and Suse defaults). Change it from:
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
to
h1:23:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
Next, the inittab runs /etc/rc.d/init.d/init.cssd. Exit this script and, at line 83, replace:
SU="/bin/su -l"
with
SU="/bin/su"
Finally, make init restart the service:
#init q
The root.sh script should now continue and finish as expected and you should be done with the graphical installer.
1.5. Starting/Stopping Services
At this point you need to add another init script to make oracle startup whenever you reboot. But first, you need to take care of some broken links that the installer creates for you.
#rm /etc/rc2.d/[SK]96*
#rm /etc/rc3.d/[SK]96*
#rm /etc/rc5.d/[SK]96*
#update-rc.d init.cssd defaults 96
Below is the init script that I customized for our needs that starts/stops the instance, listener, and the enterprise management web interface.
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_HOME=/your/oracle/home/goes/here
export ORACLE_SID=oraclesidgoeshere
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracleownergoeshere"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
su $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsole
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
su $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsole
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
Once this is in place, make it executable, and link it to all the runlevels:
#chmod 755 /etc/init.d/oracledb
#update-rc.d oracledb defaults 99
Before we can run this we have to do a couple more customizations. The following files need to have their environment variables changed for your respective setup:
/usr/local/bin/dbhome -- change ORAHOME, ORASID, and ORATAB (/etc/oratab)
$ORACLE_HOME/bin/dbhome -- same as above
$ORACLE_HOME/bin/dbstart -- change ORATAB
$ORACLE_HOME/bin/dbshut -- same as above
For all the databases that you create or want started at boot time you will need to edit the /etc/oratab file. Here is an example:
oracle:/opt/oracle/:N
to
oracle:/opt/oracle:Y
At this point you should be ready to roll. Just reboot and set your ORACLE_HOME, ORACLE_SID, and PATH variables through the command line or through startup file (i.e. .bashrc); also try running sqlplus or logging in through the web interface (http://urlhere.com:5500/em) to test everything. Enjoy
http://csee.wvu.edu/~ccole/oracle10g-ubuntu