Creation and deletion of Oracle users

Source: Internet
Author: User

1. Create a user :

Sql> create user User01 identified by User01;

User created.


But login prompt 01045 error, missing create session permission.

ERROR:
Ora-01045:user USER01 lacks CREATE SESSION privilege; Logon denied
Enter User-name:


At this point you need to give connect permission to the user (for the reason (see (2)), after logging in to create a table hint 01031 error:

Sql> CREATE table T (x number);
CREATE table T (x number)
*
ERROR at line 1:
Ora-01031:insufficient Privileges


Once again give resource permission to the user (see (2)), you can create the table.


2. You need to grant connect and resource permissions to the user :

Sql> Grant Connect, resource to User01;

Grant succeeded.

Let's say why Connect and resource permissions are required,

the permissions on Connect and resource can be found in previous blog posts: http://blog.itpub.net/7192724/viewspace-1184490/

RESOURCE: A user with RESOURCE permission can only create entities and cannot create a database structure.

Connect: A user with connect permission can only log on to Oracle, not create an entity, and cannot create a database structure.

Sql> Select Grantee,privilege from Dba_sys_privs where grantee= ' RESOURCE ' order by privilege;

GRANTEE PRIVILEGE

------------------------------ ----------------------------------------
RESOURCE CREATE CLUSTER
RESOURCE CREATE Indextype
RESOURCE CREATE OPERATOR
RESOURCE CREATE PROCEDURE
RESOURCE CREATE SEQUENCE
RESOURCE CREATE TABLE
RESOURCE CREATE TRIGGER
RESOURCE CREATE TYPE
8 rows selected.

sql> Select Grantee,privilege from Dba_sys_privs where grantee= ' CONNECT ' order by privilege;

GRANTEE PRIVILEGE
------------------------------ ----------------------------------------
CONNECT CREATE SESSION

Therefore, the user with Connect has the Sqlplus to create the session, and the creation of the table depends on the resource permission.


3. Delete the user :

sql> drop user User01;
Drop User User01
*
ERROR at line 1:
Ora-01922:cascade must is specified to drop ' USER01 '

The error indicates that there are other objects created under the user, and if the user is deleted, there are two methods:

1. Delete the object under the user:

Log in User01 after execution:

sql> drop table tbl_seg;

Table dropped.

Log in to Sys again to execute:

sql> drop user User01;

User dropped.

2. Use Cascade to cascade Delete:

drop user User01 cascade;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.