ORA-01994: GRANT failed: password file missing or disabled
1、错误现象
SQL> grant sysdba to test;
grant sysdba to test
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled
SQL> ho oerr ora 01994
01994, 00000, "GRANT failed: password file missing or disabled"
// *Cause: The operation failed either because the INIT.ORA parameter
// REMOTE_LOGIN_PASSWORDFILE was set to NONE or else because the
// password file was missing.
// *Action: Create the password file using the orapwd tool and set the
// INIT.ORA parameter REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE.
2.根据提示分析解决
SQL> show parameter remote_login
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
remote_login_passwordfile string
EXCLUSIVE
SQL> ho ls $ORACLE_HOME/dbs/orapw*
/u01/app/oracle/product/11.1.0.6/dbs/orapworcl
果然没有当前数据库的密码文件。
3.使用orapwd重建当前数据库密码文件
首先查看orapwd的用法:
[oracle]$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
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.
执行操作:
[oracle dbs]$ orapwd file=/u01/app/oracle/product/11.1.0.6/dbs/orapwsales password=oracle entries=20 <---使用orapwd重建当前数据库密码文件
SQL> ho ls $ORACLE_HOME/dbs/orapw*
/u01/app/oracle/product/11.1.0.6/dbs/orapworcl /u01/app/oracle/product/11.1.0.6/dbs/orapwsales <--有了sales这个数据库的密码文件
SQL> grant sysdba to test; <--授权成功
Grant succeeded.
SQL> commit; <--提交操作
Commit complete.
4.orapwd命令的详细解析及说明
[oracle]$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
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.
例如:D:\oracle\ora92 \database>orapwd file=orcl.ora password=orclsys entries=2 其中参数entries的含义是表示口令文件中可以存放的最大用户数,对应于允许以SYSDBA/SYSOPER权限登录数据库的最大用户数,如果用户数 超过这个值只能重建口令文件,增大entries。
file后面可以指定口令文件的全路径和文件名,否则创建在当前目录下。
windows下oracle默认的位置是ora92/database目录,默认的文件名是 pwdSID.ora,对于别的文件名是不认的。linux下oracle默认的位置是$ORACLE_HOME/dbs目录,默认的文件名是 orapwSID,对于别的文件名是不认的。
(1)、为什么需要口令文件?
在数据库没有启动之前,数据库内建用户是无法通过数据库来验证身份的。口令文件中存放sysdba/sysoper
用户的用户名及口令,允许用户通过口令文件验证,在数据库未启动之前登陆,从而启动数据库。如果没有口令文件,在数据库未启动之前就只能通过操作系统认
证。
使用Rman,很多时候需要在nomount,mount等状态对数据库进行处理。所以通常要求sysdba权限如果属于本地DBA组,可以通过操作系统
认证登陆。如果是远程sysdba登陆,需要通过passwordfile认证。
(2)、口令文件损坏或者丢失怎么办?
口令文件就是sysdba/sysoper用户的唯一口令文件,丢了就进不来,不管数据库启动没有。连接报错...
SQL> connect sys/oracle@fzlgfm as sysdba
ERROR:
ORA-01031: insufficient privileges
只能用操作系统级权限验证登陆,即oracle/oracle登陆,然后orapwd重建口令文件:
orapwd file=orcl.ora password=orclsys entries=2
Orapwd命令第二个参数是指定sys的密码,参数等于什么,sys密码以后就是什么。为什么要指定sys密码?
因为口令文件里面必须要有用户密码,否则怎么验证啊?但此时数据库如果没启动的话就根本取不到sys密码,所以只能强行指定了,启动后数据库里面sys的
密码会被改成此时指定的。另外重建口令文件的工作只能由系统验证用户完成,或者具有dba权限的用户也可以,其他用户执行orapwd命令都会失败。
(3)、如何把sysdba/sysoper用户加到口令文件中去?
再执行一遍grant sysdba/sysoper to 用户,oracle会自动在口令文件中增加一个条目,并且把密码copy过来。
察看口令文件内容的方法:
select * from v$pwfile_users;
SQL> grant sysdba to scott;
Grant succeeded
SQL> select * from v$pwfile_users;
USERNAME SYSDBA SYSOPER
--------------- ------- -------
SYS TRUE TRUE
SCOTT TRUE FALSE
(4)、没有口令文件是否可以启动数据库?
可以。9i及以下mount过程中会报错,然后手动open就可以了。因为只要用本地验证用户照样可以做sysdba的事情,没有理由让数据库启动不了。10g已经不会报错了。
(5)、没有口令文件为什么是mount阶段报错而不是nomount阶段报错?
因为只有到了alter mount阶段才验证各种文件,nomount只读spfile/pfile创建进程。
(6)、修改sysdba/sysoper用户密码时,能否同步到口令文件?
可以同步。Alter user xxx identified by yyy
所有密码忘记都没关系,但至少要记住sys用户密码。
(7)、spfile/pfile中remote_login_passwordfile是干嘛用的?
三种设定模式:可以通过show parameter pass命令查看当前模式
remote_login_passwordfile = EXCLUSIVE,则一个实例专用;
remote_login_passwordfile = SHARE则可以多个实例共享(用于OPS/RAC环境);
remote_login_passwordfile = NONE则不启用口令文件,此时任何sysdba/sysoper都无法连接进来。
remote_login_passwordfile = shared 我们看一下Oracle9i文档中的说明:
More than one database can use a password file. However, the only user recognized by the password file is SYS.
意
思是说多个数据库可以共享一个口令文件,但是只可以识别一个用户:SYS。在用SPFILE的情况
下,remote_login_passwordfile参数怎么改呢?SPFILE是不可以强行编辑的,否则数据库不认的。用alter system
set remote_login_passwordfile=none scope=spfile。
改成NONE以后怎么改回来呢?
用os级认证登陆,然后alter system set remote_login_passwordfile=none scope=spfile,或者直接create spfile from pfile;
remote_login_passwordfile='none'意味着禁用口令文件,有也不能用。等于可以
disable所有sysdba/sysoper,此时只能用oracle/oracle用户来启动和关闭数据库,也就是只有os认证,没有口令文件认
证,这就是此参数的意义-口令文件验证的开关。
(8)、sqlnet.ora中SQLNET.AUTHENTICATION_SERVICES=(NTS/NONE)有什么用?
NTS=NT Security 即采用OS优先认证登陆,NONE为不可以,必须采用usr/pwd as
sysdba/sysoper
登陆。这里是操作系统级验证的开关。如果SQLNET.AUTHENTICATION_SERVICES=(NONE)并且
remote_login_passwordfile='none',即两个开关都关闭,那么神仙也进不了数据库,hoho我指的是
sysdba/sysoper用户,普通用户可以照常使用的。当然,有物理权限的人也除外,即你可以物理地打开这台计算机操作。
总结一下,ORACLE有两种方式可以认证sysdba/sysoper用户:操作系统级认证-dba权限组(linux
/unix)和ORA_DBA组(win);口令文件认证。
两种方式有各自的开关:sqlnet.ora中AUTHENTICATION_SERVICES参数;spfile/pfile中
remote_login_passwordfile参数。并且这两个开关互不矛盾,可以同时打开同时关闭或者只开一个。
参考文档:
http://blog.itpub.net/28716724/viewspace-756259/
http://www.cnblogs.com/51linux/archive/2013/06/08/3125788.html
ORA-01994: GRANT failed: password file missing or disabled的更多相关文章
- windows下安装pywin32报错:close failed in file object destructor:sys.excepthook is missing lost sys.stderr
今晚要写搜索引擎作业,搭scrapy环境,遇到了下面问题: windows下安装pywin32报错:close failed in file object destructor:sys.excepth ...
- ORA-19563: header validation failed for file
在测试服务器还原数据库时遇到了ORA-19563错误.如下所示 RMAN-00571: ======================================================== ...
- mysql 异常宕机 ..InnoDB: Database page corruption on disk or a failed,,InnoDB: file read of page 8.
mysql 测试环境异常宕机 系统:\nKylin 3.3 mysql版本:5.6.15--yum安装,麒麟提供的yum源数据库版本 error日志 181218 09:38:52 mysqld_sa ...
- ADT开发AndroidManifest.xml file missing错误
一个错误“AndroidManifest.xml file missing”但helloworld目录下有此文件,几番google仍没能解决.想起曾经在网络上看到的一个修复project的办法,抱着死 ...
- LR连接oracle时出现:SQLState=28000[Oracle][ODBC][Ora]ORA-01017:invalid username/password;logon denied
出现的现象:
- django rest framework csrf failed csrf token missing or incorrect
django rest framework csrf failed csrf token missing or incorrect REST_FRAMEWORK = { 'DEFAULT_AUTHEN ...
- 安卓(android)建立项目时失败,出现Android Manifest.xml file missing几种解决方法?(总结中)
安卓(android)建立项目时失败.出现AndroidManifest.xml file missing几种解决方法?(总结中) Eclipse新建项目.遇到这种问题.注意例如以下: 1.文件名称最 ...
- AndroidManifest.xml file missing 解决方案
如果在导入一个项目到ECLIPSE里时,不要把项目文件放到workspace里面,放到别处再导,否则可能会提示这个错误:AndroidManifest.xml file missing,顺便导入的方式 ...
- Ceph osd启动报错osd init failed (36) File name too long
在Ceph的osd节点上,启动osd进程失败,查看其日志/var/log/ceph/ceph-osd.{osd-index}.log日志,报错如下: 2017-02-14 16:26:13.55853 ...
随机推荐
- IOS网络请求之NSURLSession使用
前言: 无论是Android还是ios都离不开与服务器交互,这就必须用到网络请求,记得在2013年做iOS的时候那时候用的ASIHTTPRequest框架,现在重新捡起iOS的时候ASIHTTPReq ...
- 基于python的互联网软件测试开发(自动化测试)-全集合
基于python的互联网软件测试开发(自动化测试)-全集合 1 关键字 为了便于搜索引擎收录本文,特别将本文的关键字给强调一下: python,互联网,自动化测试,测试开发,接口测试,服务测试,a ...
- 【前端】:css
前言: 关于前端的第二篇博客,会写关于css的,内容比较基础.写完这篇博客,会做一个类似美乐乐家具的界面.good luck to me~ 一.css-引用样式 标签上设置style属性: <b ...
- css3绘制腾讯logo
CSS3绘制的腾讯LOGO,下边是对比图. 演示地址
- JAVA高级编程序——JDBC(连接mysql数据库)——(一)
java要想连接数据库,就要用JDBC(java database connection),用这个jar包 (mysql-connector-java-xxx-xx-bin.jar) sun公司为我们 ...
- flume-sink报错 java.lang.IllegalStateException: close() called when transaction is OPEN - you must either commit or rollback first
1. 确认代码无误(根据情况修改,表示若获得不了数据不会自动commit或者rollback): Event event = channel.take(); if (event == null) { ...
- c++ TCP keepalive 使用
来源:http://blog.csdn.net/weiwangchao_/article/details/7225338 http://www.cnitblog.com/zouzheng/archiv ...
- Angular.js之自定义指令学习笔记
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- for循环与foreach的区别
for循环与foreach的区别 foreach 依赖 IEnumerable. 第一次 var a in GetList() 时 调用 GetEnumerator 返回第一个对象 并 赋给a, 以后 ...
- Struts2环境的搭建
1. Struts2 获取http://struts.apache.org/download.cgiStruts-2.3.16.3-all.zip 了解主要目录 apps :该文件夹下包含了基于Str ...