如何在oracle 12c中创建普通用户

-------如何在oracle 12c中创建普通用户-------
[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sun Nov 29 21:43:50 2015

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

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

--通过con_name能看到当前登录的环境是CDB根库,CDB包含一个名为PDBORCL的可插拔库。
SQL> show con_name pdbs;

CON_NAME
------------------------------
CDB$ROOT

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBORCL MOUNTED

--创建公用用户admin,需要使用C##或者c##作为该用户名的开头。
SQL> create user C##admin identified by Lxf$txx282534;

User created.

--如果使用普通方法创建会报错
SQL> create user admin identified by Lxf$txx282534;
create user admin identified by Lxf$txx282534
*
ERROR at line 1:
ORA-65096: invalid common user or role name

--创建公用角色, 同公用用户一样也需要使用C##或者c##作为角色名的开头。
SQL> create role C##admin01 container=all;

Role created.

--将dba角色授予公用角色, 适用范围为所有PDB
SQL> grant dba to c##admin01 container=all;

Grant succeeded.

--将公用角色授予公用用户, 使用范围为所有PDB
SQL> grant C##admin01 to C##admin container=all;

Grant succeeded.

--下面使用公用用户分别登录CDB、PDB看看是否通用。
[[email protected] admin]$ sqlplus C##admin/‘Lxf$txx282534‘@pdborcl

SQL*Plus: Release 12.1.0.2.0 Production on Sun Nov 29 22:33:29 2015

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

Last Successful login time: Sun Nov 29 2015 22:31:12 +08:00

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

SQL> show con_name;

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

[[email protected] admin]$ sqlplus C##admin/‘Lxf$txx282534‘

SQL*Plus: Release 12.1.0.2.0 Production on Sun Nov 29 22:33:53 2015

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

Last Successful login time: Sun Nov 29 2015 22:33:29 +08:00

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

SQL> show con_name;

CON_NAME
------------------------------
CDB$ROOT

在PDB中创建用户和创建普通用户就没有什么区别了
SQL> create user test identified by test;

User created.
SQL> grant create session to test;

Grant succeeded.
[[email protected] admin]$ sqlplus test/[email protected]

SQL*Plus: Release 12.1.0.2.0 Production on Sun Nov 29 22:17:16 2015

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

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

SQL> show user
USER is "TEST"
SQL> show con_name

CON_NAME
------------------------------
PDBORCL
SQL> exit

--将PDB打开
SQL> alter pluggable database pdborcl open;
Pluggable database altered.

--切换到PDB容器
SQL> alter session set container=pdborcl;
Session altered.

时间: 2024-08-02 02:49:25

如何在oracle 12c中创建普通用户的相关文章

如何在Oracle 12C中添加多个分区 (Doc ID 1482456.1)

How to Add Multiple Partitions in Oracle 12C (Doc ID 1482456.1) APPLIES TO: Oracle Database - Enterprise Edition - Version 12.1.0.1 and laterOracle Database Exadata Cloud Machine - Version N/A and laterOracle Cloud Infrastructure - Database Service -

Oracle 12c中增强的PL/SQL功能

英文链接:http://www.oracle.com/technetwork/issue-archive/2013/13-sep/o53plsql-1999801.html Oracle 12c增强了一系列定义和执行PL/SQL程序单元的方式.本文覆盖了Oracle 12c几个新特性: 1.为结果缓存条件优化了调用者权限函数 2.可以在SQL语句中定义和执行PL/SQL函数 3.通过ACCESSIBLE BY条件指定一个白名单来限制程序单元的访问 4.可直接授权角色给指定程序单元 调用者权限和P

IAR模板--如何在IAR工程中创建和使用模板

如何在IAR工程中创建和使用模板 1.编辑和使用模板的方式: 路径为:Edit -> Code Templates -> Edit Templates  如下图: 创建好模板后,可以在文件中单击右键,选择Insert Template 来插入你编辑好的代码模板. 2.如果创建编辑各种模板: 定义代码模板的语法是:模板<template name> ,<field> [=默认值] <field> ... ... 模板组成元素:模板名称,参数名称和参数的默认值,

如何在sqlite3连接中创建并调用自定义函数

#!/user/bin/env python # @Time :2018/6/8 14:44 # @Author :PGIDYSQ #@File :CreateFunTest.py '''如何在sqlite3连接中创建并调用自定义函数''' import sqlite3,hashlib #自定义函数 def md5sum(t): return hashlib.md5(t).hexdigest() #在内存中创建临时数据库 conn = sqlite3.connect(":memory:"

linux下Oracle中创建Scott用户

#实验环境:   #Linux 5.4 #Oracle 11g r2   #创建Scott的操作过程: su – oracle vi  $ORACLE_HOME/rdbms/admin/utlsampl.sql #把 DROP USER SCOTT CASCADE这一行注释了,在前面加上 -- #然后在DROP USER BLAKE CASCADE;下面加上CREATE USER SCOTT; #保存退出   #然后 #还是在oracle下   sqlplus / as sysdba @/u01

oracle中创建一个用户,只能查看指定的视图,如何授权

1.create user A identified by Apassword,创建用户,用户名是A,密码是Apassword2.grant connect to A --授予connect权限3.grant select on test to A --给指定用户的表或者视图授予select(只读)权限,其中test是表名 注意:1.如果是以普通用户(jtg1)身份登录,并创建的用户,查询时要 select * from jtg1.test才能查询出来 2.以管理员身份登录的创建的用户,应该前面

Oracle开发:创建一个用户并分配表空间和分配权限

-- 创建一个用户并分配表空间和分配权限 -- 以sysdba登录 [email protected]:~> sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 7 18:48:59 2016 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition

[转]oracle 12c 中的分页子句

转自:http://blog.itpub.net/271063/viewspace-1061279/ -- 连接数据库 创建测试用户-- Connected to Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -- Connected as [email protected]_192.168.56.120 create user scott identified by tiger default tablespace user

Oracle 11gR2中启动Scott用户的方法

Oracle 中启动 Scott 用户 的方法 , 在 Oracle11gR2, (g 代表‘网络’的意思) 数据库中 Scott 这个用户 安装时是被锁定的,安装 Oracle的时候 ,你可以直接选择 给该用户 解锁,如果忘记了解锁, 后期可以使用 sqlplus工具 通过命令 将其 解锁. 默认的scott用户是被锁定的,先解锁就能登陆使用 数据库了. 使用下面的语句解锁scott:[sql] view plaincopy alter user scott account unlock; 解