首页 » ORACLE 9i-23ai, 系统相关 » 如何在麒麟Kylin Linux V10 SP1静默安装 Oracle 11g (11.2.0.4)单实例

如何在麒麟Kylin Linux V10 SP1静默安装 Oracle 11g (11.2.0.4)单实例

最近信C进程加速, 一些行业可能面临替换CentOS、RedHat linux的ZZ任务, Oracle可能还要3-4年的缓和期,当前Oracle官方在12c已经增加了对中标麒麟的认证, 但目前没有任证的OS如果基于centOS的货也可以安装并运行生产环境, 在Kylin V10安装了个单实例oracle 11.2.0.4还算不复杂,下面简单分享。

准备软件介质

1, oracle 软件

    • p13390677_112040_Linux-x86-64_1of7.zip
    • p13390677_112040_Linux-x86-64_2of7.zip

oracle for Linux通用软件同CentOS、RHEL

2,  OS lib 依赖包

Kylin V10 SP1 OS ISO 快速下载   提取码:gm6j

Kylin V10 SP2 OS ISO 下载1 下载2

Kylin官方源rpm

CentOS 官方源

如果有OS镜像可以挂载本地yum源,如果没有可以从上面的网站下载离线rpm包

我离线安装的几个rpm 链接:提取码:i76q

操作系统配置

检查OS 版本

$ cat /etc/*release
Kylin Linux Advanced Server release V10 (Tercel)
DISTRIB_ID=Kylin
DISTRIB_RELEASE=V10
DISTRIB_CODENAME=juniper
DISTRIB_DESCRIPTION="Kylin V10"
DISTRIB_KYLIN_RELEASE=V10
DISTRIB_VERSION_TYPE=enterprise
DISTRIB_VERSION_MODE=normal
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Tercel)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Tercel)"
ANSI_COLOR="0;31"

Kylin Linux Advanced Server release V10 (Tercel)

检查swap,如果不存在手动创建

$ dd if=/dev/zero of=/swapfile bs=1M count=2048
$ mkswap /swapfile
$ swapon /swapfile
#在 /etc/fstab 中添加如下一行,使之永久生效
/swapfile swap swap defaults 0 0
$ free

关闭firewall

systemctl stop firewall
systemctl disable firewall

禁用selinux

vi /etc/selinux
SELINUX=DISABLE

修改内核参数

vi /etc/sysctl.conf
#------------oracle 11g r2 Setting--------
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 4398046511104
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
#----------end--------
-- Hugepage建议配置

sysctl -p

用户限制

Add the following lines to the "/etc/security/limits.conf" file.
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  4096
oracle              hard    nofile  65536
oracle              soft    stack   10240

创建用户、组,及环境变量

groupadd oinstall
groupadd dba
groupadd oper

useradd -g oinstall -G dba,oper oracle
passwd oracle

su - oracle
vi ~/.bash_profile

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; 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; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

创建Oracle目录

mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01

安装RPM依赖

如果有OS iso文件可以挂载本地
mount -o loop Kylin-Server-10-SP2-x86-Release-Build09-20210524.iso /mnt
cd /etc/yum.repos.d/
mv kylin_x86_64.repo kylin_x86_64.repo.bak

vi kylinV10sp2.repo
###Kylin Linux Advanced Server 10 - os repo###
[yumlocal]
name=kylin-yumlocal
baseurl=file:///mnt
gpgcheck=0
enabled=1
#priority=1

如果没有iso 查找不存在Lib ,离线下载安装

rpm  -qa  binutils
rpm  -qa  compat-libstdc++
rpm  -qa  elfutils-libelf
rpm  -qa  elfutils-libelf-devel
rpm  -qa  glibc
rpm  -qa  glibc-common
rpm  -qa  glibc-devel
rpm  -qa  gcc-c++
rpm  -qa  libaio
rpm  -qa  libaio-devel
rpm  -qa  libgcc
rpm  -qa  libstdc++
rpm  -qa  libstdc++-devel
rpm  -qa  make
rpm  -qa  sysstat
rpm  -qa  unixODBC
rpm  -qa  unixODBC-devel
rpm -qa  compat-libcap1 
rpm -qa  gcc 
rpm -qa  ksh 
rpm -qa  libXext 
rpm -qa  libXtst 
rpm -qa  libX11 
rpm -qa  libXau 
rpm -qa  libxcb 
rpm -qa  libXi 
rpm -qa  zlib-devel 
rpm -qa  libnsl  -- 必须安装否则在安装会报 Could not create the Java Virtual Machine 的错
rpm -qa  libnsl2
rpm -qa  libnsl2-devel


静默安装软件

su - oracle
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip

替换oracle自带unzip
cd database/install
mv unzip unzip.bak
ln -s /usr/bin/unzip

配置静默res文件
mkdir  /home/oracle/orarsp
cp database/response/*   /home/oracle/orarsp

cd /home/oracle/orarsp
vi db_install.rsp

oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=xxx
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.isRACOneInstall=false
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL="oracle"  
oracle.install.db.config.starterdb.automatedBackup.enable=false
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true


开始安装oracle软件

su - oracle
cd database
./runInstaller -silent -responseFile /home/oracle/rsp/db_install.rsp -ignorePrereq

执行上面最后提示的两个shell

su - root
$ /u01/app/oraInventory/orainstRoot.sh
$ /u01/app/oracle/product/11.2.0.4/db_1/root.sh

relink oracle

上面软件虽然安装成功,但是此时尝试sqlplus / as sysdba会提示ORA-12547: TNS:Lost Contact错误,此时查看oracle的binary file是0 bytes. 是因为当前的gcc版本过高,relink一下ok

su - oracle
cd $ORACLE_HOME
./relink all

注: relink 查看日志此时最容易出问题,如依赖rpm未安装,OS差异性

错误 ld cannot found /usr/lib64/libpthread_nonshared.a

su  - root
cp libpthread_nonshared.a /usr/lib64/
chmod 755 /usr/lib64/libpthread_nonshared.a

注: 上面的云盘中有提供该文件,可以单独下载。

错误 /usr/bin/ld: cannot find -lnsl

grep -i fail relinkxxx.log 会发现上面的错误
1,首先检查libnsl 和libnsl2已安装
rpm -qa|grep libnsl

2, 检查link是否丢失
在/usr/lib or /usr/lib64 下面ls -lrt libnsl*', 检查是否 'libnsl.so' 不存在

su - root
# cd /usr/lib64
# ls -lrt libnsl*
lrwxrwxrwx. 1 root root     15 Mar  7  2019 libnsl.so.2 -> libnsl.so.2.0.0
-rwxr-xr-x. 1 root root 120592 Mar  7  2019 libnsl.so.2.0.0
lrwxrwxrwx. 1 root root     14 Jun 17 01:43 libnsl.so.1 -> libnsl-2.28.so
-rwxr-xr-x. 1 root root  99160 Jun 17 01:56 libnsl-2.28.so

创建link
#  ln -s libnsl.so.1 libnsl.so

# ls -lrt libnsl*
lrwxrwxrwx. 1 root root     15 Mar  7  2019 libnsl.so.2 -> libnsl.so.2.0.0
-rwxr-xr-x. 1 root root 120592 Mar  7  2019 libnsl.so.2.0.0
lrwxrwxrwx. 1 root root     14 Jun 17 01:43 libnsl.so.1 -> libnsl-2.28.so
-rwxr-xr-x. 1 root root  99160 Jun 17 01:56 libnsl-2.28.so
lrwxrwxrwx  1 root root     11 Aug  9 17:13 libnsl.so -> libnsl.so.1

或者备份并编辑 file $ORACLE_HOME/lib/sysliblist 修改后如下:

 $ cat $ORACLE_HOME/lib/sysliblist -ldl -lm -lpthread -l:libnsl.so.1 -lirc -lipgo -lsvml -laio

重新relink

$ORACLE_HOME/bin/relink all

能避免Installation of 11.2.0.4 on RHEL 8.x failed with ‘/bin/ld: cannot find -lnsl make:Error in invoking target ‘agent nmhs’ of makefile ins_emagent.mk ‘ (Doc ID 2944859.1)
和config.o 的问题, 该问题在Kylin和LINUX 8上都会遇到。

relink失败config.o 0bytes

如果上面的修复做完relink依旧oracle执行文件是0字节,relink日志无明确错误,检查config.o 文件是否0 bytes.
$ cd $ORACLE_HOME/rdbms/lib
$ mv config.o config.o.bad

# $ORACLE_HOME/bin/relink all

-- ensure the following two files are not 0 bytes:
ls -l $ORACLE_HOME/bin/oracle
ls -l $ORACLE_HOME/rdbms/lib/config.o

静默创建数据库

cd /home/oracle/orarsp

vi dbca.rsp
根据实际需要修改,如dbname,uniqu name, global name , domain ,字符集,内存参数等都可以后期修改

dbca -silent -responsefile dbca.rsp

注: 此时会正常会自动拉起db instance. 并创建tnsnames.ora

静默创建监听

NETCA Response File

We extract only useful parameters from the template of NETCA.

[oracle@test ~]$ egrep -v "(^#|^$)" $ORACLE_HOME/assistants/netca/netca.rsp > ~/netca.rsp

Run NETCA Silent Mode

Let’s see how we use the response file.

[oracle@anbob ~]$ netca -silent -responsefile ~/netca.rsp

以上会自动启动1521上的监听,并自动创建listener.ora and sqlnet.ora,如果no service, 可以启动db instance或alter system register注册。

打赏

,

对不起,这篇文章暂时关闭评论。