ITPub博客

首页 > 数据库 > Oracle > 重建口令文件

重建口令文件

原创 Oracle 作者:kiran1990 时间:2016-12-20 09:48:19 0 删除 编辑
1.检查是否存在密码文件
[oracle@host01 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@host01 dbs]$ ls orapwPROD1
orapwPROD1

2.可以通过连接字符串(即远程方式)以sysdba身份登录数据库
[oracle@host01 ~]$ sqlplus sys/oracle@PROD1 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 20 09:53:15 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

3.删除密码文件,则无法用以上方式连接数据库
[oracle@host01 dbs]$ mv orapwPROD1 orapwPROD1.bak
[oracle@host01 dbs]$ ls orapwPROD1
ls: orapwPROD1: No such file or directory

[oracle@host01 ~]$ sqlplus sys/oracle@PROD1 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 20 09:55:27 2016

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

ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

当然,以系统方式验证,还是可以登录数据库的
[oracle@host01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 20 09:55:52 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

4.创建密码文件
[oracle@host01 dbs]$ orapwd file=orapwPROD1 password=oracle entries=30

5.再次远程通过密码验证,以sysdba身份登录数据库
[oracle@host01 ~]$ sqlplus sys/oracle@PROD1 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 20 09:58:43 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

总结
- 密码文件可有可无,一般情况下都应该存在
- 密码文件的格式orapw+实例名(此处是orapw非orapwd)
- 注意,创建密码文件时,等号两段不能有空格

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31400681/viewspace-2130998/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-10-08

  • 博文量
    61
  • 访问量
    21172