linux环境安装oralce12c

1、系统环境:centos7、linuxx64_12201_database.zip

2、配置主机名:vi /etc/hosts,添加配置项192.168.1.200  bogon

3、创建oracle用户以及用户组:

    groupadd -g54321 oinstall

    groupadd -g54322 dba

    groupadd -g54323 oper

    useradd -u 54321 -g oinstall -G dba,oper  oracle

    并使用root用户需改oracle用户的登录密码。

    不必非要按照叫oinstall,和dba,只不过一般文档上就这么叫

    oinstall组用于安装数据库

    dba组用于管理数据库

    -g 表示这个用户的主组

    -G 标识这个用户的其它组

    一个用户可以属于多个用户组,但是一个用户只能指定一个组作为其主组

4、使用oralce用户上传安装文件

5、安装依赖软件

yum install binutils -y 

yum install compat-libcap1 -y

yum install compat-libstdc++-33 -y 

yum install compat-libstdc++-33.i686 -y 

yum install glibc -y 

yum install glibc.i686 -y

yum install glibc-devel -y

yum install glibc-devel.i686 -y

yum install ksh-yyuminstalllibaio -y

yum install libaio.i686 -y

yum install libaio-devel -y

yum install libaio-devel.i686 -y 

yum install libX11 -y

yum install libX11.i686 -y

yum install libXau -y

yum install libXau.i686 -y

yum install libXi -y 

yum install libXi.i686 -y

yum install libXtst -y

yum install libXtst.i686 -y

yum install libgcc -y

yum install libgcc.i686 -y

yum install libstdc++ -y

yum install libstdc++.i686 -y

yum install libstdc++-devel -y

yum install libstdc++-devel.i686 -y

yum install libxcb -y

yum install libxcb.i686 -y

yum install make -y 

yum install nfs-utils -y

yum install net-tools -y

yum install smartmontools -y

yum install sysstat -y

yum install unixODBC -y

yum install unixODBC-devel -y

6、限制oracle用户资源使用: vi /etc/security/limits.conf 

添加如下信息:

    oracle soft nofile 1024

    oracle hard nofile 65536

    oracle soft nproc 16384

    oracle hard nproc 16384

    oracle soft stack 1024

    0oracle hard stack 32768 

    oracle hard memlock 134217728

    oracle soft memlock 134217728

7、配置内核参数:

    添加如下:

    fs.file-max =6815744

    kernel.sem =25032000100128

    kernel.shmmni =4096

    kernel.shmall =1073741824   

    kernel.shmmax =4398046511104

    kernel.panic_on_oops =1

    net.core.rmem_default =262144

    net.core.rmem_max =4194304

    net.core.wmem_default =262144

    net.core.wmem_max =1048576

    net.ipv4.conf.all.rp_filter =2

    net.ipv4.conf.default.rp_filter =2

    fs.aio-max-nr =1048576

    net.ipv4.ip_local_port_range =900065500

    运行sysctl -p命令更改当前内核参数

8、修改设置SELINUX

        vi /etc/selinux/config

        将`SELINUX`修改为permissive,即:SELINUX=permissive

         setenforce Permissive

9、禁用防火墙:

    systemctl stop firewalld

    systemctl disable firewalld

10、创建oralce安装目录

    mkdir -p /usr/local/products/oracle12c

    chown -R oracle:oinstall /usr/local

    chmod -R 775 /usr/local/

11、配置环境变量并验证

    export TMP=/tmp

    export TMPDIR=$TMP

    export ORACLE_HOSTNAME=bogon(注:主机名)

    export ORACLE_UNQNAME=cdb1

    export ORACLE_BASE=/usr/local/products

    export ORACLE_HOME=$ORACLE_BASE/oracle12c

    export ORACLE_SID=cdb1

    export PATH=/usr/sbin:/usr/local/bin:$PATH

    export PATH=$ORACLE_HOME/bin:$PATH

    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

    export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

    使文件生效:source .bash_profile

    验证:echo $ORACLE_HOME

12、解压安装包:unzip linuxx64_12201_database.zip

13、修改配置文件

    cd database/response/

    vim db_install.rsp

    修改内容如下:

    oracle.install.option=INSTALL_DB_SWONLY

    UNIX_GROUP_NAME=oinstall

    INVENTORY_LOCATION=/usr/local/products/oracle12c/oraInventory

    ORACLE_HOME=/usr/local/products/oracle12c

    ORACLE_BASE=/usr/local/products

    oracle.install.db.InstallEdition=EE

    oracle.install.db.OSDBA_GROUP=dba

    oracle.install.db.OSBACKUPDBA_GROUP=dba

    oracle.install.db.OSDGDBA_GROUP=dba

    oracle.install.db.OSKMDBA_GROUP=dba

    oracle.install.db.OSRACDBA_GROUP=dba

14、安装oracle

 命令行方式:


./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \

-showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp \

oracle.install.option=INSTALL_DB_SWONLY \UNIX_GROUP_NAME=oinstall \

INVENTORY_LOCATION=/usr/local/products/oracle12c/oraInventory \

ORACLE_HOME=/usr/local/products/oracle12c \

ORACLE_BASE=/usr/local/products \

oracle.install.db.InstallEdition=EE \

oracle.install.db.OSDBA_GROUP=dba \

oracle.install.db.OSBACKUPDBA_GROUP=dba \

oracle.install.db.OSDGDBA_GROUP=dba \

oracle.install.db.OSKMDBA_GROUP=dba \

oracle.install.db.OSRACDBA_GROUP=dba

响应文件安装:


./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \

-showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp


安装完成后使用root用户执行以下脚本:

    /usr/local/products/oracle12c/oraInventory/orainstRoot.sh

    /usr/local/products/oracle12c/root.sh

执行命令:sqlplus / as sysdba


[oracle@solang ~]$ sqlplus / as sysdba

SQL*Plus:Release12.2.0.1.0ProductiononSun May2711:52:012018

Copyright (c)1982,2016, Oracle.Allrights reserved.

Connectedtoan idle instance.

SQL>


此时数据库安装成功。

15、创建数据库:


 dbca -silent -createDatabase \ 

-templateName/usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \ 

-gdbname cdb1 -sid cdb1 -responseFile/home/oracle/database/response/dbca.rsp \ 

-characterSetAL32UTF8 \ 

-sysPasswordOraPasswd1 \ 

-systemPasswordOraPasswd1 \

 -createAsContainerDatabasetrue\ 

-numberOfPDBs1\ 

-pdbName pdb1 \ 

-pdbAdminPasswordOraPasswd1 \ 

-automaticMemoryManagementfalse\ 

-ignorePreReqs


数据文件目录datafileDestination默认安装在$ORACLE_BASE/oradata下

注意:密码设置需要密码长度至少8位,包含至少1个大写字符,1个小写字符和1个数字[0-9]。 

再次执行命令:sqlplus / as sysdba


SQL*Plus: Release 12.2.0.1.0 Production on Sat May 4 14:31:46 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select status from v$instance;

STATUS

------------

OPEN

SQL>


16、数据库监听配置:

查看监听状态:lsnrctl status


[oracle@bogon ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 04-MAY-2019 14:34:14

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

TNS-12541: TNS:no listener

TNS-12560: TNS:protocol adapter error

  TNS-00511: No listener

  Linux Error: 111: Connection refused

[oracle@bogon ~]$


此时监听未启动

使用默认的netca.rsp文件 

​执行命令netca -silent -responseFile /home/oracle/database/response/netca.rsp


[oracle@bogon ~]$ netca -silent -responseFile /home/oracle/database/response/netca.rsp

Parsing command line arguments:

    Parameter "silent" = true

    Parameter "responsefile" = /home/oracle/database/response/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Oracle Net Listener Startup:

    Running Listener Control:

      /usr/local/products/oracle12c/bin/lsnrctl start LISTENER

    Listener Control complete.

    Listener started successfully.

Listener configuration complete.

Oracle Net Services configuration successful. The exit code is 0

[oracle@bogon ~]$


启动成功,此时再次查看监听状态:


[oracle@bogon ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 04-MAY-2019 14:36:30

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bogon)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                    LISTENER

Version                  TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                04-MAY-2019 14:35:24

Uptime                    0 days 0 hr. 1 min. 6 sec

Trace Level              off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File  /usr/local/products/oracle12c/network/admin/listener.ora

Listener Log File        /usr/local/products/diag/tnslsnr/bogon/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bogon)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary...

Service "880ae9e0f0144dbee055266a1fb8e3c7" has 1 instance(s).

  Instance "cdb1", status READY, has 1 handler(s) for this service...

Service "cdb1" has 1 instance(s).

  Instance "cdb1", status READY, has 1 handler(s) for this service...

Service "cdb1XDB" has 1 instance(s).

  Instance "cdb1", status READY, has 1 handler(s) for this service...

Service "pdb1" has 1 instance(s).

  Instance "cdb1", status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@bogon ~]$


监听配置成功。

17、结束:

    启动监听:lsnrctl start

    停止监听:lsnrctl stop

本文详情请参考:Linux命令行安装Oracle12c - Pachulia - 博客园

你可能感兴趣的:(linux环境安装oralce12c)