同事让安装数据库,查询服务器信息发现操作系统是超聚变根据华为openEuler操作系统更改的自研操作系统,安装过程中踩坑不少,最后在超聚变厂商的技术支持下安装成功,步骤可参数该文。
一、 安装环境准备
1.1 软件下载
下载地址: Search Software (oracle.com)
1.2 关闭防火墙
关闭防火墙:
systemctl stop firewalld.service
systemctl disable firewalld.service
1.3 安装Oracle11g的依赖包
需要挂载完整版镜像,最小化镜像文件会缺少依赖包。
镜像文件下载地址:
百度网盘链接:https://pan.baidu.com/s/1_nEDiraeOCSBsnR74mEhPg?pwd=11bu
提取码:11bu
yum -y install xz wget gcc-c++ ncurses ncurses-devel
cmake make perl openssl openssl-devel gcc* libxml2
libxml2-devel curl-devel libjpeg* libpng* freetype*
make gcc-c++ cmake bison perl perl-devel perl perl-devel
glibc-devel libaio readline-devel
zlib.x86_64 zlib-devel.x86_64 libcurl-* net-tool*
sysstat lrzsz dos2unix telnet.x86_64 iotop unzip
ftp.x86_64 xfs* expect vim psmisc openssh-client*
libaio bzip2 automake binutils bzip2
elfutils expat gawk gcc ksh less make openssh-server
rpm sysstat unzip unzip cifs-utils libXext.x86_64
binutils
elfutils-libelf elfutils-libelf-devel
expat gcc gcc-c++ glibc glibc-common
glibc-devel glibc-headers libaio
libaio-devel libgcc libstdc++ libstdc+±devel
make sysstat unixODBC unixODBC-devel libnsl
yum install libnsl libaio-devel glibc-devel glib-devel gcc gcc-c++ ksh make glibc-compat-2.17
1.4 创建Oracle用户和用户组
groupadd -g 502 oinstall
groupadd -g 503 dba
groupadd -g 504 oper
groupadd -g 505 asmadmin
useradd -u 502 -g oinstall -G oinstall,dba,asmadmin,oper -s /bin/bash -m oracle
passwd oracle (默认设置密码为Oracle#123456)
1.5 修改操作系统配置
vim /etc/security/limits.conf
文件最后加入如下内容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
修改主机名:
hostnamectl set-hostname oracle11g
vi /etc/hosts
1.6 解压安装包
将两个安装包复制到/home/oracle目录下
su - oracle:
unzip V17530-01_1of2.zip
unzip V17530-01_2of2.zip
1.7 创建目录安装目录
mkdir -p ~/tools/oracle11g
1.8 配置Oracle环境变量
cd /home/oracle
vim ~/.bash_profile
添加在文件末尾:
export ORACLE_BASE=/home/oracle/tools/oracle11g
export ORACLE_HOME=
O
R
A
C
L
E
B
A
S
E
/
p
r
o
d
u
c
t
/
11.2.0
/
d
b
h
o
m
e
1
e
x
p
o
r
t
O
R
A
C
L
E
S
I
D
=
o
r
c
l
e
x
p
o
r
t
O
R
A
C
L
E
U
N
Q
N
A
M
E
=
o
r
c
l
e
x
p
o
r
t
N
L
S
L
A
N
G
=
.
A
L
32
U
T
F
8
e
x
p
o
r
t
P
A
T
H
=
{ORACLE_BASE}/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export ORACLE_UNQNAME=orcl export NLS_LANG=.AL32UTF8 export PATH=
ORACLEBASE/product/11.2.0/dbhome1exportORACLESID=orclexportORACLEUNQNAME=orclexportNLSLANG=.AL32UTF8exportPATH={PATH}:
O
R
A
C
L
E
H
O
M
E
/
b
i
n
/
:
{ORACLE_HOME}/bin/:
ORACLEHOME/bin/:{ORACLE_HOME}/lib64
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
source .bash_profile
1.9 修改配置文件
cd /home/oracle/
cp /home/oracle/database/response/db_install.rsp .
vim db_install.rsp
设置以下属性:
oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=oracle11g #修改成自己的主机名
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/tools/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1
ORACLE_BASE=/home/oracle/tools/oracle11g
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
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=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1024
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.password.ALL=Oracle#123456
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=test@qq.com
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/tools/oracle11g/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/tools/oracle11g/flash_recovery_area
DECLINE_SECURITY_UPDATES=true
二、 安装Oracle
2.1 根据响应文件安装Oracle
2.1.1.确认oracle_home目录空间大于5G
2.1.2.root 用户操作
vi /etc/oraInstl.loc
添加以下两行内容:
inventory_loc=/home/oracle/tools/oraInventory
inst_group=oinstall
2.1.3. 备份编译libaio
操作使用root用户
- 备份libaio.so文件
mv /usr/lib64/libaio.so.1.0.0 /usr/lib64/libaio.so.1.0.0_bak
mv /usr/lib64/libaio.so.1.0.1 /usr/lib64/libaio.so.1.0.1_bak
2、安装依赖包
yum install git rpm-build rpmdevtools dnf-utils
3、从openEuler 20.03 SP3分支获取目前FusionOS SP1发布一致的libaio代码下载需要登陆gitee账号,将libaio源码上传到/root目录下
https://gitee.com/src-openeuler/libaio/repository/archive/12d2ee059e12e75444ffc265fd7efec87c4e42fd.zip
4、创建rpmbuild目录用于编译
rpmdev-setuptree
5、解压并复制libaio代码到rpmbuild/SOURCES目录下
unzip libaio-12d2ee059e12e75444ffc265fd7efec87c4e42fd.zip
cp libaio-12d2ee059e12e75444ffc265fd7efec87c4e42fd/* /root/rpmbuild/SOURCES
6、修改gcc
mv /usr/bin/gcc /usr/bin/gcc-bak
echo -e ‘#!/usr/bin/bash\ngcc-bak $@ -fno-stack-protector’ > /usr/bin/gcc
chmod 755 /usr/bin/gcc
7、安装libaio编译依赖
yum-builddep /root/rpmbuild/SOURCES/libaio.spec
8、编译libaio的rpm包
rpmbuild -ba /root/rpmbuild/SOURCES/libaio.spec
9、升级libaio包
cd /root/rpmbuild/RPMS/x86_64/
rpm -Uvh libaio-0.3.112-4.x86_64.rpm libaio-devel-0.3.112-4.x86_64.rpm
10、恢复gcc
\mv /usr/bin/gcc-bak /usr/bin/gcc
11.更改libaio.so.1
rm -rf /usr/lib64/libaio.so.1
ln -s /usr/lib64/libaio.so.1.0.1 /usr/lib64/libaio.so.1
2.1.4.执行命令:
su - oracle
cd /home/oracle/database
./runInstaller -silent -ignorePrereq -responseFile /home/oracle/db_install.rsp
出现以下内容表示成功:
2.2 安装环境
su - root
/home/oracle/tools/oraInventory/orainstRoot.sh
/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/root.sh
2.3 登录oracle
su - oracle
lsnrctl start
sqlplus / as sysdba
查看状态是否为open:
SQL>select status from v$instance;
2.4 关闭oracle
SQL>shutdown immediate
SQL>exit
lsnrctl stop
2.5 还原libaio.so
rm -rf /usr/lib64/libaio.so.1.0.0
rm -rf /usr/lib64/libaio.so.1.0.1
mv /usr/lib64/libaio.so.1.0.0_bak /usr/lib64/libaio.so.1.0.0
mv /usr/lib64/libaio.so.1.0.1_bak /usr/lib64/libaio.so.1.0.1
2.6 补充库文件链接
echo “/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/inventory/Scripts/ext/lib/” >> /etc/ld.so.conf
ldconfig
2.7 登录验证oracle
su - oracle
lsnrctl start
sqlplus / as sysdba
SQL>startup;
查看状态是否为open:
SQL>select status from v$instance;
SQL>exit