您的位置:首页 > 数据库 > Oracle

Oracle12C用户创建、授权、登录

2015-12-31 10:54 519 查看

Oracle12C用户创建、授权、登录

1.以系统用户登录

C:\Users\LEI>sqlplus sys/dwh as sysdba;

SQL*Plus: Release 12.1.0.2.0 Production on 星期四 12月 31 10:11:29 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


2. 确认选择CDB

SQL> select name,cdb from v$database;

NAME      CDB
--------- ---
ORCL      YES

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

PDB_ID PDB_NAME                             DBID STATUS    CREATION_SCN
---------- ------------------------------ ---------- --------- ------------
3 PDBORCL                        3329151580 NORMAL         2381365
2 PDB$SEED                        964253477 NORMAL         2233968

SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

CON_ID       DBID NAME                           OPEN_MODE
---------- ---------- ------------------------------ ----------
2  964253477 PDB$SEED                       READ ONLY
3 3329151580 PDBORCL                        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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: