Labels

Showing posts with label oracle 12c. Show all posts
Showing posts with label oracle 12c. Show all posts

Thursday, March 6, 2014

Can Common user and local user name be same in oracle 12c?

In a multitenant environment, a common user is a database user whose identity and password are known in the root and in every existing and future pluggable database (PDB).
Hence common user and local user name cannot be same.
Lets proof this satement
SQL> alter system set  "_common_user_prefix"='' scope=spfile;

System altered.

SQL> create pfile from spfile;

File created.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

In pfile
ora12c._common_user_prefix=''
SQL> startup pfile='C:\app\XXXXXX\product\12.1.0\dbhome_1\database\INITora12c.ORA';
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2410864 bytes
Variable Size             666896016 bytes
Database Buffers          394264576 bytes
Redo Buffers                5365760 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> create user demo identified by demo;

User created.

SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDBORA12C                      MOUNTED
SUBUPDB                        MOUNTED
TEST                           READ WRITE

SQL> alter session set container=TEST;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
TEST
SQL> create user demo identified by demo;
create user demo identified by demo
            *
ERROR at line 1:
ORA-01920: user name 'DEMO' conflicts with another user or role name
SQL> show con_name

CON_NAME
------------------------------
TEST
SQL> create user hello identified by hello;

User created.
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> create user hello identified by hello;
create user hello identified by hello
*
ERROR at line 1:
ORA-65048: error encountered when processing the current DDL statement in
pluggable database TEST

ORA-01920: user name 'HELLO' conflicts with another user or role name

Supressing C## for common user in Oracle 12c

Normally common user are started with C## in 12c. But this can be eliminated by using hidden parameter below method. SQL> alter system set  "_common_user_prefix"='v##' scope=spfile; System altered. SQL> create user v## identified by test;create user v## identified by test            *ERROR at line 1:ORA-65096: invalid common user or role nameSolutions:-SQL> create pfile from spfile;
 File created. SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down. #####Opened the pfile and modify the value ora12c._common_user_prefix='V##' SQL> startup pfile='C:\app\XXXXXX\product\12.1.0\dbhome_1\database\INITora12c.ORA';ORACLE instance started. Total System Global Area 1068937216 bytesFixed Size                  2410864 bytesVariable Size             666896016 bytesDatabase Buffers          394264576 bytesRedo Buffers                5365760 bytesDatabase mounted.Database opened.SQL> show con_name CON_NAME------------------------------CDB$ROOTSQL> create user v## identified by test; User created.

Tuesday, March 4, 2014

Oracle 12c:--ORA-65096: invalid common user or role name

Command prompt
SQL> create user 12ctest identified by 12ctest;
create user 12ctest identified by 12ctest
            *
ERROR at line 1:
ORA-01935: missing user or role name
Sql developer:-
create user 12ctest identified by 12ctest
Error at Command Line : 1 Column : 13
Error report -
SQL Error: ORA-01935: missing user or role name
01935. 00000 -  "missing user or role name"
*Cause:    A user or role name was expected.
*Action:   Specify a user or role name.

SOLUTIONS:-
In Oracle 12c one can create either common user or local user. Common user is created in container db which started with C## where as local user is created in individual pdb.
SQL> sho con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDBORA12C                      MOUNTED
SUBUPDB                        READ ONLY
TEST                           READ WRITE
In order to create a "common" user in CDB$ROOT with name starting with c## 
SQL> create user c##12ctest identified by test;

User created.
To create a "local" user in TEST :-
SQL> alter session set container=TEST;

Session altered.

SQL> create user c##12ctest identified by test;
create user c##12ctest identified by test
            *
ERROR at line 1:
ORA-65094: invalid local user or role name
Note:-
The reason for the error is that Local user name cannot be started with C##.

SQL> create user test identified by test;

User created.

In TEST we can see that DBA_USERS lists both the local user, and the common user.
SQL> sho con_name

CON_NAME
------------------------------
TEST
SQL> select username,common from dba_users where username like '%TEST%';

USERNAME             COMMON
-------------------- --------------------
C##12CTEST           YES

TEST                 NO

Oracle 12c Last login time


The last login time for non-SYS users is displayed when you log on. This feature is on by default. The last login time is displayed in local time format. You can use the -nologintime option to disable this security feature. After you login, the last login information is displayed

C:\Users\XXXXX>sqlplus system/XXXX

SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 4 15:08:08 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Last Successful login time: Mon Mar 03 2014 17:48:00 +05:30

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
For more details please refer to below oracle site
http://docs.oracle.com/cd/E16655_01/server.121/e18404/ch_three.htm

Monday, March 3, 2014

Oracle 12c


Software can be downloaded here :- Oracle 12c Download
Documentation is available here:- Oracle 12c Release 1 (12.1)
Oracle 12c New Features documentation:- New Features Guide 12c Release 1 (12.1) 
Oracle 12c   Learning Library:-Oracle by Example tutorials
Changes on 12c Release: -Oracle 12c change
Oracle Command Line 12c:-  Command Line 12c