64位Linux平台安装Oracle11gR2
虚拟机 : VMWare ESXi 5.0 / VMWorkstation 8.0
主机环境:RedHat Enterprise Linux 5 / CentOS 5.8 / CentOS 6.2
数据库 : Oracle11gR2.0.1 / Oracle11gR2.0.3
1。 操作系统安装,RHEL5的安装比较简单,只对其中的重点进行说明
磁盘分区:这一部分需非常注意,尤其是SWAP分区的大小,应该是RAM的1~·1.5倍大小
Package安装部分,选择Customize now,勾选中以下Package Groups:
Desktop Environments
GNOME Desktop Environment
Applications
Editors
Graphical Internet
Text-based Internet
Development
Development Libraries
Development Tools
Legacy Software Development
Servers
Server Configuration Tools
Base System
Administration Tools
Base
Java
Legacy Software Support
System Tools
X Window System
CentOS 安装mini desktop 即可
共享内存:这个值在/etc/fstab文 件中配置,用 df -h /dev/shm查看
默认情况下,RHEL5会使用50%RAM来使用,我手工指定一个最大值
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults,size=3276M 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
修改之后需要重新加载
[root@enterprice64 ~]# umount /dev/shm
[root@enterprice64 ~]# mount /dev/shm
PS: CentOS某些时候修改dev/shm出现问题,参考这里 CentOS 下修改/dev/shm 大小解决ORA-00845
安装必要的包 (可以在 http://rpm.pbone.net/ 下载相应的部分)
可以先检查下需要的包是否已经安装,另,RHEL下使用yum请看 RHEL配置yum本地源
# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \binutils compat-db
# yum -y install binutils compat-db compat-gcc-34 compat-gcc-34-c++ compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-* libXp.so.6 libXt.so.6 libXtst.so.6 libgcc_s.so.1 ksh libXp libaio-devel numactl numactl-devel unixODBC unixODBC-devel pdksh
如果:pdksh包在CentOS环境下yum不到,需要手工安装
# rpm -e ksh 如果和 ksh有冲突,可以把ksh卸载掉
# rpm -i pdksh-5.2.14-37.el5.i386.rpm
# rpm -i pdksh-5.2.14-37.el5.x86_64.rpm2。
2.准备工作
系统服务:禁用掉一些系统服务,也可以进行细粒度设置
chkconfig iptables off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config (连接目录是 /etc/sysconfig/selinux)
内核参数:在 /etc/sysctl.conf文件中修改/添加如下内核参数
------- 11g配置-------------------
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048576
------- 10g配置-------------------
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni=4096
kernel.sem=250 32000 100 128
fs.file-max=65536
net.ipv4.ip_local_port_range=1024 65000
net.core.rmem_default=1048576
net.core.rmem_max=1048576
net.core.wmem_default=262144
net.core.wmem_max=262144
参数修改之后,使用 /sbin/sysctl -p 把参数立刻生效
Shell Limits配置:为了让Oracle数据库在Linux系统上获得更佳 的表现,Oracle推荐对Shell Limits进行配置
vi /etc/security/limits.conf
# Added for Oracle Shell Limits
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
vi /etc/pam.d/login
# Added for Oracle Shell Limits
session required /lib/security/pam_limits.so
session required pam_limits.so
如果是CentOS 5上安装Oracle10gR2,还需要修改这里,满足OUI的安装检查
cp /etc/redhat-release /etc/redhat-release.original
echo “redhat-4″ > /etc/redhat-release
创建用户,组,目录
组和用户
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
# /usr/sbin/useradd -g oinstall -G dba -d /home/oracle -s /bin/bash -m oracle
# passwd oracle
安装目录
# mkdir -p /u01/app/
# chown -R oracle:oinstall /u01/app/
# chmod -R 775 /u01/app/
环境变量
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/dbhome_1
export ORACLE_HOME_LISTNER=${ORACLE_HOME}
export ORACLE_PATH=${ORACLE_HOME}/rdbms/admin
export ORACLE_SID=data
export PATH=${PATH}:${ORACLE_HOME}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
export NLS_LANG=AMERICAN_AMERICA.UTF8
3 安装数据库之后的配置
修改默认的初始化参数
-- enable AMM
alter system set memory_max_target=1000m scope=spfile;
alter system set memory_target=1000m scope=spfile;
alter system set sga_target=0 scope=spfile;
alter system set pga_aggregate_target=0 scope=spfile;
-- misc
alter system set processes=1000 scope=spfile;
alter system set open_cursors=3000;
alter system set undo_retention=86400;
alter system set db_recovery_file_dest_size=8G;
-- archive log
-- mkdir -p /u01/app/oracle/oradata/archived
alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/archived/';
alter system set log_archive_format = '%T_%S_%r.arc' scope=spfile;
-- startup mount
-- alter database archivelog;
静态监听:默认是动态监听,可以设置成静态
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = data)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = data)
)
)
TNSNAMES.ORA
DATA211 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.254.211)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = data)
)
)
4。 其他
中文乱码
如果有中文乱码,设置 export NLS_LANG=AMERICAN_AMERICA.UTF8
VIM显示GBK
Vim中可以直接查看文件编码 :set fileencoding 即可显示文件编码格式。
文件编码转换
如果想查看其它编码格式的文件或者想解决用Vim查看文件乱码的问题,那么可以在
~/.vimrc 文件中添加以下内容:
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936
其中encoding是vim的默认显示编码格式,fileencodings是vim打开文件时检测的编码格式,存在这种类型的编码即转换为utf-8编码。
这样,就可以让vim自动识别文件编码(可以自动识别UTF-8或者GBK编码的文件),其实就是依照fileencodings提供的编码列表尝试,如果没有找到合适的编码,就用latin-1(ASCII)编码打开。
RLWrap 安装rlwrap实现sqlplus上下键功能
PS:如果不想安装,看这里 转载:Static Version of rlwrap for sqlplus
如果默认没有安装readline,OS的安装光盘里提供了readline包.
# rpm -Uvh readline*
error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm
# rpm -Uvh libtermcap-devel-2.0.8-46.1.i386.rpm
# rpm -Uvh readline*
package readline-5.1-1.1 is already installed
# rpm -Uvh readline-devel-5.1-1.1.i386.rpm
安装rlwrap
Download:
http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.37.tar.gz
# tar -zxvf rlwrap-0.30.tar.gz
# cd rlwrap-0.30
# ./configure
# make
# make install
# vi /home/oracle/.bash_profile
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
自动启动
# vi /etc/oratab
data:/u01/app/oracle/product/11.2.0/dbhome_1:Y
$ vi $ORACLE_HOME/bin/dbstart 和 dbshut
# First argument is used to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
方法1:
# vi /etc/rc.local
su - oracle -c "dbstart"
su - oracle -c "emctl start dbconsole"
方法2:
# cd /etc/rc.d/init.d
# vi /etc/rc.d/init.d/oracle11g
#!/bin/bash
# chkconfig: 345 99 10
# description: Startup Script for Oracle Databases
# /etc/init.d/oracle11g
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_HOME_LISTNER=$ORACLE_HOME
export ORACLE_PATH=$ORACLE_HOME/rdbms/admin
export ORACLE_SID=data
export PATH=$PATH:$ORACLE_HOME/bin
case "$1" in
start)
su oracle -c "$ORACLE_HOME/bin/dbstart"
su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch /var/lock/subsys/oracle11g
echo "OK"
;;
stop)
echo -n "Shutdown Oracle: "
su oracle -c "$ORACLE_HOME/bin/dbshut"
rm -f /var/lock/subsys/oracle11g
echo "OK"
;;
*)
echo "Usage: '$0' start|stop"
exit 1
esac
exit 0
可以使用chkconfig工具来配置自动启动
# cd /etc/rc.d/init.d
# chmod +x oracle11g
# chkconfig –add oracle11g
# chkconfig oracle11g on
也可以手工建立软连接
# ln -s /etc/rc.d/init.d/oracle11g /etc/rc.d/rc3.d/S99oracle11g
# ln -s /etc/rc.d/init.d/oracle11g /etc/rc.d/rc4.d/S99oracle11g
# ln -s /etc/rc.d/init.d/oracle11g /etc/rc.d/rc5.d/S99oracle11g
#
# ln -s /etc/rc.d/init.d/oracle11g /etc/rc.d/rc3.d/K10oracle11g
# ln -s /etc/rc.d/init.d/oracle11g /etc/rc.d/rc4.d/K10oracle11g
# ln -s /etc/rc.d/init.d/oracle11g /etc/rc.d/rc5.d/K10oracle11g
posted on 2011-11-30 17:24 wait4friend 阅读(1365) 评论(0) 编辑 收藏 举报