Oracle (User)

1. View the current user

show user;
/ / or
select user from dual;
Copy the code

2. View all user names

select * from all_users
Copy the code

3. Create a new Oracle user

3.1 Entering the Oracle Console

sqlplus /nolog 				 // Select sqlplus from sqlplus where nolog indicates no login.
Copy the code
sqlplus / as sysdba    // (as a system administrator)
Copy the code
Sqlplus system(username)/password (password)//(user name, password)
Copy the code

3.2 Creating a User

Mysql > create user identified by password;

create user root identified by root; 
Copy the code

3.3 Syntax for Unlocking a Newly created User

(syntax: alter user user name account unlock;) Alter user root account unlock; Alter user root account lock; // User is locked.

alter user root account unlock; 
Copy the code

3.4 Granting creation permission to a newly logged in user

Grant create session to user name;

grant create session to root;
Copy the code

3.5 Other permission Settings: Grant database administrator permissions to the newly created user. Syntax: grant dba to user name. Grant dba to root; Grant additional permissions to the user:

GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW , DROP ANY  VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE, DBA, CONNECT,RESOURCE,CREATE SESSION TO root;
Copy the code

3.6 Switching to the Login syntax of the newly created user

Connect User name/password

connect root/root;
Copy the code

3.7 Deleting a User syntax: drop user User name

drop user root;
Copy the code

If the user has a data table, use the keyword CASCADE:

drop user root cascade;
Copy the code