设置本地yum 库(需要安装很多os缺省不安装的库文件)
- 如果是有互联网连接,直接使用阿里yum库
cd /etc/yum.repos.d
rm *.repo
sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
- 如果没有互联网需要本地将iso挂载到目录里
vi cdrom.repo
[Base]
name=CentOS-Base
baseurl=file:///mnt/cdrom/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=CentOS-AppStream
baseurl=file:///mnt/cdrom/AppStream
enabled=1
gpgcheck=0
yum clean all
yum makecache
建立用户
groupadd oinstall
groupadd oper
groupadd dba
useradd -g oinstall -G dba,oper oracle
设置资源限制
vi /etc/security/limits.conf 增加内容:
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
设置内核限制
vi /etc/sysctl.conf
#增加内容:
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 4194304
net.core.wmem_max = 4194304
kernel.panic = 60
fs.aio-max-nr = 1048576
net.ipv4.tcp_syncookies = 1
sysctl -p
解压
mkdir ora19c
chown oracle:oinstall ora19c
su - oracle
unzip xxxxx.zip -d ora19c
设置x11 forward(为了使用oracle图形界面安装方便)
可以根据不同终端,设置x11
1.先根据实际情况安装x11 组件
yum install -y xorg-x11-xauth xorg-x11-utils xorg-x11-fonts-*
- 配置sshd x11forward
vi /etc/ssh/sshd_config
AllowAgentForwarding yes
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
- 设置完重启ssh
systemctl restart sshd
设置环境变量
vi ~/.bash_profile
# .bash_profile
## 根据实际情况调整 xdpyinfo | grep name 查看具体DISPLAY
export DISPLAY=:0.0
export LANG=en-US
export ORACLE_SID=HIE
export ORACLE_BASE= /oracle
export ORACLE_HOME= /oracle/ora19c
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export THREADS_FLAG=native
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=${PATH}:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
安装缺少包
yum install libnsl
yum -y install gcc automake autoconf libtool make
安装
以oracle用户登录
ldd $ORACLE_HOME/perl/bin/perl #查看缺少库文件,安装相应库
export LANG=en_US.UTF-8
export CV_ASSUME_DISTID=RHEL7.6
/oracle/runInstaller
安装遇到缺库检查过不去,请自行yum安装
问题排查
- LRM-00109: could not open parameter file '/app/oracle/ora19c/dbs/initXXX.ora'
处理:将$ORACLE_BASE/admin/dbname/pfile/init.ora.xxxxx 拷贝到相应的文件夹和文件 - ORA-01102: cannot mount database in EXCLUSIVE mode
处理: 删除 $ORACLE_HOME/dbs/lkXXX
3.安装软件时报类似,Exception String: Error in invoking target 'libasmclntsh19.ohso libasmperl19.ohso client_sharedlib' of makefile '/home/app/oracle/product/19.3.0/db_1/rdbms/lib/ins_rdbms.mk'. See '/tmp/Inst
原因:这类错误一般是由于软连接不正确造成的,为什么会有这种问题,感觉是安装包就有问题
处理方式:(创建软连接)
cd $ORACLE_HOME/lib
rm libclntsh.so
ln -s libclntsh.so.19.1 libclntsh.so
rm libclntshcore.so
ln -s libclntshcore.so.19.1 libclntshcore.so
rm libjavavm19.a
ln -s ../javavm/jdk/jdk8/lib/libjavavm19.a libjavavm19.a
然后retry
- 客户端登录ORA-12154
在 Listener.ora 里增加
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /oracle/ora19c)
(SID_NAME = orcl)
)
) - 客户端登录用户密码错误,但本机登录没问题
在sqlnet.ora 里增加
SQLNET.ALLOWED_LOGON_VERSION_SERVER=10
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=10
SQLNET.ALLOWED_LOGON_VERSION=8
设置自启动
- vi /etc/oratab
hie:/app/oracle/ora19c:Y - vi /usr/bin/oracle.sh
#!/bin/sh
#script For oracle19c.service
/app/oracle/ora19c/bin/lsnrctl start
/app/oracle/ora19c/bin/dbstart /app/oracle/ora19c
chmod 777 /usr/bin/oracle.sh
- vi /etc/systemd/system/oracle19c.service
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/opt/oracle/product/19c/dbhome_1"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
systemctl enable oracle19c
增加防火墙端口
firewall-cmd --permanent --zone=public --add-port=1521/tcp