ORA-01031:insufficient privileges

         安装完ORACLE 10 G, 在远程使用sys dba 连接OEM时候总是提示ORA-01031:insufficient privileges,以normal登录没有任何问题。
         先尝试使用system dba登录,结果还是同样的错误提示。按照错误提示网上大搜罗了一把,跟自己实际上遇到的情况都不太一样。再试着赋予system dba权限的时候( grant sysdba to system)时候遇到错误提示: ORA-01994: GRANT failed: password file missing or disabled,呵呵很明显密码文件有问题了,又在网上搜罗搜罗,发现事故的可能原因。首先检查初始化参数文件,init.ora在 $ORACLE_HOME/SID/pfile/init.ora 找到 remote_login_passwordfile,发现设置的值是 EXCLUSIVE模式,OK,这里也应该没有问题咯。现在就看看是不是password文件有问题咯。linux下,这个password文件的命名及位置好像是死的:$ORACLE_HOME/dbs/下面。OK,让我们看看标准文档上的说明吧:
orapwd 工具建立建立的密码文件 一定要orapw+实例名吗 ITPUB个人空间'E5v2R'rQ^"d3A'S:z

P[6`Q.L3}E^.` Y0我在 11g和10g 测试是必须要 orapw+实例名 才能登录成功 ITPUB个人空间6Qze4U hg)a
以下是验证过程

&QX Y;I/r2j B0[oracle@asm dbs]$ rm orapwasm
8Fr0x;ES"G0[oracle@asm dbs]$ orapwd file= orapwdasm password=abcdefg entries=10 ITPUB个人空间9yu._pD yu(l9h5Lm;J6}
[oracle@asm dbs]$ sqlplus /nolog ITPUB个人空间Jqep+x1C2~ X

"{-i:AX:f _ b,E0SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 26 17:24:07 2008 ITPUB个人空间9C~+b SF&pLa

o+Hiw tK%_0Copyright (c) 1982, 2005, Oracle.  All rights reserved. ITPUB个人空间g!w5|$j1O9n?(^
ITPUB个人空间)E6f!a#F j|Si.j
SQL> conn sys/abcdefg@asm as sysdba                                              ITPUB个人空间kW6{ v+T J|/A K W
ERROR:
o v!Y r-Y0ORA-01031: insufficient privileges ITPUB个人空间%L!XY9XL

4~0\*B[(zI#b;y0
c j&KWi1W]&C2g0SQL> exit                                                                        ITPUB个人空间!]2dPY0z{*]C{X
[oracle@asm dbs]$ ls
)g1f-c,\x%R3wB;^!}p0ab_+ASM.dat  hc_+ASM.dat  initdw.ora  lkASM   orapw+ASM  spfile+ASM.ora ITPUB个人空间XYz9J+}a^5yZ
hc_asm.dat   initasm.ora  init.ora    lk+ASM  orapwdasm  sqlnet.log ITPUB个人空间3tE7v9i rQu
[oracle@asm dbs]$ rm orapwdasm ITPUB个人空间7_8H(N|K_v
[oracle@asm dbs]$ ls
(P7G_b2tB1u0ab_+ASM.dat  hc_+ASM.dat  initdw.ora  lkASM   orapw+ASM       sqlnet.log
C.s&aU.aQ0hc_asm.dat   initasm.ora  init.ora    lk+ASM  spfile+ASM.ora
&^7V.~ b,qO1q1S/K0[oracle@asm dbs]$ orapwd file= orapwasm password=abcdefg entries=10
8r7XQ]b$^-V0[oracle@asm dbs]$ ls
;^9cL s-dGI4T(q0ab_+ASM.dat  hc_+ASM.dat  initdw.ora  lkASM   orapwasm   spfile+ASM.ora
(PY(N!^(Q+~"x_!C E0hc_asm.dat   initasm.ora  init.ora    lk+ASM  orapw+ASM  sqlnet.log
XNZ!W;tZ@Cu0[oracle@asm dbs]$ sqlplus /nolog
K|!?8Y4@0
.D~,F`/o gZ1T0SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 26 17:25:03 2008
.O f%VUE0
b@0pb^0Copyright (c) 1982, 2005, Oracle.  All rights reserved.
#w7N)D(KJ:K5e3Wwe0
'j!e]An+x c/}B5z0 SQL> conn sys/abcdefg@asm as sysdba                                             
E]4rI/I)f2x0Connected. ITPUB个人空间k!@a*f.s+T*zc p
SQL> ITPUB个人空间X1}-u1Q9q}
这是 itpub网友 lwjnbtx  查的官方文档
1. unix 环境: ITPUB个人空间 @^ Z5FR.S~8hp

`/y4bs{0查了 Administrator’s Reference 10g Release 2 (10.2) for UNIX-Based Operating Systems. ITPUB个人空间 YHE MJ
   
&Y\1\FCMv01. Log in as the Oracle software owner.
},k M.J0x f02. Use the orapwd utility to create the password file as follows:
G9R:M!U/O/t ^jY]!X/C0$ $ORACLE_HOME/bin/orapwd file=filename password=password entries=max_users ITPUB个人空间|a6G9[;~w
... ITPUB个人空间5}+Dh Cd:`:Q

/F4D5c&Q4H@,o0filename The name of the file in which password information is written
/~H,F@ H2d&k0]?X0
MS%Di6k$q0 The name of the file must be orapwsid, and you must supply the fullITPUB个人空间(P!T6ht%I]&Ds
path name.
Its contents are encrypted. Typically, the password file is ITPUB个人空间DT xI(K#~6a*O
created in the $ORACLE_HOME/dbs directory. ITPUB个人空间%kh@/Z zP?

!TjZ+U~#{0请注意黑体字, 所以unix环境中, password file 一定是要用 orapw<SID>, 没有例外.
4K2dQ|;dnuf}0
7NPOgeL8o02. windows 环境:
}*O#@ j+X\*Xv0查了 Platform. Guide 10g Release 2 (10.2) for Microsoft Windows (32-Bit)(没查64-bit)
q)?r%P!o t;P-QUC,V0
;GA-I4\4l4N'KS0To create and populate a password file:
-].CdM2q |.r01. Create a password file with the Password Utility: ITPUB个人空间^KuRL@9g*N*P
C:> orapwd FILE=PWDsid.ora PASSWORD=password ENTRIES=max_users ITPUB个人空间\zngA)Vk6[nj~
where
$L6J`^8~hV ^S0¦ FILE specifies the password filename. ITPUB个人空间;n3k#a7KHFa
¦ SID identifies the database instance. ITPUB个人空间!P5wr)C$T7GS
¦ PASSWORD sets the password for account SYS.
HK7JI5RG#H;X$WD,s*~0¦ ENTRIES sets maximum number of entries in password file. This corresponds
/@s0z1Cg R6t x#^0to maximum number of distinct users allowed to connect to the database ITPUB个人空间p%lF]e9mAM~
simultaneously with either the SYSDBA or the SYSOPER DBA privilege. ITPUB个人空间R#VY_zZ(u |+I'r
ITPUB个人空间&tN)Bo W,M2m
2. Set initialization parameter file parameter REMOTE_LOGIN_PASSWORDFILE to ITPUB个人空间%L5fN)_8no._
exclusive, shared, or none.
2c"r`} OY~,O0
E@GRKYFy)s0In search of the password file, Oracle Database looks in the registryfor the value of parameter
"a8U6x;Z%fD0 ORA_SID_PWFILE. If no value is specified, then it looks in the registry for the ITPUB个人空间t-H }C-i,K R0]
value of parameter ORA_PWFILE, which points to a file containing usernames,
o8Jhmqw Cd0passwords, and privileges. If that is not set, then it uses the default:
2Ba:\!?K4i0 ORACLE_BASEORACLE_HOMEDATABASEPWDsid.ORA. ITPUB个人空间k*Ne}3V y
The default value is shared. ITPUB个人空间0[ o+];h;B7q

8M{yP$Q3` R q3om0?"p0请注意黑体字, windows 环境中, 很大的部分是基于 registry 中变量 ora_sid_pwfile 或者 ora_pwfile 的设置, 缺省的值, 正如paulyibinyi兄弟指出的, 是 pwd<SID>.ora (unix中是没有这个.ora后缀的). ITPUB个人空间,|t2K+O V0wT
 
总结下密码文件命名方法
'KYV H%?)y5ot}mOZ0 linux下orapw+实例名
;k[T8O+HYQ\;\I0windows下pwd+实例名
 
 
 
另一篇文章也总结了一下关于sqlplus登录设置参数的问题:
(1)REMOTE_LOGIN_PASSWORDFILE=none且SQLNET.AUTHENTICATION_SERVICES= none:
oracle安装用户本地sqlplus “/ as sysdba”无法登录
非oracle安装用户本机sqlplus “sys/change_on_install as sysdba”无法登录
非oracle安装用户远程sqlplus “/ as sysdba_on_install@sid as sysdba”无法登录
(2)REMOTE_LOGIN_PASSWORDFILE=exclusive且SQLNET.AUTHENTICATION_SERVICES= none:
oracle安装用户本地sqlplus “/ as sysdba”无法登录
非oracle安装用户本机sqlplus “sys/change_on_install as sysdba”能登录
非oracle安装用户远程sqlplus “/ as sysdba_on_install@sid as sysdba”能登录
(3)REMOTE_LOGIN_PASSWORDFILE=none且SQLNET.AUTHENTICATION_SERVICES= (NTS):
oracle安装用户本地sqlplus “/ as sysdba”能登录
非oracle安装用户本机sqlplus “sys/change_on_install as sysdba”无法登录
非oracle安装用户远程sqlplus “/ as sysdba_on_install@sid as sysdba”无法登录
(4)REMOTE_LOGIN_PASSWORDFILE=exclusive且SQLNET.AUTHENTICATION_SERVICES= (NTS):
oracle安装用户本地sqlplus “/ as sysdba”能登录
非oracle安装用户本机sqlplus “sys/change_on_install as sysdba”能登录
非oracle安装用户远程sqlplus “/ as sysdba_on_install@sid as sysdba”能登录
 
 
问题的结果终有因,慢慢摸,索其源!

你可能感兴趣的:(File,password,grant,Missing,Failed:,ORA-01994:)