I'm a tree and wating for the spring!

Oracle Database 11g Release 2 (11.2) Installation On RHEL6.3

★作者:桐星豆博客   |  ★类别: 技术文章   |  ★发布时间: 2012-12-20 23:32   |  ★更新时间: 2012-12-28 16:35   |  ★浏览次数:4053   |  ★ 评论(0)

This article describes the installation of Oracle Database 11g Release 2 (11.2) (64-bit) on RHEL6.3 (64-bit).
Unzip the files

#unzip linux.x64_11gR2_database_1of2.zip
#unzip linux.x64_11gR2_database_2of2.zip

You should now have a single directory called "database" containing installation files.
Hosts File
The "/etc/hosts" file must contain a fully qualified name for the server.

<IP-address> <fully-qualified-machine-name> <machine-name>

For example.

127.0.0.1 localhost.localdomain localhost
192.168.0.123 ol6-112.localdomain ol6-112

Oracle recommend the following minimum parameter settings.

fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

The current values can be tested using the following command.

/sbin/sysctl -a | grep <param-name>

Add or amend the following lines in the "/etc/sysctl.conf" file.

fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=4194304
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586

Run the following command to change the current kernel parameters.

/sbin/sysctl -p

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

oracle     soft     nproc     2047
oracle     hard    nproc     16384
oracle     soft     nofile     4096
oracle     hard    nofile     65536
oracle     soft     stack     10240

Install the following packages if they are not already present.

rpm -Uvh binutils-2*x86_64*
rpm -Uvh glibc-2*x86_64* nss-softokn-freebl-3*x86_64*
rpm -Uvh glibc-2*i686* nss-softokn-freebl-3*i686*
rpm -Uvh compat-libstdc++-33*x86_64*
rpm -Uvh glibc-common-2*x86_64*
rpm -Uvh glibc-devel-2*x86_64*
rpm -Uvh glibc-devel-2*i686*
rpm -Uvh glibc-headers-2*x86_64*
rpm -Uvh elfutils-libelf-0*x86_64*
rpm -Uvh elfutils-libelf-devel-0*x86_64*
rpm -Uvh gcc-4*x86_64*
rpm -Uvh gcc-c++-4*x86_64*
rpm -Uvh ksh-*x86_64*
rpm -Uvh libaio-0*x86_64*
rpm -Uvh libaio-devel-0*x86_64*
rpm -Uvh libaio-0*i686*
rpm -Uvh libaio-devel-0*i686*
rpm -Uvh libgcc-4*x86_64*
rpm -Uvh libgcc-4*i686*
rpm -Uvh libstdc++-4*x86_64*
rpm -Uvh libstdc++-4*i686*
rpm -Uvh libstdc++-devel-4*x86_64*
rpm -Uvh make-3.81*x86_64*
rpm -Uvh numactl-devel-2*x86_64*
rpm -Uvh sysstat-9*x86_64*
rpm -Uvh compat-libstdc++-33*i686*
rpm -Uvh compat-libcap*

Note. This will install all the necessary 32-bit packages for 11.2.0.1. From 11.2.0.2 onwards many of these are unnecessary, but having them present does not cause a problem.
Create the new groups and users.

groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 506 asmdba
groupadd -g 505 asmoper
useradd -u 502 -g oinstall -G dba,asmdba,oper oracle
passwd oracle

Note. We are not going to use the "asm" groups, since this installation will not use ASM.

Additional Setup
Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.

SELINUX=disabled

Once the change is complete, restart the server.
If you have the Linux firewall enabled, you will need to disable or configure it.
Create the directories in which the Oracle software will be installed.

mkdir -p /home/oracle/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /home/oracle
chmod -R 775 /home/oracle

Login as root and issue the following command.

xhost +

Login as the oracle user and add the following lines at the end of the ".bash_profile" file.

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR


ORACLE_HOSTNAME=ol6-112.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=ORCL; export ORACLE_UNQNAME
ORACLE_BASE=/home/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=ORCL; export ORACLE_SID

PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

Installation

Log into the oracle user.Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.

./runInstaller

Proceed with the installation of your choice. The prerequisites checks will fail for the following version-dependent reasons:
  1. 11.2.0.1: The installer shows multiple "missing package" failures because it does not recognize several of the newer version packages that were installed. These "missing package" failures can be ignored as the packages are present. The failure for the "pdksh" package can be ignored because we installed the "ksh" package in its place.
  2. 11.2.0.2: The installer should only show a single "missing package" failure for the "pdksh" package. It can be ignored because we  installed the "ksh" package in its place.
  3. 11.2.0.3: The installer shows no failures and continues normally.

You can see the type of installation I performed by clicking on the links below to see screen shots of each stage.

  1. Configure Security Updates
  2. Select Install Option
  3. System Class
  4. Node Selection
  5. Select Install Type
  6. Typical Install Configuration
  7. Create Inventory
  8. Perform Prerequisite Checks
  9. Summary
  10. Install Product
  11. Database Configuration Assistant
  12. Database Configuration Assistant 2
  13. Execute Configuration Scripts
  14. Finish

Post Installation
Edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.

orcl:/home/oracle/app/oracle/product/11.2.0/db_1:Y

Common Errors
  1. "error code 35" : The machine name in the "/etc/hosts" file is not correct. It needs an entry for the loopback adapter (localhost) and the machine name. If you are using DNS for name resolution, you still need the loopback adapter reference in this file.
  2. "error code 37" : The DNS not working properly. You may also get this error is the "/etc/hosts" file is not configured correctly.
  3. "sqlplus: error while loading shared libraries: libclntsh.so.11.1" : The prerequisites have not been met. Work through them again. Specifically, make sure the "gcc" package has been installed.
  4. Listener fails to start - Typically this is due to incorrect name resolution. Make sure the "/etc/hosts" and/or DNS is configured correctly.
  5. Linking errors - Almost always due to missing prerequisites. Review the setup sections.

Hope this helps.

知识扩展:

关于Oracle数据库迁移(跨版本)以及空表不导出

一、Oracle 11g存在一个特性,如果乃用exp/imp来对数据库进行导入导出时,会出现无数据表无法导出的问题,笔者也遇到了此种问题,经研究觉得遇到此情况,最好用expdp/impdp方式进行导出导入,可以回避这种问题。(此命令缺点在于必须在服务器上执行);
二、关于Oracle版本数据版本不同时的移植,通常都会提示错误不兼容(这里所说的移植是指由高到低移植,低版本移植高版本)。笔者提供一种解决方案:用expdp进行导出(必须是10G或以上的版本,不然不支持expdp),在导出命令中补充version参数,值为目标数据库的版本号。
比如说:乃想将数据库由oracle版本11.2.0.1.0移植到10.2.0.1.0,只需要在导出时设置version='10.2.0.1.0'即可,导入时不用设置version参数。关于第一个问题:空数据表不能导出,网上也流传着另外一个解决的方法就是:(这种方法笔者不推荐使用)
11G中有个新特性,当表无数据时,不分配segment,以节省空间
解决方法:
  1、insert一行,再rollback就产生segment了。
  该方法是在在空表中插入数据,再删除,则产生segment。导出时则可导出空表。
  2、设置deferred_segment_creation 参数

show parameter deferred_segment_creation
NAME                                                 TYPE                VALUE
------------------------------------     -----------     ------------------------------
deferred_segment_creation              boolean         TRUE
SQL> alter system set deferred_segment_creation=false;
系统已更改。
SQL> show parameter deferred_segment_creation
NAME                                                 TYPE                VALUE
------------------------------------     -----------     ------------------------------
deferred_segment_creation             boolean         FALSE

该参数值默认是TRUE,当改为FALSE时,无论是空表还是非空表,都分配segment。
需注意的是:该值设置后对以前导入的空表不产生作用,仍不能导出,只能对后面新增的表产生作用。如需导出之前的空表,只能用第一种方法。
搞了我好久,最后查到这个方法。
先查询一下当前用户下的所有空表

select table_name from user_tables where NUM_ROWS=0;

用以下这句查找空表

select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0;

把查询结果导出,执行导出的语句

'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
-----------------------------------------------------------
alter table AQ$_SYS$SERVICE_METRICS_TAB_T allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_H allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_G allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_I allocate extent;

然后再执行
exp 用户名/密码@数据库名 file=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log 成功! 


请尊重他人的劳动果实,转载时务必注明出处! 请尊重他人的劳动果实,转载时务必注明出处!
转载请注明:文章转载自:桐星豆博客 [http://blog.txdou.com]
本文标题:Oracle Database 11g Release 2 (11.2) Installation On RHEL6.3
本文地址:http://blog.txdou.com/article86
分享到QQ空间 分享到腾讯朋友

  • 注意:“桐星豆博客”只会以“回复”的身份出现,不会以“咨询”的身份出现在留言或评论中,凡是以“咨询”的身份出现的留言或评论均为他人盗用!
  • 本站用以回复网友评论的唯一名称是“桐星豆博客”,除此外均无效,网友不得用此名进行相应文章的评论或回复!
  • 用户言论只代表其个人观点,不代表桐星豆博客的观点或立场!
  • 非诚勿扰,请友好如实的评论,杜绝谩骂、人格攻击等一切伤人言论,请严格遵循中华人民共和国法律法规!
  • 桐星豆博客拥有最终解释权,如有网友违规,本站将有权删除或屏蔽违规评论,情节严重者账户加入黑名单、永久封IP并报司法部门严惩!
  • 您一旦参与评论本站则默认为您已经同意以上条款,否则“非诚勿扰”,谢谢合作!

您的姓名或昵称: 选填
您的E-Mail地址: ☆必填--仅站长可见
您个人网站地址: 选填 ( 如果填写,请务必加上 http:// 或 https:// 等等 )
留言内容:

验证码: 点击重新生成验证码  [ ctrl + enter ]

CopyRight © 2009-2020 by 桐星豆博客 All Rights Reserved.