Centos7 silent installation of Oracle11g

1、 Environment and preparations#

1.1 Environment and configuration adjustment##

Operating system version, kernel version, system CPU, RAM, hard disk configuration are as follows

[ root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908(Core)[root@localhost ~]# uname -r
3.10.0- 1062. el7.x86_64
[ root@localhost ~]# cat /proc/cpuinfo| grep "processor"| wc -l
8[ root@localhost ~]# cat /proc/meminfo| grep MemTotal
MemTotal:131826144 kB
[ root@localhost ~]# cat /proc/meminfo| grep SwapTotal
SwapTotal:1835004 kB
[ root@localhost ~]# fdisk -l|grep Disk
Disk /dev/vda:21.5 GB,21474836480 bytes,41943040 sectors
Disk label type: dos
Disk identifier:0x000e4fd0
Disk /dev/vdb:2199.0 GB,2199023255552 bytes,4294967296 sectors
Disk /dev/mapper/centos-root:18.5 GB,18513657856 bytes,36159488 sectors
Disk /dev/mapper/centos-swap:1879 MB,1879048192 bytes,3670016 sectors

As shown in the table below

Item value
Operating System CentOS Linux release 7.7.1908 (Core)
Kernel version 3.10.0-1062.el7.x86_64
CPU 8C
RAM 128GB
SWAP 1GB
Disk /dev/vda 20G + /dev/vdb 2TB

The data disk is not formatted partition (here only formatted and mounted to a separate directory, not partitioned)
Reallocate appropriate swap space for this operating system according to the memory size (here increased to 16G). For the size of the swap partition, please refer to the Red Hat official description

[ root@localhost ~]# mkfs.xfs /dev/vdb
[ root@localhost ~]# mkdir /data && mount /dev/vdb /data
[ root@localhost ~]# df -h | grep "data"/dev/vdb                 2.0T   33M  2.0T   1%/data
[ root@localhost ~]# blkid |grep vdb|awk '{print $2}'|cut -d '='-f 2"11eda493-b248-4ce0-91fb-e28e1b8164a9"[root@localhost ~]# echo "UUID=11eda493-b248-4ce0-91fb-e28e1b8164a9 /data                   xfs     defaults        0 0">>/etc/fstab  #Automatically mount data disk at boot
[ root@localhost ~]# sed -ri '/^[^#]*swap/s@^@#@'/etc/fstab  #Turn off the original swap to automatically mount at boot
[ root@localhost ~]# dd if=/dev/zero of=/data/swapfile bs=1G count=16[root@localhost ~]# mkswap /data/swapfile
[ root@localhost ~]# chmod 600/data/swapfile
[ root@localhost ~]# swapon /data/swapfile
[ root@localhost ~]# echo "/data/swapfile           swap                    swap    defaults        0 0">>/etc/fstab  #Automatically mount swap partition at boot

1.2 Common parameters##

Modify hostname, close selinux, time synchronization, etc.

[ root@localhost ~]# hostnamectl set-hostname oracledb-01[root@localhost ~]# echo "127.0.0.1   oracledb-01">>/etc/hosts
[ root@oracledb-01~]# sestatus
SELinux status:                 disabled

1.3 Other preparations##

2、 oracle installation#

2.1 basic configuration##

2.2 Unzip the installation package##

[ root@oracledb-01~]# cd linux.x64_11gR2_database_2of2/[root@oracledb-01 linux.x64_11gR2_database_2of2]# ls
linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip
[ root@oracledb-01 linux.x64_11gR2_database_2of2]# unzip -q linux.x64_11gR2_database_1of2.zip -d /data
[ root@oracledb-01 linux.x64_11gR2_database_2of2]# unzip -q linux.x64_11gR2_database_2of2.zip -d /data
[ root@oracledb-01 linux.x64_11gR2_database_2of2]# mkdir -p /data/etc
[ root@oracledb-01 linux.x64_11gR2_database_2of2]# cp /data/database/response/* /data/etc/

2.3 Official installation##

Modify the value of the following variables in the file /data/etc/db_install.rsp

oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOSTNAME=oracledb-01  #Modify to host name
ORACLE_HOME=/data/app/oracle/product/11.2.0
ORACLE_BASE=/data/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba

Execute installation script

[ root@oracledb-01~]# su - oracle
[ oracle@oracledb-01~]$ cd /data/database/[oracle@oracledb-01 database]$ ./runInstaller -silent -responseFile /data/etc/db_install.rsp -ignorePrereq

You can view the log according to the installation prompt during installation

[ root@oracledb-01~]# tail -f /data/app/oracle/inventory/logs/installActions2020-10-31_09-40-21PM.log

After the installation is complete, there will be the following prompt

You can find the log ofthis install session at:/data/app/oracle/inventory/logs/installActions2020-10-31_09-40-21PM.log
The following configuration scripts need to be executed as the "root" user. 

 #! /bin/sh
 # Root scripts to run

/data/app/oracle/inventory/orainstRoot.sh
/data/app/oracle/product/11.2.0/root.sh
To execute the configuration scripts:1. Open a terminal window
   2. Log inas"root"3. Run the scripts
   4. Return to this window and hit "Enter" key to continue

Successfully Setup Software.

Follow the above prompts to run the script as the root user

[ oracle@oracledb-01~]$ su - root
Password:[root@oracledb-01~]# sh /data/app/oracle/inventory/orainstRoot.sh 
Changing permissions of/data/app/oracle/inventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of/data/app/oracle/inventory to oinstall.
The execution of the script is complete.[root@oracledb-01~]# sh /data/app/oracle/product/11.2.0/root.sh 
Check /data/app/oracle/product/11.2.0/install/root_oracledb-01_2020-10-31_09-46-20.log for the output of root script

Configure monitoring

[ root@oracledb-01~]# su - oracle
[ oracle@oracledb-01~]$ netca /silent /responsefile /data/etc/netca.rsp

Parsing command line arguments:
 Parameter "silent"=true
 Parameter "responsefile"=/data/etc/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
 Running Listener Control:/data/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER
 Listener Control complete.
 Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0

View listening port

[ oracle@oracledb-01 database]$ netstat -tnpl | grep 1521(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       00:::1521:::*                    LISTEN      6064/tnslsnr

2.4 Create a database silently##

2.4.1 Edit the answer file

Edit the answer file /data/etc/dbca.rsp

[ GENERAL]
RESPONSEFILE_VERSION ="11.2.0"
OPERATION_TYPE ="createDatabase"[CREATEDATABASE]
GDBNAME ="orcl"
SID ="orcl"
SYSPASSWORD ="oracle"
SYSTEMPASSWORD ="oracle"
SYSMANPASSWORD ="oracle"
DBSNMPPASSWORD ="oracle"
DATAFILEDESTINATION =/data/app/oracle/oradata
RECOVERYAREADESTINATION=/data/app/oracle/fast_recovery_area
CHARACTERSET ="AL32UTF8"  #Character set, set according to requirements, it is recommended to determine what character set is needed in the early stage, and it is not recommended to change it later
TOTALMEMORY ="102400"  #The total amount of memory allocated to Oracle is allocated according to the total amount of server memory

2.4.2 Perform silent library construction###

su - oracle
dbca -silent -responseFile /data/etc/dbca.rsp

The console output when executed is as follows

Copying database files
1 % complete
3 % complete
11 % complete
18 % complete
26 % complete
37 % complete
Creating and starting Oracle instance
40 % complete
45 % complete
50 % complete
55 % complete
56 % complete
60 % complete
62 % complete
Completing Database Creation
66 % complete
70 % complete
73 % complete
85 % complete
96 % complete
100 % complete
Look at the log file "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log"for further details.

2.4.3 an examination###

View process

[ oracle@oracledb-01~]$ ps -ef | grep ora_ | grep -v grep
oracle     81131012:03?00:00:00 ora_pmon_orcl
oracle     81151012:03?00:00:00 ora_vktm_orcl
oracle     81191012:03?00:00:00 ora_gen0_orcl
oracle     81211012:03?00:00:00 ora_diag_orcl
oracle     81231012:03?00:00:00 ora_dbrm_orcl
oracle     81251012:03?00:00:00 ora_psp0_orcl
oracle     81271012:03?00:00:00 ora_dia0_orcl
oracle     81291012:03?00:00:00 ora_mman_orcl
oracle     81311012:03?00:00:00 ora_dbw0_orcl
oracle     81331012:03?00:00:00 ora_lgwr_orcl
oracle     81351012:03?00:00:00 ora_ckpt_orcl
oracle     81371012:03?00:00:00 ora_smon_orcl
oracle     81391012:03?00:00:00 ora_reco_orcl
oracle     81411012:03?00:00:00 ora_mmon_orcl
oracle     81431012:03?00:00:00 ora_mmnl_orcl
oracle     81451012:03?00:00:00 ora_d000_orcl
oracle     81471012:03?00:00:00 ora_s000_orcl
oracle     81611012:03?00:00:00 ora_qmnc_orcl
oracle     81781012:03?00:00:00 ora_cjq0_orcl
oracle     81881012:03?00:00:00 ora_q000_orcl
oracle     81901012:03?00:00:00 ora_q001_orcl

View monitoring status

[ oracle@oracledb-01~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0- Production on 03-NOV-202012:06:10Copyright(c)1991,2009, Oracle.  All rights reserved.

Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0- Production
Start Date                03-NOV-202011:37:14
Uptime                    0 days 0 hr.28 min.56 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /data/app/oracle/diag/tnslsnr/oracledb-01/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb-01)(PORT=1521)))
Services Summary...
Service "orcl" has 1instance(s).
 Instance "orcl", status READY, has 1handler(s)forthis service...
Service "orclXDB" has 1instance(s).
 Instance "orcl", status READY, has 1handler(s)forthis service...
The command completed successfully

2.5 Log in to the database to start monitoring##

[ root@oracledb-01~]# su - oracle
[ oracle@oracledb-01~]$ sqlplus /as sysdba
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/data/app/oracle/product/11.2.0/dbs/initORCL.ora'

Follow the prompts

[ oracle@oracledb-01~]$ cp /data/app/oracle/admin/orcl/pfile/init.ora.103202012323/data/app/oracle/product/11.2.0/dbs/initORCL.ora

Start listening again

SQL> shutdown immediate;
SQL> startup;
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size                  2215064 bytes
Variable Size             163578728 bytes
Database Buffers          360710144 bytes
Redo Buffers                7958528 bytes
Database mounted.
Database opened.

2.6 Activate scott user (optional)

SQL> alter user scott account unlock;
SQL> alter user scott identified by tiger;
SQL> select username,account_status from dba_users;

3、 Set boot up#

Modify /data/app/oracle/product/11.2.0/bin/dbstart

ORACLE_HOME_LISTNER=$ORACLE_HOME

Modify /data/app/oracle/product/11.2.0/bin/dbshut

ORACLE_HOME_LISTNER=$ORACLE_HOME

Modify vi /etc/oratab

orcl:/data/app/oracle/product/11.2.0:Y

New service file /etc/rc.d/init.d/oracle

#! /bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig:3459010
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/data/app/oracle/product/11.2.0
ORACLE_USER=oracle
case"$1"in'start')if[-f $LOCKFILE ]; then
  echo $0 already running.
  exit 1
 fi
 echo -n $"Starting Oracle Database:"
 su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
 su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
 su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
 touch $LOCKFILE
 ;;' stop')if[!-f $LOCKFILE ]; then
  echo $0 already stopping.
  exit 1
 fi
 echo -n $"Stopping Oracle Database:"
 su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
 su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
 su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
 rm -f $LOCKFILE
 ;;' restart')
 $0 stop
 $0 start
 ;;' status')if[-f $LOCKFILE ]; then
  echo $0 started.else
  echo $0 stopped.
 fi
   ;;*)
 echo "Usage: $0 [start|stop|status]"
 exit 1
esac
exit 0

Add execution permissions and boot up

[ root@oracledb-01~]# chmod +x /etc/init.d/oracle
[ root@oracledb-01~]# chkconfig oracle on
[ root@oracledb-01~]# chkconfig --list|grep oracle

Note: This output shows SysV services only and does not include native
  systemd services. SysV configuration data might be overridden by native
  systemd configuration.

  If you want to list systemd services use 'systemctl list-unit-files'.
  To see services enabled on particular target use
  ' systemctl list-dependencies [target]'.

oracle          0:off   1:off   2:on    3:on    4:on    5:on    6:off

Modify the permissions of startup-related files

[ root@oracledb-01~]# cd /data/app/oracle/product/11.2.0/bin/[root@oracledb-01 bin]# chmod 6751 oracle
[ root@oracledb-01 bin]# cd /var/tmp
[ root@oracledb-01 tmp]# chown -R oracle:oinstall .oracle

Shut down and restart test

reboot

After shutting down and restarting, log in to the database, and then execute startup to start the database.

reference:

https://blog.csdn.net/chenghuikai/article/details/85776622
https://www.cnblogs.com/hftian/p/6944133.html
https://www.cnblogs.com/xiaofeng666/p/13702197.html

Recommended Posts

Centos7 silent installation of Oracle11g
Graphical installation of CentOS8
CentOS environment installation of Docker
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos7 installation and configuration of Jenkins
Analysis of Hyper-V installation CentOS 8 problem
Centos7 installation of Dameng database tutorial
Centos6.5 installation and deployment of KVM
CentOS 8 installation of MariaDB detailed tutorial
Installation under centos6.9 of jenkins learning
CentOS7 installation and maintenance of Gitlab
001. Installation of enterprise-level CentOS7.6 operating system
Centos5 installation guide
Installation and use of Mysql under CentOS
Centos-6.5 installation and deployment of LNMP environment
Centos7 installation and deployment of gitlab server
Docker installation (CentOS7 installation)
CentOS7 docker installation
Centos7 installation and deployment of Airflow detailed
Installation and configuration of JDK in CentOS 7 system
Centos7 installation of PHP and Nginx tutorial detailed
Installation and configuration of rsync server under CentOS 6.5
Installation and configuration of CentOS 7 in VMware Workstation
Non-Root installation of Microsoft R Open under Centos
From installation to entry of FastDFS under Centos7
CentOS online installation RabbitMQ3.7
Zabbix 2.2.20 installation details (Centos6.9)
Centos source installation Python3
Centos7 mqtt cluster installation
Mysql8.0.15 installation configuration (centos7)
Linux notes (1): CentOS-7 installation
Redis3 installation under Centos7
CentOS online installation RabbitMQ3.7
Docker CentOS installation method
Linux CentOS 7 installation tutorial
Centos7 docker installation details
Installation and cracking of confluence6.3 operation records under Centos
Centos8 (minimal installation) a new installation of Python3.8+pip method tutorial
Detailed installation steps of CentOS6.4 system in virtual machine
Discourse CentOS 8 new installation manual
Centos 7 mini installation process record
Centos mysql installation and configuration
Glusterfs cluster installation on Centos7
Redis cluster installation under CentOS
Centos7 installation and configuration prometheus
CentOS 7 Galera Cluster installation guide
Detailed explanation of Spark installation and configuration tutorial under centOS7
CentOS 7 installation and configuration PPTP
CentOS7 installation and maintenance of nginx from entry to master
Deployment of graphite on centos7
CentOS 6.x installation mysql5.7 record
CentOS installation and configuration cmake
Ubuntu16.04.5LTS installation process of SVN
Graphical centos installation detailed process
Centos7.5 installation and configuration MongoDB4.0.4
CentOS 7 installation and configuration PPTP
Hyper-V + CentOS7 installation video tutorial
centos7 kvm installation and use
CentOS 6.8 virtual machine installation details
CentOS7 postgresql installation and use