Linux下Oracle自动安装

1、 概述

为方便实施人员快速在linux系统(这里仅支持RHEL5 RHEL6)下部署oracle,以及统一公司的oracle版本,在此制作了3oracle自动安装包(10204.tar.gz版本号为10.2.0.411204.tar.gz 版本号为11.2.0.411204_FC.tar.gz是针对光纤存储优化的版本,均为64位单机版本)只要操作系统安装好,其余全部工作都由这3个安装包完成(缺包仍需各位提前准备好系统安装光盘或者系统安装镜像文件),全程安装过程可在文本界面完成,部分操作需要人工确认,安装完成后一些常见的影响公司应用系统运行的地方已调整。

 

 

 

说明:红色字体内容是注释

 

10g安装后默认调整的地方

_kgl_large_heap_warning_threshold=52428800 #大对象警告阀值,默认2048000

db_recovery_file_dest_size=8G #闪回空间,默认2G

processes=800 #连接数,默认150

单个重做日志文件容量 1G # 默认50M

 

11g安装后默认调整的地方

db_recovery_file_dest_size=10G #闪回空间,默认2G

processes=1000 #连接数,默认150

deferred_segment_creation=FALSE #延迟分配段,默认true

sec_case_sensitive_logon=false #密码大小写区分,默认true

单个重做日志文件容量 1G # 默认50M

密码过期时间改为不过期 #默认180

 

11204_FC.tar.gz是针对光纤存储(要求500GB以上)优化的版本,使用此版本必须先将光纤存储格式化之后自动挂载到/oradata目录(参考3.4),且此版本默认将开启归档(目录在/oradata/arch,数据文件保存在/oradata/(指定的oracle sid) 目录,控制文件在本地磁盘和存储各一份.在每周一零点执行rman全库备份,备份目录在/u01/rmanbak,同时删除过期备份和归档

2、 安装准备

2.1检查硬件配置

硬盘:一般要求300G以上,光纤存储500G以上

内存:16G以上,教务系统32G以上

CPU24核以上,教务系统44核以上

CPU架构X86_64

注:数字化校园建议安装集群数据库

2.2检查操作系统

系统版本RHEL5(建议5.8),RHEL6(建议6.4以上)两种都必须为64

分区 必须有一个独立的/u01分区,用来安装oracle

建议分区方案:

/boot 100M

Swap  物理内存容量<=2G swap分区容量 = 2 * 物理内存

2G<物理内存容量<16G swap分区容量 = 2G + 物理内存

  物理内存容量>=16G swap分区容量 = 16G

/     50G

/u01  剩余全部空间

     安装过程会自动关闭操作系统的防火墙和selinux,如果学校有这方面的要求,请在安装完成之后重新开启。

3、 安装

3.1上传安装包到/u01目录

注意:如果操作系统是RHEL5,请上传10204.tar.gz,如果操作系统是RHEL6,请上传11204.tar.gz,如果服务器挂载有FC光纤存储请上传11204_FC.tar.gz

 

RHEL5安装oracle 10GRHEL6安装oracle 11G

如果选择安装11g,请同时下载p10404530_112030_WINNT_3of6.zip(此文件是windows32位的11g客户端,此客户端解决了exp无法导出11204数据库数据的问题)

3.2解压安装包

[root@autotest ~]# cd /u01

10g

[root@autotest u01]# tar -zxvf 10204.tar.gz 

11g

[root@autotest u01]# tar -zxvf 11204.tar.gz

或者

[root@autotest u01]# tar -zxvf 11204_FC.tar.gz

解压过程大概5分钟,解压完成后/u01目录下会多出一个installORACLE目录 

3.3正式安装

[root@autotest u01]# cd installORACLE/

[root@autotest installORACLE]# ll

total 28

-rw-r--r-- 1 root   root     1810 Oct 11 16:55 createDB.sql

-rw-r--r-- 1 root   root     1067 Oct 11 16:55 init.ora

-rwxr--r-- 1 root   root     7551 Oct 11 16:58 localInstallORACLE.sh 

drwxrwx--- 4 500  500 4096 Mar 20  2013 oracle

-rw-r--r-- 1 root   root     2061 Jun  8 10:59 oracled

-rw-r--r-x 1 root   root      596 Jun  8 10:59 silentDBCA.sh

 

11204.tar.gz解压这里会多出一个oraInventory目录,11204_FC.tar.gz多一个rmanbak.sh

 

[root@autotest installORACLE]# ./localInstallORACLE.sh 

这里不可用/u01/installORACL/localInstallORACLE.sh方式执行

 

以下是安装过程的输出信息摘录,不同环境可能会不一样

*******************************************************************

                     System environment check                      

package elfutils-libelf-devel is not installed  这里说明系统缺包,如果不缺包则是package check passed

package gcc is not installed

package gcc-c++ is not installed

package glibc-devel is not installed

package glibc-headers is not installed

package libaio-devel is not installed

package libstdc++-devel is not installed

package openmotif is not installed

package sysstat is not installed

package unixODBC is not installed

package unixODBC-devel is not installed 

 Please insert the os install Disk or upload the iso.

Where is your operation system installation media? 这里请根据需要选择

 

通过把安装光盘或者通过虚拟机控制台挂载iso(如下图),请选择1

 

 

通过上传iso文件到当前服务器系统硬盘内,请选择2,之后会提示输入iso文件的绝对路径

 

注意顺序,是先放好光盘或上传完iso之后再选择

 

A.光盘方式

1) dvd Disc

2) iso

#? 1

You have selected dvd Disc

mount: block device /dev/cdrom is write-protected, mounting read-only

Loaded plugins: rhnplugin, security

 

BIso方式

Where is your operation system installation media?

1) dvd Disc

2) iso

#? 2

You have selected iso

Where is the iso?(in absolute path,e.g., /u01/rhel-server-5.8-x86_64-dvd.iso)/u01/rhel-server-5.8-x86_64-dvd.iso  这里是文件的绝对路径

 

 

如果 用户ID500),用户组ID500501)被占用,则会看到如下提示,本程序必须使用这三个id,按y后回车会删除占用这三个id的用户或组,所以要在备份该用户相关的数据之后再确认

**********************  warning  *****************************

the uid 500 has been used by user oracle

the gid 500 has been used by group oinstall

the gid 501 has been used by group dba

 

Please backup the files(if it's usefull) owned by user and group lists above, this program will drop  these users and groups!!!

Have you backed up the files? (y/n) 这里务必要在备份完成之后按y 

 

 

接下来关闭防火墙,selinux、配置内核参数、修改用户资源限制,都无需人工干预,省略输出

 

 

如果主机名不是localhost且主机有多块网卡,会看到如下提示。因为需要在/etc/hosts文件里面配置主机名和ip对应(否则监听不能正常运行),所以这里提示选择将要使用的网卡,然后根据这个网卡名取到上面的ip,如果是etho可直接敲回车,不是请手工输入,如eth1

This server has the folowing network interfaces 下面列出的是机器上的所有网卡

 

eth0

eth1

eth2

eth3

Enter the network interface name to use : eth0 >

 

接下来是收集oracle的相关配置信息(这里设置不合理oracle肯定歇菜),10g11g略有不同,分开讲解

关于sid,别整那些没用的特殊字符,这个不是设密码,要符合国际标准

关于内存值,正整数,必须的,要符合逻辑

 

A10g输出

*******************************************************************

                        Start oracle install                       

This will install oracle to /u01(strongly recomand it's a partion) 

*******************************************************************

Enter your ORACLE_SID : orcl > 这里需要自定义sid请输入,默认orcl则回车

Enter the memory size of oracle (in MB,recomand is physical memory * 0.7) : 1407 >这里是分配给oracle使用的内存,默认是物理内存的70%,建议不要调整,调也只能往下调,单位MB,输入只需要数字(这个数值必须 >= 下面sga + pga 的值),单位不要输入,默认则回车

Enter the memory size of sga(in MB,recomand is oracle memory * 0.8) : 1125 >这里是分配刚刚定义的oracle使用的内存,10g主要分为两大块sgapga,建议按1的比例分配,默认则回车

Enter the memory size of pga(in MB,recomand is oracle memory * 0.2) : 281 >

*******************************************************************

                        Summary & Confirm                          

         It takes aboout 15 minites to create instance             

********** If you are not sure,do not continue!!!! ****************

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

CPU architecture: X86_64

OS version: RHEL 5 64bit

ORACLE version: 10.2.0.4  64bit

ORACLE_SID: orcl

sga: 1125 MB

pga: 281 MB

Confirmed and continue? (y/n) 这里是最后一步确认,过了这儿只能一条道儿走到黑,重装需要删除相关目录后重新解压安装包再安装,如果以上输出跟实际或设想的不一致,请勿确认

 

B11g输出

 

*******************************************************************

                        Start oracle install                       

This will install oracle to /u01(strongly recomand it's a partion) 

and put datafiles into /oradata (must be a partion) FC版本会有这个提示

*******************************************************************

Enter your ORACLE_SID : orcl >xsfh这里需要自定义sid请输入,默认orcl则回车

Your physical memory is 3949 (in MB)这里显示的是此机器的物理内存大小,单位MB

Enter the memory size of oracle (in MB,recomand is physical memory * 0.7) : 2764 >这里是分配给oracle使用的内存,默认是物理内存的70%,建议不要调整,调也只能往下调,单位 MB,输入只需要数字,单位不要输入,默认则回车,11g的自动内存管理不需要再分sgapga

*******************************************************************

                        Summary & Confirm                          

         It takes aboout 15 minites to create instance             

********** If you are not sure,do not continue!!!! ****************

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

CPU architecture: X86_64

OS version: RHEL 6 64bit

ORACLE version: 11.2.0.4  64bit

ORACLE_SID: xsfh

memory_target: 2764 MB

Confirmed and continue? (y/n) 这里是最后一步确认,过了这儿只能一条道儿走到黑,重装需要删除相关目录后重新解压安装包再安装,如果以上输出跟实际或设想的不一致,请勿确认

 

确认完成后开始创建实例,输出省略,大概15分钟,此过程可以无人职守,但要确保连接不会断,断网请重装

........

 

 

SQL> spool off;

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

*******************************************************************

                     Installation Complated & check                

server ip: 10.71.19.98  如果主机名是localhost,则这里不会显示ip,不改了

ORACLE_SID: orcl

listener port: 1521

sys,system password: ASSAByL8TKw  这里的密码是11位的随机字符串,妥善保管

You should test if this database could connect from client,if it does,reboot your system and check again,if it doesn't,call 13989483540

 

Don't forget to take out the dvd Disc!!! 到这里安装过程结束,请到客户端测试是否可连接,如果连接成功,则重启服务器测试自动启动是否有效(用了光盘的去把光盘拿出来,正常情况下应该弹出光驱了,正常情况!!!),如果不成功,则。。。。。。。(略去一千字)

3.挂载光纤存储

查看服务器上的磁盘

[root@racdb2 ~]# fdisk -l

 

Disk /dev/sda: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00070655

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      102400   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              13         144     1048576   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/sda3             144       13055   103705600   8e  Linux LVM

 

Disk /dev/sdb: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

这里的sdb是模拟的一个存储,sda是服务器的本地磁盘,正式环境需要先咨询硬件或者老师到底哪个设备是存储

 

分区,这里因为是模拟环境,所以只分了一个分区,正式环境要根据需求来分

[root@racdb2 ~]# fdisk -cu /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x83dfb104.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help): n  

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First sector (2048-125829119, default 2048): 

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-125829119, default 125829119): 

Using default value 125829119

 

Command (m for help): p  

 

Disk /dev/sdb: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders, total 125829120 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x83dfb104

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048   125829119    62913536   83  Linux

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@racdb2 ~]# ll /dev/sdb*

brw-rw---- 1 root disk 8, 16 Mar 18 18:34 /dev/sdb

brw-rw---- 1 root disk 8, 17 Mar 18 18:34 /dev/sdb1

 

格式化分区

[root@racdb2 ~]# mkfs.ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

3932160 inodes, 15728384 blocks

786419 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

480 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 

        4096000, 7962624, 11239424

 

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 35 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

查看设备uuid,后面将根据这个uuid来挂载,注意不要使用/dev/sdb1这种设备名来配置自动挂载(因为重启系统此设备名可能会发生变化)

[root@racdb2 ~]# blkid

/dev/mapper/vg64-lv_root: UUID="3489ff47-03e5-4197-afc6-a0530fdc58c2" TYPE="ext4" 

/dev/sda1: UUID="a2b39ea3-f967-4cba-99d8-3a2359a7e9fb" TYPE="ext4" 

/dev/sda2: UUID="45810c5e-a490-4610-8b3b-f91294e98b29" TYPE="swap" 

/dev/sda3: UUID="wz9fNQ-uaRL-gt3E-Lmjt-NfKM-5OcS-4mxny4" TYPE="LVM2_member" 

/dev/mapper/vg64-lv_u01: UUID="e1ceb7ad-d189-4b6c-aafa-a18f91a54ab3" TYPE="ext4" 

/dev/sdb1: UUID="946679c6-70b4-48c9-b74a-0365f343b333" TYPE="ext4" 

[root@racdb2 ~]# mkdir /oradata 创建挂载点

[root@racdb2 ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Mon Aug 26 15:49:45 2013

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/vg64-lv_root /                       ext4    defaults        1 1

UUID=a2b39ea3-f967-4cba-99d8-3a2359a7e9fb /boot                   ext4    defaults        1 2

/dev/mapper/vg64-lv_u01 /u01                    ext4    defaults        1 2

UUID=45810c5e-a490-4610-8b3b-f91294e98b29 swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults     0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

UUID="946679c6-70b4-48c9-b74a-0365f343b333" /oradata    ext4 defaults   0 0

 

[root@racdb2 ~]# mount –a 测试自动挂载,如果这里报错,则证明/etc/fstab有问题,请仔细检查,直到不报错,且可以看到如下的/oradata条目

[root@racdb2 ~]# df -Th

Filesystem    Type    Size  Used Avail Use% Mounted on

/dev/mapper/vg64-lv_root

              ext4     20G  2.6G   16G  14% /

tmpfs        tmpfs    1.5G   72K  1.5G   1% /dev/shm

/dev/sda1     ext4     97M   33M   60M  36% /boot

/dev/mapper/vg64-lv_u01

              ext4     79G  7.7G   67G  11% /u01

/dev/sdb1     ext4     60G  180M   56G   1% /oradata 看到这条证明挂载成功

4、 重装

先备份数据(有需要的话),然后

[root@autotest ~]# cd /u01

[root@autotest ~]# service oracle stop

[root@autotest u01]# rm -rf installORACLE oracle oraInventory 想清楚了?这里可没有回收站哦~~~~

[root@racdb2 u01]# cd /oradata  FC版本还有这里

[root@racdb2 oradata]# rm -rf *

 

然后从3.2 开始重做,

转载于:https://www.cnblogs.com/sharetech/p/3630788.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值