Oracle 21C 数据库版本刚刚发布,之前尝试使用RPM方式安装没有解决oracle-database-preinstall-21c缺失的问题,后来下载非RPM的ZIP软件包再次安装。本次安装环境:2C8G阿里云x86 ECS,操作系统:CentOS 8.2。
安装前准备
下载ZIP安装包
https://www.oracle.com/database/technologies/oracle21c-linux-downloads.html
Oracle Database 21c (21.3) for Linux x86-64
Download | Description |
---|---|
LINUX.X64_213000_db_home.zip | (64-bit) (3,109,225,519 bytes) (sha256sum - c05d5c32a72b9bf84ab6babb49aee99cbb403930406aabe3cf2f94f1d35e0916) |
检查系统版本
[root@modb-p yum.repos.d]# uname -a
Linux modb-p 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@modb-p yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
安装需要的RPM包
[root@modb-p yum.repos.d]# dnf install bc binutils compat-openssl10 elfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXi libXtst libgcc libnsl libstdc++ libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat
调整系统参数配置
cat >> /etc/sysctl.conf <<EOF 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 EOF sysctl -p cat >> /etc/security/limits.d/oracle-database-preinstall-21c.conf <<EOF oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 134217728 oracle soft memlock 134217728 EOF
创建用户和目录
[root@modb-p ~]# groupadd oinstall
[root@modb-p ~]# groupadd dba
[root@modb-p ~]# useradd -g oinstall -G dba oracle
[root@modb-p ~]# mkdir -p /u01/app/oracle/product/21.0.0/db
[root@modb-p ~]# mkdir -p /u01/oradata
[root@modb-p ~]# chown -R oracle:oinstall /u01
[root@modb-p ~]# chmod -R 775 /u01
关闭防火墙
[root@modb-p ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@modb-p ~]# setenforce Permissive
setenforce: SELinux is disabled
[root@modb-p ~]# systemctl stop firewalld
[root@modb-p ~]#
[root@modb-p ~]# systemctl disable firewalld
设置环境变量
cat >> /home/oracle/.bash_profile <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/21.0.0/db
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=modb
export PDB_NAME=pdb1
export PATH=/usr/sbin:/usr/local/bin:\$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
EOF
解压软件到ORACLE_HOME目录
[root@modb-p tmp]# chmod 777 LINUX.X64_213000_db_home.zip
[root@modb-p tmp]# ls -l LINUX.X64_213000_db_home.zip
-rwxrwxrwx 1 root root 3109225519 Aug 14 21:04 LINUX.X64_213000_db_home.zip
[root@modb-p tmp]# sha256sum LINUX.X64_213000_db_home.zip
c05d5c32a72b9bf84ab6babb49aee99cbb403930406aabe3cf2f94f1d35e0916 LINUX.X64_213000_db_home.zip
[root@modb-p tmp]# su - oracle
[oracle@modb-p ~]$ cd $ORACLE_HOME
[oracle@modb-p db]$ unzip -oq /tmp/LINUX.X64_213000_db_home.zip
静默安装数据库软件
[oracle@modb-p db]$ ./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=${ORA_INVENTORY} \
SELECTED_LANGUAGES=en,en_US \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
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. installActions2021-08-15_00-10-15AM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2021-08-15_00-10-15AM.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/21.0.0/db/install/response/db_2021-08-15_00-10-15AM.rsp
You can find the log of this install session at:
/tmp/InstallActions2021-08-15_00-10-15AM/installActions2021-08-15_00-10-15AM.log
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/21.0.0/db/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[modb-p]
Execute /u01/app/oracle/product/21.0.0/db/root.sh on the following nodes:
[modb-p]
Successfully Setup Software with warning(s).
Moved the install session logs to:
/u01/app/oraInventory/logs/InstallActions2021-08-15_00-10-15AM
root执行脚本
[root@modb-p ~]# sh /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@modb-p ~]# sh /u01/app/oracle/product/21.0.0/db/root.sh
Check /u01/app/oracle/product/21.0.0/db/install/root_modb-p_2021-08-15_00-11-40-304464521.log for the output of root script
[root@modb-p ~]#
使用DBCA静默建库
[oracle@modb-p db]$ dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE \
-characterSet ZHS16GBK \
-sysPassword Oracle21c \
-systemPassword Oracle21c \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName ${PDB_NAME} \
-pdbAdminPassword Oracle21c \
-databaseType MULTIPURPOSE \
-memoryMgmtType auto_sga \
-totalMemory 2000 \
-storageType FS \
-datafileDestination "/u01/oradata" \
-redoLogFileSize 50 \
-ignorePreReqs
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
53% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/modb.
Database Information:
Global Database Name:modb
System Identifier(SID):modb
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/modb/modb.log" for further details.
[oracle@modb-p db]$
连接数据库检查
至此Oracle 21C单实例数据库创建完毕
[oracle@modb-p db]$ ps -ef|grep smon
oracle 33983 1 0 00:20 ? 00:00:00 ora_smon_modb
oracle 34380 25660 0 00:21 pts/0 00:00:00 grep --color=auto smon
[oracle@modb-p db]$ sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Sun Aug 15 00:21:36 2021
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL>
SQL> ALTER SESSION SET CONTAINER = pdb1;
Session altered.
SQL> select count(*) from all_tables;
COUNT(*)
----------
2348
SQL>
最后修改时间:2021-08-15 00:52:52
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。