centos5下oracle安装基本有6步:
1、准备必需软件;
2、配置系统参数;
3、配置系统用户;
4、安装数据库程序和默认数据库实例;
5、配置数据库启动脚本和自启动脚本;
6、注意事项。

1、准备必需软件
   下载数据库软件oracle for linux:
   http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linuxsoft.html
或者http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linx8664soft.html
   安装与Oracle匹配的系统软件:
[root@magic /]$ yum install libXp* compat-* make*  gcc* glibc* glibc-* setarch* libstdc++* libaio* openmotif* elfutils* binutils* sysstat* unix*

(注: 另外如果服务器不能上网,可以进入安装光盘,用下面命令安装必须的安装包,解决依赖问题,如在RHEL5.4的光盘里

cd /media/RHEL_5.4 x86_64 DVD/Server/

yum localinstall  libXp*.el5.x86_64.rpm  compat-*.el5.x86_64.rpm  make*.el5.x86_64.rpm   gcc*.el5.x86_64.rpm  glibc*.el5.x86_64.rpm  glibc-*.el5.x86_64.rpm  setarch*.el5.x86_64.rpm  libstdc++*.el5.x86_64.rpm  libaio*.el5.x86_64.rpm  openmotif*.el5.x86_64.rpm  el5futils*.el5.x86_64.rpm  binutils*.el5.x86_64.rpm  sysstat*.el5.x86_64.rpm  unix*.el5.x86_64.rpm –nogpgcheck –skip-broken


2、配置系统参数

   在/etc/sysctl.conf里追加:
   kernel.shmmni = 4096
   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
补充(2010-01-12,安装发现有错:
Checking for semopm=100; found semopm=32.    Failed <<<<
添加如下参数后问题解决,参考连接:http://www.puschitz.com/InstallingOracle10g.shtml):

 

kernel.shmmax=2147483648
kernel.sem=250 32000 100 128
fs.file-max=65536
net.ipv4.ip_local_port_range=1024 65000

 

   在/etc/pam.d/login里追加:

   session required pam_limits.so

 

(注:如果要写绝对路径,需要指明操作系统,如果是32位的,需要是

session    required     /lib/security/pam_limits.so

如果是64为的需要是

session    required     /lib64/security/pam_limits.so

参考连接:http://sosuny.iteye.com/blog/460468,否则可能会出现在操作系统ctrl+alt+f1等字符模式下无法登录系统的现象)

   在/etc/security/limits.conf里追加:
   oracle      soft    nproc   2047
   oracle      hard    nproc   16384
   oracle      soft    nofile  1024
   oracle      hard    nofile  65536

   在/etc/profile 里追加:
   if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
    fi
   检查一下/etc/selinux/config,确保:
   SELINUX=disabled
 
   都修改好了后最好重启动一下系统。或者直接执行 sysctl -p。

   3、配置系统用户:

   添加oracle用户、拷贝安装文件到oracle用户下,指定安装程序目录、数据目录、用户的环境变量。   
   完整的操作如下:
[root@magic home]$ /usr/sbin/groupadd oinstall
[root@magic home]$ /usr/sbin/groupadd dba
[root@magic home]$ /usr/sbin/useradd -g oinstall -G dba oracle -d /home/oracle
[root@magic home]$ passwd oracle
Changing password for user oracle.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@magic home]$ cp /home/simonsun/Downloads/10g.install/ /home/oracle/ -Rf
[root@magic home]$ chown oracle:oinstall /home/oracle/10g.install -Rf
[root@magic home]$ chmod ug+rwx /home/oracle/10g.install -Rf
[root@magic home]$ su oracle
口令:
[oracle@magic home]$ cd ~
[oracle@magic ~]$ mkdir ~/database
[oracle@magic ~]$ ls -la
总计 48
drwx——  5 oracle oinstall 4096 01-27 18:01 .
drwxr-xr-x 11 root   root     4096 01-27 17:54 ..
drwxrwxr-x  6 oracle oinstall 4096 01-27 17:56 10g.install
-rw-r–r–  1 oracle oinstall   33 01-27 17:54 .bash_logout
-rw-r–r–  1 oracle oinstall  359 01-27 17:58 .bash_profile
-rw-r–r–  1 oracle oinstall  124 01-27 17:54 .bashrc
drwxr-xr-x  2 oracle oinstall 4096 01-27 18:02 database
drwxr-xr-x  4 oracle oinstall 4096 01-27 17:54 .mozilla
-rw——-  1 oracle oinstall 1218 01-27 17:58 .viminfo
-rw——-  1 oracle oinstall   56 01-27 17:55 .xauthr3wcFI
-rw-r–r–  1 oracle oinstall  658 01-27 17:54 .zshrc
[oracle@magic ~]$ vim .bash_profile
添加(i,wq):
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi
PATH=$PATH:$HOME/bin

export ORACLE_BASE=/home/oracle
export ORACLE_HOME=$ORACLE_BASE/database
export ORACLE_SID=SUNORA
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_LANG=american_america.ZHS16GBK
export PATH

# User specific aliases and functions

[oracle@magic ~]$ exit
[root@magic home]$ exit
然后注销当前用户,以oracle登录。

4、安装数据库程序和默认数据库实例
   以oracle登录后,从 10g.install/runInstaller 开始安装oracle,
[oracle@magic ~]$ export LANG=en_US
[oracle@magic ~]$ cd 10g.install
[oracle@magic 10g.install]$ ./runInstaller -ignoreSysPreReqs
   每一步选择安装选项时,要与上面步骤里建立的用户组、安装程序目录等保持一致。
   安装结束后会显示一组URL,其各个端口会保存在 $ORACLE_HOME/install/portlist.ini 里。

补充(2010-01-12,安装过程中,需要根据实际情况选择NLS_LANG (AL32UTF8 或者 ZHS16GBK),
因为后续在需要逻辑导出导入dmp文件进行数据备份恢复时需要指定如下字符集,便于避免数据乱码的情况
export NLS_LANG=american_america.ZHS16GBK
如果出现乱码,可以按照如下命令修改:
./bin/sqlplus /nolog
conn /as sysdba
shutdown immediate
startup mount
alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database character set internal_use ZHS16GBK;
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16; 

shutdown immediate
startup

 

之后会发现已经生效:

SQL> select name,value$ from props$ where name like ‘%CHARACTER%’;

NAME
——————————
VALUE$
——————————————————————————

NLS_NUMERIC_CHARACTERS
.,

NLS_CHARACTERSET
ZHS16GBK

NLS_NCHAR_CHARACTERSET
AL16UTF16
)

5、配置数据库启动脚本和自启动脚本
   安装好后,需要检查oracle的启动日志,发现:
./dbstart: Starting up database “SUNORA”
2009年 01月 27日 星期二 19:33:43 CST

logger: Warning: Database instance “SUNORA” already started.
logger: Warning: Database instance “SUNORA” possibly left running when system went down (system crash?).
logger: Action: Notify Database Administrator.

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jan 27 19:33:43 2009

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

SQL> Connected.
SQL> ORACLE instance shut down.
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jan 27 19:33:44 2009

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

SQL> Connected to an idle instance.
SQL> ORACLE instance started.

Total System Global Area  268435456 bytes
Fixed Size            1218892 bytes
Variable Size           92276404 bytes
Database Buffers      171966464 bytes
Redo Buffers            2973696 bytes
ORA-01013: user requested cancel of current operation

SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

./dbstart: Database instance “SUNORA” warm started.
,即:数据库未正常启动。
需要修改 dbstart:
[oracle@magic ~]$ vim $ORACLE_HOME/bin/dbstart
查找:
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
应该是在78行,将其改为:
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
,然后修改:oratab
[root@magic home]$ vim /etc/oratab
将最后的N改为Y:
SUNORA:/home/oracle/database:Y

现在重启oracle:
[oracle@magic ~]$ export ORACLE_HOME=/home/oracle/database
[oracle@magic bin]$ cd /home/oracle/database/bin/
[oracle@magic bin]$ ./dbshut
[oracle@magic bin]$ ./lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 – Production on Sat Apr 25 10:27:35 2009

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

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@magic bin]$ ./dbstart
Processing Database instance “SUNORA”: log file /home/oracle/database/startup.log
[oracle@magic bin]$ ./sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 – Production on Sat Apr 25 10:28:06 2009

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

SQL> conn
Enter user-name: sys/您的DBA密码@SUNORA as sysdba
Connected.

启动完毕。现在就可以打开浏览器,通过http://localhost:1158/em/来访问oracle企业管理器了,或者通过sqlplus登录oracle,如:
SQL> select * from v$version ;

BANNER
—————————————————————-
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Prod
PL/SQL Release 10.2.0.1.0 – Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 – Production
NLSRTL Version 10.2.0.1.0 – Production

SQL>

然后可以给oracle建立一个自启动脚本放到/etc/rc.d/init.d/里,参见链接:

http://shellfish.iteye.com/blog/563608

6、注意事项
   前面开始安装时候,注意要把环境变量导出为en_US,否则安装界面会乱码,然后安装时候要加上参数-ignoreSysPreReqs,否则需要修改centos发行名称/etc/redhat-release。
   另外如果已经安装了tomcat,端口8080与于oracle自带的tomcat的端口冲突,需要修改tomcat的端口配置,或者修改oracle,在sqlplus下用sys as sysdba登录后执行:
SQL> — Change the HTTP/WEBDAV port from 8080 to 8081
SQL> call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get() , ‘/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()’, 8081));

Call completed.

SQL> — Change the FTP port from 2100 to 2111
SQL> call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get() , ‘/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()’, 2111));

Call completed.

SQL> COMMIT;

Commit complete.

SQL> EXEC dbms_xdb.cfg_refresh;

PL/SQL procedure successfully completed.

===============================
参考链接:

http://download.oracle.com/docs/cd/B19306_01/install.102/b28052.pdf

http://blog.chinaunix.net/u/17549/showart_415233.html

http://blog.chinaunix.net/u1/50406/showart_418375.html

http://blog.chinaunix.net/u1/34087/showart_546887.htm

http://blog.chinaunix.net/u2/63996/showart_1088585.html

http://stoncal.blog.51cto.com/288129/60310

http://blog.chinajavaworld.com/entry.jspa?id=1542

CentOS下安装配置Oracle10g指南

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据