安装Oracle数据库
准备工作
检查系统
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
df -h
uname -m
关闭SeLinux和防火墙
sed -i '/SELINUX/s/enforcing/disabled/' '/etc/selinux/config'
more '/etc/selinux/config'
systemctl stop firewalld.service
systemctl disable firewalld.service
安装依赖
# 查看缺少的包
rpm --query bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat elfutils-libelf elfutils-libelf-devel fontconfig-devel libxcb smartmontools libX11 libXau libXtst libXrender libXrender-devel | grep -e ^package
# CentOS7最小化安装缺失
yum install -y bc compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc-devel ksh libaio libaio-devel libstdc++-devel sysstat elfutils-libelf-devel fontconfig-devel libxcb smartmontools libX11 libXau libXtst libXrender libXrender-devel
系统限制
sysctl
vi /etc/sysctl.conf
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 16451328
kernel.shmmax = 33692319744
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
立即加载配置:sysctl -p
limits
vi /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
立即加载配置:ulimit -a
开始安装
创建用户
groupadd oinstall
groupadd dba
groupadd asmdba
groupadd backupdba
groupadd dgdba
groupadd kmdba
groupadd racdba
groupadd oper
useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper -m oracle
# passwd oracle
# A189C633D9995E11BF8607170EC9A4B8
echo "A189C633D9995E11BF8607170EC9A4B8" | passwd --stdin oracle
vi /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
oracle ALL=(ALL) ALL
Export
vi /home/oracle/.bash_profile
# .bash_profile内容
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=$ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:$PATH
export LANG=en_US
export DISPLAY=:0.0
# source /home/oracle/.bash_profile
mkdir -p /u01
chown -R oracle:oinstall /u01
chmod -R 775 /u01
X11
yum -y install xorg-x11-server-utils xdpyinfo
xhost +
su - oracle
export DISPLAY=192.168.19.90:0.0
export LANG="en_US"
xdpyinfo
Installer
sudo mkdir /home/temp
sudo chown oracle /home/temp
cd /home/temp
# 上传安装文件
# unzip ...
sudo chown oracle:oinstall -R database
./database/runInstaller
- Installation option
- Create and Config a database
- Install database software only
- Upgrade an existing database
- System class
- Desktop class
- Server class
- type of database
- Single instance database installation
- Oracle Real Application Cluster database installation
- Oracle RAC One Node database installation
- Installation type
- Typical install
- Advanced install
- English
- Enterprise Edition
- Location
- Oracle base:
/u01/app/oracle
- Software location:
/u01/app/oracle/product/12.1.0/dbhome_1
- Oracle base:
- Inventory
- Inventory Directory:
/u01/app/oraInventory
- Group Name:
oinstall
- Inventory Directory:
- Configuration type
- General purpose / Transaction Processing
- Data warehousing
- Database Identifiers
- Global database name:
orcl.localdomain
- SID:
orcl
- Global database name:
- Scheme Passwords
- Use different passwords for these accounts
- Use the same passwords for all accounts
启动Oracle服务
su - oracle
# A189C633D9995E11BF8607170EC9A4B8
# 打开监听服务
lsnrctl status
lsnrctl start
# lsnrctl stop
# 启动实例
sqlplus /nolog
SQL>connect /as sysdba
SQL>startup
# shutdown
SQL>quit