ubuntu 14.04 64bit 安装 oracle 11g r2

参考文章:http://tutorialforlinux.com/2016/03/09/how-to-install-oracle-11g-r2-database-on-ubuntu-14-04-trusty-lts-64bit-easy-guide-managing-db-troubleshootings/

参考文章:http://m.oschina.net/blog/318293

一.获取资源包,自己去官网下载64位版,共两个压缩包

  下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

二.安装依赖包 

 1 apt-get update
 2 apt-get install alien autoconf automake autotools-dev binutils doxygen \
 3 elfutils expat gawk gcc gcc-multilib g++-multilib libstdc++6:i386 ksh less libtiff4 \
 4 libtiff4-dev lib32z1 libaio1 libaio-dev libc6-dev libc6-dev-i386 libc6-i386 \
 5 libelf-dev libltdl-dev libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 \
 6 libpthread-stubs0 libpth-dev libstdc++5 lsb-cxx make \
 7 pdksh openssh-server rlwrap rpm sysstat unixodbc unixodbc-dev x11-utils \
 8 zlibc libglapi-mesa:i386 libglu1-mesa:i386 libqt4-opengl:i386 \
 9 libpthread-workqueue0 libpthread-workqueue-dev libzthread-2.3-2 libzthread-dev \
10 libpthread-stubs0-dev

其中包libtiff4, libtiff4-dev and libpthread-stubs0可能源中没有,可用以下方法安装

$sudo su 
$echo 'deb http://cz.archive.ubuntu.com/ubuntu precise main universe' >> /etc/apt/sources.list.d/extra.list  //添加源
apt-get update
apt-get install libtiff4 libtiff4-dev
mv /etc/apt/sources.list.d/extra.list /etc/apt/sources.list.d/extra.list.backup //移除源
apt-get update

三.配置系统环境变量

//Linking Binaries
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
//Linking Libraries
ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
cd /lib64
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 .

四.配置oracle的用户组

groupadd -g 502 oinstall
groupadd -g 503 dba
groupadd -g 504 oper
groupadd -g 505 asmadmin
useradd -u 502 -g oinstall -G dba,asmadmin,oper -s /bin/bash -m oracle
passwd oracle //设置你自己的密码
//创建需要安装oracle的文件夹
mkdir -p /u01/app/oracle/product/11.2.0/       //创建文件夹
chown -R oracle:oinstall /u01                         //给文件夹更改用户组
chmod -R 775 /u01                                       //设置文件夹权限
//----解压下载的压缩包至指定文件夹并设置权限
cd /home/[myUser]/Downloads //你压缩包所在路径
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
chown -R oracle:oinstall database
mv database /tmp

五.配置oracle 用户的.bashrc

//进入oracle 用户的账号 并在其目录下修改.bashrc文件
su - oracle //切换至oracle账号
vim ~/.bashrc
//添加以下行
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=[HOSTNAME]; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=[DBSID]; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
//其中 HOSTNAME =127.0.0.1  DBSID=你自己创建数据库的SID(可先不改)
source ~/.bashrc 使配置生效
六.安装oracle
xhost + //切换到root账号给oracle 分配 xwindow
su - oracle //切换到oracle
export DISPLAY=:0 //安装时显示图形界面
cd /tmp/database //进入刚才解压的目录 chmod -R +x /tmp/database //给目录下文件添加 x 权限 ./runInstaller //执行安装程序 可用自己的jre安装 ./runInstaller -jreloc /usr/java/[你的jre路径]

进入安装程序

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Start Oracle 11g R2 Installation

不设置email

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 1 - Disabling Security Updates

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation - Confirm on Missing eMail Warning

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 2

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 3

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 4

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 5

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 6

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 7

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 8

以下包fail选择忽略全部

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Ubuntu-like Ignore All

Getting-Started with Oracle 11g Database on Ubuntu 14.04 Trusty LTS 64bit - Linux Oracle 11g R2 Installation Step 10

===================================================================

==================================================================

//安装到84%时会出现错误,不要慌可以用以下代码解决
//ins_ctx.mk的错误提示,直接contiue跳过去
//后面还回报错:
//make file '/......emagent.mk'出错
//解决方法:
//另开一个终端 进入oracle 用户,键入命令行:
sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk
//点击安装界面的retry,就可以继续了
//类似的后面还会提示四次,以下面的命令行如法炮制
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 

Oracle 11g Ubuntu-like Installation Error in Invoking Target Agent nmhs of makefile

//安装完成后会提示要执行两个文件
//按照它的提示切换到root账户然后进入制定路径执行就可以了
//遇到要输入什么的时候按enter即可

================================================================================

七.oracle 启动和配置

//用到的命令
dbca //创建一个数据库
netca //配置监听器 --配置servicename
lsnrctl start //打开监听器
lsnrctl stop //停止监听器
lsnrctl status //查看监听器状态
sqlplus / as sysdba  // 链接数据库
startup  //开启数据库
//查看监听状态时倒数第二行可能会报no service
//解决办法为在
cd  $ORACLE_HOME/network/admin,修改下面的listener.ora:
//添加以下字段
SID_LIST_LISTENER =
(SID_LIST =
  (SID_DESC =
  (GLOBAL_DBNAME = orcl)
  (SID_NAME = orcl)
  )
)
//其中orcl为你创建的数据库名
//sqldeveloper连不上oracle的问题 
解决方法:使用netmgr命令
打开后Oracle Net Configuration->Local->Listeners->LISTENER->Add Address添加地址,
Protocal: TCP/IP       Host: oracle所在的IP地址      Port:1521

 

posted @ 2016-05-15 17:18  pabitel  阅读(6625)  评论(0编辑  收藏  举报