在Oracle 18c下已支持通过rpm包方式进行部署,目前只支持单实例。其中图形化安装方式与12.2.0.1数据库版本几乎相同。
部署环境:Centos 7.6 + oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm + oracle-database-ee-18c-1.0-1.x86_64.rpm
1、下载Oracle18c预安装包以及Oracle 18c database的rpm包
18c preinstall
curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
或者直接在http访问手动下载
http://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/index.html
找到此rpm—>oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
18c database
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle18c-linux-180000-5022980.html
2、将RPM包上传到/opt目录
[root@ora18c ~]# cd /opt/
```sql
[root@ora18c opt]# ll -hrt
total 3.4G
-rwxr-xr-x 1 root root 18K Feb 12 16:25 oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
-rwx------ 1 root root 3.4G Feb 12 16:51 oracle-database-ee-18c-1.0-1.x86_64.rpm
3、先安装preinstall
通过yum的localinstall,解决依赖包问题,安装完之后会自动创建oracle用户以及组,以及系统参数
[root@ora18c opt]# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
部分输出过程:
Loaded plugins: fastestmirror
Examining oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm: oracle-database-preinstall-18c-1.0-1.el7.x86_64
Marking oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-18c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: bc for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Dependency Updated:
bind-libs-lite.x86_64 32:9.9.4-73.el7_6 bind-license.noarch 32:9.9.4-73.el7_6 glibc.x86_64 0:2.17-260.el7_6.3
glibc-common.x86_64 0:2.17-260.el7_6.3
Complete!
4、修改oracle用户密码
[root@ora18c opt]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
[root@ora18c opt]#passwd oracle
5、安装数据库软件包
[root@ora18c opt]# rpm -ivh oracle-database-ee-18c-1.0-1.x86_64.rpm
warning: oracle-database-ee-18c-1.0-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:oracle-database-ee-18c-1.0-1 ################################# [100%]
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-18c configure
数据库软件安装完毕
6、dbca之前修改数据库配置参数
修改sid以及是否开启cdb
[root@ora18c opt]# vi /etc/init.d/oracledb_ORCLCDB-18c
export ORACLE_SID=orcl
export CREATE_AS_CDB=false
7、创建新配置文件
[root@ora18c opt]# cp /etc/sysconfig/oracledb_ORCLCDB-18c.conf /etc/sysconfig/oracledb_orcl-18c.conf
备注:此配置文件命名方法为oracledb_$ORACLE_SID-18c.conf,需要注意sid
8、创建实例
[root@ora18c opt]# /etc/init.d/oracledb_ORCLCDB-18c configure
The Oracle Database is not configured. Unable to read the configuration file '/etc/sysconfig/oracledb_orcl-18c.conf'
[root@ora18c opt]# cp /etc/sysconfig/oracledb_orcl-18c.conf /etc/sysconfig/oracledb_orcl-18c.conf^C
[root@ora18c opt]# cp /etc/sysconfig/oracledb_ORCLCDB-18c.conf /etc/sysconfig/oracledb_orcl-18c.conf
[root@ora18c opt]# /etc/init.d/oracledb_ORCLCDB-18c configure
Configuring Oracle Database orcl.
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/orcl.
Database Information:
Global Database Name:orcl
System Identifier(SID):orcl
Look at the log file "/opt/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.
实例创建完毕
9、修改oracle用户环境变量
[oracle@ora18c ~]$ vi ~/.bash_profile
export ORACLE_SID=orcl
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/18c/dbhome_1
export ORACLE_UNQNAME=orcl
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_TERM=xterm
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export THREADS_FLAG=native
export LANG=en_US
export NLS_LANG=american_america.AL32UTF8
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
if [ $USER = "oracle" ]||[ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
[oracle@ora18c ~]$ source ~/.bash_profile
10、查看数据库状态
[oracle@ora18c ~]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Wed Feb 13 11:23:53 2019
Version 18.3.0.0.0
Copyright © 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> select name, decode(cdb, 'YES', 'Multitenant Option enabled', 'Regular 12c Database: ') "Multitenant Option" , open_mode, con_id from v$database;
NAME Multitenant Option OPEN_MODE CON_ID
--------- -------------------------- -------------------- ----------
ORCL Regular 12c Database: READ WRITE 0
数据库实例创建完毕
注意事项:
1、通过rpm方式安装的数据库默认会在/opt目录
2、实例创建完毕之后sys密码是随机生成的,需要手动修改sys密码
3、oracle database的rpm包无法通过prefix参数指定安装目录,附rpm信息
[root@ora18c opt]# rpm -qpi oracle-database-ee-18c-1.0-1.x86_64.rpm
warning: oracle-database-ee-18c-1.0-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Name : oracle-database-ee-18c
Version : 1.0
Release : 1
Architecture: x86_64
Install Date: (not installed)
Group : Applications/OracleDB
Size : 8358193797
License : Oracle Corporation
Signature : RSA/SHA256, Mon 08 Oct 2018 07:56:04 AM CST, Key ID 72f97b74ec551f03
Source RPM : oracle-database-ee-18c-1.0-1.src.rpm
Build Date : Mon 08 Oct 2018 07:22:54 AM CST
Build Host : ad05d193712f
Relocations : (not relocatable)-------->无法指定路径
Packager : Oracle <www.oracle.com>
URL : http://www.oracle.com
Summary : Oracle 18c Enterprise Edition Database
Description :
Oracle 18c Enterprise Edition Database
1、创建oralce用户以及用户组
groupadd -g 601 oinstall
groupadd -g 602 dba
groupadd -g 603 oper
groupadd -g 604 backupdba
groupadd -g 605 dgdba
groupadd -g 606 kmdba
useradd -u 601 -g oinstall -G dba,backupdba,dgdba,kmdba,oper oracle
修改oracle用户密码
echo "oracle" | passwd --stdin oracle
2、创建目录结构
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/18.3.0/db_1
chown -R oracle:oinstall /u01/
chmod -R 775 /u01/
3、修改/etc/security/limits.conf
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 16384" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "oracle soft stack 10240" >>/etc/security/limits.conf
echo "oracle hard stack 32768" >>/etc/security/limits.conf
4、修改20-nproc.conf
cp /etc/security/limits.d/20-nproc.conf /etc/security/limits.d/20-nproc.conf.bak
echo "# Default limit for number of user's processes to prevent" > /etc/security/limits.d/20-nproc.conf
echo "# accidental fork bombs." >> /etc/security/limits.d/20-nproc.conf
echo "# See rhbz #432903 for reasoning." >> /etc/security/limits.d/20-nproc.conf
echo "root soft nproc unlimited" >> /etc/security/limits.d/20-nproc.conf
echo "* - nproc 16384" >> /etc/security/limits.d/20-nproc.conf
5、修改/etc/pam.d/login
cp /etc/pam.d/login /etc/pam.d/login.bak
echo "session required pam_limits.so" >>/etc/pam.d/login
6、修改/etc/sysctl.conf
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "kernel.panic_on_oops = 1" >> /etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
echo "kernel.shmmax = 15461882265" >> /etc/sysctl.conf
echo "kernel.shmall = 3774873" >> /etc/sysctl.conf
echo "Modifing the /etc/sysctl.conf has been succeed."
echo "Now make the changes take effect....."
sysctl -p
7、修改oracle用户环境变量
cp /home/oracle/.bash_profile /home/oracle/.bash_profile.bak
echo "export TMP=/tmp">> /home/oracle/.bash_profile
echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profile
echo "export ORACLE_HOSTNAME=orcl">> /home/oracle/.bash_profile
echo "export ORACLE_SID=orcl">> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/18.3.0/db_1'>> /home/oracle/.bash_profile
echo "export ORACLE_UNQNAME=rac">> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm">> /home/oracle/.bash_profile
echo 'export PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/18.3.0/db_1/bin:$ORACLE_HOME/bin'>> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/oracle/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>> /home/oracle/.bash_profile
echo "export THREADS_FLAG=native" >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/oracle/.bash_profile
echo 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >> /home/oracle/.bash_profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /home/oracle/.bash_profile
echo 'ulimit -p 16384' >> /home/oracle/.bash_profile
echo 'ulimit -n 65536' >> /home/oracle/.bash_profile
echo 'else' >> /home/oracle/.bash_profile
echo 'ulimit -u 16384 -n 65536' >> /home/oracle/.bash_profile
echo 'fi' >> /home/oracle/.bash_profile
echo 'umask 022' >> /home/oracle/.bash_profile
echo 'fi' >> /home/oracle/.bash_profile
8、安装依赖包
yum install -y binutils
yum install -y compat-libcap1
yum install -y compat-libstdc++-33
yum install -y compat-libstdc++-33.i686
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc
yum install -y glibc.i686
yum install -y glibc-devel
yum install -y glibc-devel.i686
yum install -y ksh
yum install -y libgcc
yum install -y libgcc.i686
yum install -y libstdc++
yum install -y libstdc++.i686
yum install -y libstdc++-devel
yum install -y libstdc++-devel.i686
yum install -y libaio
yum install -y libaio.i686
yum install -y libaio-devel
yum install -y libaio-devel.i686
yum install -y libXext
yum install -y libXext.i686
yum install -y libXtst
yum install -y libXtst.i686
yum install -y libX11
yum install -y libX11.i686
yum install -y libXau
yum install -y libXau.i686
yum install -y libxcb
yum install -y libxcb.i686
yum install -y libXi
yum install -y libXi.i686
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y readline
yum install -y libtermcap-devel
yum install -y pdksh
yum install *compat-libstdc*
注意:compat-libstdc+±33-3.2.3-72.el7.x86_64,7.6之前不在yum源需要手动安装
9、关闭安全防护
systemctl disable avahi-daemon.socket
systemctl disable avahi-daemon.service
systemctl stop firewalld
systemctl disable firewalld
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
cp /etc/selinux/config /etc/selinux/config.bak
echo "SELINUX=disabled" > /etc/selinux/config
echo "SELINUXTYPE=targeted" >> /etc/selinux/config
10、静默安装数据库软件
$ORACLE_HOME/runInstaller -silent -force -noconfig -ignorePrereq \
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0 \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oper \
oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=dba \
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
Launching Oracle Database Setup Wizard...
[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2019-02-13_02-05-03PM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2019-02-13_02-05-03PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/u01/app/oracle/product/18.3.0/db_1/install/response/db_2019-02-13_02-05-03PM.rsp
You can find the log of this install session at:
/tmp/InstallActions2019-02-13_02-05-03PM/installActions2019-02-13_02-05-03PM.log
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/18.3.0/db_1/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[ora18c]
Execute /u01/app/oracle/product/18.3.0/db_1/root.sh on the following nodes:
[ora18c]
Successfully Setup Software with warning(s).
Moved the install session logs to:
/u01/app/oraInventory/logs/InstallActions2019-02-13_02-05-03PM
执行上面2个root脚本,数据库软件安装完毕
附数据库软件部分输出日志
INFO: [Feb 13, 2019 2:05:45 PM] ------------------List of failed Tasks------------------
INFO: [Feb 13, 2019 2:05:45 PM] *********************************************
INFO: [Feb 13, 2019 2:05:45 PM] Swap Size: This is a prerequisite condition to test whether sufficient t
otal swap space is available on the system.
INFO: [Feb 13, 2019 2:05:45 PM] Severity:IGNORABLE
INFO: [Feb 13, 2019 2:05:45 PM] OverallStatus:VERIFICATION_FAILED
INFO: [Feb 13, 2019 2:05:45 PM] *********************************************
INFO: [Feb 13, 2019 2:05:45 PM] Package: gcc-c++-4.8.2: This is a prerequisite condition to test whether
the package "gcc-c++-4.8.2" is available on the system.
INFO: [Feb 13, 2019 2:05:45 PM] Severity:IGNORABLE
INFO: [Feb 13, 2019 2:05:45 PM] OverallStatus:VERIFICATION_FAILED
INFO: [Feb 13, 2019 2:05:45 PM] -----------------End of failed Tasks List----------------
WARNING: [Feb 13, 2019 2:05:45 PM] [WARNING] [INS-13014] Target environment does not meet some optional
requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2019-02-13_
02-05-03PM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2019-02-13_02-05-0
3PM.log. Then either from the log file or from installation manual find the appropriate configuration to
meet the prerequisites and fix it manually.
11、静默创建实例
dbca -silent -createDatabase \
-gdbName orcl \
-sid orcl \
-sysPassword oracle -systemPassword oracle \
-databaseConfigType SI \
-createAsContainerDatabase false \
-useLocalUndoForPDBs true \
-templateName /u01/app/oracle/product/18.3.0/db_1/assistants/dbca/templates/General_Purpose.dbc \
-dvConfiguration false \
-olsConfiguration false \
-datafileJarLocation /u01/app/oracle/product/18.3.0/db_1/assistants/dbca/templates/ \
-datafileDestination /u01/app/oracle/oradata/orcl/ \
-storageType FS \
-registerWithDirService false \
-variables ORACLE_BASE_HOME=/u01/app/oracle,DB_UNIQUE_NAME=orcl,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=orcl,ORACLE_HOME=/u01/app/oracle/product/18.3.0/db_1,SID=orcl \
-initParams undo_tablespace=UNDOTBS1,db_block_size=8KB,diagnostic_dest=/u01/app/oracle,remote_login_passwordfile=EXCLUSIVE,db_create_file_dest=/u01/app/oracle/oradata/orcl/,processes=1000,sga_target=8192MB,pga_aggregate_target=1589M,open_cursors=300,compatible=18.0.0,db_name=orcl,audit_trail=none \
-sampleSchema FALSE \
-emConfiguration NONE
附dbca模板路径
/u01/app/oracle/product/18.3.0/db_1/assistants/dbca/templates/General_Purpose.dbc
dbca输出日志
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/orcl.
Database Information:
Global Database Name:orcl
System Identifier(SID):orcl
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
实例创建完毕
12、静默创建监听
[oracle@ora18c db_1]$ netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp
监听输出日志
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/app/oracle/product/18.3.0/db_1/assistants/netca/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/18.3.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
查看监听
[oracle@ora18c db_1]$ lsnrctl status
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 13-FEB-2019 14:47:16
Copyright © 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora18c)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date 13-FEB-2019 14:46:05
Uptime 0 days 0 hr. 1 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/18.3.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/ora18c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora18c)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
数据库安装完毕
1、选择software only
2、单实例
3、企业版
4、保持默认
5、保持默认
6、保持默认
7、忽略警告
8、开始安装
9、执行root脚本
创建实例
Oracle Database Installation Guide for Linux
https://docs.oracle.com/en/database/oracle/oracle-database/18/ladbi/running-rpm-packages-to-install-oracle-database.html#GUID-BB7C11E3-D385-4A2F-9EAF-75F4F0AACF02