CentOS 7.9 silently installs Oracle 12c
- Environment configuration
-
- Modify hostname and hosts
- Turn off firewall
- Turn off selinux
- Confirm Transparent HugePages is closed
- Check and configure partition size
- Change yum mirror source
- Install dependency packages
- Create user groups and users
- Create file directory and authorization
- Upload the oracle installation file compressed package
- Upload 3 response files (configured in advance)
- Modify Linux kernel parameters
- Modify settings to limit
- Configure environment variables
- Install Oracle
-
- Execution file 1: Installation
- Execution file 2: monitoring
- Execution file 3: Create library
- After installation, check and use the database
-
- sqlplus connection confirmation
- listener.ora & tnsnames.ora configuration
- Restart the listening service
- Restart database
- Monitoring confirmation
- Firewall open port
- Client connection confirmation (sql developer)
- Reference resources
Environment configuration
Modify hostname and hosts
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@localhost ~]# hostname localhost.localdomain [root@localhost ~]# hostnamectl set-hostname oracle [root@localhost ~]# hostnamectl status Static hostname: oracle Icon name: computer-vm Chassis: vm Machine ID: ax**fw Boot ID: v** Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-1160.92.1.el7.x86_64 Architecture: x86-64 [root@localhost ~]# vi /etc/hosts [root@localhost ~]# cat /etc/hosts 127.0.0.1 oracle localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 oracle localhost localhost.localdomain localhost6 localhost6.localdomain6 #The actual IP must be added, otherwise port 1521 will be occupied when netca is executed. 192.168.18.20 oracle
Turn off the firewall
[root@localhost ~]# systemctl stop firewalld
Close selinux
[root@localhost ~]# vi /etc/selinux/config [root@localhost ~]# 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=enforcing #Default is this, change to disabled SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
Confirm Transparent HugePages has been closed
[root@localhost ~]# cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never
Check and configure partition size
When the RAM is 1-2GB, the SWAP size is recommended to be 1.5 times the RAM size
When the RAM is 2-16GB, the SWAP size is recommended to be equal to the RAM size
When RAM is greater than 16GB, the SWAP size is recommended to be 16GB
free -m mkdir /swapvol dd if=/dev/zero of=/swapvol/swapfile bs=1M count=10240 mkswap /swapvol/swapfile swapon /swapvol/swapfile vi /etc/fstab #Add this line at the end of the file /swapvol/swapfile swap swap defaults 0 0
Change yum mirror source
#Check whether wget is installed [root@localhost ~]# rpm -qa|grep wget #If not installed, install it [root@localhost ~]# yum install wget #Change mirror source [root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup [root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #Perform update [root@localhost ~]# yum clean all [root@localhost ~]# yum makecache [root@localhost ~]# yum update #Configure Alibaba Cloud epel source (understand that some expansion packages can be downloaded from here) [root@localhost ~]# yum install epel-release [root@localhost ~]# mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup [root@localhost ~]# mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup [root@localhost ~]# wget /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
Install dependency packages
Please refer to Official website (compat-openssl10, libnsl cannot be installed)
rpm -q bc binutils compat-openssl10 elfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXi libXtst libgcc libnsl libstdc + + libxcb libibverbs make smartmontools sysstat compat-libstdc + + compat-libstdc + + -33 gcc gcc- c++ glibc-headers libaio-deve libstdc + + -devel libstdc + + -devel unixODBC-devel binutils-* compat-libstdc + + * elfutils-libelf* glibc* gcc-* libaio* libgcc* libstdc + + * make* sysstat* unixODBC* unzip compat-libcap1 yum -y install compat-openssl10 ksh libXrender libX11 libXau libXi libXtst libnsl libxcb libibverbs smartmontools sysstat compat-libstdc + + compat-libstdc + + -33 gcc-c + + libaio-deve libstdc + + -devel libstdc + + -devel unixODBC- devel compat-libstdc + + * elfutils-libelf* glibc* libaio* libgcc* libstdc + + * make* sysstat* unixODBC* unzip compat-libcap1
Create user groups and users
groupadd oinstall groupadd dba groupadd -g 503 oper groupadd -g 504 asmadmin groupadd -g 506 asmdba groupadd -g 505 asmoper groupadd backupdba groupadd dgdba groupadd kmdba useradd -u 502 -g oinstall -G dba,asmdba,oper,backupdba,dgdba,kmdba oracle
Create file directories and authorization
mkdir /u12 mkdir mkdir -p /u12/app/oracle chmod -R 775 /u12 chown -R oracle:oinstall /u12 chmod -R 775 /u12 chmod g + s /u12
Upload the oracle installation file compressed package
Download the linux compressed package from the official website
Upload the compressed package to /u12 through mobaXterm
Upload 3 response files (configured in advance)
1. db_install.rsp
2. netca.rsp
3. dbca.rsp
Modify Linux kernel parameters
vi /etc/sysctl.conf
Write the following
fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500
Restart takes effect
sysctl -p
Modification is restricted by settings
vi /etc/security/limits.conf oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768
Configure environment variables
vi /etc/profile #Add at the end #Oracle environment set if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi #to validate source /etc/profile
Switch the oracle user and configure the oracle user environment variables
su-oracle vi.bash_profile
# Oracle Settings export ORACLE_SID=orcl export ORACLE_BASE=/u12/app/oracle export ORACLE_HOME=/u12/app/oracle/product/12.2.0/dbhome_1 export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=/lib:$HOME/lib:/lib/x86_64-linux-gnu:/usr/lib:$ORACLE_HOME/lib if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
Make the configuration file effective
source .bash_profile
Install Oracle
Switch to the oracle user and decompress to /u12/database (database is a directory that already exists in the compressed package)
[oracle@oracle ~]$ cd /u12 [oracle@oracle u12 ~]$ unzip oracle-12c-db.zip
Execution file 1: Installation
cd /u12/database ./runInstaller -silent -noconfig -responseFile /u12/db_install.rsp
Switch root to execute the two output files separately.
su-root /u12/app/oracle/oraInventory/orainstRoot.sh /u12/app/oracle/product/12.2.0/dbhome_1/root.sh
Check the log and make necessary repairs according to the log prompts (in this example, the swap partition is not large enough and dependent packages are missing)
Execution file 2: monitoring
Note: Before execution, check whether /etc/hosts has been added with ip mapping
yourip oracle
su-oracle netca -silent -responsefile /u12/netca.rsp
Execution file 3: Create library
su-oracle dbca -silent -createDatabase -responseFile /u12/dbca.rsp
After installation, check and use the database
sqlplus connection confirmation
[oracle@oracle ~]$ sqlplus / as sysdba
listener.ora & tnsnames.ora configuration
listener.ora
# listener.ora Network Configuration File: /data/u01/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcl) (ORACLE_HOME = /u12/app/oracle/product/12.2.0/dbhome_1) (SID_NAME = orcl) ) ) ADR_BASE_LISTENER = /u12/app/oracle
tnsnames.ora
ORCL = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
Restart the listening service
[oracle@oracle ~]$ lsnrctl stop [oracle@oracle ~]$ lsnrctl start
Restart the database
SQL> shutdown SQL> startup
Monitoring confirmation
[oracle@oracle ~]$ lsnrctl status
Firewall open port
[root@oracle ~]# firewall-cmd --zone=public --add-port=1521/tcp --permanent #Remove port #firewall-cmd --permanent --remove-port=1539/tcp success [root@oracle ~]# firewall-cmd --reload [root@oracle ~]# firewall-cmd --list-ports 1521/tcp [root@oracle ~]# netstat -lndtup | grep 1521 tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 26871/tnslsnr
Client connection confirmation (sql developer)
Reference resources
Installation reference resources:
[1]: https://blog.csdn.net/weixin_44499403/article/details/118102218
[2]: https://blog.csdn.net/EricLeiy/article/details/84334390?app_version=6.1.2 & amp;code=app_1562916241 & amp;csdn_share_tail={“type”:”blog”,”rType” :”article”,”rId”:”84334390″,”source”:”wenlaishiwo”} & amp;uLinkId=usr1mkqgl919blen & amp;utm_source=app
[3]: https://www.jianshu.com/p/241c205e5f64
[4]: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ladbi/supported-red-hat-enterprise-linux-8-distributions-for-x86-64.html# GUID-FBEBE161-994D-41B8-B29B-177B47C86D2A
[5]: https://blog.csdn.net/catoop/article/details/101643695
[6]: https://www.jianshu.com/p/23729b982e82
[7]: https://blog.csdn.net/ljunjie82/article/details/42214835
[8]: https://blog.csdn.net/panhaigang123/article/details/79147587