Oracle 11g r2 安装

Help Center:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#i1011296

前提:linux需要安装图形化介面,才能启动安装程序 Start the X server
   内存要求-至少需要1GB的内存SWAP (注意:这里swap的配置非常重要)
/tmp目录需要1 GB的空闲空间
   JDK 6 (Java SE Development Kit 1.6.0_21 必须安装

# grep MemTotal /proc/meminfo
# grep SwapTotal /proc/meminfo

创建安装Oracle需要的系统组和用户
# /usr/sbin/groupadd oinstall   创建OSDBA 组
# /usr/sbin/groupadd dba     创建Oracle软件创建者
# /usr/sbin/useradd -g oinstall -G dba oracle 如果不存在
# passwd oracle 更改密码

配置系统内核参数值
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 = 1048576

Oracle安装用户(oracle)资源限制
/etc/security/limits.conf
$ ulimit -Sn 
$ ulimit -Hn

配置安装Oracle安装用户(oracle)的环境
For example:
# mkdir -p /u01/app/
# chown -R oracle:oinstall /u01/app/
# chmod -R 775 /u01/app/

在打开的文件底部添加下面内容
oracle soft nproc 2047  // 最大进程数
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

vim /etc/pam.d/login
在打开的文件中添加下面内容
session required /lib/security/pam_limits.so
session required pam_limits.so

vim /home/oracle/.bash_profile
在打开的文件中添加下面内容
export ORACLE_BASE=/home/oracle_11/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:HOME/bin:$ORACLE_HOME/bin

vim /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

Linux下的Oracle在安装结束后是处于运行状态的。重启机器后,Oracle不会像在Windows下那样将Oracle添加到Windows服务,在linux下需要手动启动Orcle服务
$ sqlplus /nolog
以sysdba的身份连接到数据库,并启动Oracle数据库引擎
SQL> conn /as sysdba
SQL> startup
退出sqlplus,运行Listener
SQL> exit
$ lsnrctl start

如果想用Oracle提供的EM来管理Oracle的话还需要启动EM控制台
$ emctl start dbconsole
通过http://localhost:1158/em/来访问EM控制台

调试:
可能使用dbstart命令来启动数据库更方便一些,但初次安装完oracle之后使用dbstart命令会报这样的错误
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.2/db/bin/dbstart ORACLE_HOME
more /home/oracle_11/app/oracle/product/11.2/db/bin/dbstart
改 ORACLE_HOME_LISTNER=$1 ORACLE_HOME_LISTNE=$ORACLE_HOME
改 /etc/oratab orcl:/home/oracle_11/app/oracle/product/11.2/db:Y
以root用户建立/etc/rc.d/init.d/oradb
#!/bin/bash
# chkconfig: 2345 90 10
export ORACLE_BASE=/home/oracle_11/app/
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
ORCL_OWN="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- start, stop, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbstart"
touch /var/lock/subsys/oradb
su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl stop dbconsole"
su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbshut"
rm -f /var/lock/subsys/oradb
echo "OK"
;;
reload|restart)
$0 stop
$1 start
;;
*)
echo "Usage: 'basename $0' start|stop|restart|reload"
exit 1
esac
exit 0

chmod 755 /etc/rc.d/init.d/oradb
chkconfig --add oradb
service oradb stop
service oradb start

Oracle数据库的默认端口号:1521,Oracle提供的EM管理器默认端口号是1158

posted on 2016-04-11 13:57  baxk2001  阅读(249)  评论(0编辑  收藏  举报

导航