Install Oracle 11g in Ubuntu

Source: Internet
Author: User
$ Sudo Su-
# Apt-Get install build-essential libaio1 gawk KSh libmotif3 alien libtool LSB-rpm

Root @ hard :~ # Cd/bin
Root @ hard:/bin # ls-L/bin/sh
Lrwxrwxrwx 1 Root 4 2008-04-28 :59/bin/sh-> dash
Root @ hard:/bin # ln-SF bash/bin/sh
Root @ hard:/bin # ls-L/bin/sh
Lrwxrwxrwx 1 Root 4 2008-05-01/bin/sh-> bash

# Echo "Red Hat Linux Release 4">/etc/RedHat-release

Root @ hard:/bin # cd
Root @ hard :~ # Pwd
/Root
Root @ hard :~ # Addgroup oinstall
Adding group 'oss install' (GID 1001 )...
Done.
Root @ hard :~ # Addgroup DBA
Adding group 'dba' (GID 1002 )...
Done.
Root @ hard :~ # Addgroup nobody
Adding group 'nobody' (GID 1003 )...
Done.
Root @ hard :~ # Usermod-G nobody
Root @ hard :~ # Useradd-G oinstall-g dba-P password-D/home/Oracle-S/bin/bash Oracle
Root @ hard :~ # Passwd-l Oracle
Password Changed.
Root @ hard :~ # Mkdir/home/Oracle
Root @ hard :~ # Chown-r ORACLE: DBA/home/Oracle
Root @ hard :~ # Ln-S/usr/bin/awk
Root @ hard :~ # Ln-S/usr/bin/RPM
Root @ hard :~ # Ln-S/usr/bin/basename
Root @ hard :~ # Mkdir/etc/rc. d
Root @ hard :~ # For I in 0 1 2 3 4 5 6 s; do ln-S/etc/rc $ I. d/etc/rc. d/RC $ I. D; done
Root @ hard :~ # Mkdir-P/u01/APP/Oracle
Root @ hard :~ # Chown-r ORACLE: DBA/u01
Root @ hard :~ #

Modify the ETC/sysctl. conf file and add the following content at the end:

FS. File-max = 65535
Kernel. Shmall = 2097152
Kernel. shmmax = 2147483648
Kernel. shmmni = 4096
Kernel. SEM = 250 32000 100 128
Net. ipv4.ip _ local_port_range = 1024 65535
Net. Core. rmem_default = 1048576
Net. Core. rmem_max = 1048576
Net. Core. wmem_default = 262144
Net. Core. wmem_max = 262144

Modify the/etc/security/limits. conf file and add:
Oracle soft nproc 2047
Hard nproc 16383
Oracle soft nofile 1023
Oracle hard nofile 65535

To forcibly use the added content, modify the end Of the/etc/PAM. d/login file:
Session required/lib/security/pam_limits.so
Session required pam_limits.so
# Sysctl-P

Unzip the oracle11g installation package to the/home/Oracle/install/directory. Then go to the directory, set the display parameter (if Oracle is not set, try again), and start the installation:
Root @ hard :~ # Cd/home/Oracle
Root @ hard:/home/Oracle # chown-r ORACLE: DBA install
Root @ hard:/home/Oracle # Su-Oracle
Your account has expired; please contact your system administrator
Su: User Account has expired
(Ignored)
Oracle @ hard :~ $ Export display = 127.0.0.1: 0.0
Oracle @ hard :~ $ Pwd
/Home/Oracle
Oracle @ hard :~ $ LS-l
Total 4
Drwxr-XR-x 6 Oracle DBA 4096 install
Oracle @ hard :~ $ CD install
Oracle @ hard :~ /Install $ LS-l

Oracle @ hard :~ $./Runinstaller-ignoresysprereqs-jreloc/usr/lib/JVM/Java-6-sun/JRE

On the second page of installation, select DBA as the user group and Enterprise Edition as the "Enterprise Edition". All non-"succeeded" checked are checked. After the database is created, do not click OK first.
Perform the following operations:
Root @ hard :~ #/U01/APP/orainventory/orainstroot. Sh
Changing permissions of/u01/APP/orainventory to 770.
Changing groupname of/u01/APP/orainventory to DBA.
The execution of the script is complete
Root @ hard :~ #/U01/APP/Oracle/product/11.1.0/db_1/root. Sh
Running Oracle 11g root. Sh script...

The following environment variables are set:
Oracle_owner = Oracle
ORACLE_HOME =/u01/APP/Oracle/product/11.1.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to/usr/local/bin...
Copying oraenv to/usr/local/bin...
Copying coraenv to/usr/local/bin...

Creating/etc/oratab file...
Entries will be added to the/etc/oratab file as needed
Database Configuration assistant when a database is created
Finished running generic part of root. Sh script.
Now product-specific root actions will be saved med.
Finished product-specific root actions.
Root @ hard :~ #

Then, add the following sentence to the/etc/profile file:
Export ORACLE_HOME =/u01/APP/Oracle/product/11.1.0/db_1
Export Path = $ path:/u01/APP/Oracle/product/11.1.0/db_1/bin

Create an Oracle 11g Database STARTUP script named oracledb. Create a file in/u01/APP/Oracle/product/11.1.0/db_1/bin: oracledb. content:

#! /Bin/bash
#
#/Etc/init. d/oracledb
#
# Run-level STARTUP script for the Oracle listener and Instances
# It relies on the information on/etc/oratab

Export oracle_base =/u01/APP/Oracle
Export ORACLE_HOME =/u01/APP/Oracle/product/11.1.0/db_1
Export oracle_ownr = Oracle
Export Path = $ path: $ ORACLE_HOME/bin

If [! -F $ ORACLE_HOME/bin/dbstart-o! -D $ ORACLE_HOME]
Then
Echo "Oracle startup: cannot start"
Exit 1
Fi

Case "$1" in
Start)
# Oracle listener and instance startup
Echo-n "Starting ORACLE :"
Su $ oracle_ownr-c "$ ORACLE_HOME/bin/LSNRCTL start"
Su $ oracle_ownr-c "$ ORACLE_HOME/bin/dbstart $ ORACLE_HOME"
Touch/var/lock/Oracle
Echo "OK"
;;
Stop)
# Oracle listener and instance Shutdown
Echo-n "shutdown ORACLE :"
Su $ oracle_ownr-c "$ ORACLE_HOME/bin/LSNRCTL stop"
Su $ oracle_ownr-c "$ ORACLE_HOME/bin/dbshut $ ORACLE_HOME"
Rm-F/var/lock/Oracle
Echo "OK"
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo "Usage: 'basename $ 0' START | stop | restart | reload"
Exit 1
Esac

Exit 0

The modified script is executable:

Root @ hard :~ # Chmod A + x/u01/APP/Oracle/product/11.1.0/db_1/bin/oracledb

If you want to automatically start the Oracle 11g Database at startup, do the following:

Root @ hard :~ # Ln-S/u01/APP/Oracle/product/11.1.0/db_1/bin/oracledb/etc/init. d/oracledb
Root @ hard :~ # Sudo sysv-RC-conf -- level 2345 oracledb on

If you do not have the sysv-RC-conf command, you can use apt-Get.

Finally, add your username to the DBA group:

Root @ hard :~ # Usermod-g dba-a user (note that the user is your current user, and each user is not necessarily the same .)

Now, Oracle 11g is installed. After you log on again, you can use the Oracle command.
You can add listener through netca and add database through dbca. Test whether the installation is successful:
(Oracle_sid = Heron is the value you set during installation)

Oracle @ hard :~ $ Export oracle_sid = orcl
Oracle @ hard :~ $ Sqlplus '/As sysdba'

-- Startup nomount
Startup open
-- Shutdown immediate

SQL> select count (*) from dba_users;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.