1:关闭一些无用的服务,否则安装时可能会出现某些错误
##
systemctl disable firewalld.service //根据情况决定
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
##
2:补全安装相关包
##
rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++ libaio libaio libXext libXtst libX11 libXau libxcb libXi make sysstat unixODBC unixODBC-devel xterm libaio-devel
##
rpm -ivh 安装包名 // 本地安装程序包
yum install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++ libaio libaio libXext libXtst libX11 libXau libxcb libXi make sysstat unixODBC unixODBC-devel xterm libaio-devel -y //网络安装程序包
##
3. 创建组和用户
##
groupadd dba
groupadd oinstall
useradd -m -g oinstall -G dba oracle
passwd oracle
##
usermod -a -g oinstall -G dba oracle //已创建oracle时
##
// 如果nobody用户不存在(id nobody命令查看),则创建:
##
useradd nobody
##
4. 配置内核
注:配置大于系统数据需要配置更改,否则不需要配置。可根据安装过程中的推荐提示,修改后再继续
##
vi /etc/sysctl.conf
##
按照系统值对比添加:
[[
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 6573601
kernel.shmmax = 33656838144
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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
]]
保存后生效命令:
##
/sbin/sysctl -p
##
5. 创建安装目录
##
mkdir -p /opt/oracle/product/12.1.0.2
mkdir -p /opt/oraInventory
chown -R oracle:oinstall /opt/oracle
chown -R oracle:oinstall /opt/oraInventory
mkdir /var/oracle
chown oracle:oinstall /var/oracle
chmod 755 /var/oracle
##
6. 设置进程数和最大会话数
编辑文件:
##
vi /etc/security/limits.conf
##
加入以下语句:
[[
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
]]
7. 关联设置
编辑文件:
##
vi /etc/pam.d/login
##
加入以下语句:
[[
session required /lib/security/pam_limits.so
session required pam_limits.so
]]
(注意:根据最后一条session规则的注释,应该加在最后一条规则之前)
8. 配置环境变量
##
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
]]
9:使用Oracle用户登陆,添加oracle的用户配置:
##
su - oracle
vi ~/.bash_profile
##
以下是配置文件的全部内容,里面已有的部分就不必在次添加了。
[[
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
umask 022
# +--------------------------+
# | SETUP ORACLE ENVIRONMENT |
# +--------------------------+
TMP=/tmp
TMPDIR=/tmp
export TMP TMPDIR
# 如果安装出现相关问题请屏蔽下面5行,
# 安装好后再取消屏蔽这些环境变量设置
export ORACLE_HOME=/opt/oracle/product/12.1.0.2
export ORACLE_BASE=/opt/oracle
export ORACLE_SID=hpxtdb
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/.local/bin:$HOME/bin
# +--------------------------+
# | LINUX STUFF |
# +--------------------------+
export LANG=zh_CN.UTF-8
unset USERNAME
# +-------------+
# | "GREETINGS" |
# +-------------+
echo ".bash_profile executed"
]]
执行:
##
source ~/.bash_profile
##
10. 解压缩
将linuxamd64_12102_database_1of2.zip和linuxamd64_12102_database_2of2.zip移动到移动到/tmp目录下进行解压缩。
##
unzip -q linuxamd64_12102_database_1of2.zip
unzip -q linuxamd64_12102_database_2of2.zip
##
关于乱码处理,请执行以下动作:
##
mkdir -p /usr/share/fonts/zh_CN/TrueType
cp STXIHEI.ttf /usr/share/fonts/zh_CN/TrueType/
##
安装时乱码需要安装字体到:/usr/share/fonts/zh_CN/TrueType/ 和 $ORACLE_HOME/jre/lib/fonts/fallback/
修改
/database/stage/Components/oracle.jdk/1.6.0.75.0/1/DataFiles/filegroup2.jar
11. 安装时通过X Windows 直接用 oracle 登录 xhost + //如有问题,可先SU ROOT,执行一次xhost + 赋予所有机器访问权,再换回oralce执行
##
cd /tmp/database/
./runInstaller
##
!!!!注意:!!!!
安装完毕以root身份运行以下2个脚本:
##
sh /opt/oraInventory/orainstRoot.sh
sh /opt/oracle/product/12.1.0.2/root.sh
##
12:创建数据库,用oracle直接登录后:
##
xhost +
access control disabled, clients can connect from any host
dbca
##
13:配置监听
##
netca
##
lsnrctl status //查看测试状态
##
关于防火墙:
##
iptables -L -n
firewall-cmd --zone=public --add-port=1521/tcp --permanent
firewall-cmd --zone=public --add-port=5500/tcp --permanent
firewall-cmd --complete-reload
netstat -aunt
##
选择advance install
数据库home设置为/opt/oracle/product/12.1.0.2
字符集选
UTF8
AMERICAN AMERICA ZHS16GBK
可先创建好数据库目录
##
mkdir -p /opt/oracle/oradata/
db
chown -R oracle:oinstall /opt/oracle/oradata/db
##