CentOS7 graphical installation of Oracle19C
Operating system: CentOS7
Oracle: 19C
Remote connection tool: Xmanager Power Suite 7
Install common tools and dependencies
yum -y install vim tar net-tools wget perl python3 readline* deltarpm python-deltarpm \
zip unzip bc compat-libcap1* compat-libcap* binutils compat-libstdc++-33 \
elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.5 glibc-common glibc-devel \
glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat \
unixODBC unixODBC-devel binutils* compat-libstdc* elfutils-libelf* \
gcc* glibc* ksh* libaio* libgcc* libstdc* make* sysstat* libXp* glibc-kernheaders
Bind hostname and IP mapping
# 修改主机名
hostnamectl set-hostname oracle
# 绑定主机名和IP映射
vim /etc/hosts
Fill in the following content
192.168.126.141 oracle
It is recommended to restart the server
reboot
Modify the kernel file of LINUX
vim /etc/sysctl.conf
Append the following
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 67747971072
kernel.shmmax = 277495689510912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
# net.core.somaxconn = 262144
Generate system parameters after modification
sysctl -p
Optimize resource constraints
vim /etc/security/limits.conf
Append the following
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
Authentication settings before program execution
vim /etc/pam.d/login
Append the following
session required /lib/security/pam_limits.so
session required pam_limits.so
Configure system environment variables to set the ksh used by Oracle users
vim /etc/profile
Append the following
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
The current session global environment variable takes effect
source /etc/profile
Create Oracle use file directory and corresponding user and password
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
mkdir -p /u01/app/oracle /u01/oraInventory /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01/app/oracle
Configure the environment variables of the oracle user
Switch to the oracle user first
su - oracle
Configure user environment variables
vim .bash_profile
Append the following
export EDITOR=vim
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/db_1
export INVENTORY_LOCATION=/u01/oraInventory
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin
umask 022
Current session user environment variables take effect
source .bash_profile
Upload the Oracle installation package and decompress it
Upload the Oracle installation package to the $ORACLE_HOME path
If you use a non-oracle user to upload, switch to the root user to modify the owner of the oracle installation package
chown -R oracle:oinstall LINUX.X64_193000_db_home.zip
Switch to the oracle user to decompress
su - oracle
cd $ORACLE_HOME
or use an absolute path
cd /u01/app/oracle/product/19c/db_1
decompress
unzip LINUX.X64_193000_db_home.zip
Install Oracle software
- install software
- create listener
- DBCA create database
Use the oracle user to enter the $ORACLE_HOME directory to install
./runInstaller
According to the prompt:
As a root user, execute the following script(s): 1. /u01/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/19c/db_1/root.sh
You need to use the root user to execute the following two scripts in sequence
/u01/oraInventory/orainstRoot.sh
/u01/app/oracle/product/19c/db_1/root.sh
Response configuration file, which can be downloaded locally for future silent installation
/u01/app/oracle/product/19c/db_1/install/response/db_2023-07-04_09-02-29AM.rsp
Configure monitoring
netca
Check listening status
lsnrctl status
DBCA create database
dbca
install rlwrap
It is very inconvenient to use sqlplus under Linux. The up and down keys and backspace keys cannot be used, which seriously reduces production efficiency.
For the convenience of sqlplus under linux to call history commands and backspace, install rlwrap
Download the source code and use the root user to compile and install
tar -zxvf rlwrap-0.45.2.tar.gz
cd rlwrap-0.45.2
./configure
make -j8
make install
Switch to oracle user configuration user environment variables support rlwrap
su - oracle
vim /home/oracle/.bash_profile
Append the following:
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
Current session user environment variables take effect
source /home/oracle/.bash_profile
sqlplus connect to database
Use the oracle user to operate
sqlplus / as sysdba
conn / as sysdba;
conn sys/oracle@orcl as sysdba;
set linesize 300;
set pagesize 300;
select tname from tab;
select userenv('language') from dual;
select * from nls_database_parameters;
select * from V$NLS_PARAMETERS;
select status from v$instance;
# 关闭监听
lsnrctl stop
-- 关闭数据库
shutdown immediate;
-- 开启数据库
startup;
# 关闭监听
lsnrctl start
Development firewall port
use root user
firewall-cmd --zone=public --add-port=1521/tcp --permanent
firewall-cmd --reload
–zone #Scope
–add-port=1521/tcp #Add port, the format is: port/communication protocol
–permanent #Permanently effective, without this parameter, it will fail after restarting
sqldeveloper connects to oracle
Use the sys account to connect to the orcl instance