oracle12c 静默安装步骤

linux6.5

oracle12c 12.1.0.2

一、安装前准备

安装oracle12c之前需要检查系统的软硬件条件,我安装在自己的虚拟机上,安装前是没有检查系统硬盘大小的,导致我在安装时因为存储空间不足安装失败,我把虚拟机空间扩容了20g才安装成功,所以建议大家再安装时保留 20g的存储空间。

具体的检查情况我在下面列一下:


1. 内存要求

1) 最小值为1 GB of RAM,建议值为2 GB of RAM or more;

2) 查询命令:grep MemTotal /proc/meminfo

本测试系统环境为Linux 6.4x86-64),内存有1.8G多,满足Oracle 12c的内存安装要求。


2. 交换空间要求


1) 查询命令:grep SwapTotal /proc/meminfo

2) 通过命令:# free查看内存和交换空间的使用情况。

由上面本机内存1.8G可知,只要交换空间在1.8*1.5以上就可以,查询可知本机的交换空间接近4G,满足要求。

以上检查完毕应该都可以满足;


3.下面是配置


(1)配置/etc/sysctl.conf,具体配置:

        # System default settings live in /usr/lib/sysctl.d/00-system.conf.  
# To override those settings, enter new settings here, or in an /etc/sysctl.d/.conf f  
ile  
#  
# For more information, see sysctl.conf(5) and sysctl.d(5).  
#  
fs.file-max = 6815744  
kernel.sem = 250 32000 100 128  
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 = 9000 65500  

保存后执行/sbin/sysctl -p 使配置生效

(2)配置/etc/security/limits.d/90-nproc.conf(90-nproc.conf 这个文件 不同系统可以名字不同,在该路径下自己查看)

    # Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.


*          soft    nproc     1024
root       soft    nproc     unlimited
oracle   soft   nofile    1024  
oracle   hard   nofile    65536  
oracle   soft   nproc    16384  
oracle   hard   nproc    16384  
oracle   soft   stack    10240  
oracle   hard   stack    32768  
oracle   hard   memlock    134217728  

oracle   soft   memlock    134217728 

配置后保存:qw


4.检查Oracle需要的rpm安装情况


rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat  

oracle12c 静默安装步骤_第1张图片

 没有安装的包, 要依次去下载并且安装就可以了。

yum install glibc-devel-2.12-1.132.el6_5.1.i686 libaio-0.3.107-10.el6.i686 libaio-devel-0.3.107-10.el6.i686 libstdc++-4.4.7-4.el6.x86_64.i686 libstdc++-devel-4.4.7-4.el6.i686 libXext-1.3.1-2.el6.i686 libXtst-1.2.1-2.el6.i686 libX11-1.5.0-4.el6.i686 libXi-1.6.1-3.el6.i686  


5.创建用户和组

[root@localhost ~]# groupadd oinstall ----创建oracle用户组  
  
[root@localhost ~]# groupadd dba----创建oracle用户组  
  
[root@localhost ~]# useradd -g oinstall -G dba oracle----oracle加入新建的2个用户组  
  
[rroot@localhost ~]# passwd oracle   ----设置oracle用户的密码  
  
[root@localhost ~]# mkdir -p /usr/oracle ----创建oracle安装目录  
  
[root@localhost ~]# chown -R oracle:oinstall /usr/oracle ----更改oracle目录用户组  
  
[root@localhost ~]# chmod -R 775 /usr/oracle ----更改oracle目录权限  
  
[root@localhost ~]# chown -R oracle:oinstall /opt/oracle/oracinstall----更改oracle安装文件所在目录的用户组  
  

[root@localhost ~]# chmod -R 755 /opt/oracle/oracinstall----更改oracle安装文件所在目录的操作权限  


6.关闭防火墙

vim /etc/selinux/config  
  
SELINUX=disabled  
  
[root@centos7 ~]# systemctl stop firewalld  
  
[root@centos7 ~]# systemctl disable firewalld 


7.配置环境变量(oracle用户 home/oracle下 vi .bash_profile)

# use for oracle  
export DISPLAY=192.168.217.131:0.0
export  ORACLE_BASE=/usr/oracle


export  ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1


export  ORACLE_SID=orcl12c


export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin


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


export LANG=en_US----·À¹Oracle°²װ½ç£¬Ï°Ñï»·¾³¸ÄªӢÎ


if [ $USER = "oracle" ];then


 if [ $SHELL = "/bin/ksh" ];then


     ulimit -p 16384


     ulimit -n 65536


   else


    ulimit -u 16384 -n 65536


fi

保存.bahs_profile文件  source .bash_profile  配置文件生效

7. 配置修改/etc/hosts文件

安装RHEL的时候最好采用静态IP地址

添加IP地址和域名的映射关系,进入hosts文件,在文件末尾加上本机实际IP和主机用户名(我的主机名是默认的)



上面的步骤完成就可以安装了

二、安装Oracle 12c数据库

unzip  linuxamd64_12102_database_se2_1of2.zip

unzip  linuxamd64_12102_database_se2_2of2.zip

我的安装文件放在/opt/oracle 这个目录下

1、静默安装

[billi@slc03nuj Disk1]$ ./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /home/billi/binlearn/db_install.rsp   
Starting Oracle Universal Installer...  
  
Checking Temp space: must be greater than 500 MB.   Actual 136617 MB    Passed  
Checking swap space: must be greater than 150 MB.   Actual 1185 MB    Passed  
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-07-20_11-50-04PM. Please wait ...[billi@slc03nuj Disk1]$ You can find the log of this install session at:  
 /scratch/billi/app/oraInventory/logs/installActions2013-07-20_11-50-04PM.log  
The installation of Oracle Database 12c was successful.  
Please check '/scratch/billi/app/oraInventory/logs/silentInstall2013-07-20_11-50-04PM.log' for more details.  
  
As a root user, execute the following script(s):  
        1. /usr/oracle/product/12.1.0/db_1/root.sh  
  
  
Successfully Setup Software.  

出现Successfully Setup Software.  表示安装完成了,下面就是执行上面的脚本就好了,如果出现任何问题一定要去日志目录下面查看日志,这里不详细说。

2、以root用户运行root.sh

3、配置Net Listener

配置,添加监听 [oracle@localhost ~]$ cat netca.rsp| grep -Ev "^#|^$" 

[oracle@localhost~]$ netca -silent -responsefile /u01/database/response/netca.rsp(用oracle用户执行 环境变量配置准全) 

[oracle@localhost~]$  lsnrctl status  

LSNRCTL for Linux:Version 12.1.0.2.0 - Production on 29-MAR-2018 04:09:12 

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

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

STATUS of theLISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version12.1.0.2.0 - Production

Start Date                29-MAR-2018 04:08:47

Uptime                    0 days 0 hr. 0 min. 25 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener ParameterFile  /usr/oracle/product/12.1.0/db_1/network/admin/listener.ora

Listener LogFile        /usr/oracle/diag/tnslsnr/localhost/listener/alert/log.xml

ListeningEndpoints Summary...

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

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

The listenersupports no services

The commandcompleted successfully 

 

4、创建数据库,修改相应文件,有些参数有默认值就不需要

 

cat/opt/oracle/oracinstall/database/response/dbca.rsp | grep -Ev '^#|^$'

[GENERAL]

RESPONSEFILE_VERSION = "12.1.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "orcl12c.us.oracle.com"

SID = "orcl12c"

TEMPLATENAME ="General_Purpose.dbc"

[createTemplateFromDB]

SOURCEDB = "myhost:1521:orcl"

SYSDBAUSERNAME = "system"

TEMPLATENAME = "My Copy TEMPLATE"

[createCloneTemplate]

SOURCEDB = "orcl"

TEMPLATENAME = "My CloneTEMPLATE"

[DELETEDATABASE]

SOURCEDB = "orcl"

[generateScripts]

TEMPLATENAME = "New Database"

GDBNAME = "orcl12.us.oracle.com"

[CONFIGUREDATABASE]

[ADDINSTANCE]

DB_UNIQUE_NAME ="orcl12c.us.oracle.com"

NODENAME=

SYSDBAUSERNAME = "sys"

[DELETEINSTANCE]

DB_UNIQUE_NAME ="orcl12c.us.oracle.com"

INSTANCENAME = "orcl12c"

SYSDBAUSERNAME = "sys"

[CREATEPLUGGABLEDATABASE]

SOURCEDB = "orcl"

PDBNAME = "PDB1"

[UNPLUGDATABASE]

SOURCEDB = "orcl"

PDBNAME = "PDB1"

ARCHIVETYPE = "TAR"

[DELETEPLUGGABLEDATABASE]

SOURCEDB = "orcl"

PDBNAME = "PDB1"

[CONFIGUREPLUGGABLEDATABASE]

SOURCEDB = "orcl"

PDBNAME = "PDB1"

[oracle@localhost ~]$

 

创建数据库 

[oracle@localhost ~]$ dbca -silent-createDatabase  -responseFile /opt/oracle/oracinstall/database/response/dbca.rsp 

Enter SYS user password: sys

 

Enter SYSTEM user password: system

 

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

33% 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"/usr/oracle/cfgtoollogs/dbca/orcl12c/orcl12c.log" for furtherdetails.

 

 

5、查看状态

 

[oracle@localhost ~]$ sqlplus / as sysdba 

 

SQL*Plus: Release 12.1.0.2.0 Production on ThuMar 29 17:37:06 2018

 

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

 

 

Connected to:

Oracle Database 12c Standard Edition Release12.1.0.2.0 - 64bit Production

 

SQL> select * from dual;

 

D

-

X

 

SQL> select status from v$instance; 

 

STATUS

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

OPEN

 

SQL> ^C

 6、查看状态 出现错误:

ERROR at line 1:

ORA-01034: ORACLE not available

Process ID: 0

Session ID: 0 Serial number: 0

 

.bash_profile中的sid不正确

到此为止,我安装oracle12c的步骤已经完成。




 

你可能感兴趣的:(oracle)