`
sunwinner
  • 浏览: 204270 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Installing Oracle 11gR2 on Ubuntu 12.04 Desktop

阅读更多

本文主要参考 http://www.gizmojunkee.com/2012/05/installing-oracle-11gr2-on-ubuntu-12-04/ ,对文中一些步骤做了一些修正,并补充我遇到的新问题。

 


This howto should guide you though the installation of an Oracle Database 11g Release 2 on Ubuntu 12.04 Desktop. Ubuntu is not officially supported by Oracle so there will be a few tweaks to achieve a working solution. I hope this might help you if you aim for a similar task.

 

Before we start with this Chapter I assume you have a clean Ubuntu 12.04 Desktop up and running.
 
1. Download Oracle
First download the full Version of Oracle 11gR2 for linux OS from the Oracle side. Save the 2 files somewhere on your local PC. We will transfer them later to the VM.
 
2. Prepare the System
We have to install a few required packages for Oracle. Best way to install those is to use the standard
debian package manager. As I have installed Ubuntu on my Server and work primary on my MacBook Air
I will open a Terminal session and SSH into the Server as root. You can of course also just enter the
commands direct into the VM’s terminal to install the following packages:

 

 

$sudo -i
#apt-get install alien binutils build-essential libaio1 libaio-dev unixODBC unixODBC-dev expat sysstat libelf-dev elfutils pdksh ia32-libs unzip libstdc++5 libstdc++6 cpp-4.4 g++-4.4 gawk ksh lesstif2 lib32bz2-dev lib32z1-dev libbeecrypt7 libdb4.8 libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 libqt4-core libqt4-gui lsb lsb-cxx lsb-qt4

 
 
3. Pre-Checks
Check your /etc/hostname that it looks like below:

    localhost.localdomain

 


And also check that in /etc/hosts the below line is present:

    127.0.0.1        localhost.localdomain    localhost
 
4. Configure Memory Settings
For the installation we need a minimum of 1GB physical memory which we define when we setup the
Virtual Machine earlier, else you can check it with the following command:

   

grep MemTotal /proc/meminfo

 

 

Because the Oracle installation is demanding in resources we create some temp swap-space that will
disappear after a reboot. Bare that in mind, if you reboot the Server before completing the Oracle
installation you have to redo the below steps.
Check your current swap-space with this command:

   

grep SwapTotal /proc/meminfo

 
Now let’s create a temporary swap file for the installation.

dd if=/dev/zero of=/tmp/swap bs=1M count=4096
chmod 600 /tmp/swap
mkswap /tmp/swap
swapon /tmp/swap

 

Execute the command again to confirm the added swap-space

grep SwapTotal /proc/meminfo

 

Shared Memory is also important for Oracle, else you might face some ORA-00845 error messages.
Check your current Shared Memory with this command:

df -kh /dev/shm/

 
If you have less than 512MB edit /etc/fstab and add (either 1024M or 1512M) I am adding here 1.5GB
by adding the following line:

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

 
After remount and check the new size once again:

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

 
 
5. System Group and Users
remember we did not create any Users with our Ubuntu installation so lets do that now

addgroup --system oinstall
addgroup --system dba
useradd -r -g oinstall -G dba -m -s /bin/bash -d /var/lib/oracle oracle
passwd oracle

 
 
6. Configure Kernel
Oracle requires additional kernel parameters, you either create a new kernel parameter file or add it to
the existing system kernel. I choose to add them to the existing system file. So lets make first a backup
Backup the original system file /etc/sysctl.conf by executing:

cp /etc/sysctl.conf /etc/sysctl.conf.original

 
Execute the following command to simply paste in the parameters:

cat - >> /etc/sysctl.conf

 
Now cut and paste the following

# Oracle 11gR2 kernel parameters
fs.aio-max-nr=1048576
fs.file-max=6815744
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
kernel.sem=250 32000 100 128
kernel.shmmax=2147483648

 
then press Ctrl-d to write the file
Note:
kernel.shmmax = max possible value, e.g. size of physical RAM.
Verify the above with:

cat /etc/sysctl.conf

 
and load the new Kernel parameter with the following command:

sysctl -p

 
Verify the new kernel settings:

sysctl -q fs.aio-max-nr

 
that should return — fs.aio-max-nr = 1048576
Before we now set the Oracle limits lets backup the original file:

cp /etc/security/limits.conf /etc/security/limits.conf.original

 
Next add the following limits to /etc/security/limits.conf:

cat - >> /etc/security/limits.conf

 
cut and paste the following and then write to the file with Ctrl-d


#Oracle 11gR2 shell limits
oracle soft nproc 2048
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

 
Check/add if the following line exits within /etc/pam.d/login

session required /lib/security/pam_limits.so

 
Check if the following line exits within /etc/pam.d/su

session required pam_limits.so

 
 
7. Create Oracle directories
It’s time to create some directories for Oracle and set the permissions.

mkdir -p /u01/app/oracle
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02

 
 
8. Configuring the oracle user’s environment
Add following lines to /var/lib/oracle/.profile
We are creating here a AL32UTF8 database, so change this to US7ASCII if you want to create and
ASCII database. This will also map Oracle’s /bin to your $PATH to run Oracle’s binary directly at login:

# for Oracle User
if [ "$USER" = oracle ]; then
    if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi

umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export NLS_LANG=.AL32UTF8
unset TNS_ADMIN
if [ -d "$ORACLE_HOME/bin" ]; then
    PATH="$ORACLE_HOME/bin:$PATH"
fi

 
 
9. Fake Oracle installer
As mentioned before , Ubuntu is not listed as Oracle officially support platform and so we need
to fake it by creating symbolic links:

mkdir /usr/lib64
ln -s /etc /etc/rc.d
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/basename /bin/basename
ln -s /usr/bin/rpm /bin/rpm
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib64/
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 /usr/lib64/

 
Mask ourself as RedHat:

echo 'Red Hat Linux release 5' > /etc/redhat-release

 
 
10. Copy the Oracle installation files to the Server
We discussed in the pre-post PuTTY, so we going to use that now to copy the files over to the Server.
Copy the file 2 files (linux.x64_11gR2_database_*.zip to oracle’s home directory and unzip them

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/

 
In case that cp don’t work use the scp command that comes with PuTTY to copy the files over.

scp linux.x64* oracle@ip_address:/var/lib/oracle

 
 
11. Starting Oracle Installer
Before we can do that we have to export the Display on our Ubuntu Server as root.
Go to your Ubuntu VM and login as root if not already and execute the following commands:

DISPLAY=:0.0
export DISPLAY

 
Next go back to PuTTY session and login to the Server as oracle (su – oracle if you are already as root).
No change to the database directory and start the installer with the following command:

cd /var/lib/oracle/database && ./runInstaller

 
 
At the first screen of the Oracle Installer you can add your support Account if you have one, In case
you don’t just leave it empty and remove the default tick box for the email.

 
At the next tab [Select Installation Option] – choose the first setting Create and configure a database:

 

 

In [System Class] – choose Server Class:

 
 
 
 
In [Node Selection] – choose the option Single instance database installation:


 
In [Select Install Type] – choose Advanced install:


 
In [Select Product Languages] – choose to install at your demand I select all available languages:


 
 
In [Select Database Edition] – choose Enterprise Edition:

 
 
In [Specify Installation Location] – the default settings should be as below:
Oracle Base: /u01/app/oracle
Sofeware Location: /u01/app/oracle/product/11.2.0/dbhome_1

 
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:


 
 
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)

 



In [Specify Management Options] – choose Use Database Control for database management
and leave the rest as default:

 
 

In [Specify Database Storage Options] – choose File System where:
Specify database file location: /u01/app/oracle/oradata
 
 
 
In [Specify Recovery Options] – choose Do not enable automated backups:

 
 
In [Specify Schema Passwords] – choose to your passwords and write them down:

 
In [Privileged Operating System Groups] – confirm as below:
Database Administrator (OSDBA) Group: dba
Database Operator (OSOPER) Group: oinstall

 
In [Preform Prerequisite Checks] –  just simply ignore all warning message
(since we are using Debian but not Oracle officially supported OS):

 
 
So just confirm everything in Summary:
 
 
And now let’s go for a coffee/tee break – you deserve it

 
Special note for Ubuntu 12.04: If you face error during installation so update as below:

 
When you see the above error, open a new session to the Server and execute the below commands:

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 press Retry and keep going …

 

Another error you may encounter is: genclntsh: Failed to link libclntsh.so.11.1 in make file for rdbms/lib/ins_rdbms.mk
beacause of missing library: /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a inside
we need to create a symlink for /usr/lib64:

 

sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64

 

Yet another error is: lib//libagtsh.so: undefined reference to `nnfyboot' in make: rdbms/lib/dg4odbc] Error 1

sudo ln -sf /bin/bash /bin/sh
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm 
sudo ln -s /usr/bin/basename /bin/basename 

 

The last error I encountered is: # /lib64/libgcc_s.so.1: File or directory does not exists, while creating lib/liborasdkbase.so.11.1 in ins_rdbms.mk, execute the command:
cd /lib64
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 .
 

 
 
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

 
 
Confirm with installation progress

 
In previous screen the installer mentioned that we can access Enterprise Manager Database Control URL
from https://localhost.localdomain:1158/em, so now let’s open the browser and test it with following account:

User Name: SYS
Password: your_secret_password
Connect As: SYSDBA

 
Once login it should show Oracle admin page.
 
12. Post Configurations – Autostart Oracle during system boot
I like if everything boots up automatic so lets configure Oracle to start during system boot. You can of course
turn this feature later off, but the init.d script is very useful too. First we need to specify which database
instant will be started together with Oracle. (of course this is the first but maybe you have already done
this a few times).
Edit /etc/oratab as below:

orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

 
Now lets create the init.d script as /etc/init.d/oracle

cat - >> /etc/init.d/oracle

 
copy and paste all below and complete it with Ctrl-d

#!/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"
export ORACLE_UNQNAME=orcl
# 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

 

Set the Permission:

chmod 755 /etc/init.d/oracle

 
Finally we need to install the script so Oracle will start during system bootup:

update-rc.d-insserv oracle defaults 99 01

 
NOTE 1: 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 -fs*/#!/bin/bash -f/g' $ORACLE_HOME/bin/emctl

 Note 2: Common mistake when installing Oracle database is to not have all of your variables set correctly in your .bash_profile. If you come across this error when you try to start up the EMCTL console then here is what you do:

$ emctl start dbconsole

 
Gives error message: Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

Do:

vi ~/.bash_profile

 
Add this line:

export ORACLE_UNQNAME=orcl

 
Final Notes
Next up I will install the same database on a few other Linux distributions and see how it goes. Also I will
write up a guide how to access the Database from anywhere. I haven’t completed that task yet so just
stay tuned.

 

 

分享到:
评论

相关推荐

    Requirements For Installing Oracle10gR2 On RHEL 5&OEL 5 (x86_64)

    本文档详细介绍了在Red Hat Enterprise Linux(RHEL)5和Oracle Enterprise Linux(OEL)5(x86_64架构)上安装Oracle 10g Release 2数据库的具体要求。这些要求包括硬件配置、内核版本、以及必要的系统设置等关键...

    Step By Step guide for installing Oracle RAC 11gR2 on Linux

    在深入探讨如何逐步安装Oracle RAC 11gR2于Linux系统上的过程中,我们首先应当理解该版本中引入的一些新概念与特性,这将有助于更有效地进行部署和管理。 ### 1. 新概念概览 #### 1.1 SCAN(Single Client Access ...

    Installing Oracle Database 11g on Linux

    在本文中,我们将深入探讨如何在Linux环境下安装Oracle Database 11g,这是一个重要的数据库管理系统,广泛用于企业级数据存储和处理。Oracle 11g提供了高性能、高可用性和安全性,使其成为许多组织的核心数据库解决...

    [原创]Guide: Installing Oracle Enterprise Manager Grid Control 10.2.0.5 on Oracle Database 11gR2 and RHEL Linux 5.4

    ### 安装Oracle Enterprise Manager Grid Control 10.2.0.5于Oracle Database 11gR2及RHEL Linux 5.4环境指南 #### 概述 本指南详细介绍了如何在Red Hat Enterprise Linux (RHEL) 5.4上安装并配置Oracle Enterprise...

    Oracle administration guide + Concepts Oracle + Installing Oracle Database 10 g on Sun Solaris 10 by Using RC

    安装Oracle Database 10g在Sun Solaris 10操作系统上是一个技术性较强的步骤,"Installing Oracle Database 10 g on Sun Solaris 10 by Using RC"文档会详细指导这一过程。这通常包括硬件和软件需求分析、操作系统...

    Installing Oracle 11g Release 2 Enterprise Edition

    标题《Installing Oracle 11g Release 2 Enterprise Edition》和描述中提到的内容,强调的是安装Oracle 11g R2 EE版数据库软件的过程和注意事项。在这个过程中,首先需要了解的是,官方不推荐在生产环境中使用Oracle...

    Oracle Solaris 11 Installing Oracle Solaris 11 Systems-204

    本教程"Oracle Solaris 11 Installing Oracle Solaris 11 Systems-204"着重于系统的安装过程,旨在帮助用户理解并顺利完成Oracle Solaris 11的部署。 在安装Oracle Solaris 11时,用户需要掌握以下关键知识点: 1....

    Installing Oracle 10G On Linux

    2. **操作系统版本**:选择一个稳定且支持Oracle 10G的Linux发行版,如Red Hat Enterprise Linux或Oracle Linux 5.x/6.x。 3. **软件准备**:确保系统上安装了必要的软件包,如GCC编译器、Perl、Kerberos、NFS...

    Installing Oracle RAC 10g Release 2 on Linux x86(中)

    ### 安装Oracle RAC 10g Release 2于Linux x86(中)的知识点解析 #### 概览与背景 Oracle Database 10g Release 2 RAC(Real Application Clusters)的安装流程旨在指导新手及有经验的用户在Linux环境下部署RAC...

    installing oracle9i on redhat linux.rar

    从压缩包文件`Installing Oracle9i on RedHat Linux 7_2, 7_3, 8_0, 9, AS 2_1, 3_0 (Red Hat Enterprise Advanced Server 3 - RHEL AS 3) (Oracle database installation, install Oracle software).htm`中,我们...

    Oracle Database 11g Release 2 (11.2.0.3) RAC On Oracle Linux 6

    Oracle Database 11g Release 2 (11.2.0.3) RAC On Oracle Linux 6.3 Using VirtualBox This article describes the installation of Oracle Database 11g release 2 (11.2.0.3 64-bit) RAC on Linux (Oracle Linux ...

    Installing Oracle 9i on RedHat Linux.rar

    2. **创建用户和组**:Oracle数据库需要以特定的用户和组运行,通常创建一个名为"oracle"的用户和"dba"的组。 3. **设置权限**:修改文件系统权限,允许Oracle用户对某些目录有读写执行权限,如/oraInventory、/u01...

    Installing Oracle9i 32-bit on Red Hat

    linux 下Oracle9i 安装

    Installing STLinux on Ubuntu

    ### 安装STLinux在Ubuntu上的关键步骤与挑战 #### 概览 本文将深入探讨在Ubuntu上安装STLinux的全过程,重点解析由于包管理系统的差异而带来的挑战及其解决方案。对于那些希望在Ubuntu环境中利用STLinux强大功能的...

    installing samba on ubuntu

    面是我在Ubuntu6.06 LTS 下源码编译安装samba主要安装过程,本人第一次用Ubuntu,刚装上去时候,没有gcc编译环境。郁闷了半天。找出这一过程发了不少的时间。可能还有些不妥,不过我经过这样的安装达到了向windows共享...

    oracle-11g安装手册

    - Requirements for Installing Oracle 11g R2 RDBMS on RHEL (and OEL) 5 on AMD64/EM64T。 #### 三、Oracle 11g的安装 1. **安装流程**: - 运行Oracle Database安装程序。 - 配置单点登录(Single Sign-On)...

    beaglebone black

    【部分内容】中提到了几个关键步骤,如“Installing Ubuntu 12.04”,“Installing CodeComposerStudio”,“Installing LabFiles”,“Configuring Ubuntu Static IP”,这些都是构建嵌入式Linux环境所需要的必要...

    anaconda安装 - Installing Anaconda on Ubuntu

    ### 安装Anaconda在Ubuntu上的详细步骤及关键知识点 #### 一、Anaconda简介 Anaconda是一款非常受欢迎的数据科学平台,它集成了Python或R语言环境中的许多库和工具,便于用户进行数据处理、科学计算、机器学习等...

    Oracle Solaris 11.2 Installing Oracle Solaris 11.2 Systems-270

    1. **软件包管理系统**:Oracle Solaris 11引入了Image Packaging System (IPS),这是一种先进的包管理工具,用于安装、更新和管理系统软件。IPS基于软件包和依赖关系,确保安装过程的正确性和一致性。 2. **ZFS...

Global site tag (gtag.js) - Google Analytics