在Redhat5.5-64bit安装Oracle 10g

环境介绍:

操作系统:Redhat 5.5-64bit

实验平台:VMware Workstation

oracle软件版本:oracle-10.2.0.1 

安装Oracle建议先阅读oracle 10G官方文档:

http://docs.oracle.com/cd/B19306_01/install.102/b15667/toc.htm

分区情况:

[root@localhost ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26        3393    27053460   83  Linux
/dev/sda3            3394        3915     4192965   82  Linux swap / Solaris

内存大小:

[root@localhost ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2007        628       1378          0         37        377
-/+ buffers/cache:        212       1794
Swap:         4094          0       4094

注:安装oracle 软件,对于内存和交换分区大小设置,如下

内存:

Minimun(最低配置)1GB of RAM
Recommended(推荐配置)2GB of RAM or more(或更多)
执行检查内存有多大:# grep MemTotal /proc/meminfo

 交换分区:



Available RAM(可用RAM)Swap Space Required(交换空间需求)
Between 1GB and 2GB1.5 times the size of the RAM(内存的1.5倍)
注:如果内存大小为1GB~2GB之间,就swap设置内存的1.5倍。
Between 2GB and 16 GB

第1章 安装前的准备

1.1 配置ip地址

# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:6D:90:6B
ONBOOT=yes
IPADDR=172.16.100.1
NETMASK=255.255.0.0

1.2 修改主机名

# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=db1

1.3 修改hosts文件添加一行

# vim /etc/hosts
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
172.16.100.1    db1

1.4 确认selinux与iptables是否关闭

# vim /etc/selinux/config
SELINUX=disabled //将SELINIX修改为disabled
# getenforce  //查看SELINUX状态
Disabled
# service iptables stop //关闭防火墙
# chkconfig iptables off

1.5 安装所需要的软件包

提示:确认以下软件包是否已经安装,否则,用rpm 和 yum来安装

binutils-*                
libXp*                   
compat-libstdc++-33-*    
elfutils-libelf-*           
elfutils-libelf-devel-*     
gcc-*                  
gcc-c++-*              
glibc-*                
glibc-common-*        
glibc-devel-*          
glibc-headers-*        
ksh-*               
libaio-*             
libgcc-*            
libstdc++-*         
make-*            
sysstat-*           
unixODBC-*         
unixODBC-devel-*

1.6 创建所需要的用户和组

# groupadd -g 501 dba
# useradd -g dba -u 501 oracle
# password oracle

1.7 创建oracle、oradata目录,设置属主、属组为oracle:dba,权限为755

# mkdir /u01 /oradata
# chown -R oracle:dba /oracle /oradata
# chmod -R 755 /oracle /oradata

1.8 环境变量配置

# vim /home/oracle/.bash_profile(在末端添加3行)
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=/oracle/app/oracle/product/10.2/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
# source /home/oracle/.bash_profile

1.9 修改内核参数

# vim /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
fs.file-max = 65536
net.ipv4.ip_local_port_range= 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
# sysctl -p


1.10 设置系统oracle安装用户资源限制

# vim /etc/secrity/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536


第2章 安装Oracle软件

2.1 使用oracle上传oracle软件并解压

[oracle@db1 oracle]$ zcat 10201_database_linux_x86_64.cpio.gz |cpio -idcmv(只支持Linux)

2.2 安装Oracle软件

[oracle@db1 oracle]$ cd database/

[oracle@db1 database]$ pwd

/u01/database

在Redhat 5.5-64bit安装Oracle 10g_Oracle

 $ ./runInstaller -ignoreSysPrereqs

出现Welcome界面,点击”Next”

在Redhat 5.5-64bit安装Oracle 10g_Oracle_02

下图设置好了,点击“Next”。

在Redhat 5.5-64bit安装Oracle 10g_Linux_03

安装类型选择:Enterprise Edition后点击"Next"下一步继续。

在Redhat 5.5-64bit安装Oracle 10g_Oracle_04


在Redhat 5.5-64bit安装Oracle 10g_操作系统_05

下面环境监测只要没有报"error"错误,都可以忽略,都勾选上。

在Redhat 5.5-64bit安装Oracle 10g_操作系统_06

选择“Install database Software only”,点击“Next”继续。

在Redhat 5.5-64bit安装Oracle 10g_Linux_07

点击“Install”安装。

在Redhat 5.5-64bit安装Oracle 10g_Oracle_08

下面数据库安装进度,完成后出现100%

在Redhat 5.5-64bit安装Oracle 10g_Oracle_09

在Redhat 5.5-64bit安装Oracle 10g_Linux_10

用root执行下面两个脚本:

#/oracle/app/oracle/oraInventory/orainstRoot.sh

# /oracle/app/oracle/product/10.2/db_1/root.sh

在Redhat 5.5-64bit安装Oracle 10g_操作系统_11

以上步骤完成数据库软件安装。

$sqlplus -v   //安装好了可以使用这个命令查看软件版本号

SQL*Plus:Release 10.2.0.1.0 – Production


第3章 配置监听

3.1 执行netca

选择“Listener configuration”配置监听,在点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_Oracle_12

默认,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_操作系统_13

设置监听名字,这里默认,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_Oracle_14

选择“TCP”协议,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_Oracle_15

配置监听端口,默认是1521,也可以修改,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_Linux_16

选择“No”,不需要再配置监听

在Redhat 5.5-64bit安装Oracle 10g_操作系统_17

在Redhat 5.5-64bit安装Oracle 10g_Oracle_18

在Redhat 5.5-64bit安装Oracle 10g_Oracle_19

到了这步监听已经安装完成。


第4章 创建库

4.1 执行dbca

[oracle@db1 ~]$ dbca

出现欢迎界面,点击”Next“继续。

在Redhat 5.5-64bit安装Oracle 10g_操作系统_20

选择“Create a Database”

在Redhat 5.5-64bit安装Oracle 10g_Oracle_21

数据库模板选择“General Purpose”,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_Oracle_22

设置数据库实例名:这里设置为orcl

在Redhat 5.5-64bit安装Oracle 10g_Linux_23

去掉“Configure the Database with Enterprise Manager”前面的”√“

在Redhat 5.5-64bit安装Oracle 10g_Oracle_24

设置数据库密码

在Redhat 5.5-64bit安装Oracle 10g_Linux_25

选择“File System”,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_操作系统_26

这里选择自定义数据库文件保存位置 /oradata 

在Redhat 5.5-64bit安装Oracle 10g_Linux_27

去掉“Spectify Flash Recovery Area”前面“

在Redhat 5.5-64bit安装Oracle 10g_Linux_28

勾选上“Sample Schemas”,点击“Next”

在Redhat 5.5-64bit安装Oracle 10g_Linux_29

设置字符集和内存大小

在Redhat 5.5-64bit安装Oracle 10g_Linux_30

在Redhat 5.5-64bit安装Oracle 10g_操作系统_31

点击“Finish”

在Redhat 5.5-64bit安装Oracle 10g_操作系统_32


在Redhat 5.5-64bit安装Oracle 10g_Oracle_33

在Redhat 5.5-64bit安装Oracle 10g_操作系统_34

在Redhat 5.5-64bit安装Oracle 10g_Oracle_35

在Redhat 5.5-64bit安装Oracle 10g_Oracle_36

[oracle@db1 ~]$ sqlplus -v

SQL*Plus: Release 10.2.0.1.0 – Production

$lsnrctl start 启动监听

$lsnrctl stop  关闭监听

$lsnrctl status

连接数据库方法:连接数据库必须设置ORACLE_SID

1

$sqlplus / as sysdba (这个连接不走监听程序)

2

$sqlplussystem/oracle@ip地址/orcl(这个要走监听程序连接)

3

$sqlplus system/oracle@orcl(这个要走监听程序连接)

到了这步已完成,数据库建库。