一、密码文件

作用:主要进行DBA权限的身份认证

DBA用户:具有sysdba,sysoper权限的用户被称为dba用户。默认情况下sysdba角色中存在sys用户,sysoper角色中存在system用户

二、Oracle的两种认证方式;

1.使用与操作系统集成的身份验证

2.使用Oracle数据库的密码文件进行身份认证

三、密码文件的位置

Linux下的存放位置:$ORACLE_HOME/dbs/orapw$ORACLE_SID

即:ORACLE_HOME/dbs/orapw<sid>

Windows下的存放位置:$ORACLE_HOME/database/PWD%ORACLE_SID%.ora

密码文件查找的顺序

--->orapw<sid>--->orapw--->Failure

两种认证方式:类似于SQL server中的windows认证和SQL server认证

决定在两个参数中

1.remote_login_passwordfile = none | exclusive |shared  位于$ORACLE_HOME/dbs/spfile$ORACLE_SID.ora参数文件中

none : 不使用密码文件认证

exclusive :要密码文件认证,自己独占使用(默认值)

shared :要密码文件认证,不同实例dba用户可以共享密码文件

2. $ORACLE_HOME/network/admin/sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES = none | all | ntf(windows)

none : 表示关闭操作系统认证,只能密码认证

all : 用于linux或unix平台,关闭本机密码文件认证,采用操作系统认证,但远程<异机>可以使用密码文件认证

nts : 用于windows平台

不同的组合

1           2

none          none      sys用户无论是本机还是远程均不可用

判断当前使用的是操作系统认证还是密码认证

四、演示:

1.在sqlnet.ora中追加SQLNET.AUTHENTICATION_SERVICES = none */

[oracle@robinson ~]$ sqlplus / as sysdba /*登陆失败*/

SQL*Plus: Release 10.2.0.1.0- Production on Fri Apr 9 10:41:28 2010

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

ERROR:

ORA-01031: insufficient privileges

Enter user-name:

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

[oracle@robinson ~]$ sqlplus sys/redhat as sysdba /*使用密码文件认证,登陆成功*/

SQL*Plus: Release 10.2.0.1.0- Production on Fri Apr 9 10:42:35 2010

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0- Production

With the Partitioning, OLAPand Data Mining options

SQL>

--=================================================================================

2.将SQLNET.AUTHENTICATION_SERVICES的值改为all

[oracle@robinson admin]$ sqlplus / as sysdba /*采用本机认证可以登陆*/

SQL*Plus: Release 10.2.0.1.0- Production on Fri Apr 9 10:46:55 2010

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0- Production

With the Partitioning, OLAPand Data Mining options

SQL>

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

[oracle@robinson admin]$ sqlplus sys/redhat@orclas sysdba /*使用密码文件登陆认证失败*/

SQL*Plus: Release 10.2.0.1.0- Production on Fri Apr 9 10:48:35 2010

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

ERROR:

ORA-12641: Authenticationservice failed to initialize

Enter user-name:

--注:此时可以使用远程登陆。

--使用#符号将新增的SQLNET.AUTHENTICATION_SERVICES行注释掉恢复到缺省值

/*

五、密码文件的建立:orapwd */

[oracle@robinson ~]$ orapwd

Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n>

where

file - name of password file (mand), /*密码文件的名字orapw<sid>*/

password - password for SYS (mand),  /*sys用户的密码*/

entries - maximum number of distinct DBA and /*可以有多少个sysdba,sysoper权限用户放到密码文件中去,去掉重复记录*/

/*注意entries中存放的个数但不是实际个数,这个是二进制数据*/

force - whether to overwrite existingfile (opt),/*10g新增的参数,默认值为n ,y表示允许覆盖*/

OPERs (opt),

There are no spaces around the equal-to(=) character.

--修改密码:

[oracle@robinson ~]$ cd $ORACLE_HOME/dbs

[oracle@robinson dbs]$ ll orapworcl

-rw-r----- 1 oracle oinstall 1536 Apr 7 15:50 orapworcl

[oracle@robinson dbs]$ orapwd file=orapworcl password=oracle force=y

[oracle@robinson dbs]$ sqlplus sys/oracle@orclas sysdba

SQL*Plus: Release 10.2.0.1.0- Production on Fri Apr 9 11:34:09 2010

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0- Production

With the Partitioning, OLAPand Data Mining options

SQL>

--将密码改回原来的密码

[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat

OPW-00005:File with same name exists - pleasedelete or rename

[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat force=y

[oracle@robinson dbs]$ rm orapworcl  /*删除密码文件*/

[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat/*重建密码文件*/

--演示将entries改为,然后将多个用户设置为sysdba或sysoper

[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat entries=1

[oracle@robinson dbs]$ strings orapworcl

]/[Z

ORACLE Remote Password file

INTERNAL

F7AC0C5E9C3C37AB

E100B964899CDDDF

--创建PL/SQL增加个新用户

SQL> begin

2  for iin 1..20 loop

3  execute immediate'create user u'||i||' identified by u'||i||'';

4  end loop;

5  end;

6  /

--将新用户赋予sysdba角色

PL/SQL procedure successfully completed.

SQL> begin

2  for iin 1..20 loop

3  execute immediate'grant sysdba to u'||i||'';

4  end loop;

5  end;

6  /

begin  /*得到和密码文件相关的错误提示*/

*

ERROR at line 1:

ORA-01996:GRANT failed: passwordfile '' is full

ORA-06512: at line 3

--再次查看orapworcl发现多出了行,即当设置为的时候多出了个用户。原因是该密码文件是二进制文件,按矩阵计算可存放多少

[oracle@robinson dbs]$ strings orapworcl

]/[Z

ORACLE Remote Password file

INTERNAL

F7AC0C5E9C3C37AB

E100B964899CDDDF

3E81B724A296E296

668509DF9DD36B43

9CE6AF1E3F609FFC

7E19965085C9ED47

--注意不要轻易删掉密码文件,这样会将其他账户的信息也删除

/*

六、导致密码文件内容修改的几种方式:

1.使用orapwd建立,修改密码文件,不建议使用

2.使用alter user sys identified by <>

3.使用grant sysdba to <>或grant sysoper to <>或revoke sysdba |sysoper from <>

七、查看密码文件内容 */

[oracle@robinson dbs]$ strings orapworcl

]/[Z

ORACLE Remote Password file

INTERNAL

F7AC0C5E9C3C37AB

E100B964899CDDDF

--当sys密码不记得可以使用OS系统身份认证登陆到sqlplus,再使用alter user修改密码

SQL> alteruser sys identified by oracle;

User altered

--再次查看密码文件与上一次对比,已经发生变化

SQL> ho strings orapworcl

]/[Z

ORACLE Remote Password file

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

--通过授予权限来修改密码,密码文件中多出了scott的信息

SQL> grant sysdbato scott;

Grant succeeded.

SQL> ho strings orapworcl

]/[Z

ORACLE Remote Password file

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

SCOTT

F894844C34402B67

--注意此处中登陆后,显示的账户信息还是sys,而不是scott,但此时的scott已经具备了sys权限

[oracle@robinson dbs]$ sqlplus scott/tiger@orclas sysdba

SQL*Plus: Release 10.2.0.1.0- Production on Fri Apr 9 11:56:09 2010

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0- Production

With the Partitioning, OLAPand Data Mining options

SQL> show user

USER is "SYS"

/*

八、sysdba与sysoper的区别*/

SQL> select* from system_privilege_mapwhere name like '%SYS%';

PRIVILEGE NAME                                      PROPERTY

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

-3 ALTER SYSTEM                                     0

-4 AUDIT SYSTEM                                     0

-83 SYSDBA                                           0

-84 SYSOPER                                          0

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

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 methodof authentication that you use.

When you connect with SYSDBA or SYSOPER privileges, you connectwith a default schema,

not with theschema that is generally associatedwith your username.

For SYSDBA this schemais SYS; for SYSOPER the schema is PUBLIC.

--两者的schema不同

SQL> show user

USER is "SYS"

SQL> conn /as sysoper

Connected.

SQL> show user

USER is "PUBLIC"

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

SQL> select* from v$pwfile_users;

USERNAME                       SYSDB SYSOP

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

SYS                            TRUE  TRUE

SCOTT                          TRUE  FALSE

USER1                          FALSE TRUE

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

SQL> conn scott/tiger@orclas sysdba

Connected.

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

ERROR:

ORA-01031: insufficient privileges

Warning: You are no longer connected to ORACLE.

SQL> conn user1/user1@orclas sysdba

ERROR:

ORA-01031: insufficient privileges

SQL> conn user1/user1as sysoper

Connected.

Oracle 密码文件的更多相关文章

  1. oracle 密码文件文件

    密码文件作用: 密码文件用于dba用户的登录认证. dba用户:具备sysdba和sysoper权限的用户,即oracle的sys和system用户. 本地登录: 1)操作系统认证: [oracle@ ...

  2. 创建oracle 密码文件

    orapwd file='$ORACLE_HOME/dbs/oratest' password=oracle entries=5 force=y; 说明:●FILE参数指定口令文件存放的全路径及文件名 ...

  3. Oracle 口令文件:即 oracle密码文件

    一:文件路径位置 [oracle@localhost db_1]$ cd $ORACLE_HOME/dbs [oracle@localhost dbs]$ ls dbsorapwPROD1 hc_or ...

  4. oracle ORA-01991错误--重建密码文件问题

    问题现象描述: 统计服务器测试没问题,刚好上次配置系统的时候有点问题,故重装一次,配置好安全策略(最近在研究如何新配置一台服务器的时候,第一时间配置好相关的安全设置,有空再写下来). 为了省事,直接冷 ...

  5. Oracle 无备份情况下的恢复--密码文件/参数文件

    13.1 恢复密码文件 密码文件(linux 为例)在$ORACLE_HOME/dbs目录下,文件名的前缀是orapw,后接数据库实例名. [oracle@DSI backup]$ cd /u01/a ...

  6. 【Oracle】密码文件相关

    Oracle数据库的orapwd命令,主要用来建立密码(口令)文件. 一.查看帮助信息 [oracle@oracle11g dbs]$ orapwd Usage: orapwd file=<fn ...

  7. Oracle登录操作系统验证和密码文件验证

    1.确认数据库版本 2.查看当前配置文件 ORALCE数据库不同的登录验证方式是和SQLNET.ORA配置文件有关系的,在配置文件中有一个参数sqlnet.authentication_service ...

  8. oracle忘记sys/system/scott用户密码了,如何重置oracle密码?

    今天用到的oracle数据库,但是发现以前设置的密码,忘记了,怎么输入都不对,所以从网上找了一下资料,解决了,然后整理分享给大家. 一.遇到的问题: 1..忘记除SYS.SYSTEM用户之外的用户的登 ...

  9. oracle密码文件管理

    密码文件 密码文件作用: 密码文件用于dba用户的登录认证. dba用户:具备sysdba和sysoper权限的用户,即oracle的sys和system用户. 本地登录: 1)操作系统认证: [or ...

随机推荐

  1. 2014年国内最热门的.NET开源项目TOP25

    编者按:在2014年初时,微软宣布成立.NET基金会,全面支持开源项目.如今将过一年的时间,目前国内的开源项目到底如何了?下面我们就来细数一下国内25款比较优秀的.NET开源项目. 作者:acdoma ...

  2. expandableListview的默认箭头箭头怎样移到右边

    1 . ExpandableListView布局:<ExpandableListView    android:id="@+id/bbs_category_expandable_lis ...

  3. 并不对劲的spoj1812

    题意是求多个串的lcs. 这也是道后缀自动机的模板题.对于任意一个字符串建后缀自动机,用其他串查询就行.对于后缀自动机的每个状态要额外记匹配到当前状态的最大长度. 和spoj1811的区别在于这道题不 ...

  4. FastText 分析与实践

    一. 前言 自然语言处理(NLP)是机器学习,人工智能中的一个重要领域.文本表达是 NLP中的基础技术,文本分类则是 NLP 的重要应用.在 2016 年, Facebook Research 开源了 ...

  5. git 查看、切换用户

    查看命令: 查看用户名: git config user.name 查看用户邮箱: git config user.email 修改命令: 修改用户名: git config --global use ...

  6. python-----opencv读视频、循环读图片显示进度条

    功能:opencv读视频,显示进度条,推动进度条快进.后退,按q退出.代码如下: import os import cv2 def nothing(emp): pass def jindu(name, ...

  7. 第九周 Leetcode 502. IPO (HARD)

    Leetcode 502 一个公司 目前有资产W 可以选择实现K个项目,每个项目要求公司当前有一定的资产,且每个项目可以使公司的总资产增加一个非负数. 项目数50000 设计一个优先队列,对于当前状态 ...

  8. bzoj4237 稻草人——分治

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4237 分治: 先把所有点按 y 排序,然后二分递归: 对于每个 mid ,计算经过它的矩形的 ...

  9. Newtonsoft.Json序列化日期时间去T的几种方式。

    原文地址:MVC web api 返回JSON的几种方式,Newtonsoft.Json序列化日期时间去T的几种方式. http://www.cnblogs.com/wuball/p/4231343. ...

  10. c++ class does not name a type (转载)

    转载:http://blog.csdn.net/typename/article/details/7173550 declare class does not name a type 出现这个编译错误 ...