CentOS6.8环境安装oracle 11G (图形、静默、克隆)

转至https://www.cnblogs.com/hailun1987/p/9005386.html

 

节所讲内容:

oracle11g基础环境配置

数据库的三种安装方式(图形、静默、克隆)

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

http://db-engines.com

 

REDHAT6.5安装oracle11.2.4

ORACLE11G R2官档网址:

http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCGGJAB

1         操作系统

[root@xuegod41 ~]# cat /etc/redhat-release

CentOS release 6.8 (Final)

[root@xuegod41 ~]# uname -m

x86_64

安装图形界面

yum -y groupinstall "X Window System" "Chinese Support" "Desktop"

设置开机自动进入图形界面

[root@xuegod41 ~]# vim /etc/inittab

把最后一行的id:3:initdefault: 修改为:

id:5:initdefault:

2         安装前先进行预检查

1.1              内存

Oracle官方建议swap设置标准:

对于运行ORACLE数据库的操作系统,ORACLE官方是有设置大小建议的,在此以从ORACLE 11g R2官方文档中提取的建议大小为例:

(1)ORACLE官方要求最小1GB的RAM,建议2GB或更大

(2)SWAP与RAM的大小配置关系

1)、RAM为1-2GB时,SWAP大小建议为RAM大小的1.5倍

2)、RAM为2-16GB时,SWAP大小建议与RAM大小相等

3)、RAM大于16GB时,SWAP大小建议为16GB     

内存大小的查看命令:

[root@xuegod41 ~]# grep MemTotal /proc/meminfo    #查看物理内存

MemTotal:        3908524 kB

[root@xuegod41 ~]# grep SwapTotal /proc/meminfo  #查看swap交换内存

SwapTotal:       2047996 kB

[root@xuegod41 ~]# free

             total       used       free     shared    buffers     cached

Mem:       3908524     211396    3697128        160      12848      81240

-/+ buffers/cache:     117308    3791216

Swap:      2047996          0    2047996

[root@xuegod41 ~]# free -m

             total       used       free     shared    buffers     cached

Mem:          3816        206       3610          0         12         79

-/+ buffers/cache:        114       3702

Swap:         1999          0       1999

swap的作用:

当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,临时转移到SWAP上,供当前运行的程序提供物理内存空间,当程序需要再访问被转移到了SWAP空间上的数据时,再从SWAP中恢复到物理内存中。从此工作原理不难看出来,SWAP要有,但是尽量不要使用,使用了就会发生内存交换,必然影响系统性能

2.1              硬盘大小

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

查看本机硬盘大小

[root@xuegod41 ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        47G  1.6G   43G   4% /

tmpfs           1.9G     0  1.9G   0% /dev/shm

/dev/sda1       477M   39M  413M   9% /boot

本地的/tmp目录空间不能少于400M

3         检测软件环境

3.1              安装oracle所需的环境依赖包

配置好YUM源

查看哪些安装包没有安装,然后YUM安装

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \

compat-libcap1 \

compat-libstdc++-33 \

gcc \

gcc-c++ \

glibc \

glibc-devel \

ksh \

libgcc \

libstdc++ \

libstdc++-devel \

libaio \

libaio-devel \

make \

sysstat

 

[root@xuegod41 ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \

> compat-libcap1 \

> compat-libstdc++-33 \

> gcc \

> gcc-c++ \

> glibc \

> glibc-devel \

> ksh \

> libgcc \

> libstdc++ \

> libstdc++-devel \

> libaio \

> libaio-devel \

> make \

> sysstat

binutils-2.20.51.0.2-5.44.el6 (x86_64)

compat-libcap1-1.10-1 (x86_64)

compat-libstdc++-33-3.2.3-69.el6 (x86_64)

gcc-4.4.7-17.el6 (x86_64)

gcc-c++-4.4.7-17.el6 (x86_64)

glibc-2.12-1.192.el6 (x86_64)

glibc-2.12-1.192.el6 (i686)

glibc-devel-2.12-1.192.el6 (x86_64)

package ksh is not installed

libgcc-4.4.7-17.el6 (x86_64)

libgcc-4.4.7-17.el6 (i686)

libstdc++-4.4.7-17.el6 (x86_64)

libstdc++-devel-4.4.7-17.el6 (x86_64)

libaio-0.3.107-10.el6 (x86_64)

package libaio-devel is not installed

make-3.81-23.el6 (x86_64)

sysstat-9.0.4-31.el6 (x86_64)

 

[root@xuegod41 ~]# yum install -y ksh libaio-devel

4.1              设置主机名、修改/etc/hosts,设置主机名和Ip的对应关系

[root@xuegod41 ~]# vim /etc/hosts

 

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.10.41   xuegod41   xuegod41.cn

[root@xuegod41 ~]# hostname

xuegod41.cn

5.1              创建oracle用户uid为500、dba组gid为501,oracle用户主组为dba,然后激活这个用户

OINSTALL用户组(oinstall)

oinstall 组是Oracle推荐创建的OS用户组之一,建议在系统第一次安装oracle软件产品之前创建该oinstall组,理论上该oinstall组应当拥有oracle软件产品目录(例如$CRS_HOME和$ORACLE_HOME)和oracle Inventory信息目录仓库,oracle Inventory信息目录记录了系统上安装过的oracle产品的记录

OSDBA用户组(dba)

osdba是我们必须要创建的一种系统dba用户组(dba),若没有该用户组我们将无法安装数据库软件及执行管理数据库的任务。

OSOPER用户组(oper)

osoper是一种额外的用户组(oper),我们可以选择要不要创建该用户组,创建该用户组可以满足让os用户行使某些数据库管理权限(包括SYSOPER角色权限)的目的。注意SYSOPER的权限包括startup和shutdown,所以要小心为该用户组添加成员

[root@xuegod41 ~]# groupadd -g 500 oinstall

[root@xuegod41 ~]# groupadd -g 501 dba

[root@xuegod41 ~]# groupadd -g 502 oper

[root@xuegod41 ~]# useradd -u 500 -g oinstall -G dba,oper oracle

[root@xuegod41 ~]# id oracle

uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)

[root@xuegod41 ~]# passwd oracle

Changing password for user oracle.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

更改用户 oracle 的密码 。

新的 密码:

无效的密码: 它基于字典单词

无效的密码: 过于简单

重新输入新的 密码:

passwd: 所有的身份验证令牌已经成功更新。

用ORACLE用户登录一下,激活这个用户

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

创建ORACLE用户的安装目录与数据存放目录,并设置目录的所有者,组和权限

[root@xuegod41 ~]# mkdir -p /server/oracle

[root@xuegod41 ~]# mkdir -p /server/oradata

[root@xuegod41 ~]# mkdir -p /server/oracle/oraInventory

[root@xuegod41 ~]# chown -R oracle:dba /server/ora*

[root@xuegod41 ~]# chmod -R 775 /server/ora*

[root@xuegod41 ~]# ll /server

total 8

drwxrwxr-x 3 oracle dba 4096 Aug 22 07:20 oracle

drwxrwxr-x 2 oracle dba 4096 Aug 22 07:19 oradata

6.1              修改内核参数(服务器内存为2G的情况下)

[root@xuegod41 ~]# vim /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmmax = 1073741824

kernel.shmmni = 4096

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

kernel.shmall = 2097152

参数说明:

fs.aio-max-nr = 1048576

//表示同时可以拥有的异步IO请求数目,推荐值是1024个K,也就是1024*1024=1048576字节

fs.file-max = 6815744

//系统中可以同时打开的文件数目,计算公式:为512 乘以 processes (如128个process则为 65536),官方建议最少6815744

kernel.shmall = 2097152

//该参数控制可以使用的共享内存的总页数,(页面大小查看:getconf PAGE_SIZE),如内存超过16G则shmmax/4(kb),官方建议最少值为2097152

kernel.shmmax = 1073741824

//计算公式:1G*1024*1024*1024=1073741824 (字节)  

//是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值。设置应该足够大,能在一个共享内存段下容纳下整个的SGA ,设置的过低可能会导致需要创建多个共享内存段,这样可能导致系统性能的下降。至于导致系统下降的主要原因为在实例启动以及ServerProcess创建的时候,多个小的共享内存段可能会导致当时轻微的系统性能的降低(在启动的时候需要去创建多个虚拟地址段,在进程创建的时候要让进程对多个段进行“识别”,会有一些影响),但是其他时候都不会有影响。

  官方建议值:

  32位linux系统:可取最大值为4GB(4294967296bytes)-1byte,即4294967295。建议值为多于内存的一半,所以如果是32位系统,一般可取值为4294967295。32位系统对SGA大小有限制,所以SGA肯定可以包含在单个共享内存段中。

  64位linux系统:可取的最大值为物理内存值-1byte,建议值为多于物理内存的一半,一般取值大于SGA_MAX_SIZE即可,可以取物理内存-1byte。例如,如果为12GB物理内存,可取12*1024*1024*1024-1=12884901887,SGA肯定会包含在单个共享内存段中

kernel.shmmni = 4096

//表示最小共享内存固定4096KB(最小值)

kernel.sem = 250 32000 100 128

//表示设置的信号量,它有4个参数依次是【SEMMSL:每个用户拥有信号量最大数;SEMMNS:系统信号量最大数;SEMOPM:每次semopm系统调用操作数;SEMMNI:系统辛苦量集数最大数。这4个参数为固定内容大小】

net.ipv4.ip_local_port_range = 9000 65500

//专用服务器模式下与用户进程通信时分配给用户的端口区间

net.core.rmem_default = 262144

net.core.wmem_default = 262144

//上面两个参数表示内核套接字接收缓存区默认的大小

net.core.rmem_max = 4194304

net.core.wmem_max = 1048576

//上面两个参数表示内核套接字接收缓存区默认的最大大小

设置完成后让它生效

[root@xuegod41 ~]# sysctl -p

7.1              检查软件安装用户的资源限制

[root@xuegod41 ~]# vim /etc/security/limits.conf

 

#        - nproc - max number of processes

#        - as - address space limit (KB)

#        - maxlogins - max number of logins for this user

#        - maxsyslogins - max number of logins on the system

#        - priority - the priority to run user process with

#        - locks - max number of file locks the user can hold

#        - sigpending - max number of pending signals

#        - msgqueue - max memory used by POSIX message queues (bytes)

#        - nice - max nice priority allowed to raise to values: [-20, 19]

#        - rtprio - max realtime priority

#

#<domain>      <type>  <item>         <value>

#

 

#*               soft    core            0

#*               hard    rss             10000

#@student        hard    nproc           20

#@faculty        soft    nproc           20

#@faculty        hard    nproc           50

#ftp             hard    nproc           0

#@student        -       maxlogins       4

 

# End of file

oracle           soft     nproc         2047

oracle           hard     nproc         16384

oracle           soft     nofile        1024

oracle           hard     nofile        65536

oracle           soft     stack         10240

nofile——最大可以打开的文件数量

nproc——最大运行进程数

 

让配置的limit参数生效,所以要配置/etc/pam.d/login

[root@xuegod41 ~]# vim /etc/pam.d/login  在文件末尾加上或修改以下参数

session    required     pam_limits.so

 

设置系统变量,在后面添加针对ORACLE用户的资源限制

[root@xuegod41 ~]#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

8.1              配置ORACLE用户的环境变量

[root@xuegod41 ~]# vim /home/oracle/.bash_profile

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

export ORACLE_BASE=/server/oracle          

export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1     

export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID=test

export LANG=american_america.ZHS16GBK

export LD_LIBRARY_PATH=$ORACLE_HONE/lib

alias oratrace="cd $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace && ls|grep alert"

alias oradata="cd /server/oradata/test"

alias topc="ps -e -o pcpu,pid,user,tty,args | sort -k 1 -r | head"

alias topm="ps -e -o pmem,pid,user,tty,args | sort -k 1 -r | head"

(LD_LIBRARY_PATH环境变量用于在程序加载运行期间查找动态链接库时指定除了系统默认路径之外的其他路径,

注意,LD_LIBRARY_PATH中指定的路径会在系统默认路径之前进行查找)

9.1              上传软件包

[root@xuegod41 tmp]# ll

total 2295600

-rw-r--r-- 1 root root 1239269270 Aug 22 07:58 linux.x64_11gR2_database_1of2.zip

-rw-r--r-- 1 root root 1111416131 Aug 22 07:58 linux.x64_11gR2_database_2of2.zip

[root@xuegod41 tmp]# unzip linux.x64_11gR2_database_1of2.zip

[root@xuegod41 tmp]# unzip linux.x64_11gR2_database_2of2.zip

[root@xuegod41 tmp]# chown -R oracle.dba database/

4         安装软件

切换到ORACLE用户

10.1        安装数据库软件

[root@xuegod41 tmp]# su - oracle

[oracle@xuegod41 ~]$ cd /tmp

[oracle@xuegod41 tmp]$ cd database/

[oracle@xuegod41 database]$ ./runInstaller

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 120 MB.   Actual 38647 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 1999 MB    Passed

Checking monitor: must be configured to display at least 256 colors

    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

出现这种报错,解决方法:

用root用户运行 xhost  + 本机IP,然后使用oracle用户登录,$su oracle 安装oracle 数据库

 

如下图如果出现乱码,设置以下环境变量

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

[oracle@xuegod41 database]$ export LANG=en.US

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

如下图:安装环境检测后有几个警告,一个是包的版本没有安装,一个是内核参数设置过小,

一个是swap空间设置过小,内核参数可以点击fix&check again

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

如下图,复制那个sh脚本在root用户状态下执行,此时不要点那个OK

 

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

[root@xuegod41 ~]# sh /tmp/CVU_11.2.0.1.0_oracle/runfixup.sh

Response file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.response

Enable file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.enable

Log file location: /tmp/CVU_11.2.0.1.0_oracle/orarun.log

Setting Kernel Parameters...

kernel.sem = 250 32000 100 128

[root@xuegod41 ~]#

执行完成后,再点OK

 

交换分区值过小,可以有两种方法来增加swap分区,一种是将新的分区来作为swap,另一种是在磁盘中创建一个大的文件来作swap. 我们以文件扩展swap

[root@xuegod41 ~]# cd /var/

[root@xuegod41 var]# dd if=/dev/zero of=file bs=1M count=2048

2048+0 records in

2048+0 records out

2147483648 bytes (2.1 GB) copied, 31.7267 s, 67.7 MB/s

[root@xuegod41 var]# mkswap -f file

Setting up swapspace version 1, size = 2097148 KiB

no label, UUID=246d49b4-e205-4545-9454-8b24a4e254eb

[root@xuegod41 var]# swapon file

[root@xuegod41 var]# free -m

             total       used       free     shared    buffers     cached

Mem:          3816       3318        498          1         25       2869

-/+ buffers/cache:        424       3392

Swap:         4047          0       4047

[root@xuegod41 var]#

[root@xuegod41 var]# echo "/var/file    swap      swap           defaults   0  0 " >> /etc/fstab

安装pdksh包,如果安装不上,可以先把KSH这个包卸载

[root@xuegod41 tmp]# wget http://ftp.pbone.net/mirror/www.whiteboxlinux.org/whitebox/3.0/en/os/x86_64/RedHat/RPMS/pdksh-5.2.14-21.x86_64.rpm

[root@xuegod41 tmp]# rpm -qa|grep ksh

ksh-20120801-35.el6_9.x86_64

[root@xuegod41 tmp]# rpm -e ksh-20120801-35.el6_9.x86_64

[root@xuegod41 tmp]# rpm -ivh pdksh-5.2.14-21.x86_64.rpm

warning: pdksh-5.2.14-21.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 73307de6: NOKEY

Preparing...                ########################################### [100%]

   1:pdksh                  ########################################### [100%]

然后我们再次点安装检测

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

解决方法:
yum list libaio-devel 查看下名字
之后yum install libaio-devel-0.3.105.i386
其他的同理,如还是不能解决,选择忽略

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

以root用户身份执行上面两条脚本,然后点ok

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

[root@xuegod41 tmp]# cd /server/oracle/oraInventory/

[root@xuegod41 oraInventory]#

[root@xuegod41 oraInventory]# ./orainstRoot.sh

Changing permissions of /server/oracle/oraInventory/.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /server/oracle/oraInventory/ to oinstall.

The execution of the script is complete.

[root@xuegod41 oraInventory]# cd ../product/

[root@xuegod41 product]# ./11.2/db_1/root.sh

Running Oracle 11g root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /server/oracle/product/11.2/db_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 直接回车

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

 

11.1        配置监听

[oracle@xuegod41 oracle]$ netca

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

安装oracle数据库

[oracle@xuegod41 oracle]$ dbca

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

CentOS6.8环境安装oracle 11G (图形、静默、克隆)

安装完成

查看监听状态正常

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

查看数据库版本及状态正常

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

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

根据时间关系,把另外几种安装方式说一下,软件安装的三种方式:图形、静默、克隆

二、克隆安装($ORACLE_HOME)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

三、根据响应文件安装(针对个别单位不能使用图形界面,只能使用静默安装)

解压完数据库软件包以后,在它的目录下面有相应的响应文件

[root@xuegod45 tmp]# ls

database  linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip  yum.log

[root@xuegod45 tmp]# cd database/

[root@xuegod45 database]# ls

doc  install  response  rpm  runInstaller  sshsetup  stage  welcome.html

[root@xuegod45 database]# cd response/

[root@xuegod45 response]# ls

dbca.rsp  db_install.rsp  netca.rsp

12.1        生成响应文件模板

安装依赖包

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \

compat-libcap1 \

compat-libstdc++-33 \

gcc \

gcc-c++ \

glibc \

glibc-devel \

ksh \

libgcc \

libstdc++ \

libstdc++-devel \

libaio \

libaio-devel \

make \

sysstat

 

[root@xuegod45 response]# yum install -y libaio-devel ksh

设置主机名、修改/etc/hosts,设置主机名和Ip的对应关系

[root@xuegod45 response]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.10.45    xuegod45   xuegod45.cn

[root@xuegod45 response]# hostname

xuegod45.cn

 

创建用户和组

[root@xuegod45 response]# groupadd -g 500 oinstall

[root@xuegod45 response]# groupadd -g 501 dba

[root@xuegod45 response]# groupadd -g 502 oper

[root@xuegod45 response]# useradd -u 500 -g oinstall -G dba,oper oracle

[root@xuegod45 response]# id oracle

uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)

[root@xuegod45 response]# passwd oracle

Changing password for user oracle.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

 CentOS6.8环境安装oracle 11G (图形、静默、克隆)

 

oracle用户登录一下激活账号

[root@xuegod45 response]#chown oracle.dba /tmp/database/*

 

创建文件路径

[root@xuegod45 ~]# mkdir -p /server/oracle

[root@xuegod45 ~]# mkdir -p /server/oradata

[root@xuegod45 ~]# mkdir -p /server/oracle/oraInventory

[root@xuegod45 ~]# chown -R oracle:dba /server/ora*

[root@xuegod45 ~]# chmod -R 755 /server/ora*

[root@xuegod45 ~]# ll /server

total 8

drwxr-xr-x 3 oracle dba 4096 Aug 22 13:58 oracle

drwxr-xr-x 2 oracle dba 4096 Aug 22 13:58 oradata

 

扩展虚拟内存

[root@xuegod45 ~]# cd /var/

[root@xuegod45 var]# dd if=/dev/zero of=file bs=1M count=1024

1024+0 records in

1024+0 records out

1073741824 bytes (1.1 GB) copied, 6.85347 s, 157 MB/s

[root@xuegod45 var]# mkswap -f file

Setting up swapspace version 1, size = 1048572 KiB

no label, UUID=d01e69df-c23a-467a-a312-12aec5ca1801

[root@xuegod45 var]# swapon file

[root@xuegod45 var]#  free -m

             total       used       free     shared    buffers     cached

Mem:          3816       3691        124          0         32       3421

-/+ buffers/cache:        237       3579

Swap:         3023          0       3023

 

[oracle@xuegod45 database]$ cd /tmp/database/response/

[oracle@xuegod45 response]$ ls

dbca.rsp  db_install.rsp  netca.rsp

[oracle@xuegod45 response]$ vim db_install.rsp

#--------------------------------------------------------------------

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=xuegod64

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/server/oracle/oraInventory

SELECTED_LANGUAGES=en

ORACLE_HOME=/server/oracle/product/11.2/db_1

ORACLE_BASE=/server/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.EEOptionsSelection=true

oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0

oracle.install.db.DBA_GROUP=oinstall

oracle.install.db.OPER_GROUP=dba

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

DECLINE_SECURITY_UPDATES=true

oracle.installer.autoupdates.option=SKIP_UPDATES

 

#--------------------------------------------------------------------

 

 

各参数含义如下:

-silent 表示以静默方式安装,不会有任何提示

-force 允许安装到一个非空目录

-noconfig 表示不运行配置助手netca

-responseFile 表示使用哪个响应文件,必需使用绝对路径

oracle.install.responseFileVersion 响应文件模板的版本,该参数不要更改

oracle.install.option 安装选项,本例只安装oracle软件,该参数不要更改

DECLINE_SECURITY_UPDATES 是否需要在线安全更新,设置为true

ORACLE_HOSTNAME 安装主机名

UNIX_GROUP_NAME oracle用户用于安装软件的组名

INVENTORY_LOCATION oracle产品清单目录

SELECTED_LANGUAGES oracle运行语言环境,一般包括英文和简繁体中文

ORACLE_HOME Oracle安装目录

ORACLE_BASE oracle基础目录

oracle.install.db.InstallEdition 安装版本类型,一般是企业版

oracle.install.db.optionalComponents 定制安装组件列表

oracle.install.db.DBA_GROUP oracle用户用于授予OSDBA权限的组名

oracle.install.db.OPER_GROUP oracle用户用于授予OSOPER权限的组名

 

开始安装oracle软件

通过response文件静默安装, 大概10-15分钟:

[oracle@xuegod45 database]$ ./runInstaller -silent -responseFile /tmp/database/response/db_install.rsp

用法:

runInstaller  [-options] [(<CommandLineVariable=Value>)*]

 

其中选项包括:

  -clusterware oracle.crs,<crs version> 

         已安装的集群就绪服务的版本。

 

  -crsLocation <Path> 

         仅用于安装集群, 可指定 CRS 主目录位置的路径。指定此路径将覆盖从主产品清单中获取的 CRS 信息。

 

  -invPtrLoc <full path of oraInst.loc> 

         仅适用于 Unix。指向其他产品清单位置。orainst.loc 文件中包含:

inventory_loc=<location of central inventory>

inst_group=<>

 

  -jreLoc <location> 

         Java 运行时环境的安装路径。没有该路径, OUI 就无法运行。

 

  -logLevel <level> 

         过滤优先级别低于 <level> 的日志消息。有效的选项包括: severe, warning, info, config, fine, finer, finest, basic, general, detailed 和 trace。建议不要使用 basic, general, detailed 和 trace。

 

  -paramFile <location of file> 

         指定 OUI 要使用的 oraparam.ini 文件的位置。

 

  -responseFile <Path> 

         指定要使用的响应文件和路径。

 

  -attachHome 

         将主目录附加到 OUI 产品清单。

 

  -cfs 

         表明指定的 Oracle 主目录位于集群文件系统 (已共享) 中。如果指定 '-local', 则必须同时指定此选项, 这样 Oracle Universal Installer 才能相应地在产品清单中注册该主目录。

 

  -clone 

         使 Oracle 主目录副本与当前环境匹配。

 

  -debug 

         从 OUI 获取调试信息。

 

  -detachHome 

         用于将主目录与 OUI 产品清单分离, 而不删除 Oracle 主目录内的产品清单目录。

 

  -enableRollingUpgrade 

         在集群环境中使用, 用于允许在 (安装了该产品的) 节点子集上对产品进行升级。

 

  -executeSysPrereqs 

         执行系统先决条件检查并退出。

 

  -force 

         允许在非空目录中进行无提示模式的安装。

 

  -help 

         显示上述用法。

 

  -ignoreSysPrereqs 

         忽略系统先决条件检查的结果。

 

  -local 

         无论是否指定集群节点, 均在本地节点上执行操作。

 

  -printdiskusage 

         记录有关磁盘使用情况的调试信息。

 

  -printmemory 

         记录有关内存使用情况的调试信息。

 

  -printtime 

         记录有关时间使用情况的调试信息。

 

  -relink 

         对 Oracle 主目录执行重新链接操作

          用法: -relink -maketargetsxml <location of maketargetsxml> [-makedepsxml <location of makedepsxml>] [name=value]

 

  -silent 

         对于无提示模式下的操作, 输入内容可以是一个响应文件, 也可以是命令行变量值对的列表。

 

  -waitforcompletion 

         安装程序将等待完成, 而不是衍生 Java 引擎并退出。

 

  -suppressPreCopyScript 

         禁止执行预复制脚本。

 

  -acceptUntrustedCertificates 

         接受来自安全站点的不受信任的证书。

 

  -suppressPostCopyScript 

         禁止执行复制后脚本。

 

  -noconfig 

         不执行配置工具。

 

  -noconsole 

         禁止在控制台中显示消息。不分配控制台。

 

  -formCluster 

         安装 Oracle Clusterware 以构成集群。

 

  -remotecp <Path> 

         Unix 特定选项。仅用于安装集群, 可指定本地集群节点上远程复制程序的路径。

 

  -remoteshell <Path> 

         Unix 特定选项。仅用于安装集群, 可指定本地集群节点上远程 shell 程序的路径。

 

  -executePrereqs

         仅执行先决条件检查。

 

  -ignorePrereq

         忽略运行先决条件检查。

 

  -ignoreInternalDriverError

         忽略任何内部驱动程序错误。

 

  -downloadUpdates

         只下载更新。

 

  -showProgress

         用于在控制台上显示安装进度。仅在无提示安装下才支持此选项。

 

 

 

 

 

 

[oracle@xuegod45 ~]$  /server/oracle/product/11.2/db_1/bin/netca -silent -responseFile /tmp/database/response/netca.rsp

 

[oracle@xuegod45 ~]$ ll /server/oracle/product/11.2/db_1/network/admin/*.ora

-rw-r--r-- 1 oracle oinstall 365 Aug 22 15:08 /server/oracle/product/11.2/db_1/network/admin/listener.ora

-rw-r--r-- 1 oracle oinstall 215 Aug 22 15:08 /server/oracle/product/11.2/db_1/network/admin/sqlnet.ora

上一篇:Oracle 11g的一些常用语句记录


下一篇:oracle-3-Linux-11g安装