参考:
http://blog.sina.com.cn/s/blog_6d96facb01018w2f.html
http://wiki.ubuntu.org.cn/Ubuntu%E4%B8%8AOracle10g%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97
http://www.cnblogs.com/luochengor/archive/2011/08/20/2147041.html
http://wiki.ubuntu.org.cn/index.php?title=Index/database/oracle-install&variant=zh-hant
http://edin.no-ip.com/blog/hswong3i/oracle-database-11g-release-2-ubuntu-12-04-howto
http://www.makina-corpus.org/blog/howto-install-oracle-11g-ubuntu-linux-1204-precise-pangolin-64bits
1.http://www.oracle.com/technetwork/indexes/documentation/index.html
下载安装文件linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
2.依赖库安装
sudo apt-get 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-debian ksh libtool lesstif2 lesstif2-dev lib32bz2-dev lib32z1-dev lib32z1 libaio-dev libaio1 libbeecrypt7 libc6 libc6-dev libc6-i386 libc6-dev-i386 libdb4.8 libelf-dev libelf1 libltdl-dev libltdl7 libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 libqt4-core libqt4-gui libsqlite3-0 libstdc++5 libstdc++6 lib32stdc++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
3.欺骗oracle的安装程序
echo 'Red Hat Linux release 5' > /etc/redhat-release
//////////////////////
mkdir /etc/rc.d
ln -s /etc /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
//////////////////////
ln -sf /bin/bash /bin/sh
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
//////////////////////
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /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 /lib64/
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
4.创建用户
sudo addgroup oinstall
sudo addgroup dba
sudo addgroup nobody
sudo useradd -m -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle
sudo usermod -g nobody nobody
5.创建安装目录
su -
mkdir -p /opt/oracle/oracle11g
chown -R oracle:oinstall /opt/oracle/oracle11g
chmod -R 775 /opt/oracle/oracle11g
6.为oracle用户分配密码
sudo passwd oracle
7.添加用户到sudoer列表中
终端visudo
在"root ALL=(ALL) ALL"下一行,添加:oracle ALL=(ALL) ALL
cat /etc/sudoers
8.检查系统变量在/etc/sysctl.conf中增加对应数据
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.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.ip_local_port_range = 9000 65500
9.更新系统,运行: sudo sysctl -p
10.添加对oracle用户的内核限制
vi /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
* soft stack 10240
11.查看/etc/pam.d/login,增加以下行(有就不用增加)
session required pam_limits.so
检查/etc/pam.d/su,没有以下行就加上
session required pam_limits.so
*修改了以上文件後,必须让其生效,或重启系统,或切换到 root 用户下用以下的方式改变内核运行参数: sysctl -p
12.设置环境变量
vi /etc/profile:
# oracle install add
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
..................
export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_BASE=/opt/oracle/oracle11g
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_OWNER=oracle
export ORACLE_SID=oral
export ORACLE_TERM=xterm
export NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:usr/lib:/lib64:/usr/lib64:/usr/local/lib64
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=$ORACLE_HOME/bin:$PATH
13.安装oracle
chown -Rf oracle:oinstall /opt/oracle/
a.su -
b.执行xhost +
c.su - oracle
d.export DISPLAY=:0
e../runInstaller
#./runInstaller -jreLoc /opt/java/jdk1.6.0_29/jre
14.安装数据库
为了防止ORACLE安装界面出现乱码,在终端执行:export LANG=en_CN
total swap space is available:
[#安装时创建临时swap文件,重启后会消失
dd if=/dev/zero of=/tmp/swap bs=1M count=4096
chmod 600 /tmp/swap
mkswap /tmp/swap
swapon /tmp/swap
grep SwapTotal /proc/meminfo
]
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=/opt/oracle/oracle11g/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
15.启动oracle
在“终端”以oracle身份运行
启动TNS监听器:$ORACLE_HOME/bin/lsnrctl start
($ORACLE_HOME,就是oracle的安装目录:/opt/oracle/oracle11g .直接cd,进入oracle的安装目录,到bin文件夹下,$lsnrctl start ,也行)。
关闭TNS:$ORACLE_HOME/bin/lsnrctl stop
启动sqlplus:$ORACLE_HOME/bin/sqlplus /nolog
关闭sqlplus:SQL> exit
////////////////////////////////////////////////////////////////////
iSQL*Plus URL:
http://ubuntu-Lenovo:5560/isqlplus
iSQL*Plus DBA URL:
http://ubuntu-Lenovo:5560/isqlplus/dba
/////////////////////tora在ubuntu上的安装///////////////////////////
sudo ln -s /opt/oracle/oracle11g/product/11.2.0/db_1/lib/libclntsh.so.11.1 /usr/lib/
sudo ln -s /opt/oracle/oracle11g/product/11.2.0/db_1/lib/libnnz11.so /usr/lib/
sudo gedit src/Makefile.am
找到“BUILT_SOURCES = \”处,在他的下面加入一行”moc_toawr.cpp \”
./configure --prefix=/usr --with-oracle=/opt/oracle/oracle11g/product/11.2.0/db_1 --with-oci-version=11G --with-oracle-libraries=/opt/oracle/oracle11g/product/11.2.0/db_1/lib --without-rpath --disable-new-check --without-kde --enable-libsuffix=