Oracle用户及角色介绍

上传人:仙*** 文档编号:100687848 上传时间:2022-06-03 格式:DOC 页数:16 大小:173KB
返回 下载 相关 举报
Oracle用户及角色介绍_第1页
第1页 / 共16页
Oracle用户及角色介绍_第2页
第2页 / 共16页
Oracle用户及角色介绍_第3页
第3页 / 共16页
点击查看更多>>
资源描述
wordOracle 用户与角色 介绍一. 用户管理1.1 建立用户数据库验证CREATEUSER DAVE IDENTIFIED BY pwdDEFAULT TABLESPACE usersTEMPORARY TABLESPACE tempQUOTA 5m ON users;1.2 修改用户ALTERUSER DAVE QUOTA 0 ON SYSTEM;1.3 删除用户DROPUSER DAVE; DROPUSER DAVE CASCADE;1.4 显示用户信息SELECT * FROM DBA_USERSSELECT * FROM DBA_TS_QUOTAS二.系统权限系统权限作用CREATE SESSION连接到数据库CREATE TABLE建表CREATE TABLESPACE建立表空间CREATE VIEW建立视图CREATE SEQUENCE建立序列CREATE USER建立用户系统权限是指执行特定类型SQL命令的权利,用于控制用户可以执行的一个或一类数据库操作。新建用户没有任何权限2.1 授予系统权限GRANTCREATESESSION,CREATETABLETO DAVE; GRANTCREATESESSIONTO DAVE WITH ADMIN OPTION; 选项:ADMIN OPTION 使该用户具有转授系统权限的权限。2.2 显示系统权限查看所有系统权限:Select * from system_privilege_map;显示用户所具有的系统权限:Select * from dba_sys_privs;显示当前用户所具有的系统权限:Select * from user_sys_privs;显示当前会话所具有的系统权限:Select * from session_privs;2.3 收回系统权限REVOKECREATETABLEFROM DAVE;REVOKECREATESESSIONFROM DAVE;三 .角色:角色是一组相关权限的命名集合,使用角色最主要的目的是简化权限管理。3.1 预定义角色。CONNECT自动建立,包含以下权限:ALTER SESSION、CREATE CLUSTER、CREATE DATABASELINK、CREATE SEQUENCE、CREATE SESSION、CREATE SYNONYM、CREATE TABLE、CREATEVIEW。RESOURCE自动建立,包含以下权限:CREATE CLUSTER、CREATE PROCEDURE、CREATE SEQUENCE、CREATE TABLE、CREATE TRIGGR。3.2 显示角色信息,ROLE_SYS_PRIVSROLE_TAB_PRIVSROLE_ROLE_PRIVSSESSION_ROLESUSER_ROLE_PRIVSDBA_ROLES四. Oracle用户角色每个Oracle用户都有一个名字和口令,并拥有一些由其创建的表、视图和其他资源。Oracle角色role就是一组权限privilege(或者是每个用户根据其状态和条件所需的访问类型)。用户可以给角色授予或赋予指定的权限,然后将角色赋给相应的用户。一个用户也可以直接给其他用户授权。数据库系统权限Database System Privilege允许用户执行特定的命令集。例如,CREATE TABLE权限允许用户创建表,GRANT ANY PRIVILEGE权限允许用户授予任何系统权限。数据库对象权限Database Object Privilege使得用户能够对各个对象进展某些操作。例如DELETE权限允许用户删除表或视图的行,SELECT权限允许用户通过select从表、视图、序列sequences或快照 snapshots中查询信息。4.1 创建用户Oracle部有两个建好的用户:SYSTEM和SYS。用户可直接登录到SYSTEM用户以创建其他用户,因为SYSTEM具有创建别的用户的权限。在安装Oracle时,用户或系统管理员首先可以为自己建立一个用户。例如:create user user01 identified by u01;该命令还可以用来设置其他权限。要改变一个口令,可以使用alter user命令:alter user user01 identified by usr01;现在user01的口令已由“u01改为“usr01。除了alter user命令以外,用户还可以使用password命令。如果使用password命令,用户输入的新口令将不在屏幕上显示。有dba特权的用户可以通过password命令改变任何其他用户的口令;其他用户只能改变自己的口令。当用户输入password命令时,系统将提示用户输入旧口令和新口令,如下所示:passwordChanging password for user01Old password:New password:Retype new password:当成功地修改了口令时,用户会得到如下的反应:Password changed4.2 删除用户删除用户,可以使用drop user命令,如下所示:drop user user01;如果用户拥有对象,如此不能直接删除,否如此将返回一个错误值。指定关键字CASCADE,可删除用户所有的对象,然后再删除用户。下面的例子用来删除用户与其对象:drop user user01 CASCADE;4.3 3种标准角色Oracle为了兼容以前的版本,提供了三种标准的角色role:CONNECT、RESOURCE和DBA。4.3.1.CONNECT Role(连接角色)临时用户,特别是那些不需要建表的用户,通常只赋予他们CONNECT role。CONNECT是使用Oracle的简单权限,这种权限只有在对其他用户的表有访问权时,包括select、insert、update和delete等,才会变得有意义。拥有CONNECT role的用户还能够创建表、视图、序列sequence、簇cluster、同义词synonym 、会话session和与其他数据库的链link。4.3.2. RESOURCE Role(资源角色)更可靠和正式的数据库用户可以授予RESOURCE role。RESOURCE提供应用户另外的权限以创建他们自己的表、序列、过程procedure、触发器trigger、索引index和簇cluster。4.3.3. DBA Role(数据库管理员角色)DBA role拥有所有的系统权限-包括无限制的空间限额和给其他用户授予各种权限的能力。SYSTEM由DBA用户拥有。一些DBA经常使用的典型权限。1. grant授权命令grant connect, resource to user01;2. revoke撤消权限revoke connect, resource from user01;一个具有DBA角色的用户可以撤消任何别的用户甚至别的DBA的CONNECT、RESOURCE 和DBA的其他权限。当然,这样是很危险的,因此,除非真正需要,DBA权限不应随便授予那些不是很重要的一般用户。撤消一个用户的所有权限,并不意味着从Oracle中删除了这个用户,也不会破坏用户创建的任何表;只是简单禁止其对这些表的访问。其他要访问这些表的用户可以象以前那样地访问这些表。五、创建角色除了前面讲到的三种系统角色-CONNECT、RESOURCE和DBA,用户还可以在Oracle创建自己的role。用户创建的role可以由表或系统权限或两者的组合构成。为了创建role,用户必须具有CREATE ROLE系统权限。5.1 创建rolecreate role STUDENT;这条命令创建了一个名为STUDENT的role。5.2 对role 授权一旦创建了一个role,用户就可以给他授权。给role授权的grant命令的语法与对对用户的语法一样。在给role授权时,在grant命令的to子句中要使用role的名称,如下所示:grant select on CLASS to STUDENT;现在,拥有STUDENT角色的所有用户都具有对CLASS表的select权限。5.3 删除角色要删除角色,可以使用drop role命令,如下所示:drop role STUDENT;指定的role连同与之相关的权限将从数据库中全部删除。六. oracle sys system 用户的区别sys是Oracle数据库中权限最高的,具有create database的权限,而system没有这个权限,sys的角色是sysdba,system的角色是sysoper。其余就是他们两个用户共有的权限了:startup/shutdown/dba两个用户都是可以管理的。平时用system来管理数据库就可以了。这个用户的权限对于普通的数据库管理来说已经足够权限了。七. 查看权限和角色ORACLE中数据字典视图分为3大类, 用前缀区别,分别为:USER,ALL 和 DBA,许多数据字典视图包含相似的信息。USER_*: 有关用户所拥有的对象信息,即用户自己创建的对象信息ALL_*: 有关用户可以访问的对象的信息,即用户自己创建的对象的信息加上其他用户创建的对象但该用户有权访问的信息DBA_*:有关整个数据库中对象的信息这里的*可以为TABLES, INDEXES, OBJECTS, USERS等。比如:只知道scott用户的密码,需要查看一下scott的一些信息、查scott用户的创建时间、用户状态、使用的默认表空间、临时表空间等信息SQL conn scott/admin已连接。SQLselect * from user_users;另:select * from all_users;(scott用户可以访问其他数据库用户对信息的用户名)另:select * from all_users;(所有数据库的用户信息,各用户的密码、状态、默认表空间、临时表空间等)、查看scott用户自己拥有什么角色SQL select * from user_role_privs;USERNAME GRANTED_ROLE ADM DEF OS_- - - - -SCOTT CONNECT NO YES NOSCOTT RESOURCE NO YES NO注:“ADM表示这个用户是否可以把该具有的角色赋予给其他的用户另:没有all_role_privs这个视图另:select * from dba_role_privs所有数据库用户具有哪些角色,这个视图只有dba角色的权限才可以查询、查看scott用户自己具有什么的权限SQL select * from session_privs;、查看scott用户具有什么的系统权限呢SQLselect * from user_sys_privs;另:没有all_sys_privs视图另:select * from dba_sys_privs;(所有数据库用户、角色所用于的系统权限)、查看scott用户中,都哪些用户把对象授予给scott用户呢读取其他用户对象的权限SQLselect * from user_tab_privs;另:select * from all_tab_privs; select * from dba_tab_privs; 、查看scott用户中拥有的resource角色都具有什么权限呢SQL select * from role_sys_privs where role=RESOURCE;ROLE PRIVILEGE ADM- -RESOURCE CREATE SEQUENCE NORESOURCE CREATE TRIGGER NORESOURCE CREATE CLUSTER NORESOURCE CREATE PROCEDURE NORESOURCE CREATE TYPE NORESOURCE CREATE OPERATOR NORESOURCE CREATE TABLE NORESOURCE CREATE INDEXTYPE NO已选择8行。、scott用户自己拥有多少的表SQLselect * from user_tables;另:select * from all_tables; 其他用户所拥有的表另:select * from dba_tables;数据库中所有用户的表、查看scott用户已经使用多大的空间,允许使用的最大空间是多少SQL select tablespace_name,bytes,max_bytes from user_ts_quotas;另:select * from dba_ts_quotas;(所有的数据库用户在每个表空间已使用的空间,最大空间)、把自己的表赋予给其他用户SQLgrant select on emp to mzl;查看都把哪些表什么权限赋予了其他用户SQLselect * from user_tab_privs_made、把表的某一列操作权限赋予给其他用户SQLgrant update(job) on emp to mzl;注:查看数据库中所有的角色select * form. dba_roles;、sys授予scott用户dba角色SQL conn /as sysdba已连接。SQL grant dba to scott;授权成功。另:如果这样SQL grant dba to scott with admin option;授权成功。scott用户就可以把dba的权限授予给其他的用户了。7.12 sys回收scott用户的dba角色SQL revoke dba from scott;撤销成功。八Oracle 用户与作用介绍Oracle 官方文档对Oracle 的用户分成了三类:(1) PredefinedAdministrative Accounts(2) PredefinedNon-Administrative User Accounts(3) PredefinedSample Schema User Accounts8.1 Predefined Administrative AccountsA default OracleDatabase installation provides a set of predefined administrative accounts. These are accounts that have specialprivileges required to administer areas of the database, such as the CREATEANY TABLE or ALTER SESSION privilege, or EXECUTE privilegeson packages owned by the SYSschema. The default tablespace foradministrative accounts is either SYSTEM or SYSAUX.Table 3-1 Predefined Oracle DatabaseAdministrative User AccountsUser AccountDescriptionStatus After InstallationANONYMOUSAccount that allows access to Oracle XML DB. It is used in place of theAPEX_PUBLIC_USER account when the Embedded PL/SQL Gateway (EPG) is installed in the database.EPG is a Web server that can be used with Oracle Database. It provides the necessary infrastructure to create dynamic applications.Expired and lockedCTXSYSThe account used to administer Oracle Text. Oracle Text enables you to build text query applications and document classification applications. It provides indexing, word and theme searching, and viewing capabilities for text.See Oracle Text Application Developers Guide.Expired and lockedDBSNMPThe account used by the Management Agent ponent of Oracle Enterprise Manager to monitor and manage the database.See Oracle Enterprise Manager Grid Control Installation and Basic Configuration.OpenPassword is created at installation or database creation time.EXFSYSThe account used internally to access the EXFSYS schema, which is associated with the Rules Manager and Expression Filter feature. This feature enables you to build plex PL/SQL rules and expressions. The EXFSYS schema contains the Rules Manager and Expression Filter DDL, DML, and associated metadata.See Oracle Database Rules Manager and Expression Filter Developers Guide.Expired and lockedLBACSYSThe account used to administer Oracle Label Security (OLS). It is created only when you install the Label Security custom option.See Enforcing Row-Level Security with Oracle Label Security and Oracle Label Security Administrators Guide.Expired and lockedMDSYSThe Oracle Spatial and Oracle Multimedia Locator administrator account.See Oracle Spatial Developers Guide.Expired and lockedMGMT_VIEWAn account used by Oracle Enterprise Manager Database Control.OpenPassword is randomly generated at installation or database creation time. Users do not need to know this password.OLAPSYSThe account that owns the OLAP Catalog (CWMLite). This account has been deprecated, but is retained for backward patibility.Expired and lockedOWBSYSThe account for administrating the Oracle Warehouse Builder repository.Access this account during the installation process to define the base language of the repository and to define Warehouse Builder workspaces and users. A data warehouse is a relational or multidimensional database that is designed for query and analysis.See Oracle Warehouse Builder Installation and Administration Guide.Expired and lockedORDPLUGINSThe Oracle Multimedia user. Plug-ins supplied by Oracle and third-party, format plug-ins are installed in this schema.Oracle Multimedia enables Oracle Database to store, manage, and retrieve images, audio, video, DI format medical images and other objects, or other heterogeneous media data integrated with other enterprise information.See Oracle Multimedia Users Guide and Oracle Multimedia Reference.Expired and lockedORDSYSThe Oracle Multimedia administrator account.See Oracle Multimedia Users Guide, Oracle Multimedia Reference, and Oracle Multimedia DI Developers Guide.Expired and lockedOUTLNThe account that supports plan stability. Plan stability prevents certain database environment changes from affecting the performance characteristics of applications by preserving execution plans in stored outlines. OUTLN acts as a role to centrally manage metadata associated with stored outlines.See Oracle Database Performance Tuning Guide.Expired and lockedSI_INFORMTN_SCHEMAThe account that stores the information views for the SQL/MM Still Image Standard.See Oracle Multimedia Users Guide and Oracle Multimedia Reference.Expired and lockedSYSAn account used to perform database administration tasks.See Oracle Database 2 Day DBA.OpenPassword is created at installation or database creation time.SYSMANThe account used to perform Oracle Enterprise Manager database administration tasks. The SYS and SYSTEM accounts can also perform these tasks.See Oracle Enterprise Manager Grid Control Installation and Basic Configuration.OpenPassword is created at installation or database creation time.SYSTEMA default generic database administrator account for Oracle databases.For production systems, Oracle remends creating individual database administrator accounts and not using the generic SYSTEM account for database administration operations.See Oracle Database 2 Day DBA.OpenPassword is created at installation or database creation time.TSMSYSAn account used for transparent session migration (TSM).Expired and lockedWK_TESTThe instance administrator for the default instance, WK_INST. After you unlock this account and assign this user a password, then you must also update the cached schema password using the administration tool Edit Instance Page.Ultra Search provides uniform search-and-location capabilities over multiple repositories, such as Oracle databases, other ODBC pliant databases, IMAP mail servers, HTML documents managed by a Web server, files on disk, and more.See Oracle Ultra Search Administrators Guide.Expired and lockedWKSYSAn Ultra Search database super-user. WKSYS can grant super-user privileges to other users, such as WK_TEST. All Oracle Ultra Search database objects are installed in the WKSYS schema.See Oracle Ultra Search Administrators Guide.Expired and lockedWKPROXYAn administrative account of Oracle9i Application Server Ultra Search.See Oracle Ultra Search Administrators Guide.Expired and lockedWMSYSThe account used to store the metadata information for Oracle Workspace Manager.See Oracle Database Workspace Manager Developers Guide.Expired and lockedXDBThe account used for storing Oracle XML DB data and metadata.Oracle XML DB provides high-performance XML storage and retrieval for Oracle Database data.See Oracle XML DB Developers Guide.Expired and locked8.2 PredefinedNon-Administrative User AccountsNon-administrativeuser accounts only have the minimum privileges needed to perform their jobs.Their default tablespace is USERS.Table 3-2 PredefinedOracle Database Non-Administrative User AccountsUser AccountDescriptionStatus After InstallationAPEX_PUBLIC_USERThe Oracle Database Application Express account. Use this account to specify the Oracle schema used to connect to the database through the database access descriptor (DAD).Oracle Application Express is a rapid, Web application development tool for Oracle Database.See Oracle Database Application Express Users Guide.Expired and lockedDIPThe Oracle Directory Integration and Provisioning (DIP) account that is installed with Oracle Label Security. This profile is created automatically as part of the installation process for Oracle Internet Directory-enabled Oracle Label Security.See Oracle Label Security Administrators Guide.Expired and lockedFLOWS_30000The account that owns most of the database objects created during the installation of Oracle Database Application Express. These objects include tables, views, triggers, indexes, packages, and so on.See Oracle Database Application Express Users Guide.Expired and lockedFLOWS_FILESThe account that owns the database objects created during the installation of Oracle Database Application Express related to modplsql document conveyance, for example, file uploads and downloads. These objects include tables, views, triggers, indexes, packages, and so on.See Oracle Database Application Express Users Guide.Expired and lockedMDDATAThe schema used by Oracle Spatial for storing Geocoder and router data.Oracle Spatial provides a SQL schema and functions that enable you to store, retrieve, update, and query collections of spatial features in an Oracle database.See Oracle Spatial Developers Guide.Expired and lockedORACLE_OCMThe account used with Oracle Configuration Manager. This feature enables you to associate the configuration information for the current Oracle Database instance with OracleMetaLink. Then when you log a service request, it is associated with the database instance configuration information.See Oracle Database Installation Guide for your platform.Expired and lockedSPATIAL_CSW_ADMIN_USRThe Catalog Services for the Web (CSW) account. It is used by Oracle Spatial CSW Cache Manager to load all record-type metadata and record instances from the database into the main memory for the record types that are cached.See Oracle Spatial Developers Guide.Expired and lockedSPATIAL_WFS_ADMIN_USRThe Web Feature Service (WFS) account. It is used by Oracle Spatial WFS Cache Manager to load all feature type metadata and feature instances from the database into main memory for the feature types that are cached.See Oracle Spatial Developers Guide.Expired and lockedXS$NULLAn internal account that represents the absence of a user in a session. Because XS$NULL is not a user, this account can only be accessed by the Oracle Database instance. XS$NULL has no privileges and no one can authenticate as XS$NULL, nor can authentication credentials ever be assigned to XS$NULL.Expired and locked8.3 PredefinedSample Schema User AccountsIf you install the sample schemas, which you must doto plete the examples in this guide, Oracle Database creates a set of sampleuser accounts. The sample schema user accounts are all non-administrativeaccounts, and their tablespace is USERS.Table 3-3 DefaultSample Schema User AccountsUser AccountDescriptionStatus After InstallationBIThe account that owns the BI (Business Intelligence) schema included in the Oracle Sample Schemas.See also Oracle Warehouse Builder Users Guide.Expired and lockedHRThe account used to manage the HR (Human Resources) schema. This schema stores information about the employees and the facilities of the pany.Expired and lockedOEThe account used to manage the OE (Order Entry) schema. This schema stores product inventories and sales of the panys products through various channels.Expired and lockedPMThe account used to manage the PM (Product Media) schema. This schema contains descriptions and detailed information about each product sold by the pany.Expired and lockedIXThe account used to manage the IX (Information Exchange) schema. This schema manages shipping through business-to-business (B2B) applications.Expired and lockedSHThe account used to manage the SH (Sales) schema. This schema stores business statistics to facilitate business decisions.Expired and locked16 / 16
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 施工组织


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!