密码文件作用:

密码文件用于dba用户的登录认证。

dba用户:具备sysdba和sysoper权限的用户,即oracle的sys和system用户。

本地登录:

1)操作系统认证:

[oracle@localhost ~]$ sqlplus "/as sysdba"

[oracle@localhost ~]$ sqlplus / as sysdba

[oracle@localhost ~]$ sqlplus sys/tiger as sysdba

2)密码文件认证:

[oracle@localhost ~]$ sqlplus sys/tiger@rezin as sysdba

远程密码文件登录:

[oracle@localhost ~]$ sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

密码文件位置:

linux/unix:[oracle@localhost ~]$ ls $ORACLE_HOME/dbs/orapw$ORACLE_SID

/u01/oracle/10g/dbs/orapworcl

/u01/oracle/10g/dbs/orapwrezin

windows:$ORACLE_HOME/oradate/orapw$ORACLE_SID

密码文件查找顺序:

         1)opapw<sid>

2)orapw

以上两个都查找不到,验证失败。

密码文件认证还是OS认证:

1)参数文件:remote_login_passwordfile=none|exclusive|shared

none:不使用密码文件认证

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

shared:使用密码文件认证,不同实例dba用户可以共享密码文件(asm下必须使用)

2)$ORACLE_HOME/network/admin/sqlnet.ora文件下:

SQLNET.AUTHENTICATION_SERVICES =none|all|nts(linux下默认没有设置)

none:关闭OS认证,只能密码文件认证

all:linux平台关闭本机密码文件认证,采用操作系统认证,但是远程(异机)可以密码文件认证

nts:windows下使用(桶linux下all)

练习:

1)配置:remote_login_passwordfile=exclusive

SQLNET.AUTHENTICATION_SERVICES =none

结果:可以密码文件认证(本地/远超),不可以操作系统认证

[oracle@localhost ~]$ sqlplus sys/tiger as sysdba(本地密码文件登录)

[oracle@localhost ~]$ sqlplus sys/tiger@rezin as sysdba(本地密码文件登录)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 19:00:39 2015

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

???:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> exit

? Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options ??

[oracle@localhost ~]$ sqlplus / as sysdba(OS认证)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 19:00:51 2015

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

ERROR:

ORA-01031: insufficient privileges

Enter user-name:

[oracle@localhost ~]$ sqlplus "/as sysdba"(OS认证)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 19:01:04 2015

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

ERROR:

ORA-01031: insufficient privileges

Enter user-name:

2)配置:remote_login_passwordfile=exclusive

SQLNET.AUTHENTICATION_SERVICES =all

结果:本机密码文件认证不可用,但是远程密码文件认证可用,本机OS认证可用

[oracle@localhost ~]$ sqlplus "/as sysdba"(本机OS认证登录成功)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 19:45:35 2015

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, OLAP and Data Mining options

[oracle@localhost ~]$ sqlplus sys/tiger@orcl as sysdba(本机密码文件认证失败)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 19:46:52 2015

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

ERROR:

ORA-12641: Authentication service failed to initialize

Enter user-name:

C: >sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba(远程密码文件登录成功)

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 3月 14 11:58:38 2015

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

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL>

[oracle@localhost ~]$ sqlplus scott/tiger(普通用户本地OS登录成功)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 20:01:57 2015

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, OLAP and Data Mining options

SQL>

[oracle@localhost ~]$ sqlplus scott/tiger@orcl(登录失败)

[oracle@localhost ~]$ sqlplus scott/t (登录失败)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 20:02:52 2015

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

ERROR:

ORA-12641: Authentication service failed to initialize

Enter user-name:

密码文件管理:

密码文件建立:orapwd命令用法(不建议使用)

[oracle@localhost ~]$ 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用户可以放到密码文件里边去(采用二进制方式,即输入1表示最少存放4个,去除重复的)

force - whether to overwrite existing file (opt), -->oracle 10g后新加的参数,用法:force=n或force=y,表示密码文件存在是否覆盖,10g之前只能删除原有的密码文件,再创建。

OPERs (opt),

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

例如:[oracle@localhost ~]$orapwd file=orapworcl password=rezin entries=1 force=y

密码文件修改:例如 修改sys用户密码或授予sysdba、sysoper权限

         orapwd重建密码文件:不建议使用,可能会让其他sys用户不能登录

alter user sys identified by <new password>

grant sysdba|sysoper to <user>;

revoke sysdba|sysoper from <user>

查看密码文件内容:strings指令查看二进制文件内容。

[oracle@localhost dbs]$ strings orapworcl

]\[Z

ORACLE Remote Password file

INTERNAL

9D9FF9FDAFB17385

E6BAA2164C375C09

sysdba和sysoper具体区别:查看官方文档

通过system_privilege_map视图查看系统权限:

SQL> select * from system_privilege_map

2  where name like '%SYS%';

PRIVILEGE NAME                                       PROPERTY

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

-3 ALTER SYSTEM                                      0

-4 AUDIT SYSTEM                                      0

-83 SYSDBA                                            0

-84 SYSOPER                                           0

查看用户系统权限通过密码文件视图v$pwfile_user查看:

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP

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

SYS                            TRUE  TRUE

通过以上查询可以知道,sys用户登录方式既可以通过as sysdba登录schema显示‘SYS’,也可以通过as sysoper登录schema显示‘PUBLIC’。

LAST验证:需要配合参数文件知识练习

1、按照组合:

1)remote_login_passwordfile=none                       sqlnet.authentication_services=none

2)remote_login_passwordfile=exclusive      sqlnet.authentication_services=none

3)remote_login_passwordfile=none                       sqlnet.authentication_services=all

如果是win,请你把all改为nts

4)remote_login_passwordfile=exclusive               sqlnet.authentication_services=all

分别测试:

本机:sqlplus / as sysdba

sqlplus sys/<pswd> as sysdba

sqlplus sys/<pswd>@<sid> as sysdba

远程:sqlplus sys/<pswd>@<sid> as sysdba

sqlplus sys/<pswd>@ip:port/<sid> as sysdba

测试哪些组合可以登录成功,哪些不能登录成功。

总结出如果关闭OS验证;如何关闭密码文件验证;如何关闭本地密码文件验证;如何关闭远程密码文件验证。

2、修改remote_login_passwordfile=shated然后使用alter user sys identified by <pswd>;修改密码,测试能否修改成功。

不允许修改

3、如果sys密码丢失或不对,你如何做?

alter user sys identified by tiger;修改密码

4、sysdba、sysoper区别在哪,普通用户如何使用密码文件已sysdba或sysoper登录。

答案:

1)remote_login_passwordfile=none                    sqlnet.authentication_services=none

关闭密码文件认证,关闭OS认证。

本机:sqlplus / as sysdba

[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 08:06:22 2015

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

ERROR:

ORA-01031: insufficient privileges

Enter user-name:

本机:sqlplus sys/tiger as sysdba

[oracle@localhost dbs]$ sqlplus sys/tiger as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 08:14:24 2015

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

ERROR:

ORA-01017: invalid username/password; logon denied

Enter user-name:

本机:sqlplus sys/tiger@orcl as sysdba

[oracle@localhost dbs]$ sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 08:15:39 2015

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

ERROR:

ORA-01017: invalid username/password; logon denied

Enter user-name:

远程:sqlplus sys/tiger@orcl as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 15 00:16:11 2015

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

ERROR:

ORA-12154: TNS: 无法解析指定的连接标识符

请输入用户名:

远程:sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 15 00:17:35 2015

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

ERROR:

ORA-01017: invalid username/password; logon denied

请输入用户名:

2)remote_login_passwordfile=exclusive              sqlnet.authentication_services=none

关闭OS认证,只能使用密码文件认证,自己独占使用。

本机:sqlplus / as sysdba

[oracle@localhost dbs]$ sqlplus  / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 22:38:23 2015

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

ERROR:

ORA-01031: insufficient privileges

Enter user-name:

本机:  sqlplus sys/<pswd> as sysdba

[oracle@localhost dbs]$ sqlplus  sys/tiger as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 22:39:24 2015

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, OLAP and Data Mining options

SQL>

本机:  sqlplus sys/<pswd>@<sid> as sysdba

[oracle@localhost dbs]$ sqlplus  sys/tiger@orcl as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 22:41:00 2015

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, OLAP and Data Mining options

SQL>

远程:sqlplus sys/<pswd>@<sid> as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 3月 14 14:41:52 2015

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

ERROR:

ORA-12154: TNS: 无法解析指定的连接标识符

请输入用户名:

远程: sqlplus sys/<pswd>@ip:port/<sid> as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 3月 14 14:44:07 2015

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

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL>

3)remote_login_passwordfile=none                    sqlnet.authentication_services=all

关闭密码文件认证,采用OS认证。

本机:sqlplus / as sysdba

[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 08:22:24 2015

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, OLAP and Data Mining options

SQL>

本机:sqlplus sys/tiger as sysdba

[oracle@localhost dbs]$ sqlplus sys/tiger as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 08:23:10 2015

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, OLAP and Data Mining options

SQL>

本机:sqlplus sys/tiger@orcl as sysdba

[oracle@localhost dbs]$ sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 08:24:01 2015

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

ERROR:

ORA-12641: Authentication service failed to initialize

Enter user-name:

远程:sqlplus sys/tiger@orcl as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 15 00:24:47 2015

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

ERROR:

ORA-12154: TNS: 无法解析指定的连接标识符

请输入用户名:

远程:sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 15 00:25:33 2015

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

ERROR:

ORA-01017: invalid username/password; logon denied

请输入用户名:

4)remote_login_passwordfile=exclusive            sqlnet.authentication_services=all

linux平台关闭本机密码文件认证,采用OS认证,但是远程(异机)可以密码文件认证,自己独占使用。

本机:sqlplus / as sysdba

[oracle@localhost dbs]$ sql / as sysdba

[uniread] Loaded history (12 lines)

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 22:57:20 2015

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, OLAP and Data Mining options

SQL>

本机: sqlplus sys/<pswd> as sysdba

[oracle@localhost dbs]$ sqlplus sys/tiger as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 22:59:16 2015

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, OLAP and Data Mining options

SQL>

本机:sqlplus sys/<pswd>@<sid> as sysdba

[oracle@localhost dbs]$ sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 14 23:00:44 2015

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

ERROR:

ORA-12641: Authentication service failed to initialize

Enter user-name:

远程:sqlplus sys/<pswd>@<sid> as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 3月 14 15:01:18 2015

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

ERROR:

ORA-12154: TNS: 无法解析指定的连接标识符

请输入用户名:

远程:sqlplus sys/<pswd>@ip:prot/<sid> as sysdba

C:\Users\WCWEN>sqlplus sys/tiger@192.168.96.141:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 3月 14 15:02:56 2015

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

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL>

http://www.cnblogs.com/wcwen1990/p/4337422.html

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

  1. Oracle密码概要文件,密码过期时间180天修改为3天,相关用户密码是否过期

    #Oracle用户密码,概要文件修改测试 #默认的用户使用概要文件,默认概要文件密码过期时间参数180天,修改为3天,对于老的用户来说,是密码过期,还是未发生改变, 对于新用户来说,新设置的密码过期时 ...

  2. 用cmd导入oracle的.dmp文件和修改oracle管理员密码

    1,首先创建用户 语法[创建用户]: create user 用户名 identified by 口令[即密码]: 例子:create user zhengxin identified by zhen ...

  3. Oracle----SQL语句积累 (Oracle 导入 dmp文件)

    Oracle----SQL语句积累 (Oracle 导入 dmp文件) Oracle SQL PL  导入dum文件 1.数据库DBA权限: 注意:这个是在cmd命令行中直接输入,不需要进入Oracl ...

  4. Linux下oracle11gR2系统安装到数据库建立配置及最后oracle的dmp文件导入一站式操作记录

    简介 之前也在linux下安装过oralce,可每次都是迷迷糊糊的,因为大脑一片空白,网上随便看见一个文档就直接复制,最后搞了乱七八糟,虽然装上了,却乱得很,现在记录下来,希望能给其他网上朋友遇到问题 ...

  5. oracle使用口令文件验证和os验证

    一.Oracle安装之后默认情况下是启用了OS认证的,这里提到的os认证是指服务器端os认证.OS认证的意思把登录数据库的用户和口令校验放在了操作系统一级.如果以安装Oracle时的用户登录OS,那么 ...

  6. Oracle学习——dmp文件(表)导入与导出

    Oracle学习——dmp文件(表)导入与导出 2014-12-28      0个评论    来源:张文康 廊坊师范学院信息技术提高班 第九期   收藏    我要投稿 前言 关于dmp文件我们用的 ...

  7. oracle导入sql文件

    oracle导入sql文件: 1.进入到sql文件目录下,登录需要导入文件的用户 打开cmd,输入以下命令,进入oracle, sqlplus username/password username:需 ...

  8. Linux服务器磁盘扩展和oracle表空间文件迁移操作记录

    1.环境介绍 服务器硬件:Dell R710 服务器OS:红帽子Linux   RHEL4.8 数据库:Oracle 10g 2.出现的问题 因为数据表每天有上百万的数据写入表,加上建立索引,导致表空 ...

  9. oracle表分区、表分析及oracle数据泵文件导入导出开心版

    1.先说oracle表分区是什么吧,这样吧我们来举个桃子,栗子太小,我们就不举了,我们来举个桃子. 你有500万份文件,你要把他存在磁盘上,好嘛,我们就一个文件夹,500万分文件在那儿杵着,我们想找到 ...

  10. Oracle表空间数据文件移动的方法

    最近遇到这样的一个问题,Oracle存放表空间文件的盘符 空间不够了,必须把部分表空间迁移出去, [转]http://www.jb51.net/article/77026.htm 实现把用户表空间中的 ...

随机推荐

  1. 清华集训2014 day2 task3 矩阵变换

    题目 算法 稳定婚姻系统(其实就是贪心) 一个方案不合法,当且仅当下面这种情况: 设第\(i\)行选了数字\(x\),如果第\(j\)行有一个\(x\)在第\(i\)行的\(x\)后面,并且第\(j\ ...

  2. hdu 4614 Vases and Flowers (二分 线段树)

    题目大意:爱丽丝有N个花瓶,每个花瓶最多放一朵花.然后又如下两个操作. 1:A B    从第A个花瓶开始,往后依次插B朵花,直到不能插为止.如果一朵花都不能插入就输出“can.....”,否则输出第 ...

  3. android模拟器 一个错误:X Error of failed request: BadRequest (invalid request code or no such operation)

    最近ubuntu12.04学习python,python2.7 python3.2所不同的是还是蛮大的.学习思考的新 升级后 结果显示 输入方法不显示   update-manager 和  add- ...

  4. C语言,const

    const意味着“只读” ubunto下的实验 1). 关键字const的作用是为给读你代码的人传达非常有用的信息,实际上,声明一个参数为常量是为了告诉了用户这个参数的应用目的.如果你曾花很多时间清理 ...

  5. Java 获取到配置文件信息

    Java程序将数据库或者服务器IP写入到代码中,难免缺少灵活性. 如果写入到配置文件,部署到不通服务器上,只需要修改配置文 件即可. Java怎么读取配置文件 /** * 获取到配置文件信息 * @p ...

  6. 深入理解maven与应用(二):灵活的构建

    深入理解maven及应用(一):生命周期和插件 參考官方url:http://maven.apache.org/guides/index.html 一个优秀的构建系统必须足够灵活,应该可以让项目在不同 ...

  7. [放松一下] 经典高清电影合集 170G BT种子下载

    经典高清电影合集 170G BT种子下载 点击文件名下载 经典高清电影合集170G BT种子.torrent 下载方法 经典高清电影合集详情见目录: 1. 杀手47 2. 这个杀手不太冷 3. 放牛班 ...

  8. C#面试-总结

    1.override,overload的区别(鲁班联盟面试题) 笔试场景: 当时写反了区别 正确答案: override(重写,覆盖) 1.方法名.参数.返回值相同. 2.子类方法不能缩小父类方法的访 ...

  9. tomcat 后台启动设置

    如果你环境变量配置对了且保证tomcat的bin目录下有如下三个文件,则你只需在cmd中运行 service install tomcat即可将tomcat添加的服务项中,然后在设置开机自动启动,则以 ...

  10. 怎样在Windows和Linux下写相同的代码

    目前,Linux在国内受到了越来越多的业内人士和用户的青睐.相信在不久的将来,在国内为Linux开发 的应用软件将会有很大的增加(这不,金山正在招兵买马移植WPS呢).由于未来将会是Windows和L ...