教程中国
PHOTOSHOP CS9.0中文版 MAYA 8.5 FOR WINDOWS Corel Painter v9.0 Flash MX2004 中文版 Illustrator cs2 中文版
VC++6.0含sp6 中英文版 VB6.0 +sp6 简体中文版 Borland Delphi 7汉化版 MSDN for vb6.0中文版 Visual Studio 2005简体
教程中国下属 文件存储共享专家BIBIDU.COM 提供大型软件,教材,源码,电影,音乐,图书等下载 更多精品请点此进入
  您目前所在位置: 教程中国 >> Oracle >> 入门基础 >> Oracle中password file的作用及说明 RSS订阅
Oracle中password file的作用及说明
教程(视频,书籍)下载:  ASP.NET AutoCAD 数据库 C# ASP java photoshop 网页设计 delphi 3dmax Flash C++ VB 张孝祥 实例   更多请进入BIBIDU搜索
IT搜索引擎   

  在数据库没有启动之前,数据库内建用户是无法通过数据库来验证身份的。口令文件中存放sysdba/sysoper用户的用户名及口令,允许用户通过口令文件验证,在数据库未启动之前登陆,从而启动数据库。如果没有口令文件,在数据库未启动之前就只能通过操作系统认证.使用Rman,很多时候需要在nomount,mount等状态对数据库进行处理所以通常要求sysdba权限如果属于本地DBA组,可以通过操作系统认证登陆如果是远程sysdba登陆,需要通过passwordfile认证.
  
  1.remote_login_passwordfile = NONE此时停用口令文件验证,Oracle数据库不允许远程SYSDBA/SYSOPER身份登录无法通过远程进行数据库起停等操作管理local:
  
  [oracle@jumper oracle]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.3.0 - Production on Thu Apr 15 09:58:45 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Connected to:Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.3.0 - ProductionSQL> alter user sys identified by oracle;User altered.SQL> show parameter passNAME TYPE VALUE--------------------- ----------- ------------------------------remote_login_passwordfile string NONE
  
  remote:
  
  E:\Oracle\ora92\bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:39:22 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as sysdbaERROR:ORA-01017: invalid username/password; logon denied
  
  此处实际上是无法通过口令文件验证
  
  2.remote_login_passwordfile = exclusive
  
  SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;System altered.SQL> startup force;ORACLE instance started.Total System Global Area 131142648 bytesFixed Size 451576 bytesVariable Size 104857600 bytesDatabase Buffers 25165824 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL> show parameter passNAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string EXCLUSIVESQL> alter user sys identified by oracle;User altered.
  
  remote:
  
  E:\Oracle\ora92\bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:47:11 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as sysdba已连接。SQL> show userUSER 为"SYS"SQL>
  
  这实际上就是通过口令文件验证登录的
  
  3.进一步测试如果此时我们删除passwdfile,sysdba/sysoper将无法认证,也就无法登陆数据库
  
  Server:
  
  SQL> ![oracle@jumper oracle]$ cd $ORACLE_HOME/dbs[oracle@jumper dbs]$ ls orapwhsjforapwhsjf[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak[oracle@jumper dbs]$
  
  Remote:
  
  E:\Oracle\ora92\bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:50:14 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as sysdbaERROR:ORA-01031: insufficient privilegesSQL>
  
  这实际上就是无法通过口令文件验证身份
  
  4.如果丢失了passwdfile如果使用passwdfile却意外丢失,此时将不能启动数据库
  
  SQL> startup force;ORACLE instance started.Total System Global Area 131142648 bytesFixed Size 451576 bytesVariable Size 104857600 bytesDatabase Buffers 25165824 bytesRedo Buffers 667648 bytesORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3
  
  此时可以通过orapwd重建口令文件来解决此处我们恢复口令文件既可
  
  SQL> ![oracle@jumper oracle]$ mv $ORACLE_HOME/dbs/orapwhsjf.bak orapwhsjf[oracle@jumper oracle]$ exitexitSQL> alter database open;Database altered.SQL>
  
  大致就是如此.
  
  5. remote_login_passwordfile = shared
  
  我们看一下Oracle9i文档中的说明:
  
  SHARED
  
  More than one database can use a password file. However, the only user recognized by the password file is SYS.
  
  意思是说多个数据库可以共享一个口令文件,但是只可以识别一个用户:SYS
  
  SQL> select * from v$pwfile_users;
  
  USERNAME SYSDB SYSOP------------------------------ ----- -----SYS TRUE TRUE
  
  SQL> grant sysdba to eygle;grant sysdba to eygle*ERROR at line 1:ORA-01994: GRANT failed: cannot add users to public password file
  
  SQL> show parameter password
  
  NAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string SHARED
  
  我们看到,此时的口令文件中是不能添加用户的.
  
  很多人的疑问在于:口令文件的缺省名称是orapw<sid>,怎么能够共享?
  
  实际上是这样的: Oracle数据库在启动时,首先查找的是orapw<sid>的口令文件,如果该文件不存在,则开始查找,orapw的口令文件如果口令文件命名为orapw,多个数据库就可以共享.
  
  我们看一下测试:
  
  [oracle@jumper dbs]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.3.0 - Production on Tue Jul 6 09:40:34 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Connected to:Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.3.0 - ProductionSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> ![oracle@jumper dbs]$ lshsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf spfilehsjf.ora[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak[oracle@jumper dbs]$ exitexitSQL> startupORACLE instance started.Total System Global Area 235999908 bytesFixed Size 451236 bytesVariable Size 201326592 bytesDatabase Buffers 33554432 bytesRedo Buffers 667648 bytesORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'--这是最后查找的文件ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3
  
  我们建立orapw口令文件,这时候可以打开数据库.
  
  SQL> ![oracle@jumper dbs]$ lshsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf.bak spfilehsjf.ora[oracle@jumper dbs]$ cp orapwhsjf.bak orapw[oracle@jumper dbs]$ exitexitSQL> alter database open;Database altered.SQL> show parameter passwNAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string SHAREDSQL>
  
  那么你可能会有这样的疑问,多个Exclusive的数据库是否可以共享一个口令文件(orapw)呢?
  
  我们继续这个实验:
  
  SQL> show parameter password
  
  NAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string SHARED
  
  [oracle@jumper dbs]$ strings orapw]\[ZORACLE Remote Password fileINTERNALAB27B53EDC5FEF418A8F025737A9097A
  
  注意这里仅记录着INTERNAL/SYS的口令
  
  REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE 时
  
  SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;
  
  System altered.
  
  SQL> startup force;ORACLE instance started.
  
  Total System Global Area 235999908 bytesFixed Size 451236 bytesVariable Size 201326592 bytesDatabase Buffers 33554432 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL> ![oracle@jumper bin]$ cd $ORACLE_HOME/dbs[oracle@jumper dbs]$ strings orapw]\[ZORACLE Remote Password fileHSJFINTERNALAB27B53EDC5FEF418A8F025737A9097A[oracle@jumper dbs]$ exitexit
  
  注意这里,以EXCLUSIVE 方式启动以后,实例名称信息被写入口令文件.
  
  此时如果有其他实例以Exclusive模式启动仍然可以使用这个口令文件,口令文件中的实例名称同时被改写.
  
  也就是说,数据库只在启动过程中才读取口令文件,数据库运行过程中并不锁定该文件,类似于pfile/spfile文件.
  
  SQL> select * from v$pwfile_users;
  
  USERNAME SYSDB SYSOP------------------------------ ----- -----SYS TRUE TRUE

来源:upschool.com.cn
作者:
关键字:file,作用,说明
发表日期:2007-1-6 1:19:23

网页显示有限 阅读全文请下载本文完整版WORD文档

上一篇:Oracle 10g学习手册1:证书的验证一(图)   下一篇:Oracle弱智900问一


2008-12-3 4:14:46
本文的相类似文章
  • 卡巴斯基安装及设置说明
  • 声卡入门——声卡的作用
  • v$tempfile与v$sort_usage之关系解析
  • Oracle中password file的作用及说明
  • Oracle RAC中Srvctl命令详细说明文档
  • Oracle PL/SQL Profiler应用指南
  • Oracle 数据库中常用操作的具体说明
  • 使用product_user_profile来实现用户权限的设定
  • 在Oracle9i中建立SPFILE文件
  • 设置不使用spfile
  • 在学习中进步 在进步中成长 教程中国相随您的成长之路
    华腾联合科技股份有限公司版权所有
    广告联系:Rosibo@163.com