1,首先你要清楚口令文件的作用, 当你通过远程的方式去连接数据库时,口令文件会校验用户的密码 是否正确,但是如果你是通过操作系统验证,那口令文件就不再起作用了 来看下面的验证
[
oracle@ENMOEDU dbs]$ sqlplus sys/
oracle@ENMOEDU as sysdba #远程方式登录
SQL*Plus: Release 11.2.0.3.0 Production on Sun Aug 17 22:25:08 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[
oracle@ENMOEDU dbs]$ sqlplus / as sysdba #操作系统验证
SQL*Plus: Release 11.2.0.3.0 Production on Sun Aug 17 22:30:04 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@ENMOEDU>
2.接着咱们把口令文件删掉。口令文件的命名格式 :orapw+实例名
[
oracle@ENMOEDU dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[
oracle@ENMOEDU dbs]$ ls #红色字是口令文件
84pg6l6q_1_1 87pg6lh0_1_1 c-87396644-20140817-01 init.ora
orapwenmoedu snapcf_ENMOEDU.f
86pg6lco_1_1 c-87396644-20140817-00 hc_ENMOEDU.dat lkENMOEDU orapwENMOEDU spfileENMOEDU.ora
3.再次验证远程方式和操作系统验证两种方式 发现远程已经不能成功连接了 但操作系统仍然有效
[
oracle@ENMOEDU dbs]$ sqlplus sys/
oracle@ENMOEDU as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Aug 17 22:32:55 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
[
oracle@ENMOEDU dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Aug 17 22:35:14 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
4.要知道口令文件是可以重建的 看下面过程
1)显示创建密码文件工具的帮助信息
oracle@ENMOEDU dbs]$ orapwd
Usage: orapwd file=
entries= force= ignorecase= nosysdba=
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at command line,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
There must be no spaces around the equal-to (=) character.
2)创建密码文件
[
oracle@ENMOEDU dbs]$
orapwd file=orapwENMOEDU password=oracle entries=10 #entries 是说最多可以有多少拥有DBA角色的用户
[
oracle@ENMOEDU dbs]$ ls
84pg6l6q_1_1 87pg6lh0_1_1 c-87396644-20140817-01 init.ora orapwenmoedu snapcf_ENMOEDU.f
86pg6lco_1_1 c-87396644-20140817-00 hc_ENMOEDU.dat lkENMOEDU
orapwENMOEDU spfileENMOEDU.ora
5.再次 远程通过密码验证 成功登录
[
oracle@ENMOEDU dbs]$ sqlplus sys/
oracle@ENMOEDU as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Aug 17 22:42:42 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@ENMOEDU>
总结 :1.口令文件可有可无,一般情况下是有的
2.密码文件的格式: orapw+实例名 (也就是 .bash_profile 文件中的 $ORACLE_SID =实例名)
3.注意创建口令文件时,等号两端不能有空格
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29654823/viewspace-1253405/
,如需转载,请注明出处,否则将追究法律责任。