在Linux环境下设置 ora-01031:insufficient privileges解决方法总结

今天需要使用sys用户处理问题,但是报错上面ora-01031:insufficient privileges。

在网上有很多方法,这个是自己经过测试的方法步骤。

1:首先检查文件sqlnet.ora文件是否设置正确(文件地址就是你oracle安装的目录)

# sqlnet.ora Network Configuration File: /app/oracle/product/10.2.0/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)
SQLNET.AUTHENTICATION_SERVICES=(ALL)

2:如果上面设置正确(为什么设置可以参考http://blog.csdn.net/huoyin/article/details/45544709)

然后用ssh等连接工具访问Linux服务器这里注意了如果存在多个实例需要指定 

登录oracle

su - oracle
指定 实例

export ORACLE_SID=***
3:需要检查系统配置

登录oracle

sqlplus / as sysdba
查询

SQL> show parameter password

NAME                         TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile            string      EXCLUSIVE
SQL> 

2:检查有哪些用户

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP
------------------------------ ----- -----
SYS                    TRUE  TRUE

SQL> 
因为我已经操作过了现在显示是有sys的,没有设置的是空的

SQL> grant sysdba to sys;
grant sysdba to sys
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled

3:现在添加文件退出oracle用户

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@dd ~]$ 

4:添加文件

执行添加加密的建立password文件

[oracle@dd ~]$orapwd file=/app/oracle/product/10.2.0/dbs/orapwprice.ora password=111111 entries=10 force=y
因为是linux所以文件明是orapw+ 实例.ora
window是pwd+ 实例.ora 

5:重启服务,用sys登录

你可能感兴趣的:(oracle)