如何创建可以在Oracle 12c中创建用户的用户? [英] How do I create a user that can create users in Oracle 12c?

查看:776
本文介绍了如何创建可以在Oracle 12c中创建用户的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个用户,授予了您在sysdba中可以在SQL Developer中看到的所有特权,并以新用户身份登录,但是我仍然无法创建其他用户.

I have created a user, granted all the privileges you can see in SQL Developer except sysdba and logged in as the new user, but I still cannot create other users.

这是我到目前为止所做的:

Here is what I have done so far:

  1. 以本地sysdba身份登录;

  1. Login as local sysdba;

运行:

CREATE USER USERA IDENTIFIED BY "PWDpwd123" DEFAULT TABLESPACE TBS1
TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;

  • 将您在SQL Developer中可以看到的所有特权和角色授予USERA;

  • Grant all privileges and roles you can see in SQL Developer to USERA;

    以USERA身份登录;

    Login as USERA;

    运行:

     CREATE USER USERB IDENTIFIED BY "pwd321" DEFAULT TABLESPACE TBS2
     TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
    

  • 然后我得到一个ORA-01031 ERROR.怎么了? 非常感谢您的帮助!

    And then I get a ORA-01031 ERROR. What's wrong? Many thanks for your help!

    推荐答案

    您需要向该用户授予CREATE USER系统特权.

    You need to grant CREATE USER system priviege to that user.

    GRANT CREATE USER to username;
    

    您还可以向该用户授予ALTER USERDROP USER系统特权.

    请参阅文档: https://docs.oracle.com/database/121 /SQLRF/statements_9013.htm#i2077938

    You can also grant ALTER USER and DROP USER system privileges to this user.

    See the documentation: https://docs.oracle.com/database/121/SQLRF/statements_9013.htm#i2077938

    系统特权名称:CREATE USER

    创建用户.此特权还允许创建者执行以下操作:

    Create users. This privilege also allows the creator to:

    在任何表空间上分配配额.设置默认和临时 表空间.将配置文件分配为CREATE USER语句的一部分.

    Assign quotas on any tablespace. Set default and temporary tablespaces. Assign a profile as part of a CREATE USER statement.


    编辑-实际示例


    EDIT - practical example

    C:\>sqlplus system as sysdba
    
    SQL*Plus: Release 12.1.0.2.0 Production on Sat Jan 16 15:16:52 2016
    
    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
    
    Enter password:
    
    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> create user test123 identified by test;
    
    User created.
    
    SQL> grant connect to test123;
    
    Grant succeeded.
    
    SQL> grant create user to test123;
    
    Grant succeeded.
    
    SQL> connect test123
    Enter password:
    Connected.
    SQL> create user alamakota1 identified by alamakota;
    
    User created.
    
    SQL> select user from dual;
    
    USER
    ------------------------------
    TEST123
    
    SQL>
    

    最后一个命令SELECT user FROM dual显示,当前(已登录)用户是user123

    The last command SELECT user FROM dual shows, that the current (logged) user is user123

    这篇关于如何创建可以在Oracle 12c中创建用户的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆