`

Users, roles and privileges in Oracle

阅读更多
Oracle® Database Security Guide:
http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/toc.htm

Understanding User Privileges and Roles:
http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/admusers.htm#i1007169
Oracle Predefined Roles:

the complete list of system privileges and their descriptions(下页的Table 18-1):
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9013.htm#SQLRF01603

Users, roles and privileges in Oracle:
http://www.adp-gmbh.ch/ora/misc/users_roles_privs.html
引用

Privileges
A privilege is a right to execute an SQL statement or to access another user's object. In Oracle, there are two types of privileges: system privileges and object privileges. A privileges can be assigned to a user or a role
The set of privileges is fixed, that is, there is no SQL statement like create privilege xyz...
System privileges
There are quite a few system privileges: in Oracle 9.2, we count 157 of them, and 10g has even 173. Those can be displayed with
select name from system_privilege_map

Executing this statement, we find privileges like create session, drop user, alter database, see system privileges.
System privileges can be audited.
Arguably, the most important system privileges are:
create session (A user cannot login without this privilege. If he tries, he gets an ORA-01045).
create table
create view
create procedure
sysdba
sysoper
Object privileges
privileges can be assigned to the following types of database objects:
Tables
select, insert, update, delete, alter, debug, flashback, on commit refresh, query rewrite, references, all
Views
select, insert, update, delete, under, references, flashback, debug
Sequence
alter, select
Packeges, Procedures, Functions (Java classes, sources...)
execute, debug
Materialized Views
delete, flashback, insert, select, update
Directories
read, write
Libraries
execute
User defined types
execute, debug, under
Operators
execute
Indextypes
execute
For a user to be able to access an object in another user's schema, he needs the according object privilege.
Object privileges can be displayed using all_tab_privs_made or user_tab_privs_made.
Public
If a privilege is granted to the special role public, this privilege can be executed by all other users. However, sysdba cannot be granted to public.
Users
to be finished ...
Roles
Predefined Roles
Along with the installation, more exactly with the creation of an oracle database, Oracle creates predefined roles. These are:
connect, resource, dba
These might not be created anymore in future versions of Oracle.
Oracle 9.2 grants create session, alter session, create synonym, create view, create database link, create table, create cluster and create sequence to connect.
It also grants create table , create cluster, create sequence, create trigger create procedure, create type, create indextype and create operator to resource.
The role dba gets basically everything and that with admin option.
delete_catalog_role, execute_catalog_role, select_catalog_role
Accessing data dictionary views (v$ views and static dictionary views)
exp_full_database, imp_full_database
This role is needed to export objects found in another user's schema.
aq_user_role, aq_administrator_role, global_aq_user_role(?)
logstdby_administrator
snmpagent
recovery_catalog_owner
hs_admin_role
oem_monitor, oem_advisor
scheduler_admin
gather_system_statistics
plustrace
xdbadmin
xdbwebservices
ctxapp
Assigning privileges to users and roles
A privilege can be assigned to a user with the grant sql statment. On the other hand, revoke allows to take away such privileges from users and roles.
Oracle stores the granted privileges in its data dictionary.
Displaying the relationship between users, roles and privileges
Use this script to recursively list users, granted roles and privileges:
引用

Listing privileges recursively for Oracle users:
http://www.adp-gmbh.ch/ora/misc/recursively_list_privilege.html





oracle sys system 用户的区别:
引用

sys是Oracle数据库中权限最高的帐号,具有create database的权限,
而system没有这个权限,sys的角色是sysdba,system的角色是sysoper。
其余就是他们两个用户共有的权限了:
startup/shutdown/dba两个用户都是可以管理的。
平时用system来管理数据库就可以了。这个用户的权限对于普通的数据库管理来说已经足够权限了。



Oracle中超级用户权限的管理
http://blog.csdn.net/aqszhuaihuai/archive/2009/04/05/4049611.aspx
引用
Oracle 的用户根据所被授予的权限分为系统权限和对象权限。其中最高的权限是sysdba。 Sysdba具有控制Oracle一切行为的特权,诸如创建、启动、关闭、恢复数据库,使数据库归档/非归档,备份表空间等关键性的动作只能通过具有 sysdba权限的用户来执行。这些任务即使是普通DBA角色也不行。Sysoper是一个与sysdba相似的权限,只不过比sysdba少了 SYSOPER privileges WITH ADMIN OPTION,CREATE DATABASE,RECOVER DATABASE UNTIL这几个权限而已。这两者的认证方式是相同的办法,所以下面只介绍sysdba的认证管理。

  一般对sysdba的管理有两种方式:操作系统认证和密码文件认证。具体选择那一种认证方式取决于:你是想在Oracle运行的机器上维护数据库,还是在一台机器上管理分布于不同机器上的所有的Oracle数据库。若选择在本机维护数据库,则选择操作系统认证可能是一个简单易行的办法;若有好多数据库,想进行集中管理,则可以选择 password文件认证方式。

  使用操作系统认证方式的配置过程:

  1. 在操作系统中建立一个合法帐户。

  具体来说,在NT上,首先建立一个本地用户组,取名为ORA_<SID>_DBA,其中SID为该数据库实例的SID,或者建立一个 ORA_DBA地组,该组不对应于任何一个单独的Oracle实例。这样当一个NT上有好几个Oracle实例时,不用分别管理。然后再NT上建立一个用户,并且把它归入该组中。但是实际上这两步在Oracle8I安装过程中已经自动完成了,一般不用手动进行。

  第三步:在sqlnet.ora(位于$ORACLE_HOME/NETWORK/ADMIN目录中)中,把SQLNET.AUTHENTICATION _

  SERVICES 设置为SQLNET.AUTHENTICATION_SERVICES= (NTS),意思为使用NT认证方式。

  第四步,在INIT<SID>.ORA中,把REMOTE_LOGIN_PASSWORD设置为NONE,意思是不用password认证方式。

  完成以上步骤后,就可以在登录到NT后,直接在SQL*Plus 和SERVER MANAGER中CONNECT INTERNAL (CONNECT / AS SYSDBA)来作为超级用户登录到Oracle中,执行一些只有超级用户才能进行的操作。

  在Unix下,情况有些不同。毕竟这是两个完全不同的操作系统。

  首先,在安装Oracle之前,建立一个DBA组,这一步不用说了,不然是装不上Oracle的。一般还建立一个名为Oracle的用户,并把它加入到DBA组中。

  第二步, 设置REMOTE_LOGIN_PASSWORD为NONE。在Oracle8.1以后,该参数默认为EXCLUSIVE。一定要记得改过来。

  第三步, 用该用户名登录Unix,运行SQL*Plus 或者SERVER MANAGER,输入以下命令:CONNECT INTERNAL

  (CONNECT / AS SYSDBA)来登录到Oracle中。

  使用password文件认证的具体步骤:

  Oracle提供orapwd实用程序来创建password 文件,运用orapwd建立该认证方式的具体步骤如下:

  1. 使用Orapwd实用程序来创建一个PASSWORD文件。

  语法:

  orapwd file=文件名 password=internal用户密码 entries=entries.

  详细解释:

  文件名要包含完整的全路径名,如果不指定,Oracle把它默认放置$ORACLE_HOME/dbs(Unix下)或者$ORACLE_HOME/DATABASE(NT下)下。

  用户密码是用户internal的密码。当然后来还可以再向里边加入别的超级用户。

  Entries表示最大允许有的超级用户数目。这个是一个可选的。前两者是必须指定的。一般会把它设置的比实际需要大一些,以免不够。

  2. 把INIT<SID>.ORA中REMOTE_LOGIN_PASSWORD设置为EXCLUSIVE 或SHARED.使用EXCLUSIVE表示只有当前INSTANCE使用这个password文件。而且允许有别的用户作为sysdba登录进系统里边,而若选择了SHARED,则表明不止一个实例使用这个密码文件,伴随着一个很强的约束:sysdba权限只能授予sys和internal这两个用户名。(其实internal不是一个实际用户,而只是sys作为sysdba登录时的一个别名。)

  同时还要记得把 sqlnet.ora文件中SQLNET.AUTHENTICATION _SERVICES设置为NONE。一般在Unix下它是默认设置。在NT下,若选择典型安装时,会使用OS认证,而自定义时会使用密码文件认证方式。在安装过程中会提示输入INTERNAL密码。这样的话,就不用在手工创建密码文件和设定INTERNAL的密码了。

  3. 用SQL*Plus 或SERVER MANAGER运行下面命令登录进系统:CONNECT INTERNAL/密码。

  注意:

  1.在Oracle8.1.6安装在WIN2000下创建数据库时,常常会发生凭证检索失败的错误。这是由于Oracle不能应用OS认证的结果。一般可以通过修改sqlnet.ora中SQLNET.AUTHENTICATION _SERVICES为NONE来解决。这时,Oracle将采用密码文件认证方式。

  2.由于Oracle有几个系统预建的用户,所以最好在安装完成以后马上改变这些用户的密码。系统默认得密码分别为:internal/oracle , sys/change_on_install, system/manager.

  3.当选择密码文件认证方式时,可以再向系统中加入其他超级用户。比如用以下语句把用户SCOTT加入超级用户之中:(由具有sysdba权限的人执行)

  SQL>GRANT SYSDBA TO SCOTT;这样SCOTT用户就具有了sysdba权限。注意,此时SCOTT用户可以以两种身份登录:SCOTT , SYS.当SCOTT在登录时没有输入AS SYSDBA时,SCOTT是作为普通用户登录的。而当登录时输入了AS SYSDBA时,此时SCOTT登录进去的用户实际上为sys。这可以从下图观察:

  4. 当前系统中的具有sysdba权限的用户名可以从数据字典视图v$pwfile_user中查询得到: SELECT * FROM V$PWFILE_USERS; 如上图所示。

  5.系统中最大的具有sysdba权限的用户数由创建密码文件时的ENTRIES参数决定。当需要创建更多的具有sysdba权限的用户时,就需要删除原有的密码文件,重新创建一个。这需要关闭数据库,删除密码文件,重新创建一个新的密码文件,在entries中输入足够大的数目。再启动Oracle。这时,所有原来北授权的超级用户都不再存在,需要重新授权。所以在重新创建密码文件前,先要查询该视图,记下用户名,再在创建完密码文件后重新授权。

  6. Internal用户密码忘记的处理方法:

  有两种办法:

  1. ALTER USER SYS IDENTIFIED BY 新密码;//这同时也改变了Internal的密码,在Oracle8I中通过

  2. 重新创建一个新的密码文件,指定一个新的密码。

  • 大小: 39.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics