Oracle 12c 安装
首先先添加一块硬盘,要重启才会生效。用处:装oracle数据库
1、关闭防火墙
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] ~]# setenforce 0
2、检查
[[email protected] ~]# cd /dev/
[[email protected] dev]# ls
sdb //确保有新增的硬盘
3、磁盘格式化
[[email protected] dev]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x7c9be3ac.
Command (m for help): n //输入n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p //输入p
Partition number (1-4, default 1): //回车
First sector (2048-41943039, default 2048): //回车
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): //回车
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): w //输入w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4、格式转换
[[email protected] dev]# mkfs -t xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5242624, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
5、创建挂载点,并更改主机名
[[email protected] dev]# mkdir /orc
[[email protected] dev]# vim /etc/hostname
localhost.localdomain
HOSTNAME=oracle //更改主机名
6、添加IP地址以及关联的名称
[[email protected] dev]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.35.175 oracle //添加此行内容
7、重启生效
init 6
8、将分区进行挂载
[[email protected] ~]# mount /dev/sdb1 /orc
[[email protected] ~]# df -h //查看挂载状况
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 20G 3.3G 17G 17% /
devtmpfs 897M 0 897M 0% /dev
tmpfs 912M 0 912M 0% /dev/shm
tmpfs 912M 9.0M 903M 1% /run
tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda1 6.0G 179M 5.9G 3% /boot
/dev/mapper/centos-home 10G 37M 10G 1% /home
tmpfs 183M 8.0K 183M 1% /run/user/42
tmpfs 183M 0 183M 0% /run/user/0
/dev/sdb1 20G 33M 20G 1% /orc
9、安装软件环境包
[[email protected] ~]# yum install -y binutils compat-libcapl compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
10、调整内核参数
[[email protected] ~]# vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
#异步I0请求数目,推荐值是: 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
#套接字发送缓冲区大小的最大值
11、sysctl -p //重新加载配置文件
用户环境配置
1、创建oinstall、dba组,创建oracle用户并设置密码
[[email protected] ~]# groupadd oinstall
[[email protected] ~]# groupadd dba
[[email protected] ~]# useradd -g oinstall -G dba oracle
[[email protected] ~]# passwd oracle //密码设为123123
2、创建工作目录,并赋予权限
[[email protected] ~]# mkdir -p /orc/app/oracle
[[email protected] ~]# chown -R oracle.oinstall /orc/app/
[[email protected] ~]# chmod -R 755 /orc/app/oracle/
3、Oracle用户环境配置
[[email protected] ~]# vim /home/oracle/.bash_profile
//以下两行配置文件直接删掉
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
//添加以下配置
umask 022
ORACLE_BASE=/orc/app/oracle
ORACLE_HOME=/orc/app/oracle/product/12.2.0/dbhome_1/
ORACLE_SID=orcl
NLS_LANG="SIMPLIFIED CHINESE_CHINA".UTF8
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
LANG=zh_CN.UTF-8
export PATH LANG NLS_LANG ORACLE_BASE ORACLE_HOME ORACLE_SID
Oracle用户资源限制
使用pam_limits认证模块
[[email protected] ~]# vim /etc/pam.d/login
在第8和9行添加以下配置
session required /lib/security/pam_limits.so
session required pam_limits.so
[[email protected] ~]# vim /etc/security/limits.conf
#单用户可使用的进程数量
oracle soft nproc 2047
#单用户可打开的文件数量
oracle hard nproc 16384
oracle soft nofile 1024
#堆栈设置
oracle hard nofile 65536
oracle soft stack 10240
[[email protected] ~]# vim /etc/profile
if [ $USER = "oracle" ]
then
if [ $SHELL = "/bin/bash"]
then
ulimit -p 16384 //缓冲区大小
ulimit -n 65536 //文件数
else
ulimit -u 16384 -n 65536 //进程数、文件数
fi
fi
Oracle安装
把解压的database包挂载到Linux上的/abc中
[[email protected] ~]# mkdir /abc
[[email protected] ~]# mount.cifs //192.168.100.7/database /abc/
Password for [email protected]//192.168.100.7/database:
[[email protected] ~]# cd /abc/
[[email protected] abc]# ls
install response rpm runInstaller sshsetup stage welcome.html
在图形化界面操作
[[email protected] ~]# xhost + //以root用户在图形化界面操作
access control disabled, clients can connect from any host
[[email protected] ~]# su - oracle //切换oracle用户
[[email protected] ~]$ cd /abc
[[email protected] ~]$ export DISPLAY=:0.0
[[email protected] abc]$ ls
install response rpm runInstaller sshsetup stage welcome.html
[[email protected] abc]$ ./runInstaller
正在启动 Oracle Universal Installer...
检查临时空间: 必须大于 500 MB。 实际为 16855 MB 通过
检查交换空间: 必须大于 150 MB。 实际为 8191 MB 通过
检查监视器: 监视器配置至少必须显示 256 种颜色。 实际为 16777216 通过
准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2019-12-13_12-00-44PM. 请稍候...
安装注意事项:
(1)去掉“✔”,点击下一步
(2)弹出对话框,点击是
(3)选择创建和配置数据库,点击下一步
(4)选择服务器类,点击下一步
(5)以下两步按默认选择,点击下一步
(6) 输入口令,并确认口令,点击下一步,当弹出对话框,不符合建议,点击继续
(7)点击下一步,并点击安装
(8)当安装进度到达79%时,会弹出执行配置脚本的对话框,不要急着关闭,解决如下:
安装中弹窗处理
切换到root用户
[[email protected] abc]# /orc/app/oraInventory/orainstRoot.sh
更改权限/orc/app/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。
更改组名/orc/app/oraInventory 到 oinstall.
脚本的执行已完成。
[[email protected] abc]# /orc/app/oracle/product/12.2.0/dbhome_1/root.sh
1、回车
2、输入“yes”
3、稍微等待一会,等待加载完
加载好以后,在图形化界面点击确定继续安装即可,安装好后点击关闭