oracle12c创建PDB用户方式

方式一

创建不带c##pdb用户

alter session set "_oracle_script"= true;

create user pdb01 identified by pdb01;

grant connect,resource to pdb01;

方式二:

1、创建pdb数据库:

首先要确定使用那个pdb,可以通过命令查看,查看pdb有那些,需要CDB$ROOT,因为先查看当前用户

sqlplus  / as  sysdba

show con_name

CON_NAME

------------------------------

CDB$ROOT

2、然后查看有那些pdb

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 ORCLPDB                        READ WRITE NO

如果ORCLPDB没开启执行:alter pluggable database orclpdb open;

3、进入到对应的pdb

alter session set container=ORCLPDB;

会话已更改。

4、创建表空间

数据表空间:

create tablespace mydata_d  logging  datafile '\DATA\APP\ORACLE\ORADATA\ORCL\DATAFILE\mydata_d_01.dbf' size 50m  autoextend on  next 50m maxsize 20480m extent management local;

表空间已创建。

临时表空间:

create temporary tablespace  mydata_temp    tempfile '\DATA\APP\ORACLE\ORADATA\ORCL\DATAFILE\mydata_temp_01.dbf'  size 50m autoextend on next 50m maxsize 20480m extent management local;

表空间已创建。

5、创建用户,并指定表空间

create user pdb01 identified by pdb01 default tablespace mydata_d temporary tablespace mydata_temp;

用户已创建。

6、给用户授权

grant connect,resource to pdb01;

7、关闭pdb,删除数据库

show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 ORCLPDB                           READ WRITE NO

alter pluggable database orclpdb close immediate;

插接式数据库已变更。

show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         4 ORCLPDB                          MOUNTED

drop pluggable database test1 including datafiles;

`插接式数据库已删除。

你可能感兴趣的:(笔记,数据库,centos,linux,运维)