Linux上安装与卸载oracle

Linux下安装与卸载oracle

安装Oracle

AS5+ORACLE10G安装笔记

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

Oracle Database 10g Release 2 (10.2.0.1) Installation On Red Hat Enterprise Linux 5 (RHEL5)

 

一、           安装需求

vista + vm6.5

1.swap 分区1G

2.selinux 状态disable

3.物理内存768M

 

系统组件

 

GNOME Desktop Environment

Editors

Graphical Internet

Text-based Internet

Development Libraries

Development Tools

Legacy Software Development

Server Configuration Tools

Administration Tools

Base

Legacy Software Support

System Tools

X Window System

 

二、           安装准备

1.软件下载

http://www.oracle.com/technology ... 10201linuxsoft.html

2.参考官方的安装文档

http://www.oracle.com/technology/tech/linux/install/index.html

建议看下这个

http://www.puschitz.com/Installi ... gOracleEnvironments

3.解包

unzip 10201_database_linux32.zip

如果是:ship.db.cpio.gz

gunzip ship.db.cpio.gz

cpio -idmv < ship.db.cpio

 

三、     数据库服务器配置

 

1.       修改/etc/hosts文件

vi /etc/hosts

加进localhost和你的机器名(hostname查询获得)

127.0.0.1    localhost

IP地址      主机名称

 

2.       修改/etc/sysctl.conf文件

vi /etc/sysctl.conf

加入:

kernel.shmall = 2097152

kernel.shmmax = 2147483648

 

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

 

3.       修改/etc/security/limits.conf文件

vi /etc/security/limits.conf *可以用你的账号代替,如oracle

oracle soft nproc 2047

oracle  hard nproc 16384

oracle  soft nofile 1024

oracle  hard nofile 65536

 

4.       修改/etc/pam.d/login文件

vi /etc/pam.d/login

session required /lib/security/pam_limits.so

 

5.       修改/etc/selinux/config文件,禁用selinux

vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - SELinux is fully disabled.

SELINUX=disabled

# SELINUXTYPE= type of policy in use. Possible values are:

# targeted - Only targeted network daemons are protected.

# strict - Full SELinux protection.

#SELINUXTYPE=targeted

SELINUXTYPE=disabled

 

6.       检查并安装rpm

安装rpm(如果空间够,LINUX安装时组件尽量都安装上)

rpm -q gcc make binutils openmotif setarch compat-db compat-gcc \compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

 

如果采用默认安装,该命令执行后通常会提示openmotifcompat-dbcompat-gcccompat-gcc-c++,compat-libstdc++,compat-libstdc++-devel 没有安装。对缺失的包需要通过光盘或其他介质安装,采用光盘安装

/mnt 下创建cdrom

将光盘放入光驱,执行命令 mount -t iso9660 /dev/cdrom /mnt/cdrom

命令执行后/mnt/cdrom下将产生光盘下面的文件

进入光盘Server目录下  cd /mnt/cdrom/Server

rpm -Uvh compat-db-4*

rpm -Uvh libaio-0*

rpm -Uvh compat-libstdc++-33-3*

rpm -Uvh glibc-headers-2.5-12.i386.rpm

rpm -Uvh glibc-devel-2.5-12.i386.rpm

rpm -Uvh compat-gcc-34-3*

rpm -Uvh compat-gcc-34-c++-3*

rpm -Uvh libXp-1*

rpm -Uvh openmotif-2*

rpm -Uvh gcc-4*

rpm -Uvh glibc-2.5-12.i686.rpm

rpm -Uvh libgomp-4.1.1-52.el5.i386.rpm

rpm -Uvh gcc-4.1.1-52.el5.i386.rpm

安装完成后仍然提示部分包没有安装,不过不影响使用

 

如果没有光盘,可以下载这些rpm包,然后使用上面的命令安装。

 

7.       建立oracle用户和组

/usr/sbin/groupadd oinstall

/usr/sbin/groupadd dba

/usr/sbin/useradd -m -g oinstall -G dba oracle

id oracle

passwd oracle

 

8.       建立oracle安装目录

mkdir -p /u01/app/oracle/product/10.2.0/db_1

chown -R oracle.oinstall /u01

chmod -R 775 /u01

 

9.       修改认证

AS5为通过10g的认证,需要修改一下10g安装盘的配置文件,或者修改一下操作系统信息。

第一种方法:修改 database/install/oraparam.ini,AS4的内容复制一下,改成AS5就可以了。

Linux=redhat-3,SuSE-9,redhat-4,redhat-5,UnitedLinux-1.0,asianux-1,asianux-2

[Linux-redhat-5.0-optional]

TEMP_SPACE=80

SWAP_SPACE=150

MIN_DISPLAY_COLORS=256

 

第二种方法:

修改/etc/redhat-release这个文件中的内容为redhat-4也可以

 

我选择第二种方法,编辑/etc/redhat-release

vi /etc/redhat-release

Red Hat Enterprise Linux Server release 5.2 (Tikanga)

Red Hat Enterprise Linux AS release 4 (Nahant Update 4)

 

记得安装完成后改回来,如果是安装10.2.0之前的版本,改成AS3最好,这里主要是为了避开安装时对系统版本的检查

 

10.   修改环境变量

登陆oracle 建立相应的环境变量(注意的是这里所有的环境变量都不是必需的,只是为了遵循ORACLEOFA而做这样的设置,

必须的是 ORACLE_BASE  ORACLE_HOME  ORACLE_SID  PATH 

su - oracle

vi ~/.bash_profile

 

我的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

#Oracle Settings

umask 022

PATH=$PATH:$ORACLE_HOME/bin

LD_LIBRARY_PATH=$ORACLE_HOME/lib

 

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

ORACLE_SID=orcl

PATH=$ORACLE_HOME/bin:$PATH

export PATH LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME ORACLE_SID

export LANG=AMRICAN

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

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

 

四、           开始安装

 

开始安装(建议直接以ORACLE帐户登陆安装,而不是用su - oracle的方法)

 

一般用下面的方法:

去掉ORACLE帐户中DISPLAY的参数,重启,然后用ORACLE帐户登陆

还有就是使用xhost +(root帐户执行)

For XDMCP connection to Red Hat 5 EL

1. XDM Configuration

A. Change runlevel to 5

Open /etc/inittab and set the initial runlevel to 5 as following:

id:5:initdefault:

 

B. Enable XDMCP

   For GDM:

Open /etc/gdm/custom.conf and set the Enable entry to 1 in the [xdmcp] section as following.

[xdmcp]

Enable=1

 

   For KDM:

Open /usr/share/config/kdm/Xaccess and remove the initial "#" character for the following line:

#* #any host can get a login window ==>

* #any host can get a login window

 

Open /usr/share/config/kdm/kdmrc and set the Enable entry to true in the [xdmcp] section as following.

[xdmcp]

Enable=true

 

2. Firewall (TCP/UDP Ports) Configuration

Open UDP port 177 from the PC to the remote host direction.

Open incoming TCP ports 6000~6010 from the remote host to your PC.

 

3. Reboot the remote host and start Xmanager

# init 3 ; init 5

 

启动安装程序

./runInstaller

 

安装过程,如果之前的包按照要求安装完成,安装过程应该很顺利,如果安装进度在63%左右出现错误,如提示遇到问题需要重试,忽略等等,一般就是系统要求的包没有安装完全。

 

安装结束后修改vi /etc/redhat-release 内容为

Red Hat Enterprise Linux Server release 5.2 (Tikanga)

 

设置开机启动vi /etc/oratab

TSH1:/u01/app/oracle/product/10.2.0/db_1:Y

 

 

我是使用Xmanager进行的远程安装:

1.       CRT连接数据库服务器

2.       执行命令:

$ su - oracle

$ DISPLAY=10.19.10.14:0.0

$ export DISPLAY

$ cd /home/oracle/database

$ ./runInstaller

这样,就可以将安装界面调用到本地,开始远程安装。

 

五、           安装后测试

安装好之后ORACLE就启动了,如下方法连接

[oracle@oracle10ga ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Sep 25 10:19:24 2008

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

SQL> connect / as sysdba

Connected to an idle instance.

 

 

卸载Oracle

Linux下卸载Oracle比较简单

一、           停止oracle进程

命令:

$ ps –ef | grep ora

$ kill -9 进程号

二、           调用远程卸载界面

与安装时一样,执行命令:

$ su - oracle

$ DISPLAY=10.19.10.14:0.0

$ export DISPLAY

$ cd /home/oracle/database

$ ./runInstaller

 

三、           执行卸载

1.       在安装界面中,选择高级安装

2.       下一步

3.       下一步

4.       点击Installed Products…

5.       弹出框中勾选已安装的数据库

6.       点击Remove…

7.       点击Yes,开始卸载

8.       手动删除oracle安装目录

9.       卸载完成