Atikh's DBA blog
  • Home
  • Oracle
  • MySQL
  • MongoDB
  • PostgreSQL
  • Snowflake
  • About Me
  • Contact Us

Create User in Oracle Database Pre-12c and 12c

 Atikh Shaikh     12c, oracle, Oracle 12c, Oracle user     No comments   

This post will give you brief details about how to create user in oracle database in 10g,11g and 12c

Pre-12c Database (Application to all below 12c ):

creating user is normal and important activity is DBA’s life. below commands are described to create user in databases under 12c.
Granting create session is mandatory as it will allow you to connect to database, assume username is xyz and password is abc123

create user xyz identified by abc123 
default tablespace users
temporary tablespace temp
profile default 
password expire;
grant create session to xyz;

Here
USERS is default tablespace
TEMP is temporary tablespace
“password expire” option will allow user to change the password while first login.
DEFAULT is profile assigned to user

User Creation in 12c Database:

In 12c database we have concept container database and pluggable databases, we should be clear with our idea whether we need to create user in container to pluggable db

In order to create user in container database i.e. user having access to all pluggable databases we need to use c## prefix with username. For example

create user c##xyz identified by abc123;
grant create session to c##xyz;

For creating user under any pluggable database we need to set container database using alter session command, Suppose pluggable database is PDB1
Command to set pluggable database

alter session set container=PDB1;
create user xyz identified by abc123;
grant create session to xyz;

Changing Default ,Temporary Tablespace, Granting Role,Privileges

We can simply perform these operation using alter user command in order to give more access to user as per application requirement

In case we don’t mention anything during create user command oracle will assign default and temporary tablespace as per database’s default settings

Changing users default and temp tablespace

alter user xyz default tablespace <tablespace_name>;
alter user xyz temporary tablespace <temporary tablespace name>;

In case we need to create objects under this user then we are suppose to grant quota on tablespace this can be done using below command

alter user xyz quota unlimited on <tablespace_name>;

granting Roles and Privileges
grant <role_name> to xyz
grant select,insert,update,delete on <table_name> to xyz ;

Verification of user creation  and grants

Select username, profile,account_status from dba_users where username='XYZ';
select grantee,PRIVILEGE from dba_sys_privs where grantee='XYZ';
select grantee,granted_role from dba_role_privs where grantee='XYZ';
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Author

Atikh Shaikh
View my complete profile

Categories

  • MongoDB (18)
  • Oracle 12c (30)
  • Oracle12cR2 New Feature (3)
  • PostgreSQL (20)
  • RMAN (10)
  • Snowflake (8)
  • mysql (23)
  • oracle (74)

Blog Archive

  • ▼  2018 (38)
    • ▼  November (25)
      • Introduction On MySQL
      • SQL Modes in MySQL
      • MySQL Version explained
      • MySQL Storage Engines (Part 1)
      • MySQL Storage Engines (Part 2)
      • Login to MySQL Database on Linux
      • Error Code: 1419. You do not have the SUPER privil...
      • Create MySQL database on Linux
      • Create New User in MySQL Database
      • MySQL Default database | MySQL System Database
      • Oracle ASM Basic Commands
      • Oracle Database Schema Refresh
      • Create User in Oracle Database Pre-12c and 12c
      • RMAN Disk backup and List or Report RMAN Backup
      • RMAN Backup of Single Datafile and List Backup
      • Difference Between User, Service account and Schem...
      • Create MySQL Database Backup | mysqldump mysqlbackup
      • Switching between ARCHIVELOG Mode and NOARCHIVELOG...
      • Introduction to MongoDB
      • Introduction to PostgreSQL
      • Installation of PostgreSQL 9.6 on Windows
      • Installation of MongoDB on Windows
      • Oracle DBA Scripts
      • Databases, Collections and Documents in MongoDB
      • CRUD (Create, Read, Update, Delete) Operations in ...
    • ►  December (13)
  • ►  2019 (33)
    • ►  January (15)
    • ►  February (6)
    • ►  March (2)
    • ►  April (5)
    • ►  May (5)
  • ►  2020 (5)
    • ►  April (1)
    • ►  May (2)
    • ►  July (2)
  • ►  2021 (8)
    • ►  June (3)
    • ►  July (3)
    • ►  August (1)
    • ►  December (1)
  • ►  2022 (33)
    • ►  May (3)
    • ►  June (10)
    • ►  July (3)
    • ►  August (4)
    • ►  September (8)
    • ►  October (3)
    • ►  November (2)
  • ►  2023 (14)
    • ►  February (1)
    • ►  April (5)
    • ►  May (2)
    • ►  June (1)
    • ►  September (1)
    • ►  October (1)
    • ►  December (3)
  • ►  2024 (5)
    • ►  January (2)
    • ►  March (3)
  • ►  2025 (6)
    • ►  March (1)
    • ►  April (3)
    • ►  May (2)

Popular Posts

  • ORA-29283: invalid file operation: unexpected "LFI" error (1509)[29437]
    I was trying to export the schema in my windows PC, it got stuck with below error    C:\Users\shaik\Videos\technodba exp>expdp userid...
  • Oracle 23ai : Use of NOVALIDATE Constraints in IMPDP
    While performing impdp operations in the Oracle database, Oracle performs validation checks for every constraint on the imported table, that...
  • PostgreSQL : How to get data directory location for PostgreSQL instance
    Sometimes, you start working on a PostgreSQL instance but forget about the data directory, here we will discuss different methods to know th...
  • ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
    In previous articles, we have learned about user creation and grants  in MySQL in detail, but there are a few privileges called global priv...
  • Oracle Dataguard Broker Configuration (DGMGRL)
    Data Guard Broker is a command-line interface that makes managing primary and standby databases easy. DBA can use a single command to switch...

Labels

oracle Oracle 12c mysql PostgreSQL MongoDB oracle 19c Oracle23c oracle19c Orale PDB-CDB oracle12c python AWS Oracle ASM Virtualbox pluggable database storage engine

Pages

  • Disclaimer
  • Privacy Policy

Follow TechnoDBA

Copyright © Atikh's DBA blog | Powered by Blogger