一、关闭防墙
(1)如果是firewalld
1、 检查防火墙状态:
[root@oracle~]# firewall-cmd --state
Running
2、 如果正在运行,则停用firewalld
root@oracle ~]# systemctl stopfirewalld.service
[root@oracle ~]# firewall-cmd--state
not running
3、 禁用firewalld
[root@oracle ~]# systemctldisable firewalld.service
rm'/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm'/etc/systemd/system/basic.target.wants/firewalld.service'
(2)如果是iptables
1、检查防火墙状态
# serviceiptables status 或 # /etc/init.d/iptables status
2、关闭防火墙
#service iptables stop
3、 永久关闭iptables
#chkconfig--level 35 iptables off
二、关闭SELINUX
1、 检查SELINUX状态
[root@oracle ~]# getenforce
Enforcing
2、 如果状态为Enforcing则关闭
[root@oracle ~]# setenforce 0
[root@oracle~]# getenforce
Permissive
3、 禁用SELINUX
[root@oracle ~]# vi /etc/selinux/config
#SELINUX=enforcing#注释掉
#SELINUXTYPE=targeted#注释掉
SELINUX=disabled#增加
:wq! #保存退出
三、系统升级
[root@oracle~]# yum –y update
四、修改主机名
1、方法1:
[root@oracle ~]#hostnamectlset-hostname centos.tranfy.com
方法2:
[root@oracle ~]#vi /etc/hostname
centos.tranfy.com
:wq!
2、[root@oracle ~]# reboot #重启
3、[root@oracle ~]# uname –n #查看主机名是否重设成功
五、修改hosts
1、方法1:
[root@oracle ~]# echo "192.168.1.111 centos centos.tranfy.com" >> /etc/hosts [root@oracle ~]#ping centos.tranfy.com
方法2:
[root@oracle~]#vi /etc/hosts
#增加以下一行
192.168.1.111 centoscentos.tranfy.com
:wq!
五、检查安装oracle所需包列表
[root@centos ~]# rpm -q binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-develelfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-develglibc-headers glibc-static kernel-headers pdksh libaio libaio-devel libgcclibgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstatunixODBC unixODBC-devel
binutils-2.23.52.0.1-30.el7_1.2.x86_64
packagecompat-libstdc++-33 is not installed
elfutils-libelf-0.160-1.el7.x86_64
packageelfutils-libelf-devel is not installed
packageelfutils-libelf-devel-static is not installed
package gccis not installed
packagegcc-c++ is not installed
glibc-2.17-78.el7.x86_64
glibc-common-2.17-78.el7.x86_64
packageglibc-devel is not installed
packageglibc-headers is not installed
packageglibc-static is not installed
packagekernel-headers is not installed
package pdkshis not installed
libaio-0.3.109-12.el7.x86_64
packagelibaio-devel is not installed
libgcc-4.8.3-9.el7.x86_64
libgomp-4.8.3-9.el7.x86_64
libstdc++-4.8.3-9.el7.x86_64
packagelibstdc++-devel is not installed
packagelibstdc++-static is not installed
make-3.82-21.el7.x86_64
packagenumactl-devel is not installed
sysstat-10.1.5-7.el7.x86_64
packageunixODBC is not installed
packageunixODBC-devel is not installed
根据以上列出未安装的包,一一安装,如:
[root@centos ~]#yum–y install compat-libstdc++-33
其中pdksh无法yum –install,需要自行网上下载安装:
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
# rpm -ivhpdksh-5.2.14-37.el5_8.1.x86_64.rpm
--如果因ksh冲突无法安装,有两个解决办法:
(1)需先删除KSH ,再安装:
# rpm -e ksh-20120801-28.el6_7.3.x86_64
# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
(2)直接强制安装:
# rpm -ivhpdksh-5.2.14-37.el5_8.1.x86_64.rpm –nodeps --force
六、创建组与用户
[root@centos ~]# groupadd oinstall
[root@centos ~]# groupadd dba
[root@centos ~]# useradd -g oinstall -G dba oracle
[root@centos ~]# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokensupdated successfully.
七、配置内核
[root@centos ~]# vim /etc/sysctl.conf
# Kernel paramaters required by Oracle 11gR1
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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
保存并使之生效:
[root@centos ~]# /sbin/sysctl -p
注意: kernel.shmmax's 的值是物理内存的一半。
八、设置Oracle账户的进程数和最大会话数
[root@centos ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
九、pam模块配置
[root@centos ~]# vim/etc/pam.d/login
#加入以下一句
session requiredpam_limits.so
十、为oracle用户在bash和ksh中设定资源限制编辑文件
[root@centos ~]#vi/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
十一、创建Oracle安装目录
[root@centos~]# mkdir -p /u01/app/
[root@centos~]# chown -R oracle:oinstall /u01/
[root@centos~]# chmod -R 755 /u01/
十二、设置oracle用户的环境变量:
[root@centos~]# vi /home/oracle/.bash_profile
#增加以下内容
TMP=/tmp;export TMP
TMPDIR=$TMP;export TMPDIR
ORACLE_BASE=/u01/app;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;export ORACLE_HOME
ORACLE_SID=orcl;export ORACLE_SID
ORACLE_TERM=xterm;export ORACLE_TERM
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH;export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
exportLD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
exportCLASSPATH
umask022
NLS_LANG="SIMPLIFIED CHINESE_CHINA.al32utf8"; exportNLS_LANG
##(红字备注,安装oracle时选择了al32utf8,为解决中文乱码问题,指定Oracle用户环境变量字符集,问题解决)
[oracle@centos]$source ./bash_profile
十三、安装FTP并启动
yum –install vsftp
/sbin/service vsftpd start
十二、将解压好的Oracle11g的Database文件夹上传到 /home/oracle下
chmod–R 777 /home/oracle/database
进入database目录,并执行安装程序
cd/home/oracle/database
./runInstaller
安装完成后,编辑dbstart与dbshut
vi/u01/app/product/11.2.0/dbhome_1/bin/dbstart
将ORACLE_HOME_LISTNER=$1修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
vi/u01/app/product/11.2.0/dbhome_1/bin/dbshut
将ORACLE_HOME_LISTNER=$1修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
修改 /etc/oratab
orcl:/u01/app/oracle/product/12.1.0/dbhome_1:N
修改成
orcl:/u01/app/oracle/product/12.1.0/dbhome_1:Y
查看listener状态
lsnrctlstatus
启动listener
lsnrctlstart
启动数据库:
方法1:
dbstart
方法2:
sqlplus /nolog
conn /as sysdba
startup
启动em
$emctl start dbconsole
访问em
https://192.168.1.111:1158/em
设置自动启动:
[root@centosbin]# vim /etc/rc.d/rc.local
su- oracle -c 'lsnrctl start'
su- oracle -c 'dbstart'
su– oracle –c 'emctl start dbconsole'
如果自动启无法执行,查看/etc/rc.d/rc.local是否有可执行权限,如没有则:
# chmod+x /etc/rc.d/rc.local