linux下安装oracle的一些坑

linux下安装oracle ,按的我想吐血,总结一下

1.创建oracle用户与相关用户组

在linux用户下:

  su - root    

    然后输入密码

first:安装软件包

root# apt-get install elfutils libaio1 libaio-dev libstdc++6-4.4-dev numactl pdksh sysstat unixODBC-dev unixODBC build-essential libaio1 gawk ksh libmotif3 alien libtool

 

Create and prepare Oracle user:

root# addgroup oinstall
root# addgroup dba
root# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
root# mkdir /home/oracle
root# chown -R oracle:dba /home/oracle

修改并且添加 sysctl.conf:

root# vi /etc/sysctl.conf
# Oracle 12c entries
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmall=2097152
kernel.shmmni=4096
kernel.sem=250 32000 100 128
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.shmmax=1073741824

  然后:

root# sysctl -p

  修改并添加:/etc/security/limits.conf 

root# vi /etc/security/limits.conf
#Oracle 12c
oracle soft nproc 2048
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

 

如果你之前有掉坑的经历,已经添加过用户了,可以使用id oracle命令核查oracle用户是否配置完善:看Oracle是否属于oinstalldba用户组

 

下载安装包:

软件包官网下载链接如下:

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

官方提供的文档链接如下:

http://www.oracle.com/technetwork/database/enterprise-edition/documentation/index.html

官方链接

记得必须两个文件都要下载,必须必须啊,不然后面就得重新安装

 

下载完成后,解压就不用多说了吧

在这这前需要注意:

/home/oracle_11/app/win64_11gR2_database_2of2\database\stage\Components 中的 4个文件 复制(剪切应该也可以,没试过)到  
/home/oracle_11/app/win64_11gR2_database_1of2\database\stage\Components 中,

 

这一部如果忘了就会出现:

 未找到wfmlrsvcapp.ear,切记切记!

然后执行:

 切换到oracle

  su - oracle 

./runInstaller

  欢迎进坑..ok!

这样会出现问题1的情况

然后重新开一个终端 ctrl +alt+T

执行:

 tail -f /home/oracle_11/app/oraInventory/logs/installActions2018-09-09_11-54-45PM.log

 此命令用于追踪日志状态,具体错误信息都在里面!不同人日志不一样,需要注意 

 

首先问题1:

Starting Oracle Universal Installer...

Checking Temp space: must be greater than120 MB.   Actual 9049 MB    Passed

Checking swap space: must be greater than150 MB.   Actual 1999 MB    Passed

Checking monitor: must be configured todisplay at least 256 colors

    >>> Could not execute auto checkfor display colors using command /usr/bin/xdpyinfo. Check if the DISPLAYvariable is set.    Failed<<<<

Some requirement checks failed. You mustfulfill these requirements before

 continuing with the installation,

Continue? (y/n) [n] 

User Selected: No

Exiting Oracle Universal Installer, log forthis session can be found at /tmp/OraInstall2012-04-13_09-12-43PM/installActions2012-04-13_09-12-43PM.log

安装开始出现的问题:

解决方法:

在中注销用户并重启切换到oracle用户登录,就可以执行了

问题2:

INFO: Start output from spawned process:
INFO: ----------------------------------
INFO:

INFO: /oracle/base/dbhome_1/bin/genclntsh

INFO: /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a inside

INFO: collect2: ld returned 1 exit status

INFO: genclntsh: Failed to link libclntshcore.so.12.1

INFO: make: *** [client_sharedlib] Error 1

INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'client_sharedlib' of makefile '/oracle/base/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/oracle/oraInventory/logs/installActions2013-09-19_08-51-51AM.log' for details.
Exception Severity: 1

看问题:

INFO: /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a inside(64位)
INFO: /usr/bin/ld: cannot find /usr/lib/libpthread_nonshared.a inside(32位)

解决方法:

root:~# locate libpthread_nonshared
  /usr/lib/i386-linux-gnu/libpthread_nonshared.a
  /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a

其中locate查看哪儿存在 libpthread_nonshared.a,然后发现两个地方都有,但是/usr/lib64或者/usr/lib没有

套路一(64位):

root:~# ln -s /usr/lib /usr/lib/lib64
root:~# ln /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.a

套路二(32/64 bit)

cp /usr/lib/i386-linux-gnu/libpthread_nonshared.a   /usr/lib/

没有嘛,我补上还不行嘛!

 

问题3:

INFO: /oracle/base/dbhome_1/bin/genclntsh

INFO: /usr/bin/ld: cannot find /usr/lib64/libc_nonshared.a inside
collect2:
INFO: ld returned 1 exit status

INFO: genclntsh: Failed to link libclntshcore.so.12.1
make: *** [client_sharedlib] Error 1

INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'client_sharedlib' of makefile '/oracle/base/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/oracle/oraInventory/logs/installActions2013-09-19_08-51-51AM.log' for details.
Exception Severity: 1

  这个问题和问题2差不太多,解决思路一样

解决方法

套路一:(64位)

root:~# locate libc_nonshared.a
  /usr/lib/libc_nonshared.a
  /usr/lib/x86_64-linux-gnu/libc_nonshared.a

root:~# ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64
root:~# ls -l /usr/lib64/libc_nonshared.a
  lrwxrwxrwx 1 root root 42 Sep 19 10:53 /usr/lib64/libc_nonshared.a -> /usr/lib/x86_64-linux-gnu/libc_nonshared.a

套路二:(通杀)

32位:
  cp /usr/lib/i386-linux-gnu/libc_nonshared.a /usr/lib
64位:
  cp  /usr/lib/libc_nonshared.a /usr/lib64

问题3: 

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

解决办法:

su root
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
su oracle
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

sudo ln -s $ORACLE_HOME/lib/libclient11.a $ORACLE_HOME/lib/libagtsh.a

 $ORACLE_HOME/bin/genagtsh $ORACLE_HOME/lib/libagtsh.so 1.0

 

问题4:

INFO: /usr/bin/ld: /oracle/base/dbhome_1/lib//libagtsh.so: undefined reference to symbol 'ssMemRealloc'
/usr/bin/ld: note: 'ssMemRealloc' is defined in DSO /oracle/base/dbhome_1/lib//libclntshcore.so so try adding it to the linker command line
/oracle/base/dbhome_1/lib//libclntshcore.so: could not read symbols: Invalid operation

INFO: collect2: ld returned 1 exit status

INFO: make: *** [/oracle/base/dbhome_1/rdbms/lib/hsots] Error 1

INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'all_no_orcl' of makefile '/oracle/base/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/oracle/oraInventory/logs/installActions2013-09-19_08-51-51AM.log' for details.
Exception Severity: 1

Let’s see:

INFO: /usr/bin/ld:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/libagtsh.so: undefined reference to symbol 'ssMemRealloc

解决方法:

oracle$ cd /home/oracle/app/oracle/product/11.2.0/dbhome_1
oracle$dbhome_1/lib$   ldd libnnz12.so 

    linux-vdso.so.1 => (0x00007fff759d9000) 
    libclntshcore.so.12.1 => not found 
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f324050f000) 
    /lib64/ld-linux-x86-64.so.2 (0x00007f3240ff5000) 

由上可知:

libclntshcore.so.12.1 => not found

libclntshcore.so.12.1没有,要嘛直接安装,如果存在就链接或者拷贝

一般解决办法

root# ln -s /home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.12.1 /usr/lib
root# ls
-l /usr/lib/libclntsh.so.12.1   
  lrwxrwxrwx
1 root root 43 Sep 19 11:20 /usr/lib/libclntsh.so.12.1->
/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.12.1

请记住用ldd和locate的命令....ok

 

问题5:

INFO: make[1]: *** [/u01/app/oracle/product/11.2.0.3/sysman/lib/emdctl] Error 1


INFO: make[1]: Leaving directory `/u01/app/oracle/product/11.2.0.3/sysman/lib'


INFO: make: *** [emdctl] Error 2


INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0.3/sysman/lib/ins_emagent.mk'.

 

解决办法:

vi $ORACLE_HOME/sysman/lib/ins_emagent.mk

搜索以下行:
  $(MK_EMAGENT_NMECTL)
改变为:
  $(MK_EMAGENT_NMECTL) -lnnz11

 

问题6:

  Error in invoking target 'all_no_orcl' of makefile '/opt/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/opt/oraInventory/logs/installActions2016-03-19_02-37-44PM.log' for details.

 INFO: /opt/oracle/product/11.2.0/dbhome_1/bin/genorasdksh: Failed to link liborasdk.so.11.1

 INFO: make: *** [liborasdksh] Error 1

 INFO: End output from spawned process.
 INFO: ----------------------------------
 INFO: Exception thrown from action: make
 Exception Name: MakefileException
 Exception String: Error in invoking target 'all_no_orcl' of makefile '/opt/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/opt/oraInventory/logs/installActions2016-03-19_02-37-44PM.log' for details.

解决办法:

缺少编译参数

-Wl,--no-as-needed
执行下面的命令即可
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
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命令很强大

  sed -i 's/text1/text2/g' file       把file中的text1替换成特效text2并写入文件

  ^ 表示开头

  \ 转义 

  \s匹配空格、制表符、换行、回车,也就是\s其实也匹配\n(多行模式的每行结尾)

  \s*就是有0到n个空格或\n

保存匹配的字符,如 sed -n 's/\(love\)able/\1rs/p'
        loveable被替换成lovers。 sed
's/keywords\(pattern1\)\(pattern2\)/\1\2/ #匹配keywords(pattern1)(pattern2),并将其替换为pattern2和pattern1匹配到的内容,
其中\1匹配第一部分
pattern1,\2匹配第二部分pattern2,即他们保持原样替换

之前的命令都可以测试一下在换成上面的

sed -n 's/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\) /\1 -Wl,--no-as-needed \2/gp' $ORACLE_HOME/network/lib/env_network.mk
sed -n 's/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \(\$(PL_FLAGS)\) /\1 -Wl,--no-as-needed \2 /gp' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -n 's/^\(\$LD \$LD_RUNTIME\) \(\$LD_OPT\)/\1 -Wl,--no-as-needed \2 /gp' $ORACLE_HOME/bin/genorasdksh
sed -n 's/^\(\s*\) \(\$(OCRLIBS_DEFAULT)\) /\1 -Wl,--no-as-needed \2 /gp' $ORACLE_HOME/srvm/lib/ins_srvm.mk

可以逐条测试,他会打印替换的内容,这样你就知道干了什么事

 

其他的记住多ldd,多locate,缺啥补啥

还有问题可以参考下面的博客:

  https://www.cnblogs.com/exmyth/p/9048941.html

  https://blog.csdn.net/zhongyifly/article/details/42610399

好了,如果还有问题,度娘来帮你,臣妾真的办不到啊......……

 

posted @ 2018-09-10 17:28  白伟碧一些小心得  阅读(17537)  评论(0编辑  收藏  举报