How to create users with database authentication in oracle database with sample examples.
meda Changed status to publish 16/07/2022
We use the CREATE USER SQL statement to create database users and authenticate for connection.
Example:
D:\app\Admin\virtual\virtual\product\12.2.0\dbhome_1\bin>sqlplus/nolog SQL*Plus: Release 12.2.0.1.0 Production on Sat Feb 19 14:44:15 2022 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> conn sys/orcl@to_primary as sysdba Connected. --- To create user and assign default tablespaces and quota SQL> create user bar identified by adimesno 2 default tablespace users 3 temporary tablespace temp 4 quota unlimited on users; User created. ---To grant create session system privilege SQL> grant create session to bar; Grant succeeded. ---To grant create table privilege SQL> grant create table to bar; Grant succeeded. SQL>
We can also use the GRANT … INDENTIFIED BY SQL statement to create users.
Example:
SQL> grant create table, create session to aman identified by aman; Grant succeeded. SQL>
Amen Edited answer 19/02/2022