在Scientific Linux 4.0 上安裝Oracle10g轉載自極速論壇
作者:小瞇的爸爸
第 2 部分: 為 Oracle 配置 Linux
2.1 添加用戶
[root@scientific linux]# groupadd dba
[root@scientific linux]# groupadd oinstall
[root@scientific linux]# useradd -m -g oinstall -G dba oracle
[root@scientific linux]# id oracle
uid=501(oracle) gid=502(oinstall) groups=502(oinstall),501(dba)
[root@scientific linux]# passwd oracle
Changing password for user oracle.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@scientific linux]#
2.2 創建掛載點
[root@scientific linux]# mkdir -p /u01/app/oracle
[root@scientific linux]# chown -R oracle:oinstall /u01/app/oracle
[root@scientific linux]# chmod -R 775 /u01/app/oracle
2.3 配置內核參數
[root@scientific linux]# cat >> /etc/sysctl.conf >>EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
EOF
/sbin/sysctl -p
2.4 為 oracle 用戶設置 Shell 限制
[root@scientific linux]# cat >> /etc/security/limits.conf >>EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
[root@scientific linux]# cat >> /etc/pam.d/login >>EOF
session required /lib/security/pam_limits.so
EOF
[root@scientific linux]# cat >> /etc/profile >>EOF
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
[root@scientific linux]# cat >> /etc/csh.login >>EOF
if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF
2.5 配置Oracle的環境變量
以Oracle用戶登錄系統,輸入如下命令:
login as: oracle
[email protected]'s password:
Last login: Thu Jun 23 03:06:06 2005 from 192.168.2.117
[oracle@scientific ~]$ vi /home/oracle/.bash_profile
umask 022
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
ORACLE_SID=orcl
LD_LIBRARY_PATH=$ORACLE_HOME/jdk/fre/lib/i386:
$ORACLE_HOME/jdk/jre/lib/i386/server:
$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:
$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
存盤退出。
2.6 重新登錄Oracle用戶,用set | more命令查看Oracle用戶的環境變量是否生效。
login as: oracle
[email protected]'s password:
Last login: Thu Jun 23 03:31:03 2005 from 192.168.2.117
-bash: /u01/app/oracle/product/10.1.0/db_1/jdk/jre/lib/i386/server:: No such file or directory
-bash: /u01/app/oracle/product/10.1.0/db_1/rdbms/lib:/u01/app/oracle/product/10.1.0/db_1/lib:: No such file or directory
-bash: /u01/app/oracle/product/10.1.0/db_1/jdk/fre/lib/i386:: No such file or directory
[oracle@scientific ~]$ set | more
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="00" [2]="15" [3]="1" [4]="release" [5]="i686-redhat-
linux-gnu")
BASH_VERSION='3.00.15(1)-release'
CATALINA_HOME=/usr/local/jakarta-tomcat-5.0.19
CLASSPATH=.:/usr/local/java/jdk1.4.2_08/lib/dt.jar:/usr/local/java/jdk1.4.2_08/l
ib/tools.jar
COLORS=/etc/DIR_COLORS.xterm
COLUMNS=80
DIRSTACK=()
EUID=501
GROUPS=()
G_BROKEN_FILENAMES=1
HISTFILE=/home/oracle/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/home/oracle
HOSTNAME=scientific
HOSTTYPE=i686
IFS=$' \t\n'
INPUTRC=/etc/inputrc
JAVA_HOME=/usr/local/java/jdk1.4.2_08
KDEDIR=/usr
LANG=en_US.UTF-8
LD_LIBRARY_PATH=/u01/app/oracle/product/10.1.0/db_1/jdk/fre/lib/i386:
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=24
LOGNAME=oracle
LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;
01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.
btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31
:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:
*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;
35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'
MACHTYPE=i686-redhat-linux-gnu
MAIL=/var/spool/mail/oracle
MAILCHECK=60
OPTERR=1
OPTIND=1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1
ORACLE_SID=orcl
OSTYPE=linux-gnu
PATH=/u01/app/oracle/product/10.1.0/db_1/bin:/bin:/usr/bin:/usr/local/bin:/usr/X
11R6/bin
PIPESTATUS=([0]="0")
PPID=4609
PROMPT_COMMAND='echo -ne "3]0;$@$:$7"'
PS1='[\u@\h \W]$ '
PS2='> '
PS4='+ '
PWD=/home/oracle
QTDIR=/usr/lib/qt-3.3
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:moni
tor
SHLVL=1
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SSH_CLIENT='192.168.2.117 2103 22'
SSH_CONNECTION='192.168.2.117 2103 192.168.2.114 22'
SSH_TTY=/dev/pts/4
SUPPORTED=zh_HK.UTF-8:zh_HK:zh:zh_CN.UTF-8:zh_CN:zh:zh_TW.UTF-8:zh_TW:zh:en_US.U
TF-8:en_US:en:ja_JP.UTF-8:ja_JP:ja:ko_KR.UTF-8:ko_KR:ko
TERM=xterm
UID=501
USER=oracle
_=ORACLE_SID
[oracle@scientific ~]$
[oracle@scientific ~]$