+ All Categories
Home > Documents > Oracle Database 11g Release 2 on Ubuntu 11

Oracle Database 11g Release 2 on Ubuntu 11

Date post: 05-Apr-2018
Category:
Upload: gerberyevelin-molina
View: 221 times
Download: 0 times
Share this document with a friend

of 21

Transcript
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    1/21

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    2/21

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    3/21

    Shared memory is very important, too. Or else you may face the ORA-00845 errormessage. First check it with:

    df -kh /dev/shm/

    If you have less than 512MB (I will suggest for 1GB), edit your /etc/fstab and add/modifythe following line:

    tmpfs /dev/shm tmpfs defaults,size=1024M 0 0

    Then remount it and check the size once again:

    mount -o remount /dev/shmdf -kh /dev/shm/

    Install dependence packages

    As I assume you have Ubuntu 12.04 installed correctly with X11, we just need to dig intodependence packages installation directly (in case of AMD64):

    aptitude -y install alien binutils build-essential cpp-4.4 debhelper g++-4.4 gawk gcc-4.4 gcc-4.4-base gettext html2text ia32-libs intltool-debianksh lesstif2 lib32bz2-dev lib32z1-dev libaio-dev libaio1 libbeecrypt7libc6 libc6-dev libc6-dev-i386 libdb4.8 libelf-dev libelf1 libltdl-devlibltdl7 libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 libqt4-corelibqt4-gui libsqlite3-0 libstdc++5 libstdc++6 libstdc++6-4.4-dev lsb lsb-core lsb-cxx lsb-desktop lsb-graphics lsb-qt4 make odbcinst pax po-debconf rpm rpm-common sysstat unixodbc unixodbc-dev unzip

    System groups and users

    Check your existing setup with:

    grep oinstall /etc/groupgrep dba /etc/groupgrep nobody /etc/groupid oracleid nobody

    Most likely, you should run the following command for create the required system groupsand users. Latest Ubuntu already come with user nobody so we don't need to retouch it:

    addgroup --system oinstalladdgroup --system dbauseradd -r -g oinstall -G dba -m -s /bin/bash -d /var/lib/oracle oraclepasswd oracle

    Configure kernel parameters

    Check your existing setup with:

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    4/21

    /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

    Then edit your /etc/sysctl.conf and add the following lines:

    fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586

    Run the following command to reload these kernel parameters:

    sysctl -p

    Shell limits for oracle user

    Add the following to /etc/security/limits.conf as below:

    oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240

    Check (or add) if the following line exits within /etc/pam.d/login:

    session required /lib/security/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 /u02mkdir -p /u01/app/oraclemkdir -p /u02/oradata

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    5/21

    chown -R oracle:oinstall /u01 /u02chmod -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; changeto 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" ]; thenulimit -p 16384ulimit -n 65536

    elseulimit -u 16384 -n 65536

    fi

    umask 022export ORACLE_HOSTNAME=localhost.localdomainexport ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1export ORACLE_SID=AL32UTF8export NLS_LANG=.AL32UTF8export ORACLE_UNQNAME=AL32UTF8unset TNS_ADMINif [ -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/lib64ln -s /etc /etc/rc.dln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/ln -s /usr/bin/awk /bin/awkln -s /usr/bin/basename /bin/basenameln -s /usr/bin/rpm /bin/rpmln -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.

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    6/21

    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/oraclecp linux.x64_11gR2_database_2of2.zip /var/lib/oracle

    cd /var/lib/oracleunzip -q linux.x64_11gR2_database_1of2.zipunzip -q linux.x64_11gR2_database_2of2.zipchown -Rf oracle:oinstall /var/lib/oracle/

    I will STRONGLY suggest for a complete reboot, and double-check ALL pre-installationBEFORE 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 skipin here):

    In "Selection Installation Option", choose "Create and configure a database":

    http://edin.no-ip.com/files/linux.x64_11gr2_database024.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    7/21

    In "System Class", choose "Server Class" (we hope to give a full control duringinstallation):

    In "Node Selection", choose "Single instance database installation":

    http://edin.no-ip.com/files/linux.x64_11gr2_database026.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database025.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database026.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database025.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    8/21

    In "Select Install Type", choose "Advanced install":

    In "Select Product Languages", I choose to install all available languages:

    http://edin.no-ip.com/files/linux.x64_11gr2_database028.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database027.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database028.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database027.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    9/21

    In "Select Database Edition", I choose "Enterprise Edition":

    In "Specify Installation Location", it should default as below:

    Oracle Base: /u01/app/oracle Sofeware Location: /u01/app/oracle/product/11.2.0/dbhome_1

    http://edin.no-ip.com/files/linux.x64_11gr2_database030.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database029.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database030.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database029.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    10/21

    In "Create Inventory", it should default as below:

    Inventory Directory: /u01/app/oraInventory oraInventory Group Name: oinstall

    In "Select Configure Type", choose "General Purpose / Transaction Processing":

    http://edin.no-ip.com/files/linux.x64_11gr2_database032.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database031.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database032.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database031.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    11/21

    (IMPORTANT!) In "Specify Database Identifiers", configure as below:

    Global database name: AL32UTF8.localdomain Oracle Service Identifier (SID): AL32UTF8

    In "Specify Configuration Options", configure as below:

    Memory -> Enable Automatic Memory Management: TRUE Character sets: Use Unicode (AL32UTF8)

    http://edin.no-ip.com/files/linux.x64_11gr2_database034.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database033.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database034.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database033.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    12/21

    In "Specify Management Options", choose "Use Database Control for databasemanagement" but keep other else empty:

    http://edin.no-ip.com/files/linux.x64_11gr2_database036.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database035.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database036.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database035.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    13/21

    In "Specify Database Storage Options", choose "File System" where:

    Specify database file location: /u02/oradata

    In "Specify Recovery Options", choose "Do not enable automated backups":

    http://edin.no-ip.com/files/linux.x64_11gr2_database038.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database037.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database038.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database037.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    14/21

    In "Specify Schema Passwords", I am a bit lazy so choose "Use the same password for allaccounts" (don't do this in production server!):

    In "Privileged Operating System Groups", confirm as below:

    Database Administrator (OSDBA) Group: dba Database Operator (OSOPER) Group: oinstall

    http://edin.no-ip.com/files/linux.x64_11gr2_database040.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database039.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database040.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database039.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    15/21

    In "Preform Prerequisite Checks", just simply ignore all warning message (since we areusing Debian but not Oracle officially supported OS):

    So just confirm everything in "Summary":

    http://edin.no-ip.com/files/linux.x64_11gr2_database042.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database041.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database042.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database041.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    16/21

    And now let's go for a coffee break ;-)

    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_1sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g'$ORACLE_HOME/sysman/lib/ins_emagent.mksed -i 's/^\(\$LD \$LD_RUNTIME\) \(\$LD_OPT\)/\1 -Wl,--no-as-needed \2/g'$ORACLE_HOME/bin/genorasdkshsed -i 's/^\(\s*\)\(\$(OCRLIBS_DEFAULT)\)/\1 -Wl,--no-as-needed \2/g'$ORACLE_HOME/srvm/lib/ins_srvm.mk

    http://edin.no-ip.com/files/linux.x64_11gr2_database044.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database043.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database044.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database043.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    17/21

    sed -i 's/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\)/\1-Wl,--no-as-needed \2/g' $ORACLE_HOME/network/lib/env_network.mksed -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 ;-)

    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

    http://edin.no-ip.com/files/linux.x64_11gr2_database046.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database045.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database046.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database045.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    18/21

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    19/21

    Once login it should show as below:

    Autostart Oracle during system boot

    There is almost for sure that you will hope to start your Oracle automatically during systemboot. 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

    http://edin.no-ip.com/files/linux.x64_11gr2_database050.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database049.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database050.pnghttp://edin.no-ip.com/files/linux.x64_11gr2_database049.png
  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    20/21

    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" instart)

    # Oracle listener and instance startupecho -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 onlysu - $ORA_OWNR -c "$ORA_HOME/bin/emctl start dbconsole"

    touch /var/lock/oracleecho "OK";;

    stop)# Oracle listener and instance shutdownecho -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/oracleecho "OK";;

    reload|restart)$0 stop

  • 7/31/2019 Oracle Database 11g Release 2 on Ubuntu 11

    21/21

    $0 start;;

    *)echo "Usage: $0 start|stop|restart|reload"exit 1

    esacexit 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/bashto solve the problem:

    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1sed -i 's/^#!\/bin\/sh -f\s*/#!\/bin\/bash -f/g' $ORACLE_HOME/bin/emctl


Recommended