Linux下安装ORACLE
安装前准备工作
配置安装环境
1. 安装补丁包
关于确认补丁包的是否已安装,可以使用下述方式来查看
rpm -q gcc make binutils openmotif setarch compat-db compat-gcc /
compat-gcc-c compat-libstdc compat-libstdc -devel
关于rpm工具的使用,请参照:RPM使用简介
我提供的下载地址中 RHEL 5.4 为 ISO 文件,我们可以将其挂载到某一个目录来安装补丁。
使用 root 帐户创建一个挂载目录
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
安装以下所需的包
cd /mnt/cdrom/Server
rpm -Uvh setarch-2*
rpm -Uvh make-3*
rpm -Uvh glibc-2*
rpm -Uvh libaio-0*
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh compat-gcc-34-c++-3*
rpm -Uvh gcc-4*
rpm -Uvh libXp-1*
rpm -Uvh openmotif-2*
rpm -Uvh compat-db-4*
2. 主机及网络设置
如果将该机作为服务器,建议使用固定的 IP ,测试环境可以使用动态 IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0
以下内容使用动态 IP ,则不需要更改
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:59:52:BB
ONBOOT=yes
以下是内容是动态IP
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.10.10.1
NETMASK=255.255.255.0
GATEWAY=10.10.10.1
使IP地址生效:
/sbin/ifdown eth0
/sbin/ifup eth0
vim /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
10.10.10.1 localhost.localdomain localhost
3. 设置内核参数
在 sysctl.conf 文件末尾添加如下行
vim /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
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
运行下面的命令使设置生效: /sbin/sysctl –p
在 limit.conf 文件末尾添加如下行
vim /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
在 login 文件末尾添加如下行
vim /etc/pam.d/login
session required pam_limits.so
修改 config 文件,使得 SELINUX =disabled
vim /etc/selinux/config
SELINUX =disabled
4. 创建帐户及安装目录
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
id oracle
创建成功后如下 :
[root@localhost ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
mkdir -p /oracle/
chown -R oracle:oinstall /oracle
chmod -R 775 /oracle
5. 为 oracle 帐户创建环境变量
su – oracle
vim ~/.bash_profile
export ORACLE_BASE=/oracle;
export ORACLE_HOME=$ORACLE_BASE/10g
export ORACLE_SID=orcl
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
export LANG=en
修改完之后用“source .bash_profile”使其生效。
6. 修改 linux 的版本号(因该版本为 5.4 ,为避免检查无法通过,修改版本号)
[root@robinson ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel /r on an /m
使用 vim 修改版本号
vim /etc/issue
vi /etc/redhat-release
[root@robinson ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 4.4 (Tikanga)
Kernel /r on an /m
7. 执行完上述步骤后建议重新启动 Linux
8. 使用 root 执行 hostx +
[root@robinson ~]# xhost +
access control disabled,clients can connect from any host
1.把安装包复制到/opt目录下,然后解压。
gunzip 10201_database_linux_x86_64.cpio.gz
cpio -idmv <10201_database_linux_x86_64.cpio
cd /root/database
./runInstaller
执行安装
安装结束前执行两个脚本:
[root@robinson ~]# /oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
[root@robinson ~]# /oracle/10g/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/10g
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.