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是否屬於oinstall和dba用戶組

下載安裝包:
軟件包官網下載鏈接如下:
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
好了,如果還有問題,度娘來幫你,臣妾真的辦不到啊......……
