Article From:https://www.cnblogs.com/gaoyuechen/p/9121863.html

CentOS 7Silent (no graphical interface) installation of Oracle 11g

 

Prepare the CentOS 7 system environment

Let me take CentOS-7-x86_64-DVD-1511.iso Oracle as an example to briefly describe the installation process of 11g.

Due to the installation of silent mode (silent), I did not need to use graphical interfaces. I chose the smallest installed server version of CentOS 7.

The installation process can be referred tohttps://jingyan.baidu.com/article/fd8044fade8ac35031137a82.html

After the installation is completed, only the command line interface is available.

 

To facilitate command operation, I used the remote connection tool Xshell.

I would like to share with you the green version of XshellXftpPortable:

http://pan.baidu.com/s/1pL5DL4B

After downloading, unzip can be used

 

Download Oracle 11g

OracleOfficial website

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

My machine is installed on the CentOS7 64 bit system, so the Oracle version downloaded is also 64 bits.

 

11.2.0.2.0  zlinux64The version of Oracle is installed on the IBM server, and CentOS 7 is not installed.

After the download is completed, there are two compressed files

linux.x64_11gR2_database_1of2.zip And linux.x64_11gR2_database_2of2.zip

 

Uploading the compressed file to /db/ via Xftp

Install dependency package

Before installing the dependency package, it is recommended that the yum source be modified to aliyun source and download faster.

cd /etc

mv yum.repos.d yum.repos.d.bak

mkdir yum.repos.d

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum clean all

yum makecache

 

After the modification is successful, install the following dependency package:

yum -y install 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 \

pdksh \

sysstat \

unixODBC \

unixODBC-devel

After the installation is completed, the following interface is displayed

 

Use the following commands to check whether the dependencies are complete

rpm -q \

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 \

pdksh \

sysstat \

unixODBC \

unixODBC-devel | grep “not installed”

There is no installation of pdksh

 

Execute the yum -y install pdksh and find that CentOS 7 does not have relevant installation packages available.

 

Download the pdksh RPM package directly through the WGet command. I downloaded it to /tmp/.

wget -O /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm

After the download is completed, enter the /tmp/

 

rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm

 

Again check whether the dependency package is complete

rpm -q \

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 \

pdksh \

sysstat \

unixODBC \

unixODBC-devel | grep “not installed”

 

This depends on the complete package installation

Add Oracle user groups and users

groupadd oinstall

groupadd dba

groupadd asmadmin

groupadd asmdba

useradd -g oinstall -G dba,asmdba oracle -d /home/oracle

When the addition is finished, look at the Oracle user

id oracle

Initializing the password for the Oracle user

passwd oracle

 

Configuring hostname (native IP mapping)

vim /etc/hosts

192.168.154.154 centos-oracle

Test hostname

ping -c 3 centos-oracle

 

Optimization of OS kernel parameters

kernel.shmmax The parameters are set to half of the physical memory

vim /etc/sysctl.conf

fs.aio-max-nr=1048576

fs.file-max=6815744

kernel.shmall=2097152

kernel.shmmni=4096

kernel.shmmax = 1073741824

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=1048586

Make the parameters effective

sysctl -p

 

Limit the shell permissions of Oracle users

vim /etc/security/limits.conf

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

vim /etc/pam.d/login

session  required   /lib64/security/pam_limits.so

session  required   pam_limits.so

vim /etc/profile

if [ $USER = “oracle” ]; then

if [ $SHELL = “/bin/ksh” ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

Create the Oracle installation directory

mkdir -p /db/app/oracle/product/11.2.0

mkdir /db/app/oracle/oradata

mkdir /db/app/oracle/inventory

mkdir /db/app/oracle/fast_recovery_area

chown -R oracle:oinstall /db/app/oracle

chmod -R 775 /db/app/oracle

Configuring the Oracle user environment variable

su – oracle

vim .bash_profile

umask 022

export ORACLE_HOSTNAME=centos-orcl

export ORACLE_BASE=/db/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/

export ORACLE_SID=ORCL

export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH

export LC_ALL=”en_US”

export LANG=”en_US”

export NLS_LANG=”AMERICAN_AMERICA.ZHS16GBK”

export NLS_DATE_FORMAT=”YYYY-MM-DD HH24:MI:SS”

After the above configuration is completed, it is recommended that the system be restarted.

reboot

Unzip the Oracle compressed file to the /db

cd /db/

unzip linux.x64_11gR2_database_1of2.zip -d /db

unzip linux.x64_11gR2_database_2of2.zip -d /db

 

After unzip

mkdir /db/etc/

cp /db/database/response/* /db/etc/

vim /db/etc/db_install.rsp

 

oracle.install.option=INSTALL_DB_SWONLY

DECLINE_SECURITY_UPDATES=true

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/db/app/oracle/inventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOSTNAME=centos-oracle

ORACLE_HOME=/db/app/oracle/product/11.2.0

ORACLE_BASE=/db/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.isCustomInstall=true

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=dba

 

Start installation

su – oracle

cd /db/database/

./runInstaller -silent -ignorePrereq -responseFile /db/etc/db_install.rsp

During installation, you can use the tail command to monitor the installation log of Oracle.

tail -f /db/app/oracle/inventory/logs/installActions2017-07-12_03-48-29PM.log

 

Installation is done, prompting Successfully Setup Software.

Complete the configuration according to the hint

 

su root

sh /db/app/oracle/inventory/orainstRoot.sh

sh /db/app/oracle/product/11.2.0/root.sh

 

Silent monitor

su – oracle

netca /silent /responsefile /db/etc/netca.rsp

perhaps

[oracle@localhost ~]$ cat /db/app/oracle/product/11.2.0/network/admin/listener.ora
# listener.ora Network Configuration File: /db/app/oracle/product/11.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = centos-oracle)(PORT = 1521))
)
)

ADR_BASE_LISTENER = /db/app/oracle

 

View the monitor port

netstat -tnulp | grep 1521


Silent creation of a database

TOTALMEMORY Set to 80% of the total memory

vi /db/etc/dbca.rsp

GDBNAME = “orcl”

SID = “orcl”

SYSPASSWORD = “oracle”

SYSTEMPASSWORD = “oracle”

SYSMANPASSWORD = “oracle”

DBSNMPPASSWORD = “oracle”

DATAFILEDESTINATION =/db/app/oracle/oradata

RECOVERYAREADESTINATION=/db/app/oracle/fast_recovery_area

CHARACTERSET = “AL32UTF8”

TOTALMEMORY = “1638”

Execution of silence

dbca -silent -responseFile /db/etc/dbca.rsp

 

Look at the Oracle instance process

ps -ef | grep ora_ | grep -v grep

 

View the monitoring state

lsnrctl status

cp -a /db/app/oracle/admin/orcl/pfile/init.ora.522018105539 /db/app/oracle/product/11.2.0/dbs/initORCL.ora

 

====================

Open the instance with the default parameter file (SPFILE), load the default database, and open the database.

It is equal to the following three commands

startup nomount

alter database mount

alter database open

==============================================

Create a directory file

[root@localhost ~]# cat /etc/oracle/olr.loc
olrconfig_loc = /db/app/oracle/product/11.2.0/cdata/centos-oracle.olr
CRS_HOME = /db/app/oracle/product/11.2.0/

touch  /db/app/oracle ……olr

===================

reboot

Log in to sqlplus to see the instance state

sqlplus / as sysdba

select status from v$instance;

 

View the database code

select userenv(‘language’) from dual;

 

View the database version information

select * from v$version;

 

Activating Scott users

alter user scott account unlock;

alter user scott identified by tiger;

select username,account_status from all_users;

 

NavicatRemote connection Oracle

Open 1521 port

firewall-cmd –zone=public –add-port=1521/tcp –permanent

firewall-cmd –reload

Official website

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

Download the instantclient-basic, unzip the compressed file

 

Download Navicat

http://pan.baidu.com/s/1c2GP9U4

Open Navicat, tool – Option

Open the OCI interface, select the oci.dll under the instantclient-basic decompression directory on the right OCI library column, then click OK.

 

Restart Navicat, click the connection, and select Oracle

 

IPFor the IP address of the Oracle server, the instance name of the service named Oracle can be ignored.

select instance_name from v$instance;

 

The user name uses the newly activated Scott and the password is tiger. After completing the above information, click the connection test.

 

The Navicat remote connection to the Oracle database is successful

Set the Oracle boot to start

vi /db/app/oracle/product/11.2.0/bin/dbstart

ORACLE_HOME_LISTNER=$ORACLE_HOME

vi /db/app/oracle/product/11.2.0/bin/dbshut

ORACLE_HOME_LISTNER=$ORACLE_HOME

vi /etc/oratab

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

vi /etc/rc.d/init.d/oracle

 

[plain] view plain copy

 
  1. #! /bin/bash  
  2. # oracle: Start/Stop Oracle Database 11g R2  
  3. #  
  4. # chkconfig: 345 90 10  
  5. # description: The Oracle Database is an Object-Relational Database Management System.  
  6. #  
  7. # processname: oracle  
  8. . /etc/rc.d/init.d/functions  
  9. LOCKFILE=/var/lock/subsys/oracle  
  10. ORACLE_HOME=/db/app/oracle/product/11.2.0  
  11. ORACLE_USER=oracle  
  12. case “$1” in  
  13. ‘start’)  
  14.    if [ -f $LOCKFILE ]; then  
  15.       echo $0 already running.  
  16.       exit 1  
  17.    fi  
  18.    echo -n $”Starting Oracle Database:”  
  19.    su – $ORACLE_USER -c “$ORACLE_HOME/bin/lsnrctl start”  
  20.    su – $ORACLE_USER -c “$ORACLE_HOME/bin/dbstart $ORACLE_HOME”  
  21.    su – $ORACLE_USER -c “$ORACLE_HOME/bin/emctl start dbconsole”  
  22.    touch $LOCKFILE  
  23.    ;;  
  24. ‘stop’)  
  25.    if [ ! -f $LOCKFILE ]; then  
  26.       echo $0 already stopping.  
  27.       exit 1  
  28.    fi  
  29.    echo -n $”Stopping Oracle Database:”  
  30.    su – $ORACLE_USER -c “$ORACLE_HOME/bin/lsnrctl stop”  
  31.    su – $ORACLE_USER -c “$ORACLE_HOME/bin/dbshut”  
  32.    su – $ORACLE_USER -c “$ORACLE_HOME/bin/emctl stop dbconsole”  
  33.    rm -f $LOCKFILE  
  34.    ;;  
  35. ‘restart’)  
  36.    $0 stop  
  37.    $0 start  
  38.    ;;  
  39. ‘status’)  
  40.    if [ -f $LOCKFILE ]; then  
  41.       echo $0 started.  
  42.       else  
  43.       echo $0 stopped.  
  44.    fi  
  45.    ;;  
  46. *)  
  47.    echo “Usage: $0 [start|stop|status]”  
  48.    exit 1  
  49. esac  
  50. exit 0  

Boot up Oracle

systemctl enable oracle

Startup problem

oracle ORA-12547: TNS:lost contact

cd /db/app/oracle/product/11.2.0/bin/

chmod 6751 oracle

TNS-12555: TNS:permission denied

cd /var/tmp

chown -R oracle:oinstall .oracle

Copyright notice: This article is an original article for bloggers. It can not be reproduced without permission from bloggers. Https://blog.csdn.net/Kenny1993/article/details/75038670
Article Tags: oracleoracle 11g server centoscentos7

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *