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
2.
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 three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
3.关闭防火墙
 systemctl stop firewalld
 systemctl disable firewalld  
firewall-cmd --state 
4.创建相关用户
groupadd -g 54321 oinstall 
groupadd -g 54322 dba 
groupadd -g 54323 oper 
useradd -u 54321 -g oinstall -G dba,oper oracle
5.设置oracle密码
passwd  oracle
6.创建目录以及权限和所属
mkdir -p /u01/app/oracle/product/12.2.0.1/db_1 
chown -R oracle:oinstall /u01 
chmod -R 775 /u01
7.oracle用户下设置环境变量

export PATH
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=vdedu   
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=vdedu
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,编辑host
vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.253.153 vdedu
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
unzip linuxx64_12201_database.zip
10.准备安装
export DISPLAY=:0.0
xhost + 
11.安装
进入/u01/database目录下   ./runInstaller (中间会有一步警告,选择忽略)
12.创建监听
netca(如果起不来,就操作export DISPLAY=:0.0    xhost + )
13.创建数据库dbca
dbca
14.查看pdb操作
show con_name;查看当前
show pdbs; 容器个数
desc v$containers;
15.启动关闭pdb数据库
启动PDB
alter pluggable database  pdb open;
alter pluggable database  pdb close immediate;
16.进入pdb两种方法
alter session set container=pdb;
sqlplus sys/oracle@PDB as sysdba;
17.创建用户
cdb/ 下只能创建comm user
create user c##us identified by oracle;
pdb  普通用户 
create user n identified by o;
18.实例注册到监听
netca
show parameter local_
alter  system set loca_listener='端口号 ';
19.创建表空间
create tablespace liushuwei datafile '/u01/app/oracle/oradata/vdedu/liushuwei01.dbf' size 100m ;
20.rman备份
i_关闭数据库,启动到mount状态
shut immediate              startup mount
ii_开启归档模式
alter database archivelog
iii_打开数据库
alter database open
iiii_进入rman备份
rman target/      backup database
21.数据泵备份数据库
SQL> create directory d1 as '/home/oracle'
SQL> grant read,write on directory d1 to public;

 expdp system/oracle@vdedu schemas=system directory=d1 dumpfile=sys_expdp.dmp logfile=sys_expdp.log

 impdp system/oracle remap_schema=system:system2 dumpfile=sys_expdp.dump  logfile=sys2_impdp.log directory=d1