1. 环境配置
关闭防火墙firewall
[root@orcl ~]# chkconfig iptables off
设置selinux 不装载任何安全策略
[root@orcl ~]# vi /etc/sysconfig/selinux
SELINUX=enforcing 修改为 SELINUX=disabled
重启linux
[root@orcl ~]# reboot
2. 建账号(安装和运行oracle数据库的账号,linux区别于windows,很多软件不允许root用户安装)
创建组
[root@orcl ~]# groupadd -g 54321 oinstall
[root@orcl ~]# groupadd -g 54322 dba
[root@orcl ~]# groupadd -g 54323 oper
[root@orcl ~]# groupadd -g 54324 backupdba
[root@orcl ~]# groupadd -g 54325 dgdba
[root@orcl ~]# groupadd -g 54326 kmdba
验证组
[root@orcl ~]# cat /etc/group
创建用户
[root@orcl ~]# useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle
[root@orcl ~]# passwd oracle
groupdel xxx 删除组
userdel -r yyy 删除用户
3. 建立目录(建议使用OFA结构)
Oracle的最佳灵活体系结构(Optimal Flexible Architecture,简称OFA),是指Oracle软件和数据库文件及文件夹的命名约定和存储位置规则。
/pm/s/u/product/v/type_[n]
- pm A mount point name
- s A standard directory name
- u The name of the owner of the directory
- product product
- v The version of the software
- type_n The type of installation, for example Database (dbhome_1), Client (client), or Oracle Grid Infrastructure (grid)
- n An optional counter, which enables you to install the same product more than once in the same Oracle base directory
/u01/app/oracle/product/12.1.0/dbhome_1
ORACLE_BASE /u01/app/oracle(手动创建此目录)
ORACLE_HOME /u01/app/oracle/product/12.1.0/dbhome_1
[root@orcl ~]# mkdir -p /u01/app/oracle
修改目录拥有者和拥有者组
[root@orcl ~]# chown -R oracle.oinstall /u01
修改目录权限
[root@orcl ~]# chmod -R 775 /u01
4. 设置环境变量
[root@orcl ~]# vi /home/oracle/.bash_profile
umask 022
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
5. 主机名解析(服务器本机的IP地址和主机名)
[root@orcl ~]# vi /etc/hosts
200.100.50.127 orcl.example.com
6. 设置limit(文件 进程 栈)
[root@orcl ~]# vi /etc/security/limits.conf
oracle hard nofile 65536
oracle soft nproc 2047
oracle soft stack 10240
7. 下载oracle数据库软件包并解压至/tmp目录
[root@orcl ~]# unzip /media/12CR1/linuxamd64_12102_database_1of2.zip -d /tmp
[root@orcl ~]# unzip /media/12CR1/linuxamd64_12102_database_2of2.zip -d /tmp
8. 使用oracle用户安装(远程直接登录不要使用su命令)
[oracle@orcl database]$ ./runInstaller
DBCA建库
监听器 LISTENER 1521
Character Sets Unicode