ora-01031:insufficient privileges/ v$pwfile_users

本文介绍了在Oracle数据库操作中遇到ora-01031权限不足的问题,通过检查remote_login_passwordfile参数、v$pwfile_users视图和密码文件,发现并解决了因密码文件名错误导致的权限问题。同时,解析了v$pwfile_users视图的作用,包括其与密码文件的关系、用户权限的添加与移除,以及远程登录的依据。
摘要由CSDN通过智能技术生成

今天在做dg的时候在主库上使用sys连接主库总是报ora-01031:insufficient privileges的错误:

1、查看参数 remote_login_passwordfile is set to SHARED or EXCLUSIVE
SQL> show parameter remote_login_passwordfile


NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
remote_login_passwordfile            string                            EXCLUSIVE---没有问题


2、查看使用密码文件的用户中是否有sys用户

SQL> select * from v$pwfile_users;


no rows selected


SQL> grant sysdba to sys;
grant sysdba to sys
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled
没有密码文件????马上查看是否存在密码文件

[oracle@master-new dbs]$ pwd
/disk2/oracle/product/11.2.0/dbs

发现密码文件竟然是:orapwdmaildata---哎密码文件错误啊,应该是orapw开头,结果多了d,重建密码文件

orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID entries=10 password=password

那这里面的这个视图 v$pwfile_users到底有什么作用那????

http://www.xifenfei.com/2025.html--转载

一、V$PWFILE_USERS定义

V$PWFILE_USERS lists all users in the password file , and indicates whether the user has been granted the SYSDBA, SYSOPER, and SYSASM privileges.
Column      Datatype    Description
USERNAM    VARCHAR2(30) Name of the user that is contained in the password file
SYSDBA     VARCHAR2(5)  Indicates whether the user can connect with SYSDBA privileges (TRUE) or not (FALSE)
SYSOPER    VARCHAR2(5)  Indicates whether the user can connect with SYSOPER privileges (TRUE) or not (FALSE)
SYSASM     VARCHAR2(5)  Indicates whether the user can connect with SYSASM privileges (TRUE) or not (FALSE)

二、v$pwfile_users与密码文件关系

[oracle@node1 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 4 19:08:06 2011
 
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
Connected to :
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
 
--查看密码文件用户权限
SQL> select * from v$pwfile_users;
 
USERNAME                       SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS                            TRUE  TRUE  FALSE
 
SQL> show parameter instance_name;       
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------
instance_name                        string      ora11g
 
--查看系统级别查看密码文件内容
SQL> !strings $ORACLE_HOME/dbs/orapwora11g
]\[Z
ORACLE Remote Password file
INTERNAL
A1174901D667F113
18698BFD1A045BCC
 
--创建新sysdba用户,查看视图和密码文件变化
SQL> create user xff01 identified by xifenfei;
 
User created.
 
SQL> grant sysdba to xff01;
 
Grant succeeded.
 
SQL>  select * from v$pwfile_users;
 
USERNAME                       SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS                            TRUE  TRUE  FALSE
XFF01                          TRUE  FALSE FALSE
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值