动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > Oracle教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Oracle教程 ]的信息

本月文章推荐
.Oracle中Instance实例和数据库的.
.常用数据库JDBC连接写法大全.
.Oracle开发(一).Windows下配置使.
.实例讲解如何更改字段至兼容的不.
.用JDBC访问一个数据库.
.分享:我的oracle9i学习笔记(三).
.Oracle 8i中字符集乱码解决.
.SQLPlus命令使用指南(二) enh.
.使用Oracle的扩展SQL跟踪数据的方.
.SAP与Oracle对战企业市场.
.Oracle 学习过程中的笔记以及几个.
.autoconf手册(九).
.设置TOMCAT PATH,CLASSPATH变量.
.Oracle的优化器(Optimizer).
.深入了解Oracle 10g新的多重集运.
.Oracle 9i 游标.
.处理数据库中的null.
.如何使用Oracle数据库中空间管理.
.对Oracle的Web运营所进行的幕后观.
.从SCN看热备份的原理.

Oracle中password file的作用及说明

发表日期:2008-2-9 |


在数据库没有启动之前,数据库内建用户是无法通过数据库来验证身份的。

口令文件中存放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 2004 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.3.0 - Production SQL> alter user sys identified by oracle; User altered. SQL> show parameter pass NAME TYPE VALUE --------------------- ----------- ------------------------------ remote_login_passwordfile string NONE
remote:
 E:\Oracle\ora92\bin>sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:39:22 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect sys/oracle@hsjf as sysdba
ERROR:
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 bytes Fixed Size 451576 bytes Variable Size 104857600 bytes Database Buffers 25165824 bytes Redo Buffers 667648 bytes Database mounted. Database opened. SQL> show parameter pass NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ remote_login_passwordfile string EXCLUSIVE SQL> alter user sys identified by oracle; User altered.
remote:  
 E:\Oracle\ora92\bin>sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:47:11 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect sys/oracle@hsjf as sysdba
已连接。
SQL> show user
USER 为"SYS"
SQL>
 这实际上就是通过口令文件验证登录的
3.进一步测试

假如此时我们删除passwdfile,sysdba/sysoper将无法认证,也就无法登陆数据库
Server:  
SQL> !
[oracle@jumper oracle]$ cd $ORACLE_HOME/dbs
[oracle@jumper dbs]$ ls orapwhsjf
orapwhsjf
[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak
[oracle@jumper dbs]$



Remote:
 
E:\Oracle\ora92\bin>sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:50:14 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect sys/oracle@hsjf as sysdba
ERROR:
ORA-01031: insufficient privileges


SQL>



这实际上就是无法通过口令文件验证身份 4.假如丢失了passwdfile

假如使用passwdfile却意外丢失,此时将不能启动数据库 


SQL> startup force;
ORACLE instance started.

Total System Global Area 131142648 bytes
Fixed Size 451576 bytes
Variable Size 104857600 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
ORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'
ORA-27037: unable to oBTain file status
Linux Error: 2: No such file or Directory
Additional information: 3


此时可以通过orapwd重建口令文件来解决
此处我们恢复口令文件既可
 
SQL> !
[oracle@jumper oracle]$ mv $ORACLE_HOME/dbs/orapwhsjf.bak orapwhsjf
[oracle@jumper oracle]$ exit
exit

SQL> 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 TRUESQL> 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 passwordNAME 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 2004 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.3.0 - Production SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> ! [oracle@jumper dbs]$ ls hsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf spfilehsjf.ora [oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak [oracle@jumper dbs]$ exit exit SQL> startup ORACLE instance started. Total System Global Area 235999908 bytes Fixed Size 451236 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes ORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'--这是最后查找的文件 ORA-27037: unable to obtain file status Linux Error: 2: No such file or directory Additional information: 3
我们建立orapw口令文件,这时候可以打开数据库.
SQL> ! [oracle@jumper dbs]$ ls hsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf.bak spfilehsjf.ora [oracle@jumper dbs]$ cp orapwhsjf.bak orapw [oracle@jumper dbs]$ exit exit SQL> alter database open; Database altered. SQL> show parameter passw NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ remote_login_passwordfile string SHARED SQL>  
那么你可能会有这样的疑问,多个Exclusive的数据库是否可以共享一个口令文件(orapw)呢?我们继续这个实验:
SQL> show parameter passwordNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string SHARED
[oracle@jumper dbs]$ strings orapw
]\[Z
ORACLE Remote Password file
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
注重这里仅记录着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 bytes
Fixed Size 451236 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> !

[oracle@jumper bin]$ cd $ORACLE_HOME/dbs
[oracle@jumper dbs]$ strings orapw
]\[Z
ORACLE Remote Password file
HSJF
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
[oracle@jumper dbs]$ exit
exit
注重这里,以EXCLUSIVE 方式启动以后,实例名称信息被写入口令文件.此时假如有其他实例以Exclusive模式启动仍然可以使用这个口令文件,口令文件中的实例名称同时被改写.也就是说,数据库只在启动过程中才读取口令文件,数据库运行过程中并不锁定该文件,类似于pfile/spfile文件.
SQL> select * from v$pwfile_users;USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUESQL> grant sysdba to eygle;Grant succeeded.SQL> select * from v$pwfile_users;USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE
EYGLE TRUE FALSESQL> !
[oracle@jumper bin]$ cd $ORACLE_HOME/dbs
[oracle@jumper dbs]$ strings orapw
]\[Z
ORACLE Remote Password file
HSJF
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
>EYGLE
B726E09FE21F8E83

注重此时可以增加SYSDBA用户,并且这些信息可以被写入到口令文件.一旦口令文件中增加了其他SYSDBA用户,此文件不再能够被其他Exclusive的实例共享.
实际上,口令文件对于其他用户来说就是启到了一个 sudo 的作用.
6.重建口令文件假如口令文件丢失,可以使用orapwd可以重建口令文件,语法如下:
[oracle@jumper oracle]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA and OPERs (opt),
There are no spaces around the equal-to (=) character. 

上一篇:程序员如何掌握计算机英语 人气:606
下一篇:梦网网关接口 人气:425
浏览全部Oracle教程的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-9-6 Movie34电影搜索引擎 v3.0
2008-9-6 wap2.0仿帝国建站喜用 v2.0
2008-9-6 免费人才招聘网 宽屏版 v3.01
2008-9-6 喜喔喔视频采集程序 v1.0 beta
2008-9-6 ASP客户管理系统
2008-9-6 主流驿站中秋祝福程序
2008-9-6 php实现msn协议的类
2008-9-5 Coppermine Photo Gallery v1.4.
2008-9-5 清松网络日记本 v2.4
2008-8-23 Mini WinMount V0.4
2008-8-23 Vista优化大师3.11正式版
2008-8-23 Wine 1.13
2008-8-23 KlipFolio 5.0 Build 5899-80
2008-8-23 Windows Sysinternals Desktops
2008-8-23 OneTap Movies1.2破解版
2008-8-23 AnnotaterPDF阅读1.1.503 破解版
2008-8-23 SoundMeter分贝测量仪 v1.0汉化破
2008-8-23 iDrum音乐节拍1.0破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | Html转换js | js/vbs加密 | md5加密 | 进制转换
实用工具:汉字翻译拼音 | 符号对照表 | 个税计算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号