Oracle12C用户创建、授权、登录

col pdb_name for a30

  

Oracle12C用户创建、授权、登录

  1.以系统用户登录

    命令

 sqlplus sys/dwh as sysdba;

       

  2. 确认选择CDB

select name,cdb from v$database;

      

 

col pdb_name for a30
select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;

      

select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
    CON_ID       DBID          NAME                        OPEN_MODE
---------- ---------- ------------------------------ ----------
         2      964253477      PDB$SEED                 READ ONLY
         3     3329151580     ORCLPDB                    MOUNTED

  

3.创建使用者为test

SQL> create user c##test identified by test;

SQL>  alter session set container=PDBORCL;

会话已更改。

SQL> show con_name;

CON_NAME
------------------------------
PDBORCL

4.创建真正的用户

SQL> startup;
插接式数据库已打开。
SQL> create user test identified by test default tablespace users temporary tablespace temp;

用户已创建。

SQL> grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to test ;

授权成功。

SQL>

5.修改plsql登录配置

    D:\java\Orcal_database\Orcal\virtual\product\12.2.0\dbhome_1\network\admin\tnsnames.ora文件中添加

ORCLPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCLPDB)
    )
  )

6.plsq登录

 

posted @ 2017-06-21 20:18  爱做梦的奋斗青年  阅读(20175)  评论(3编辑  收藏  举报