Ubuntu 12.04 LTS Install Oracle11gR2
Install Packages
Check your packages
You can search packages on website : http://packages.ubuntu.com/
Here we need this two packages:
libaio
I found here:http://kr.archive.ubuntu.com/ubuntu/pool/main/liba/libaio/libaio1_0.3.109-2ubuntu1_amd64.deb
libstdc++5
I found here:
http://kr.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-25ubuntu1_amd64.deb
you show download these packages for your Ubuntu and you can use dpkg –i yourpackage_path
System groups and users
Check your existing setup with:
grep oinstall /etc/group
grep dba /etc/group
grep nobody /etc/group
id oracle
id nobody
Most likely, you should run the following command for create the required system groups and users. Latest Ubuntu already come with user nobody so we don't need to retouch it:
addgroup --system oinstall
addgroup --system dba
useradd -r -g oinstall -G dba -m -s /bin/bash -d /var/lib/oracle oracle
passwd oracle
Configure kernel parameters
Check your existing setup with:
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default
/sbin/sysctl -a | grep rmem_max
/sbin/sysctl -a | grep wmem_default
/sbin/sysctl -a | grep wmem_max
Create /etc/sysctl.d/99-oracle.conf and add the following lines:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
Run the following command to reload these kernel parameters:
service procps start
Shell limits for oracle user
Create /etc/security/limits.d/oracle.conf as below:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
Check (or add) if the following line exits within /etc/pam.d/login:
session required pam_limits.so
Check (or add) if the following line exits within /etc/pam.d/su:
session required pam_limits.so
Create required directories
Create required directory and change permission:
rm -rf /u01 /u02
mkdir -p /u01/app/oracle
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
Configuring the oracle user's environment
Add following line to /var/lib/oracle/.profile (as i will create a AL32UTF8 database; change to US7ASCII if you will create ASCII database). This will also map Oracle's /bin to your $PATH so can run Oracle's binary directly when login as user oracle:
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
#export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_BASE=/u01/app/oracle
#export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=AL32UTF8
export NLS_LANG=.AL32UTF8
#export ORACLE_UNQNAME=AL32UTF8
unset TNS_ADMIN
if [ -d "$ORACLE_HOME/bin" ]; then
PATH="$ORACLE_HOME/bin:$PATH"
fi
Fake Oracle installer
As mentioned before , Ubuntu is not listed as Oracle officially support platform and so we need to "fake" it. Create symbolic links:
mkdir /usr/lib64
ln -s /etc /etc/rc.d
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/basename /bin/basename
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib64/
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
Also mask ourself as RedHat:
echo 'Red Hat Linux release 5' > /etc/redhat-release
Last step before installation start
First of all, login with your new oracle user, with X enabled.
If you are using PuTTY + Xming, for sure that the X11 forward is enabled.
Copy the file linux_11gR1_database.zip to oracle's home directory, then unzip it:
cp linux.x64_11gR2_database_1of2.zip /var/lib/oracle
cp linux.x64_11gR2_database_2of2.zip /var/lib/oracle
cd /var/lib/oracle
unzip -q linux.x64_11gR2_database_1of2.zip
unzip -q linux.x64_11gR2_database_2of2.zip
chown -Rf oracle:oinstall /var/lib/oracle/
I will STRONGLY suggest for a complete reboot, and double-check ALL pre-installation BEFORE starting the next step.
Recommended installation procedures
First of all login with useraccount "oracle" and start the X11 with startx, then start the installer with:
cd /var/lib/oracle/database && ./runInstaller
Next we go though the installation (I don't have the "Oracle Support Password" so just skip in here):
<!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="图片_x0020_27" o:spid="_x0000_i1051" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database024.png" style='width:780pt; height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" o:title="linux.x64_11gr2_database024"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Selection Installation Option", choose "Create and configure a database":
<!--[if gte vml 1]><v:shape id="图片_x0020_26" o:spid="_x0000_i1050" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database025.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" o:title="linux.x64_11gr2_database025"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "System Class", choose "Server Class" (we hope to give a full control during installation):
<!--[if gte vml 1]><v:shape id="图片_x0020_25" o:spid="_x0000_i1049" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database026.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png" o:title="linux.x64_11gr2_database026"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Node Selection", choose "Single instance database installation":
<!--[if gte vml 1]><v:shape id="图片_x0020_24" o:spid="_x0000_i1048" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database027.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image007.png" o:title="linux.x64_11gr2_database027"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Select Install Type", choose "Advanced install":
<!--[if gte vml 1]><v:shape id="图片_x0020_23" o:spid="_x0000_i1047" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database028.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image009.png" o:title="linux.x64_11gr2_database028"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Select Product Languages", I choose to install all available languages:
<!--[if gte vml 1]><v:shape id="图片_x0020_22" o:spid="_x0000_i1046" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database029.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image011.png" o:title="linux.x64_11gr2_database029"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Select Database Edition", I choose "Enterprise Edition":
<!--[if gte vml 1]><v:shape id="图片_x0020_21" o:spid="_x0000_i1045" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database030.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image013.png" o:title="linux.x64_11gr2_database030"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Specify Installation Location", it should default as below:
<!--[if !supportLists]-->· <!--[endif]-->Oracle Base: /u01/app/oracle
<!--[if !supportLists]-->· <!--[endif]-->Sofeware Location: /u01/app/oracle/product/11.2.0/dbhome_1
<!--[if gte vml 1]><v:shape id="图片_x0020_20" o:spid="_x0000_i1044" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database031.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image015.png" o:title="linux.x64_11gr2_database031"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Create Inventory", it should default as below:
<!--[if !supportLists]-->· <!--[endif]-->Inventory Directory: /u01/app/oraInventory
<!--[if !supportLists]-->· <!--[endif]-->oraInventory Group Name: oinstall
<!--[if gte vml 1]><v:shape id="图片_x0020_19" o:spid="_x0000_i1043" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database032.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image017.png" o:title="linux.x64_11gr2_database032"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Select Configure Type", choose "General Purpose / Transaction Processing":
<!--[if gte vml 1]><v:shape id="图片_x0020_18" o:spid="_x0000_i1042" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database033.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image019.png" o:title="linux.x64_11gr2_database033"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
(IMPORTANT!) In "Specify Database Identifiers", configure as below:
<!--[if !supportLists]-->· <!--[endif]-->Global database name: orcl
<!--[if !supportLists]-->· <!--[endif]-->Oracle Service Identifier (SID): orcl
<!--[if gte vml 1]><v:shape id="图片_x0020_17" o:spid="_x0000_i1041" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database034.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image021.png" o:title="linux.x64_11gr2_database034"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Specify Configuration Options", configure as below:
<!--[if !supportLists]-->· <!--[endif]-->Memory -> Enable Automatic Memory Management: TRUE
<!--[if !supportLists]-->· <!--[endif]-->Character sets: Use Unicode (AL32UTF8)
<!--[if gte vml 1]><v:shape id="图片_x0020_16" o:spid="_x0000_i1040" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database035.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image023.png" o:title="linux.x64_11gr2_database035"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
<!--[if gte vml 1]><v:shape id="图片_x0020_15" o:spid="_x0000_i1039" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database036.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image025.png" o:title="linux.x64_11gr2_database036"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Specify Management Options", choose "Use Database Control for database management" but keep other else empty:
<!--[if gte vml 1]><v:shape id="图片_x0020_14" o:spid="_x0000_i1038" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database037.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image027.png" o:title="linux.x64_11gr2_database037"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Specify Database Storage Options", choose "File System" where:
<!--[if !supportLists]-->· <!--[endif]-->Specify database file location: /u02/oradata
<!--[if gte vml 1]><v:shape id="图片_x0020_13" o:spid="_x0000_i1037" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database038.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image029.png" o:title="linux.x64_11gr2_database038"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Specify Recovery Options", choose "Do not enable automated backups":
<!--[if gte vml 1]><v:shape id="图片_x0020_12" o:spid="_x0000_i1036" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database039.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image031.png" o:title="linux.x64_11gr2_database039"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Specify Schema Passwords", I am a bit lazy so choose "Use the same password for all accounts" (don't do this in production server!):
<!--[if gte vml 1]><v:shape id="图片_x0020_11" o:spid="_x0000_i1035" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database040.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image033.png" o:title="linux.x64_11gr2_database040"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Privileged Operating System Groups", confirm as below:
<!--[if !supportLists]-->· <!--[endif]-->Database Administrator (OSDBA) Group: dba
<!--[if !supportLists]-->· <!--[endif]-->Database Operator (OSOPER) Group: oinstall
<!--[if gte vml 1]><v:shape id="图片_x0020_10" o:spid="_x0000_i1034" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database041.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image035.png" o:title="linux.x64_11gr2_database041"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
In "Preform Prerequisite Checks", just simply ignore all warning message (since we are using Debian but not Oracle officially supported OS):
<!--[if gte vml 1]><v:shape id="图片_x0020_9" o:spid="_x0000_i1033" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database042.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image037.png" o:title="linux.x64_11gr2_database042"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
So just confirm everything in "Summary":
<!--[if gte vml 1]><v:shape id="图片_x0020_8" o:spid="_x0000_i1032" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database043.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image039.png" o:title="linux.x64_11gr2_database043"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
And now let's go for a coffee break ;-)
<!--[if gte vml 1]><v:shape id="图片_x0020_7" o:spid="_x0000_i1031" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database044.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image041.png" o:title="linux.x64_11gr2_database044"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Oh it should that almost done! Special note for Ubuntu 12.04: If you face error during installation so update as below:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk
sed -i 's/^\(\$LD \$LD_RUNTIME\) \(\$LD_OPT\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/bin/genorasdksh
sed -i 's/^\(\s*\)\(\$(OCRLIBS_DEFAULT)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/srvm/lib/ins_srvm.mk
sed -i 's/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/network/lib/env_network.mk
sed -i 's/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \(\$(PL_FLAGS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
Then keep ongoing for installation ;-)
<!--[if gte vml 1]><v:shape id="图片_x0020_6" o:spid="_x0000_i1030" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database045.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image043.png" o:title="linux.x64_11gr2_database045"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Now following the instructions and run the following commands with "root" user:
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
<!--[if gte vml 1]><v:shape id="图片_x0020_5" o:spid="_x0000_i1029" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database046.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image045.png" o:title="linux.x64_11gr2_database046"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Ok you get it!
<!--[if gte vml 1]><v:shape id="图片_x0020_4" o:spid="_x0000_i1028" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database047.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image047.png" o:title="linux.x64_11gr2_database047"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Confirm with installation progress
In previous screen the installer mentioned that we can access "Enterprise Manager Database Control URL - (AL32UTF8)" from https://yourhostname:1158/em, so now let's open the browser and test it with following account:
<!--[if !supportLists]-->· <!--[endif]-->User Name: SYS
<!--[if !supportLists]-->· <!--[endif]-->Password: your_secret_password
<!--[if !supportLists]-->· <!--[endif]-->Connect As: SYSDBA
<!--[if gte vml 1]><v:shape id="图片_x0020_3" o:spid="_x0000_i1027" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database048.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image049.png" o:title="linux.x64_11gr2_database048"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Once login it should show as below:
<!--[if gte vml 1]><v:shape id="图片_x0020_2" o:spid="_x0000_i1026" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database049.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image051.png" o:title="linux.x64_11gr2_database049"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
<!--[if gte vml 1]><v:shape id="图片_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75" alt="http://edin.no-ip.com/files/linux.x64_11gr2_database050.png" style='width:780pt;height:604.2pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\Mechrevo\AppData\Local\Temp\msohtmlclip1\01\clip_image053.png" o:title="linux.x64_11gr2_database050"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Autostart Oracle during system boot
There is almost for sure that you will hope to start your Oracle automatically during system boot. Even you may turn this feature off, but the init.d script is very useful, too.
First of all, specify which database instant will be started together with Oracle. Edit /etc/oratab as below:
AL32UTF8:/u01/app/oracle/product/11.2.0/dbhome_1:Y
Next, create init.d script as /etc/init.d/oracle:
#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
### BEGIN INIT INFO
# Provides: Oracle
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Startup/Shutdown Oracle listener and instance
### END INIT INFO
ORA_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_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 "$ORA_HOME/bin/dbstart $ORA_HOME"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"
#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl start dbconsole"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl stop dbconsole"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNR -c "$ORA_HOME/bin/dbshut $ORA_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
Permission is very important, too:
chmod 755 /etc/init.d/oracle
Finally, install the script so Oracle will start during system bootup:
update-rc.d-insserv oracle defaults 99 01
NOTE: You may find the following error message during /etc/init.d/oracle/stop:
Shutdown Oracle: ulimit: 25: bad number
You can then update /u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl with #!/bin/bash to solve the problem:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
sed -i 's/^#!\/bin\/sh -f\s*/#!\/bin\/bash -f/g' $ORACLE_HOME/bin/emctl
References
<!--[if !supportLists]-->· <!--[endif]-->http://lostinmac.com/2012/01/29/installtion-doracle-11gr2-sur-ubunutu-11-10/
<!--[if !supportLists]-->· <!--[endif]-->https://forums.oracle.com/forums/thread.jspa?threadID=2301639
<!--[if !supportLists]-->· <!--[endif]-->https://forums.oracle.com/forums/thread.jspa?threadID=697814