OS:linux redhat5.5 32bit
数据库:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
1、问题描述:该数据库监听、实例正常运行,始终无法用sys以sysdba身份登入,用toad连接时,也报这个错误;但是用普通用户用命令和toad均可以登录成功。
sqlplus sys/sys as sysdba
报错时,提示:ORA-01031: insufficient privileges
2、检查:能用普通用户登录,说明数据库正常,然后
sqlplus / as sysdba
SQL> show parameter password;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
SQL> grant sysdba to sys;
grant sysdba to sys
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled
SQL> select * from v$pwfile_users;
no rows selected
没有发现密码文件,判断有可能是密码文件问题,检查密码文件
[oracle@localhost dbs]$ cd /u01/app/oracle/oracle/product/10.2.0/db_1/dbs/
[oracle@localhost dbs]$ ll
总计 2304304
-rw-r----- 1 oracle oinstall 1544 2014-05-30 hc_orcl.dat
-rw-rw---- 1 oracle oinstall 1544 01-11 06:23 hc_ORCL.dat
-rw-r----- 1 oracle oinstall 12920 2001-05-03 initdw.ora
-rw-r----- 1 oracle oinstall 8385 1998-09-11 init.ora
-rw-r----- 1 oracle oinstall 8386 2014-06-03 initORCL.ora
-rw-r----- 1 oracle oinstall 8385 1998-09-11 initORCL.ora~
-rw-rw---- 1 oracle oinstall 24 2014-06-03 lkDEFAULT
-rw-r----- 1 oracle oinstall 24 2014-05-29 lkORCL
-rw-r----- 1 oracle oinstall 1536 2014-05-29 orapworcl
-rw-r----- 1 oracle oinstall 3584 2014-06-02 spfileorcl.ora
-rw-r----- 1 oracle oinstall 3584 01-17 04:07 spfileORCL.ora
-rw-r----- 1 oracle oinstall 2147491840 01-17 04:40 TSP_QZ.DBF
-rw-r----- 1 oracle oinstall 209723392 01-16 22:07 TSP_ZP
查看系统实例名
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string ORCL
lock_name_space string
log_file_name_convert string
service_names string orcl
发现是ORCL,而密码文件名为orapworcl,将密码文件名改为prapwORCL,再试
[oracle@localhost dbs]$ sqlplus sys/sys as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jan 17 04:49:36 2017
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter password
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE
问题解决!