Linux版本:Red Hat <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Enterprise Linux5.0
Oracle版本:oracle 11g
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

Linux版本检查 #cat /etc/issue

 

首先检查自己安装的linux5.0上是否安装有以下包(参照oracle11g文档):
The following packages (or later versions) must be installed:

binutils-2.17.50.0.6-2.el5

compat-libstdc++-33-3.2.3-61

elfutils-libelf-0.125-3.el5

elfutils-libelf-devel-0.125

gcc-4.1.1-52

gcc-c++-4.1.1-52

glibc-2.5-12

glibc-common-2.5-12

glibc-devel-2.5-12

glibc-headers-2.5-12

libaio-0.3.106

libaio-devel-0.3.106

libgcc-4.1.1-52

libstdc++-4.1.1

libstdc++-devel-4.1.1-52.e15

make-3.81-1.1

sysstat-7.0.0

 
若是10g则需以下包:
make-3.79.1
gcc-3.2.3-34
glibc-2.3.2-95.20
glibc-devel-2.3.2-95.20
glibc-devel-2.3.2-95.20 (32 bit)
compat-db-4.0.14-5
compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128
gnome-libs-1.4.1.2.90-34.1 (32 bit)
openmotif21-2.1.30-8
setarch-1.3-1
libaio-0.3.96-3
libaio-devel-0.3.96-3
怎样检查是否安装呢?如检查 binutils-2.17.50.0.6-2.el5

[root@oracle11gdemo ~]# rpm -qa | grep binutils

binutils-2.17.50.0.6-2.el 5

说明binutils-2.17.50.0.6-2.el5已经安装。其它的依次检查。

将没有安装的包(去安装文件的server目录下找)上传到linux上,然后运行以下命令安装:

# rpm –ivh  *.rpm

 

下面的组和用户必须存在
The oinstall group (the oracle inventory group)
The dba group (the OSDBA group)
The oracle user (the oracle owner)
如果上面的组和用户不存在,用下面的步骤创建它们。
(1)先查看这些组和用户是否存在:
#grep oinstall /etc/group

#grep dba /etc/group

(2)创建安装oracle 所需的组和用户
#groupadd oinstall

#groupadd dba

 

 

bash: groupadd: command not found 错误解决:groupadd命令是要用ROOT用户来执行的,而出错的用户是用 su root切换到ROOT用户下,这个命令不会把环境带过去!!!!, 要用
 su  -  root 命令。

 

(3)建立一个目录作为oracle用户的缺省路径
创建目录:#mkdir –p /user01
建立一个缺省路径为/user01/oracle的用户oracle,同时oracle属于主组oinstall,和属于辅助组dba#useradd –g oinstall –G dba –d /user01/oracle oracle

 

将目录user01的属主改为oracle,属组改为oinstall
[root@oracle11gdemo /]# chown -R oracle.oinstall /user01

 

查看nobody是否存在:[root@oracle11gdemo user01]# id nobody

 

配置内核参数:
/etc/sysctl.conf 下通过 vi 添加如下参数
kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 262144

net.ipv4.tcp_wmem = 262144 262144 262144

net.ipv4.tcp_rmem = 4194304 4194304 4194304

 

如下这些参数如法炮制

To increase the shell limits:

1. Add the following lines to the /etc/security/limits.conf file:

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

2. Add or edit the following line in the /etc/pam.d/login file, if it does not

already exist:

session required pam_limits.so

3. Depending . the oracle user's default shell, make the following changes to the

default shell start-up file:

For the Bourne, Bash, or Korn shell, add the following lines to the

/etc/profile file (or the file . SUSE Linux Enterprise Server systems

/etc/profile.local ):

if [ $USER = "oracle" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

For the C shell ( csh or tcsh ), add the following lines to the

/etc/csh.login file (or the file . SUSE Linux Enterprise Server systems

/etc/csh.login.local ):

if ( $USER == "oracle" ) then

limit maxproc 16384

limit de.ors 65536

endif

 

 

oracle 用户名登录系统,配置oracle 用户的环境。以oracle 帐号用安装器来安装oracle,但是开始运行安装器之前,还得设定oracle用户的环境变量。
[oracle@oracle11gdemo ~]$ vi .bash_profile

vi打开.bash_profile,然后添加一下变量:
ORACLE_BASE=/user01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=Wilson
PATH=$ORACLE_HOME/bin:$PATH

 

export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

 

oracle安装文件解压:
[root@oracle11gdemo user01]# unzip linux_11gR1_database_1013.zip

 

解压后将在当前目录生成一个database文件夹,将此文件夹移动的oracle用户的缺省路径的上一级路径:
[root@oracle11gdemo user01]# mv database/ /user01

 

将目录database的属主改为oracle,属组改为oinstall
[root@oracle11gdemo user01]# chown -R oracle.oinstall database/

 

 

oracle用户登录图像界面,运行database下的runInstaller:
./runInstaller
注:一定要用oracle用户登陆,不能用root,否则安装oracle时会出现错误:。。。。。 at least 256 color 。。。。。

如果用root登陆,要按以下操作:
# xhost +
# su - oracle
$ export DISPLAY= :0
$ ./runInstaller.sh
我建议用oracle 登陆,简单,直接到Disk1目录下安装即可
# ./runInstaller
如果是第一次安装的话,系统会提示用root用户运行一个脚本文件,新开一个consolesu root后,按照提示运行即可。
之后的安装过程比较简单,一路next即可。

 

至此,oracle11g安装完毕。下面介绍怎么创建一个数据库实例:
首先配置一个Listener,启动linux图形界面,打开终端,输入netca,然后一路next
接着就可以配置数据库实例了,在终端中输入dbca,然后跳出dbca的图形界面,一路设置下去即可。

 

开启监听后才可以用PLSQL Developer连接。
开启监听命令: $ lsnrctl start

开启数据库实例命令:SQL> startup
 
错误解决:
1.Can't connect to X11 window server using '127.0.0.1:0.0' as the value of the DISPLAY variable.
解决:
在终端里   以root用户执行   #xhost   +
然后su   -   oracle
执行#export   DISPLAY=:0
运行runinstaller

 
2.若想在本地通过plsql访问服务器的oracle,需先把服务器的防火墙关闭。
解决:
1) 重启后生效
开启: chkconfig iptables
关闭: chkconfig iptables off
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。

在开启了防火墙时,做如下设置,开启相关端口,
修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT