安装环境
- 操作系统版本:Redhat 6.7 64位
- Oracle版本: Oracle 11.2.0.4
- ORALCE_BASE:/u01/app/oracle
- ORACLE_HOME:/u01/app/oracle/product/11.2.0/db_1
- 数据文件目录:/oradata
- 日志文件目录:/oralog
设置hosts文件
vim /etc/hosts 10.65.204.228 LQas-12test1
关闭防火墙及selinux
service iptables stop chkconfig iptables off service ip6tables stop chkconfig ip6tables off vim /etc/selinux/config SELINUX=disabled
安装必要的包
binutils-2.17.50.0.6-2.el5 compat-libstdc -33-3.2.3-61 elfutils-libelf-0.125-3.el5 elfutils-libelf-devel-0.125 glibc-2.5-12 /glibc-common-2.5-12 /glibc-devel-2.5-12 gcc-4.1.1-52 /gcc-c -4.1.1-52 libaio-0.3.106 /libaio-devel-0.3.106 libgcc-4.1.1-52 /libstdc -4.1.1 libstdc -devel-4.1.1-52.e15 make-3.81-1.1 sysstat-7.0.0 unixODBC-2.2.11 unixODBC-devel-2.2.11
使用rpm安装:
rpm -ivh binutils-2.20.51.0.2-5.43.el6.x86_64.rpm rpm -ivh binutils-devel-2.20.51.0.2-5.43.el6.x86_64.rpm rpm -ivh compat-libstdc -33-3.2.3-69.el6.x86_64.rpm rpm -ivh elfutils-libelf-0.161-3.el6.x86_64.rpm rpm -ivh glibc-2.12-1.166.el6.x86_64.rpm rpm -ivh glibc-common-2.12-1.166.el6.x86_64.rpm rpm -ivh glibc-devel-2.12-1.166.el6.x86_64.rpm rpm -ivh gcc-4.4.7-16.el6.x86_64.rpm rpm -ivh gcc-c -4.4.7-16.el6.x86_64.rpm rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm rpm -ivh libaio-devel-0.3.107-10.el6.x86_64.rpm rpm -ivh libgcc-4.4.7-16.el6.x86_64.rpm rpm -ivh libstdc -4.4.7-16.el6.x86_64.rpm rpm -ivh libstdc -devel-4.4.7-16.el6.x86_64.rpm rpm -ivh make-3.81-20.el6.x86_64.rpm rpm -ivh sysstat-9.0.4-27.el6.x86_64.rpm rpm -ivh unixODBC-2.2.14-14.el6.x86_64.rpm rpm -ivh unixODBC-devel-2.2.14-14.el6.x86_64.rpm
设置系统内核参数
shmmax和shmall的设置
shmmax指的是单个内存段的最大值,单位为bytes
shmall指的是Orale能使用的最大内存大小,单位为pages,
pages大小可通过 getconf PAGE_SIZE 命令查询,一般操作系统page大小为4096 bytes
如操作系统内存为8G,给80%给Oracle使用,则
kernel.shmmax=(8*0.8*1024 * 1024 * 1024 )=6871947673
kernel.shmall=kernel.shmmax/4096=1677721
如原文件的值较大则保留
vim /etc/sysctl.conf kernel.shmmax = 107374182400 kernel.shmall = 26214400 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default =4194304 net.core.rmem_max =4194304 net.core.wmem_default =262144 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576
最后保存配置
/sbin/sysctl -p
设置OS shell限制
vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
vim /etc/pam.d/login session required /lib/security/pam_limits.so session required pam_limits.so
建立用户和组
[root@]# groupadd oinstall [root@]# groupadd dba [root@]# useradd -g oinstall -G dba oracle [root@]# passwd oracle [root@]# id nobody [root@]# id oracle [root@]# su – oracle
建立oracle目录
[root@]# mkdir -p /u01/app/oracle/product/11.2.0/db_1 [root@]# mkdir -p /u01/app/oracle/ [root@]# chown -R oracle:oinstall /u01/app [root@]# chmod -R 775 /u01/app [root@]# chown -R oracle:dba /oradata [root@]# chmod -R 775 /oradata [root@]# chown -R oracle:dba /oralog [root@]# chmod -R 775 /oralog
设置环境变量
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH export ORACLE_BASE=/u01/app/oracle export ORACLE_SID=hdb1 #export ORACLE_UNQNAME=hdb export NLS_LANG=american_america.al32utf8 export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export ORACLE_TERM=xterm export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64 export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS" export TNS_ADMIN=$ORACLE_HOME/network/admin