你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle 中system sys,sysoper sysdba 的区别

[日期:2013-01-30] 来源:Linux社区  作者:robinson [字体:大 中 小]

下面的链接是两者不同的权限说明

http://download.Oracle.com/docs/cd/B19306_01/server.102/b14231/dba.htm#sthref137

 

The manner in which you are authorized to use these privileges depends upon the method of

authentication that you use.When you connect with SYSDBA or SYSOPER privileges, you connect with

a default schema, not with the schema that is generally associated with your username.For

SYSDBA this schema is SYS; for SYSOPER the schema isPUBLIC.

 

--两者的schema不同

SQL> show user

USER is "SYS"

SQL> conn / as sysoper

Connected.

SQL> show user

USER is "PUBLIC"

 

在使用OEM登陆时,还有一种登陆时角色的选择则是normal,这个是对所有普通用户而言,登陆后其schema是自身

 

--查看密码文件视图,可以得到哪些用户为sysdba,哪些用户为sysoper

SQL> select * from v$pwfile_users;

 

USERNAMESYSDB SYSOP

------------------------------ ----- -----

SYSTRUETRUE

SCOTTTRUEFALSE

USR1FALSE TRUE

 

--下面演示了使用不同的角色来登陆

SQL> conn scott/tiger@orcl as sysdba

Connected.

 

SQL> show user;--尽管登陆的帐户是scott,但执行show user显示的是sys

USER is "SYS"

 

SQL> conn scott/tiger@orcl as sysoper/*scott的sysop列为false*/

ERROR:

ORA-01031: insufficient privileges

Warning: You are no longer connected to ORACLE.

 

SQL> conn usr1/usr1@orcl as sysdba

ERROR:

ORA-01031: insufficient privileges

 

SQL> conn usr1/usr1 as sysoper

Connected.

 

SQL> show user;--登陆的帐户是usr1,执行show user显示的是public

USER is "PUBLIC"

 

sys@ORCL> select * from dba_roles where rolelike 'SYS%'; --不存在这两个角色

 

no rows selected

 

--下面演示sysdba与sysoper都可以用来启动数据库

idle> conn scott/tiger as sysdba

Connected to an idle instance.

idle> startup

 

idle> conn usr1/usr1 as sysoper

Connected to an idle instance.

idle> startup

 

总结:

sysoper与sysdba不是角色,DBA角色也不包含这两种权限。

这是两种用于完成数据库管理任务的特殊权限,如数据库创建,实例启动、关闭等

这两个权限独立于数据库之外,位于数据库密码文件之中,属于密码认证范畴

通常在启动数据库时使用的场合较多,当然也可以以这两种方式连接数据库

连接数据库时使用sysdba则show user查看时为sys,使用sysoper则show user查看时为public

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款