最小化安装的redhat系统安装oracle12c日记
mini模式安装好的redhat系统,没有光盘要安装oarcle12c数据库
1.第一步当然是配置网络了,配置em1网口
vi /etc/sysconfig/network-scripts/ifcfg-em1 #编辑配置文件,添加修改以下内容
BOOTPROTO=static #启用静态IP地址
ONBOOT=yes #开启自动启用网络连接
IPADDR=192.168.1.115 #设置IP地址
NETMASK=255.255.255.0 #设置子网掩码
GATEWAY=192.168.1.1 #设置网关
DNS1=202.101.172.35 #设置主DNS
DNS2=114.114.114.114 #设置备DNS
:wq! #保存退出
vi /etc/resolv.conf #配置dns,保障可以正常访问外网
nameserver 202.101.172.35 #设置主DNS
nameserver 114.114.114.114 #设置备DNS
service network restart #重启网络连接
PING测试一下 是否可以正常访问外网
2.因为没原版光盘,手头也没ISO之好配置yum源,这里配置163的源
rpm -qa|grep yum|xargs rpm -e --nodeps #删除原来的yum 因为一些包之间可能会有依赖关系,所以我们需要加上参数 --nodeps 无视依赖关系。
下载163的centos yum
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
下载好4个包后安装包
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm #2个包互相依赖 需要一起安装
更换yum源
cd /etc/yum.repos.d/
mv rhel-source.repo rhel-source.repo.bak #备份原来的源文件
vi rhel-source.repo #编辑源
#复制下面的文字到rhel-source.repo文件
#rhel-source.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
wq保存
清理后重建缓存
yum clean all
yum makecache
更新yum
yum update
3.centos下熟悉的yum源回来了,最小安装当然没有图形了,为了安装oracle方便,还是安装个图形吧.
yum -y groupinstall Desktop #安装桌面
yum -y groupinstall "X Window System" #安装Xwindow
yum -y groupinstall chinese-support #中文支持
vi /etc/sysconfig/i18n #修改语言为中文
lang=''zh_cn.UTF-8''
wq #保存
startx #启动图形界面
#修改开机后自动进入图形界面
vi /etc/inittab
#改id:3:initdefault为
id:5:initdefault
wq #保存
4.安装oracle12c所需的依赖包
yum -y install binutils "compat-libstdc++" elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++ make "pdksh" sysstat unixODBC unixODBC-devel
yum -y install compat-libstdc++-33 ksh
yum -y install libio.i686 glibc.i686 compat-libstdc++-33.i686 libaio-devel.i686 libgcc.i686 libstdc++.i686 unixODBC.i686 unixODBC-devel.i686
yum -y install binutils install compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 glibc glibc.i686 glibc-devel glibc-devel.i686 libaio libaio.i686 libaio-devel.i686 libX11
libX11.i686 libXau libXau.i686 libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686
libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libxcb libxcb.i686 make nfs-utils net-tools smartmontools sysstat unixODBC unixODBC-devel
5.添加oracle用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
6.配置内核
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
//异步IO请求数目 推荐值是:1048576 其实它等于 1024*1024 也就是 1024K 个
fs.file-max = 6815744
//打开的文件句柄的最大数量,防止文件描述符耗尽的问题
kernel.shmall = 2097152
//共享内存总量 页为单位,内存除以4K所得
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
//SEMMSL: 每个信号集的最大信号数量 SEMMNS:用于控制整个 Linux 系统中信号的最大数
//SEMOPM: 内核参数用于控制每个 semop 系统调用可以执行的信号操作的数量 SEMMNI :内核参数用于控制整个 Linux 系统中信号集的最大数量
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 //套接字发送缓冲区大小的最大值
wq保存文件
sysctl -p 刷新内核
7 更改oracle用户的shell 限制
cat /etc/security/limits.conf
vi /etc/security/limits.conf
#在/etc/security/limits.conf后面增加如下行
vi /etc/security/limits.conf
oracle soft nproc 2047 //单用户可使用的进程数量
oracle hard nproc 16384
oracle soft nofile 1024 //用户可打开的文件数量
oracle hard nofile 65536
oracle soft stack 10240 //堆栈设置
8.改用户资源限制
#在/etc/pam.d/login 后面增加如下行
vi /etc/pam.d/login
session required pam_limits.so
wq
9.改profile
#在在 /etc/profile 后面增加如下行
vi /etc/profile
#lidt update
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
wq
9.改oracle用户的profile
#更改Oracle 用户的 profile
#以Oracle 用户登录,运行
vi /home/oracle/.bash_profile
#lidt add
umask 022
ORACLE_BASH=/home/u01/oracle #oracle目录
ORACLE_SID=orcl;
#unset ORACLE_HOME
#unset TNS_ADMIN
ORACLE_HOME=/home/u01/oracle/product/12.1.0/dbhome_1
export ORACLE_HOME
#ORACLE_TERM=xterm;
#export ORACLE_TERM
PATH=$ORACLE_HOME/bin:$PATH;
export PATH
wq
source .bash_profile #启用修改好的profile
更改完成后,退出oracle用户,重新登录,用以下命令检查是否更改成功
umask
env | more
至此,环境配置完毕,可以开始安装Oracle了
10.使用oracle用户登录先把两个下载的zip文件,复制/home/u01/oracle目录下,用unzip命令把zip的内容解接压缩
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
11、开始安装
cd database/
./runInstaller
12、执行2个root 的的脚本,https:///localhost:5500/em便可访问了
13、#设置防火墙,远程可访问
vi /etc/sysconfig/iptables
#添加如下两行
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1158 -j ACCEPT
wq
#重启防火墙
/etc/init.d/iptables restart
#关闭SELINUX
vi /etc/selinux/config
SELINUX=disabled
14、启动em命令:emctl start dbconsole
关闭em命令emctl stop dbconsole
16、修复emctl不能启动
[oracle@BoxCentOS6 ~]$ emctl start dbconsole
OC4J Configuration issue. /opt/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_BoxCentOS6_lidt not found.
[oracle@BoxCentOS6 ~]$ mv /opt/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_localhost_lidt/ /opt/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_BoxCentOS6_lidt
[oracle@BoxCentOS6 ~]$ emctl start dbconsole
EM Configuration issue. /opt/oracle/product/11.2.0/dbhome_1/BoxCentOS6_lidt not found.
[oracle@BoxCentOS6 ~]$ mv /opt/oracle/product/11.2.0/dbhome_1/localhost_lidt/ /opt/oracle/product/11.2.0/dbhome_1/BoxCentOS6_lidt
[oracle@BoxCentOS6 ~]$ emctl start dbconsole
如果还不能启动,就要修复
#给用户解锁、设置密码
alter user dbsnmp account unlock;
alter user dbsnmp identified by dbsnmp;
alter user sysman account unlock;
alter user sysman identified by sysman;
#请先开启数据库
[oracle@BoxCentOS6 ~]$ emca -config dbcontrol db -repos recreate
参考了以下文章,感谢以下博主
https://www.cnblogs.com/xzjf/p/8301109.html
https://www.cnblogs.com/boentouch/p/11027250.html
https://blog.youkuaiyun.com/weixin_43315211/article/details/90256603
https://blog.youkuaiyun.com/tobearc/article/details/91351821
https://blog.youkuaiyun.com/wankaiming/article/details/7716662
https://yq.aliyun.com/articles/670705/
https://wenku.baidu.com/view/f59f367a19e8b8f67c1cb9ae.html?from=search