1.安装相关的开发工具包
#yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++
#yum -y install libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
2.修改内核参数
# vi /etc/sysctl.conf
# make it comment
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0
# add at the last line
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
#shmmax为物理内存的一半或4G
kernel.shmmax = 1050195968
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
#vi /etc/pam.d/login
session required pam_limits.so
# vi /etc/security/limits.conf
# add at the last line
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
3.添加用户及组
groupadd oinstall
groupadd oper
groupadd dba
groupadd oracle
useradd -g oinstall -G dba,oper,oracle oracle
groupadd asmadmin
useradd osasm
usermod -g oinstall -G asmadmin,dba,oper osasm
4.修改环境变量与建立目录
# vi /etc/profile
# add at the last line
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
mkdir /u01/oracle/app
mkdir /u01/oracle/app
mkdir /u01/oracle/app
chmod 775 /u01/oracle/app
mkdir /u01/oracle/oradata
chmod 775 /u01/oracle/oradata
chown -R oracle:oinstall /u01/
vi ~/.bash_profile
export ORACLE_BASE=/u01/oracle/app
5.解压缩zip文件以及安装
在解压缩那两个zip文件后在database目录下直接输入:
安装只选择software only,建库等事,在后面
在oracle软件安装结束后,修改oracle用户环境
vi ~/.bash_profile
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
source ~/.bash_profile
6建立监听
输入netca命令启动,选择“Listener Configuration” 下一步,选择“add”下一步,选择默认LISENTER名字,一下步。一直下一步,直到选择finish
7.建库
输入dbca启动,选择"Create Database“后下一步,输入你喜欢的 Grobal Database name and SID l(我输入为mydb01)一直下一步,知道step9 选择Character setting,选择use Unicode ,National Character set选择UTF-8.一直下一步直到完成
8.修改/etc/oratab文件
将最后一个修改类似如下所示:
mydb01:/u01/oracle/app/product/11.2.0/dbhome_1:Y #default N,change to Y
修改.bash_profile
# vi /usr/oracle/.bash_profile
# add your SID at the last line
export ORACLE_SID=mydb01
9.创建启动脚本
vi /etc/rc.d/init.d/oracle
# this is an example
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/u01/oracle/app/product/11.2.0/dbhome_1
ORACLE_USER=oracle
case "$1" in
'start')
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
'stop')
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
# chmod 755 /etc/rc.d/init.d/oracle
# /etc/rc.d/init.d/oracle start
10.登录测试:
或者sqlplus /nolog
SQL> connect sys as sysdba
Enter password:
Connected.
阅读(4298) | 评论(0) | 转发(2) |