• Home
  • About
  • Log In
  • Register
Follow Us
KTEXPERTS
  • Oracle DBA
    • Oracle 12C New Features
      • Oracle Multitenant Features
      • Non Container Features
    • Oracle Architecture
      • Oracle Server Architecture
      • Oracle Background Processes
      • Oracle Pyhisical Database
      • Select and Update Statement
      • Startup and Shutdown Modes
      • Redolog File Management
      • User Management
        • RMAN (Recovery Manager)
        • Oracle Production Support Scripts
    • Oracle Tablespace Management
    • Oracle Datapump (Exports & Imports)
    • Performance Tuning
    • Oracle Dataguard
    • Oracle ASM
    • Oracle Auditing
    • Oracle Partitioning
    • SecureCRT
    • Partitions/Shell Script
  • Oracle RAC
    • Introduction to Oracle RAC
    • 11gR2 RAC Installation
    • 12cR2 RAC Installation
    • 19c RAC Installation
    • Flashback Restore on Two Node RAC Servers
  • GoldenGate
    • Oracle to Oracle GoldenGate Unidirectional Replication
    • MySQL to Oracle Heterogeneous Replication
    • Oracle to MySQL Heterogeneous Replication
    • CredentialStore in Goldengate
    • GoldenGate Monitoring Commands
    • Usage of HandleCollisions and No HandleCollisions
    • Goldengate subdirs
    • Enable/Disable DDL replication
    • Data Selection & Filtering
    • Automation scripts in Goldengate
    • Logdump utility
    • Initial loads with GoldenGate
    • IgnoreDelete and IgnoreUpdate parameters in GG
    • COLS & COLSEXCEPT FILTER in GG
    • Add new table to existing GoldenGate Replication
      • Cassandra
  • AWS
    • EC2 (Elastic Compute Cloud)
    • S3 (Simple Storage Service)
    • IAM (Identity and Access Management)
    • CloudWatch
    • VPC (Virtual Private Cloud)
    • Route 53
    • RDS
    • Dynamo DB
    • EFS (Elastic File System)
    • Cloud Trail
    • Cloud Front
    • SNS (Simple Notification Service)
    • SQS (Simple Queue Service)
    • SES (Simple Email Service)
    • Redshift
    • Elastic Cache
    • Snowball
  • SQL Server
  • DevOps
    • LINUX
    • GIT
    • Chef
    • Ansible
    • Docker
    • Maven
  • MySQL
    • MySQL Installation & Upgrade
    • MySQL DBA
    • Difference Between Oracle and MySQL
  • PostgreSQL
    • Installation of PostgreSQL
    • WAL Internals in PostgreSQL
    • Replication to GCP PostgreSQL
    • Level of Work in Postgres Database
    • Data Fragmentation in PostgreSQL
    • PostgreSQL Interview Q&A
    • PostgreSQL Commands
  • Authors
    • Authors
    • Speakers
    • Volunteers
  • INDEX
    • Oracle DBA
      • Performance Tuning
      • Oracle RAC
      • Oracle 12c New Features
      • Oracle Production Support Scripts
      • Oracle DataGuard
      • Data Pump (Export & Import)
      • Oracle 18c
      • RMAN (Recovery Manager)
      • Oracle Tablespaces
      • Oracle ASM
      • Oracle Partitioning
      • Oracle Architecture
    • PostgreSQL
    • AWS
    • DevOps
    • GoldenGate
    • Cassandra
    • SQL Server
    • Oracle RAC
    • MySQL
    • SecureCRT
  • Webinar Recordings
  • Daily Tips
    • Oracle DBA Tips
    • GoldenGate Tips
    • MySQL Tips
    • SQL Server Tips
    • PostgreSQL Tips
    • MongoDB Tips
    • DevOps Tips
    • Python Tips
    • Data Science Tips
      • Exadata Tips
    • AWS Tips
    • .NET Tips
    • Linux Tips
  • Azure
  • Python
  • MongoDB
mm

Binnary Ajay Kumar

This is Binnary Ajay Kumar having around 4+ years of experience as Oracle DBA having exposure to SQL,PL*SQL, RAC,Dataguard, RMAN,GoldenGate,MySQL DBA and Amazon Web Services. Share your knowledge. It’s a way to achieve immortality.

Follow

Share this post

Tags

  • common user and local user
  • common user in 12c
  • local user in 12c
  • users in multi tenant

Difference b/w Common user and Local user in Oracle 12c

Posted on June 19, 2018 in Oracle 12C New Features, Oracle DB Admin, Oracle Metadata, Oracle Non-Container Features
Share via:
Post Views: 0

Dear Readers,

In this article, we will see the following Difference b/w Common user and Local user in Oracle 12c.

Oracle has Introduced  Multitenant architecture in the version 12c and also new terminologies for users in container database called  LOCAL USER and COMMON USER.

Common users

 Users who exist in all containers current and future and can navigate across them.

Local users

   Users who exist only within a single pluggable database (PDB)  – i.e. the one where they are created.

Difference b/w Common user and Local user in Oracle 12c.

Note :

Once created, the common user will be visible across all containers. However, such a user needs explicit grants to be able to connect to and do things a pdb. And his grants can differ from pdb to pdb.
The common user can switch containers – if granted the required privileges.

 

1
2
3
4
5
6
7
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLUG4                          READ WRITE NO
         4 PLUG2                          READ WRITE NO
         5 PLUG5                          READ WRITE NO

How to create a common user.

We can create  a common user using CREATE and GRANT command.

By default create command has container=ALL clause, In case of grant mention Container=ALL.

1
2
3
4
5
6
7
8
9
10
SQL> create user C##ATG IDENTIFIED BY ATG1;
User created.
SQL> grant connect,resource,unlimited tablespace to C##ATG;
Grant succeeded.
SQL> GRANT connect,resource,unlimited tablespace TO C##OTG identified by OTG ;     
GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO C##OTG identified by OTG                                         
ERROR at line 1:
ORA-65094: invalid local user or role name
SQL> grant connect,resource,unlimited tablespace TO  C##OTG identified by OTG  container=ALL;
Grant succeeded.

Connect to C##OTG user and perform some transaction by creating objects.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
C##OTG>> create table acc_cust (sno number,sname varchar2(10),address  varchar2(30));
Table created.
C##OTG>> insert into acc_cust(sno,sname,address) values(101,'VINOD','19/45.....');
1 row created.
C##OTG>> insert into acc_cust(sno,sname,address) values(102,'AJAY','14/85...');
1 row created.
C##OTG>> insert into acc_cust(sno,sname,address) values(103,'SAI','16/58.....');
1 row created.
C##OTG>> COMMIT;
Commit complete.
C##OTG>> SELECT * FROM acc_cust;
       SNO SNAME      ADDRESS
---------- ---------- ------------------------------
       101 VINOD      19/45.....
       102 AJAY       14/85...
       103 SAI        16/58.....

Connect to one of pluggable database and check objects created by common user in root container.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
SYS>> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLUG4                          READ WRITE NO
         4 PLUG2                          READ WRITE NO
         5 PLUG5                          READ WRITE NO
SYS>> alter session set container=plug5;
Session altered.
SYS>> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         5 PLUG5                          READ WRITE NO
SYS>> select username from dba_users;
USERNAME
----------------------------------------
OUTLN
SYSTEM
SYS
ANONYMOUS
DBSNMP
XDB
APPQOSSYS
GSMADMIN_INTERNAL
GSMCATUSER
SYSBACKUP
C##OTG
DIP
SYSDG
ORACLE_OCM
SYSKM
XS$NULL
GSMUSER
AUDSYS
PLUSER
C##ATG
20 rows selected.
SYS>> conn c##OTG/OTG
Connected.
C##OTG>>show user
USER is "C##OTG"
C##OTG>>select * from tab;
TNAME                                                  TABTYPE   CLUSTERID
------------------------------------------------------ ----------
ACC_CUST                                                TABLE
SQL> select * from acc_cust  ;
       SNO SNAME      ADDRESS
---------- ---------- ------------------------------
       101 VINOD      19/45.....
       102 AJAY       14/85...
       103 SAI        16/58.....

How to create and connect to a local user.

1
2
3
4
5
6
7
8
9
10
SQL> grant connect,resource,unlimited tablespace to loc_u1 identified by u1 container=all;
grant connect,resource,unlimited tablespace to loc_u1 identified by u1 container=all
ERROR at line 1:
ORA-65065: A local user or role can only be altered within the current container
SQL> grant connect,resource,unlimited tablespace to loc_u1 identified by u1;
Grant succeeded.
SQL>> SQL> conn loc_u1/u1
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.

We can’t  to  a local without Oracle Net Services.

configure listener file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[oracle@dba20 ~]$ vi listener.ora
plug5 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.120)(PORT = 8989))
      )
    )
  )
SID_LIST_plug5 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = microcdb)
      (ORACLE_HOME = /oraeng/app/oracle/product/12.1.0)
    )
    )
[oracle@dba20 ~]$ export TNS_ADMIN=$HOME
[oracle@dba20 ~]$ lsnrctl start plug5
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 18-JUN-2018 21:33:41
Copyright (c) 1991, 2014, Oracle.  All rights reserved.
Starting /oraeng/app/oracle/product/12.1.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /home/oracle/listener.ora
Log messages written to /oraeng/app/oracle/diag/tnslsnr/dba20/plug5/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.120)(PORT=8989)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.120)(PORT=8989)))
STATUS of the LISTENER
------------------------
Alias                     plug5
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                18-JUN-2018 21:33:41
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/listener.ora
Listener Log File         /oraeng/app/oracle/diag/tnslsnr/dba20/plug5/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.120)(PORT=8989)))
Services Summary...
Service "microcdb" has 1 instance(s).
  Instance "microcdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully.

configure tnsnames file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[oracle@dba20 ~]$ vi tnsnames.ora
to_plug5=
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.120)(PORT = 8989))
    )
    (CONNECT_DATA =
      (SERVICE_NAME=plug5)
    )
  )
[oracle@dba20 ~]$ tnsping to_plug5
TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 18-JUN-2018 21:35:45
Copyright (c) 1997, 2014, Oracle.  All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.120)(PORT = 8989))) (CONNECT_DATA = (SERVICE_NAME=plug5)))
OK (10 msec)

Connect and SQL*PROMPT and set LOCAL_LISTENER parameter.

1
2
3
4
5
[oracle@dba20 ~]$sqlplus / as sysdba
SYS>> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.120)(PORT = 8989))) (CONNECT_DATA = (SERVICE_NAME=plug5)))'
scope=spfile;
System altered.
SYS>> startup force

Alter session to pluggable database and connect to LOCAL USER.

1
2
3
4
5
6
7
8
9
10
11
SYS>>alter session set container=plug5;
Session altered.
SYS>> conn loc_u1/u1@to_plug5
ERROR:
ORA-00942: table or view does not exist
Error accessing PRODUCT_USER_PROFILE
Warning:  Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM
Connected.
LOC_U1>>create table BAN_CUST(SNO NUMBER,SNAME VARCHAR2(10));
Table created.

How to convert PDB$SEED into READ WRITE mode.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SYS>> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLUG4                          READ WRITE NO
         4 PLUG2                          READ WRITE NO
         5 PLUG5                          READ WRITE NO
SYS>> show con_id
CON_ID
------------------------------
1
SYS>> show con_name
CON_NAME
------------------------------
CDB$ROOT
SYS>> alter session set container=PDB$SEED;
Session altered.
SYS>> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SYS>> show con_id
CON_ID
------------------------------
2
SYS>> show con_name
CON_NAME
-----------------------------
PDB$SEED
SYS>> alter pluggable database pdb$seed close;
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SYS>> alter session set "_oracle_script"=TRUE;
Session altered.
SYS>> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SYS>> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
SYS>> alter pluggable database pdb$seed OPEN READ WRITE;
Pluggable database altered.
SYS>> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ WRITE NO
SYS>> alter session set "_oracle_script"=false;
Session altered.

 

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTEXPERTS is always active on below social media platforms.

Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform

 

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 5.00 out of 5)
Loading...

You might also like...

  • Automating OSWatcher Log Capture with oswlogs_capture.sh

    Automating OSWatcher Log Capture with oswlogs_capture.sh

  • Table/index movement using pl/sql procedure

    Table/index movement using pl/sql procedure

  • Datapump export and import from Source PDB to Target PDB

    Datapump export and import from Source PDB to Target PDB

Previous Post: How to perform DATAPUMP operations on standby database by converting snapshot standby.
Next Post: SQL*Loader in Oracle 12c

5 thoughts on “Difference b/w Common user and Local user in Oracle 12c”

  1. Vinod

    June 21, 2018 at 3:16 pm

    Reply

    12c: Differences between Common user and Local User
    Agenda
    Differences b/w common user and local user.
    How to create common user and how does it work?
    How to create local user and how does it work?
    How to convert seed database into READ WRITE mode.
    Extra commands in CDB.
    Sat, Jun 23, 2018 8:00 AM – 10:00 AM PDT
    Please join my meeting from your computer, tablet or smartphone.
    https://global.gotomeeting.com/join/423048053
    You can also dial in using your phone.
    United States: +1 (312) 757-3121
    Access Code: 423-048-053

    Time Zone Converter
    https://www.timeanddate.com/worldclock/converter.html?iso=20180623T140000&p1=176&p2=137&p3=236&p4=136&p5=179

  2. Vinod

    June 24, 2018 at 12:56 am

    Reply

    Hello Everyone,

    Great response to the session on Differences between the Common user and Local User.

    Please check Vimeo video link.:
    https://vimeo.com/276668325/db37172045

  3. Bharath Kumar

    June 24, 2018 at 3:29 am

    Reply

    This post is very useful for everyone.Thnak you Ajay and Vinod for sharing 12c sessions and giving us your precious time.

  4. Nama

    June 24, 2018 at 5:21 am

    Reply

    More Informative article

  5. mm

    Ajay Kumar

    July 10, 2018 at 7:23 am

    Reply

    If you are interested to know more details about future session please join below telegram group :
    https://t.me/joinchat/JFVAtAv1TE9DGHLbJ6rZbw

Leave a Reply to Ajay Kumar Cancel reply

Recent Comments

  • Krishna on Installation of Oracle Linux In windows
  • Binnary Ajay Kumar on How to move or rename Oracle Home
  • Prabhu on How to move or rename Oracle Home
  • Krishna on Protected: How to kill Long Running Query using scripts.
  • krishna on Linux Basic Commands for DevOps (PART-2)

Categories

Ad

Started ktexperts.com with a small hope of sharing knowledge, And today we can proudly say that ktexperts.com is being accessed from all corners of the world. Here’s a glimpse of our growth.

About KTEXPERTS

KT Experts is one enthusiastic knowledge-sharing platform. The platform concentrates on all Database Technologies like Oracle Database Administration(DBA), Oracle RAC, Oracle GoldenGate, MySQL, SQL Server Database Administration, Cassandra, AWS and DevOps.

This page consists of all the well-developed articles  of the Technologies. This is an effort of many dedicated professionals for a better IT world.

We have received the best reviews over time and the usage of this page has been increasingly drastic. So why wait? Let’s get started!!!

Thank you 

Follow Our Social Networking Sites

Recent Posts

  • Automating OSWatcher Log Capture with oswlogs_capture.sh

    Automating OSWatcher Log Capture with oswlogs_capture.sh

  • COMPRESSION IN CASSANDRA

    COMPRESSION IN CASSANDRA

  • INSTALLING CASSANDRA USING DEBIAN PACKAGES

    INSTALLING CASSANDRA USING DEBIAN PACKAGES

  • OBJECT ORIENTED PROGRAMMING IN PYTHON

    OBJECT ORIENTED PROGRAMMING IN PYTHON

  • CASSANDRA INSTALLATION USING

    CASSANDRA INSTALLATION USING

Our Partners

Website Visitors


Locations of visitors to this page

COPYRIGHT © 2017 - KTEXPERTS.COM Back To Top
sponsored