Oracle DB 12c中定制COMMON USER的前缀

联系:QQ(5163721)

标题:Oracle DB 12c中定制COMMON USER的前缀

作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]

我们知道Oracle Database 12c中用户分为COMMON_USERS 和 LOCAL_USERS两种,其中COMMON_USERS缺省以”C##”开头 ,其实这是受一个隐含参数控制的,即 _common_user_prefix
我们可以定制COMMON USER的前缀,下面咱们测试下:

[oracle@lunar ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 29 21:25:56 2013

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


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

SYS@lunarbb>show con_name

CON_NAME
------------------------------
CDB$ROOT
SYS@lunarbb>show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/lunarbb/spfilelunarbb.or
                                                 a
SYS@lunarbb>col KSPPINM for a30
SYS@lunarbb>col ksppstvl format a15
SYS@lunarbb>col KSPPDESC for a55
SYS@lunarbb>select ksppinm, ksppstvl, KSPPDESC 
  2  from x$ksppi pi, x$ksppcv cv 
  3  where cv.indx=pi.indx and pi.ksppinm like '\_%' escape '\' 
  4   and pi.ksppinm like '%common%';

KSPPINM                        KSPPSTVL        KSPPDESC
------------------------------ --------------- -------------------------------------------------------
_eliminate_common_subexpr      TRUE            enables elimination of common sub-expressions
_dump_common_subexpressions    FALSE           dump common subexpressions
_common_data_view_enabled      TRUE            common objects returned through dictionary views
_common_user_prefix            C##             Enforce restriction on a prefix of a Common User/Role/Profile name


Elapsed: 00:00:00.01
SYS@lunarbb>      
SYS@lunarbb>conn c##lunar/lunar
Connected.
C##LUNAR@lunarbb>create pfile='/tmp/pfile.bak' from spfile;
create pfile='/tmp/pfile.bak' from spfile
*
ERROR at line 1:
ORA-01031: insufficient privileges


Elapsed: 00:00:00.00
C##LUNAR@lunarbb>conn c##lunar/lunar as sysdba
Connected.
SYS@lunarbb>create pfile='/tmp/pfile.bak' from spfile;

File created.

Elapsed: 00:00:00.12
SYS@lunarbb>

[oracle@lunar ~]$ tail /tmp/pfile.bak
*.query_rewrite_enabled='TRUE'
*.remote_login_passwordfile='EXCLUSIVE'
*.resource_manager_plan='SCHEDULER[0x420F]:DEFAULT_MAINTENANCE_PLAN'
*.result_cache_max_size=1560K
*.sga_max_size=330M# internally adjusted
*.sga_target=330M
*.shared_pool_size=160M
*.skip_unusable_indexes=TRUE
*.undo_tablespace='UNDOTBS1'
*._common_user_prefix='L##'
[oracle@lunar ~]$ 

SYS@lunarbb>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@lunarbb>startup pfile=/tmp/pfile.bak
ORACLE instance started.

Total System Global Area  346562560 bytes
Fixed Size                  2288240 bytes
Variable Size             297797008 bytes
Database Buffers           37748736 bytes
Redo Buffers                8728576 bytes
Database mounted.
Database opened.
SYS@lunarbb>

SYS@lunarbb>conn c##lunar/lunar
Connected.
C##LUNAR@lunarbb>conn L##lunar/lunar
ERROR:
ORA-01017: invalid username/password; logon denied


Warning: You are no longer connected to ORACLE.
C##LUNAR@lunarbb>
C##LUNAR@lunarbb>conn / as sysdba 
Connected.
SYS@lunarbb>
SYS@lunarbb>CREATE USER L##lunar IDENTIFIED BY lunar;

User created.

Elapsed: 00:00:00.80
SYS@lunarbb>grant dba,sysdba,connect,resource to L##lunar;

Grant succeeded.

Elapsed: 00:00:00.17
SYS@lunarbb>
SYS@lunarbb>conn L##lunar/lunar
Connected.
L##LUNAR@lunarbb>conn L##lunar/lunar as sysdba
Connected.
SYS@lunarbb>
SYS@lunarbb>show parameter common

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_common_data_view_enabled            boolean     TRUE
_common_user_prefix                  string      L##
_eliminate_common_subexpr            boolean     TRUE
SYS@lunarbb>
此条目发表在 Database, ORACLE 12C 分类目录,贴了 , 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注