合 Ubuntu 20.04安装Oracle 11.2.0.4单机
环境配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | docker rm -f ub20oracle11g docker run -itd --name ub20oracle11g -h ub20oracle11g \ -p 33392:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrubuntu2004:3.0 \ /bin/bash docker exec -it ub20oracle11g bash cat >> /etc/apt/sources.list << EOF deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ focal-backports main restricted universe multiverse deb http://dk.archive.ubuntu.com/ubuntu/ xenial main deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe EOF apt-get update cat > /tmp/b.sh <<"EOF" sudo apt-get install bzip2 sudo apt-get install elfutils sudo apt-get install automake sudo apt-get install autotools-dev sudo apt-get install binutils sudo apt-get install expat sudo apt-get install gawk sudo apt-get install gcc sudo apt-get install gcc-multilib sudo apt-get install g++-multilib sudo apt-get install ia32-libs sudo apt-get install ksh sudo apt-get install less sudo apt-get install lesstif2 sudo apt-get install lesstif2-dev sudo apt-get install lib32z1 sudo apt-get install libaio1 sudo apt-get install libaio-dev sudo apt-get install libc6-dev sudo apt-get install libc6-dev-i386 sudo apt-get install libc6-i386 sudo apt-get install libelf-dev sudo apt-get install libltdl-dev sudo apt-get install libmotif4 sudo apt-get install libodbcinstq4-1 libodbcinstq4-1:i386 sudo apt-get install libpth-dev sudo apt-get install libpthread-stubs0 sudo apt-get install libpthread-stubs0-dev sudo apt-get install libstdc++5 sudo apt-get install lsb-cxx sudo apt-get install make sudo apt-get install openssh-server sudo apt-get install pdksh sudo apt-get install rlwrap sudo apt-get install rpm sudo apt-get install sysstat sudo apt-get install unixodbc sudo apt-get install unixodbc-dev sudo apt-get install unzip sudo apt-get install x11-utils sudo apt-get install zlibc EOF /tmp/b.sh -- 注意 /etc/apt/sources.list 最后2行,可以安装gcc-4.8 sudo apt-get update sudo apt-get -y install gcc-4.8 g++-4.8 cpp-4.8 #gcc、g++降级 ll /usr/bin/gcc* ll /usr/bin/g++* ll /usr/bin/cpp* sudo mv /usr/bin/gcc /usr/bin/gcc-7 sudo mv /usr/bin/g++ /usr/bin/g++-7 sudo mv /usr/bin/cpp /usr/bin/cpp-7 sudo ln -sf /usr/bin/g++-4.8 /usr/bin/g++ sudo ln -sf /usr/bin/gcc-4.8 /usr/bin/gcc sudo ln -sf /usr/bin/cpp-4.8 /usr/bin/cpp sudo chmod 755 /usr/bin/g++ sudo chmod 755 /usr/bin/gcc sudo chmod 755 /usr/bin/cpp gcc -v g++ -v cpp -v dpkg -l | grep libstdc -- Oracle默认不支持ubuntu需要欺骗一下Oracle安装程序,执行以下命令: sudo mkdir -p /usr/lib64 sudo ln -sf /etc /etc/rc.d sudo ln -sf /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/ sudo ln -sf /usr/bin/awk /bin/awk sudo ln -sf /usr/bin/basename /bin/basename sudo ln -sf /usr/bin/rpm /bin/rpm sudo ln -sf /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/ sudo ln -sf /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/ sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib64/ sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/ |
环境配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 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 echo "oracle:lhr" | chpasswd mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1 chown -R oracle:oinstall /u01 chmod -R 775 /u01 cat > /etc/oraInst.loc <<"EOF" inventory_loc=/u01/app/oraInventory inst_group=oinstall EOF chown oracle:oinstall /etc/oraInst.loc chmod 664 /etc/oraInst.loc source /etc/oralnst.loc echo "oracle ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers cat >> /home/oracle/.bash_profile <<"EOF" export TMP=/tmp export TMPDIR=$TMP export ORACLE_SID=lhrdb export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export PATH=/usr/sbin:$PATH export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss' alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias sas='sqlplus / as sysdba' EOF echo 'fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 ' >> /etc/sysctl.conf && sysctl -p echo 'oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 ' >> /etc/security/limits.conf echo 'session required /lib64/security/pam_limits.so session required pam_limits.so ' >> /etc/pam.d/login echo 'if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi ' >> /etc/profile |
静默安装和建库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | echo xfce4-session > /home/oracle/.xsession chmod +x /home/oracle/.xsession service xrdp restart unzip p13390677_112040_Linux-x86-64_1of7.zip && unzip p13390677_112040_Linux-x86-64_2of7.zip su - oracle /soft/database/runInstaller -silent -force -noconfig -IgnoreSysPreReqs -ignorePrereq \ oracle.install.option=INSTALL_DB_SWONLY \ DECLINE_SECURITY_UPDATES=true \ UNIX_GROUP_NAME=oinstall \ INVENTORY_LOCATION=/u01/app/oraInventory \ SELECTED_LANGUAGES=en \ ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 \ ORACLE_BASE=/u01/app/oracle \ oracle.install.db.InstallEdition=EE \ oracle.install.db.isCustomInstall=false \ oracle.install.db.DBA_GROUP=dba \ oracle.install.db.OPER_GROUP=dba \ oracle.install.db.isRACOneInstall=false \ oracle.install.db.config.starterdb.type=GENERAL_PURPOSE \ SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \ oracle.installer.autoupdates.option=SKIP_UPDATES -- 日志:/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log -- root用户执行 /u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/11.2.0/dbhome_1/root.sh -- 解决错误 ll $ORACLE_HOME/rdbms/lib/config.o ll $ORACLE_HOME/bin/oracle mv $ORACLE_HOME/rdbms/lib/config.o $ORACLE_HOME/rdbms/lib/config.o.bad -- 此时执行sqlplus / as sysdba会报错:ORA-12547: TNS:lost contact -- 解决 sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk sed -i "s/KFOD_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk sed -i "s/AMDU_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk sed -i "s/\$LD \$LD_RUNTIME \$LD_OPT/& -Wl,--no-as-needed/g" $ORACLE_HOME/bin/genorasdksh sed -i "s/KFNDG_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/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 -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 -- 重新编译,编译完成后sqlplus正常 cd $ORACLE_HOME/rdbms/lib relink all -- 调试安装 ./runInstaller -debug -logLevel finest strace ./runInstaller -- 静默建库 -- dbca -silent -deleteDatabase -sourceDB lhrdb dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \ -gdbname lhrdb -sid lhrdb \ -sysPassword lhr -systemPassword lhr \ -datafileDestination '/u01/app/oracle/oradata' \ -recoveryAreaDestination '/u01/app/oracle/flash_recovery_area' \ -redoLogFileSize 50 \ -storageType FS \ -characterset AL32UTF8 -nationalCharacterSet AL16UTF16 \ -sampleSchema true \ -totalMemory 512 \ -databaseType OLTP \ -emConfiguration NONE 日志:/u01/app/oracle/cfgtoollogs/dbca/silent.log_2023-03-16_08-52-06-AM 报错:ORA-29516: Aurora assertion failure: Assertion failure at joez.c:3422,可以忽略 在76%时卡住,其实数据库已经创建完了!!!可以直接执行如下的SQL: -- 创建spfile create spfile from memory; startup force -- 其它修改 lsnrctl start |
报错处理
报错1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | root@lhrubuntu2004:/# more /u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log | grep -i error | grep -v INFO collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'client_sharedlib' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'links proc gen_pcscfg' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/precomp/lib/ins_precomp.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'links proc gen_pcscfg' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/precomp/lib/ins_precomp.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'idg4odbc' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'idg4odbc' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'itnsping' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'itnsping' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/ins_ctx.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/ins_ctx.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/plsql/lib/ins_plsql.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/plsql/lib/ins_plsql.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'all_no_orcl' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'all_no_orcl' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/lib/ins_sqlplus.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/lib/ins_sqlplus.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'clientonlyinstall' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/ldap/lib/ins_ldap.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'clientonlyinstall' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/ldap/lib/ins_ldap.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'ioklist' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_nau.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'ioklist' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_nau.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/srvm/lib/ins_srvm.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/srvm/lib/ins_srvm.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'utilities' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'utilities' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'iokdstry iokinit' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_nau.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'iokdstry iokinit' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_nau.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_server.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'install' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_server.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Exception String: Error in invoking target 'itrcroute' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'itrcroute' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. collect2: error: ld returned 1 exit status Exception String: Error in invoking target 'irman ioracle' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. Error in invoking target 'irman ioracle' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oraInventory/logs/installActions2023-03-15_01-13-46PM.log' for details. root@lhrubuntu2004:/# |
解决:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk sudo sed -i "s/KFOD_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk sudo sed -i "s/AMDU_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk sudo sed -i "s/\$LD \$LD_RUNTIME \$LD_OPT/& -Wl,--no-as-needed/g" $ORACLE_HOME/bin/genorasdksh sudo sed -i "s/KFNDG_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/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 -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 #'agent nmhs',修改ins_emagent.mk 176行,在$(MK_EMAGENT_NMECTL)后添加 -lnnz11 sudo sed -i 's/^\s∗$(MKEMAGENTNMECTL)\s∗$(MKEMAGENTNMECTL)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk # 'all_no_orcl'的kfod问题,修改env_rdbms.mk的KFOD_LINKLINE变量(2913行),添加 -Wl,--no-as-needed sudo sed -i "s/KFOD_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk # 'all_no_orcl'的amdu问题,修改env_rdbms.mk的AMDU_LINKLINE变量(2922行),添加 -Wl,--no-as-needed sudo sed -i "s/AMDU_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk # 'all_no_orcl'的genorasdksh问题,修改genorasdksh (289行),添加 -Wl,--no-as-needed sudo sed -i "s/\$LD \$LD_RUNTIME \$LD_OPT/& -Wl,--no-as-needed/g" $ORACLE_HOME/bin/genorasdksh # 'all_no_orcl'的renamedg问题,修改env_rdbms.mk的KFNDG_LINKLINE变量(2918行),添加 -Wl,--no-as-needed sudo sed -i "s/KFNDG_LINKLINE=\$(LINK) \$(S0MAIN)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk # 'install'的ins_srvm.mk问题,修改env_srvm.mk的GETCRSHOME_LINKLINE变量(1899行),添加 -Wl,--no-as-needed sudo sed -i "s/GETCRSHOME_LINKLINE=\$(LINK)/& -Wl,--no-as-needed/g" $ORACLE_HOME/srvm/lib/env_srvm.mk # 'install'的ins_net_server.mk问题,修改env_network.mk的TNSLSNR_LINKLINE变量(2232行),添加 -Wl,--no-as-needed sudo sed -i "s/TNSLSNR_LINKLINE=\$(LINK)/& -Wl,--no-as-needed/g" $ORACLE_HOME/network/lib/env_network.mk # 'irman ioracle'的ins_rdbms.mk问题,修改env_rdbms.mk的ORACLE_LINKLINE变量(2759行),添加 -Wl,--no-as-needed sudo sed -i "s/ORACLE_LINKLINE=\$(ORACLE_LINKER) \$(PL_FLAGS)/& -Wl,--no-as-needed/g" $ORACLE_HOME/rdbms/lib/env_rdbms.mk |
报错2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 信息: be used when making a PIE object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status make: *** [/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/rman] Error 1 信息: 终止从衍生进程输出。 信息: ---------------------------------- 严重: oracle.sysman.oii.oiil.OiilActionException: Error in invoking target 'irman ioracle' of makefile '/u01/app/o racle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'. See '/u01/app/oracle/product/11.2.0/dbhome_1/install/relink Actions2023-03-15_09-24-40-AM.log' for details. /usr/bin/ld: /u01/app/oracle/product/11.2.0/dbhome_1/lib//libgx11.a(gxzsus.o): relocation R_X86_64_32 against `_2__STRING.0.0' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/opimai.o: relocation R_X86_64_32 against `_2__STRING.0.0' can not be used when making a PIE object; recompile with -fPIC |
主要原因:gcc版本问题
1 2 | gcc -v g++ -v |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | oracle@lhrubuntu2004:~$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) oracle@lhrubuntu2004:~$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) oracle@lhrubuntu2004:~$ |
卸载
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | rm -rf /etc/ora* rm -rf /var/tmp/.oracle rm -rf /tmp/* rm -rf /u01/app/grid/* rm -rf /u01/app/oracle/* rm -rf /u01/app/oraInventory/* rm -rf /u01/app/* userdel oracle userdel grid groupdel oinstall groupdel dba groupdel oper groupdel asmadmin groupdel asmoper groupdel asmdba |
总结
1、我自己尝试了Ubuntu 14.04,Ubuntu 16.04,Ubuntu 18.04,Ubuntu 20.04,Ubuntu 22.04,这几个版本安装Oracle 11.2.0.4,都能安装成功,基本步骤一样,在Ubuntu 14.04,Ubuntu 16.04安装过程一样;在Ubuntu 18.04,Ubuntu 20.04,Ubuntu 22.04安装过程一样,不过需要把gcc进行降级处理,其它过程都一样;。