RHEL7.5-oracle-12c单机安装
环境:
RHEL7.5
IP地址: 192.168.95.200/24 网络设置host-only
使用Xshell或Putty、SecureCRT等软件远程连接到RHEL7.5的服务器上.
1) 修改hosts file文件
[root@12c ~]# hostnamectl
Static hostname: 12c.oracle.com
[root@12c ~]# ip addr show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:1b:8d:48 brd ff:ff:ff:ff:ff:ff
inet 192.168.95.200/24
[root@12c ~]# vim /etc/hosts
192.168.95.200 12c.oracle.com 12c ###添加记录
为了后面使用yum安装对应软件包,在本地做一个yum仓库
创建挂载点
[root@12c ~]# mkdir /mnt/rhel7
[root@12c ~]# vim /etc/fstab
/dev/cdrom /mnt/rhel7 iso9660 defaults 0 0
[root@12c ~]# vim /etc/yum.repos.d/rhel7.repo
[RHEL7_Repos]
name=RHEL7
baseurl=file:///mnt/rhel7
enabled=1
gpgcheck=0
[root@12c ~]# yum clean all
[root@12c ~]# yum repolist all
[root@12c ~]# yum makecache
2) manual Setup
[root@12c ~]# vim /etc/sysctl.d/12c-oracle.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
[root@12c ~]# /sbin/sysctl -p
[root@12c ~]# vim /etc/security/limits.d/12c-oracle.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
3) 使用yum安装需要的软件包
4) 创建组 用户等信息
[root@12c ~]# groupadd -g 54321 oinstall
[root@12c ~]# groupadd -g 54322 dba
[root@12c ~]# groupadd -g 54323 oper
[root@12c ~]# useradd -u 54321 -g oinstall -G dba,oper oracle
[root@12c ~]# echo "oracle" | passwd --stdin oracle
[root@12c ~]# grep oracle /etc/passwd
oracle:x:54321:54321::/home/oracle:/bin/bash
5) 设置SELinux 防火墙
[root@12c ~]# setenforce 0
[root@12c ~]# vim /etc/selinux/config
#SELINUX=enforcing
SELINUX=permissive
[root@12c ~]# systemctl is-active firewalld.service
[root@12c ~]# systemctl stop firewalld.service
[root@12c ~]# systemctl disable firewalld.service
active
6) 创建安装目录和修改目录权限和拥有者
7) 使用oracle上传的Oracle软件包并解压
[root@12c ~]# su - oracle
使用xshell自带的zmoden上传软件包到RHEL7.5的oracle用户的目录下
[oracle@12c ~]$ unzip linuxx64_12201_database.zip
8) 使用oracle修改.bash_profile文件
[oracle@12c ~]$ ll /home/oracle/.bash_profile
-rw-r--r--. 1 oracle oinstall 193 Sep 26 2017 /home/oracle/.bash_profile
[oracle@12c ~]$ vim /home/oracle/.bash_profile
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
[oracle@12c ~]$ source /home/oracle/.bash_profile
[oracle@12c ~]$ echo $ORACLE_SID
orcl
[oracle@12c ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/12.2.0.1/db_1
9) 使用Oracle用户 OUI方式
[oracle@12c ~]$cd database
[oracle@12c database]$ ./runInstaller
[oracle@12c orcl]$ which sqlplus
/u01/app/oracle/product/12.2.0.1/db_1/bin/sqlplus
[oracle@12c orcl]$ sqlplus / as sysdba
SQL Developer、Sqlplus 、plsql developer、toad等等
需要启动实例
SQL> startup
查看Oracle的监听命令
[oracle@12c sqldeveloper]$ which lsnrctl
/u01/app/oracle/product/12.2.0.1/db_1/bin/lsnrctl
[oracle@12c sqldeveloper]$ lsnrctl status
[oracle@12c db_1]$ cd $ORACLE_HOME/network/admin
[oracle@12c admin]$ pwd
/u01/app/oracle/product/12.2.0.1/db_1/network/admin
[oracle@12c admin]$ ls
listener.ora samples shrept.lst sqlnet.ora tnsnames.ora
[oracle@12c admin]$ lsnrctl start
[oracle@12c admin]$ lsnrctl status
[oracle@12c admin]$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup
[oracle@12c admin]$ echo $ORACLE_SID
orcl
Human Resource (HR) Schema
user and schema
SQL> desc dba_users
解决Oracle目前环境不支持上下方向键
使用root用户
[root@12c ~]# ls rlwrap-0.41.tar.gz
rlwrap-0.41.tar.gz
[root@12c ~]# file rlwrap-0.41.tar.gz
rlwrap-0.41.tar.gz: gzip compressed data, from Unix, last modified: Mon May 19 02:46:08 2014, max compression
[root@12c ~]# tar xvf rlwrap-0.41.tar.gz
[root@12c ~]# cd rlwrap-0.41/
[root@12c rlwrap-0.41]# ./configure
[root@12c rlwrap-0.41]# ./configure
[root@12c rlwrap-0.41]# make && make install
SQL> col username format a10
SQL> col account_status format a20
SQL> ALTER USER hr ACCOUNT UNLOCK IDENTIFIED BY hr;