Environment to prepare

  1. CentOS 7.6
  2. Oracle 11gR2 64-bit Linux installation package
    linux.x64_11gR2_database_1of2.zip
    linux.x64_11gR2_database_2of2.zip
    Copy the code

Install the implementation

1. Disable the firewall

systemctl stop firewalld.service
systemctl disable firewalld.service
Copy the code

2. Install dependency packages

yum install -y automake autotools-dev binutils bzip2 elfutils expat     \
gawk gcc gcc-multilib g++-multilib lib32ncurses5 lib32z1 \
ksh less lib32z1 libaio1 libaio-dev libc6-dev libc6-dev-i386 \
libc6-i386 libelf-dev libltdl-dev libodbcinstq4-1 libodbcinstq4-	     1:i386 \
libpth-dev libpthread-stubs0-dev libstdc++5 make openssh-server         rlwrap \
rpm sysstat unixodbc unixodbc-dev unzip x11-utils zlibc unzip cifs-     utils \
libXext.x86_64  glibc.i686
Copy the code

If the preceding command fails, run the following command to install the software

yum -y install xz wget gcc-c++ ncurses ncurses-devel \
cmake make perl openssl openssl-devel gcc* libxml2 \
libxml2-devel curl-devel libjpeg* libpng* freetype* \
make gcc-c++ cmake bison perl perl-devel  perl perl-devel \
glibc-devel.i686 glibc-devel libaio readline-devel \
zlib.x86_64 zlib-devel.x86_64 libcurl-* net-tool*  \
sysstat lrzsz dos2unix telnet.x86_64 iotop unzip \
ftp.x86_64 xfs* expect vim psmisc openssh-client* \
libaio bzip2  epel-release automake binutils bzip2 \
elfutils expat gawk gcc  ksh less make openssh-server \
rpm sysstat unzip unzip cifs-utils libXext.x86_64  \
glibc.i686 binutils compat-libstdc++-33 \
elfutils-libelf elfutils-libelf-devel \
expat gcc gcc-c++ glibc glibc-common \
glibc-devel glibc-headers libaio \
libaio-devel libgcc libstdc++ libstdc++-devel \
make sysstat unixODBC unixODBC-devel libnsl
Copy the code

3. Create an Oracle user

groupadd -g 502 oinstall groupadd -g 503 dba groupadd -g 504 oper groupadd -g 505 asmadmin useradd -u 502 -g oinstall -G  oinstall,dba,asmadmin,oper -s /bin/bash -m oracle passwd oracleCopy the code

4. Decompress the Oracle database installation package

Switch to the newly created Oracle user, su – Oracle, and go to the installation directory. I am ready to install to home/ Oracle, then upload the installation package to the installation directory and decompress it

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
Copy the code

5. Modify the operating system configuration

Switch to user root and modify the file

vim /etc/security/limits.conf
Copy the code

Add the following configuration items at the end of the file.

oracle          soft      nproc   2047
oracle          hard      nproc   16384
oracle          soft      nofile  1024
oracle          hard      nofile  65536
oracle          soft      stack   10240
Copy the code

6. Modify environment variables

As the root user, modify the global configuration file vi /etc/profile and add the following information

Export ORACLE_BASE = / home/oracle export ORACLE_HOME = $ORACLE_BASE/product / 11.2.0 / dbhome_1 export ORACLE_SID = former export ORACLE_UNQNAME=orcl export NLS_LANG=.AL32UTF8 export PATH=${PATH}:${ORACLE_HOME}/bin/:$ORACLE_HOME/lib64Copy the code

Put environment variables into effect.

source /etc/profile
Copy the code

7. Modify the Oracle configuration file

Switch to the Oracle user and copy the configuration file to my installation directory, home/oracle

cp /home/oracle/database/response/db_install.rsp .
Copy the code

Edit the db_install.rsp file.

vim db_install.rsp
Copy the code

The configuration items that need to be modified are listed as follows.

Oracle.install. option=INSTALL_DB_AND_CONFIG ORACLE_HOSTNAME=localhost # Can actually be changed to your own host name or domain name (IP) UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/home/oracle/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME = / home/oracle/product / 11.2.0 / dbhome_1 ORACLE_BASE = / home/oracle. Oracle install. Db. InstallEdition = EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=orcl oracle.install.db.config.starterdb.SID=orcl oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=1024 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.password.ALL=Oracle#123456 oracle.install.db.config.starterdb.control=DB_CONTROL oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false oracle.install.db.config.starterdb.dbcontrol.emailAddress=test@qq.com # can fill in your email address oracle.install.db.config.starterdb.automatedBackup.enable=false oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/oradata oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/fast_recovery_area oracle.install.db.config.starterdb.automatedBackup.enable=false DECLINE_SECURITY_UPDATES=trueCopy the code

8. Silently install Oracle 11gR2

As oracle user, run the following command to start the installation

cd /home/oracle/database
./runInstaller -silent -ignoreSysPrereqs -responseFile /home/oracle/db_install.rsp
Copy the code

The console will print some information, ignore the warning message, see the following output indicates that the installation is normalWe can then open another command line window, open scroll log, and see the output of the installation process

tail -f /home/data/oraInventory/logs/installActions2021-02-05_02-51-05PM.log
Copy the code

Some information similar to the following is displayed

The installation and configuration is complete. The console output is as followsOpen another command line window, execute the two scripts as prompted, and return to the installation window and press Enter to see that the installation is complete

Successfully Setup Software.
Copy the code

9. Verify

Now that the database is installed, an instance has been created and started, and listeners have been started, you can use the following command to enter oracle command line mode

su - oracle
sqlplus / as sysdba
Copy the code

Create a user and authorize it

create user test identified by test123;
grant connect,resource,dba to test;
Copy the code

Then use the Connect tool to connect.