oracle 12c 安装文档

官方文档
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admin/managing-a-multitenant-environment.html#GUID-93F1E584-D309-4301-82E0-AD0E60D4977C

环境准备,centos7

1. 关闭防火墙及selinux

[root@bogon ~]# systemctl stop firewalld
[root@bogon ~]# systemctl disable firewalld
[root@bogon ~]# systemctl status firewalld
[root@linux01 ~]#vi /etc/selinux/config  
#This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

2. 下载yum源并安装

wget http://yum.oracle.com/public-yum-ol7.repo
wget http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
yum install oracle-database-server-12cR2-preinstall.x86_64 --nogpgcheck

2.1 或者用yum

yum -y install binutils elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh compat-libcap1 libXext* libXtst* libX11* libXau* libxcb* libXi* nscd* libXp*  xorg*  xterm*  unzip* readline* compat*
yum install libXext.i686 -y 
yum install zlib-devel.i686 -y 

 3.创建必要用户: 

groupadd -g 54321 oinstall  
groupadd -g 54322 dba 
groupadd -g 54323 oper 
useradd -u 54321 -g oinstall -G dba,oper oracle

4.  修改密码 

passwd  oracle

5. 创建文件目录

 mkdir -p /u01/

chown -R oracle:oinstall /u01 

chmod -R 775 /u01

6.  切换用户到oracle 下编辑环境变量  

[oracle@localhost ~]$ vi .bash_profile 
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=Chaos_oaa   
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=Chaos_oaa
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

7.  root用户编辑/etc/hosts

[root@bogon ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.80.17 Chaos_oaa
~ 
8. 下载oracle12c安装包 
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-linux-12201-3608234.html?ssSourceSiteId=otncn
传到目录/u01  下 
9. oracle用户下解压 linuxx64_12201_database.zip 

[oracle@localhost u01]$ unzip linuxx64_12201_database.zip 

10.准备安装    
# su - oracle
# export DISPLAY=:0.0
# xhost +  
11.   [oracle@localhost database]$ cd /u01/database 
[oracle@localhost database]$ ./runInstaller
12.  dbca 创建数据库

13.oracle12c 常用命令

> show con_name;   查看当前连接的数据库
> show pdbs;    容器数据库个数
> desc v$containers;
启动PDB数据库
> alter pluggable database  pdb open;
> alter pluggable database  pdb close immediate;
进入pdb数据库
> alter session set container=pdb;
> sqlplus sys/oracle@PDB as sysdba;
cdb/ 下创建comm user
> create user c##us identified by oracle;
pdb  下创建普通用户 
> create user n identified by o;
原文地址:https://www.cnblogs.com/Chaos-oaa/p/9562429.html