文章目录
- 下载安装包
- 1.下载Oracle19c的安装包
- 2.下载Oracle19c的预安装包
- 3.拖到Linux中
- 一、安装依赖
- 二、创建用户和组
- 三、修改Linux相关内核参数
- 四、修改用户限制
- 五、关闭防火墙和SELinux
- 六、创建安装目录并解压安装包
- 七、设置环境变量
- 八、安装Oracle数据库
- 九、创建实例
- 十、配置监听
- 启动数据库
操作系统:Centos7.9
内存:8G
处理器:4
硬盘:100G
下载安装包
1.下载Oracle19c的安装包
https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#19c
2.下载Oracle19c的预安装包
http://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
3.拖到Linux中
一、安装依赖
yum install -y unzip compat-libcap1 compat-libstdc++-33 gcc-c++ ksh libaio-devel libstdc++-devel elfutils-libelf-devel fontconfig-devel libXrender-devel rlwrap
二、创建用户和组
groupadd oinstall
groupadd dba
groupadd asmdba
groupadd backupdba
groupadd dgdba
groupadd kmdba
groupadd racdba
groupadd oper
useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper -m oracle
三、修改Linux相关内核参数
vim /etc/sysctl.conf
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_keepalive_time = 150
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 6
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 16451328
kernel.shmmax = 33692319744
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 = 1048576
运行sysctl -p
使配置生效。
四、修改用户限制
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 32768
oracle soft memlock 262144000
oracle hard memlock 262144000
五、关闭防火墙和SELinux
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
vim /etc/selinux/config
# 设置 SELINUX=disabled
六、创建安装目录并解压安装包
mkdir -p /data/u01/app/oracle/product/19c/dbhome_1
mkdir -p /data/u01/app/oraInventory
chown -R oracle:oinstall /data/u01
cd /root
unzip LINUX.X64_193000_db_home.zip -d /data/u01/app/oracle/product/19c/dbhome_1/
chown -R oracle:oinstall /data/u01/
七、设置环境变量
vim /home/oracle/.bash_profile
export ORACLE_SID=orcl19c
export ORACLE_HOSTNAME=`hostname -s`
export ORACLE_BASE=/data/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/network/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$HOME/.local/bin:$HOME/bin:$PATH
export EDITOR=vi
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin
export SQLPATH=$ORACLE_HOME/sqlplus/admin
保存并运行source /home/oracle/.bash_profile
使配置生效。
八、安装Oracle数据库
su - oracle
/data/u01/app/oracle/product/19c/dbhome_1/runInstaller -silent -force -noconfig -ignorePrereq \
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/data/u01/app/oraInventory \
ORACLE_BASE=/data/u01/app/oracle \
ORACLE_HOME=/data/u01/app/oracle/product/19c/dbhome_1 \
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=racdba \
oracle.install.db.rootconfig.executeRootScript=true \
oracle.install.db.rootconfig.configMethod=ROOT
九、创建实例
dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \
-gdbname orcl19c -sid orcl19c \
-createAsContainerDatabase TRUE \
-numberOfPDBs 1 \
-pdbName orclpdb2 \
-pdbAdminPassword oracle12334 \
-sysPassword oracle12334 -systemPassword oracle12334 \
-datafileDestination '/data/u01/app/oracle/oradata' \
-recoveryAreaDestination '/data/u01/app/oracle/flash_recovery_area' \
-redoLogFileSize 50 \
-storageType FS \
-characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \
-sampleSchema true \
-totalMemory 2048 \
-databaseType OLTP \
-emConfiguration NONE
十、配置监听
vim /data/u01/app/oracle/product/19c/dbhome_1/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orclpdb2)
(SID_NAME = orcl19c)
)
(SID_DESC =
(GLOBAL_DBNAME = gzpdb1)
(SID_NAME = orcl19c)
)
(SID_DESC =
(GLOBAL_DBNAME = ynpdb1)
(SID_NAME = orcl19c)
)
(SID_DESC =
(GLOBAL_DBNAME = tstpdb)
(SID_NAME = orcl19c)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle19c )(PORT = 1521))
)
)
ADR_BASE_LISTENER = /data1/u01/app/oracle
HOST修改成自己的主机名或IP
启动监听
lsnrctl start
启动数据库
sqlplus / as sysdba
startup
show pdbs;