ORA-01031: insufficient privileges


在一次清理过程中将sys用户的密码文件清除了

也就是$ORACLE_HOME/dbs/orapw($ORACLE_SID)文件弄没了


然后登录的时候出现了

ORA-01031: insufficient privileges


SQL> connect / as sysdba
Connected.
SQL> show parameter service_name

NAME          TYPE     VALUE
------------------------------------ ----------- ------------------------------
service_names          string     caitest
SQL> connect sys/cai@caitest as sysdba
ERROR:
ORA-01031: insufficient privileges


Warning: You are no longer connected to ORACLE.


然后进行陪查了一圈也没看出来有什么错误system登录也没问题

SQL> show parameter remote;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode         string     TIMESTAMP
remote_listener              string
remote_login_passwordfile         string     EXCLUSIVE
remote_os_authent             boolean     FALSE
remote_os_roles              boolean     FALSE
result_cache_remote_expiration         integer     0

然后查sys用户的密码文件

[oracle@oracle ~]$ ll $ORACLE_HOME/dbs/orapw*

ls: /oracle/software/dbs/orapw*: No such file or directory

看来是被删了

创建之用orapwd命令

[oracle@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@oracle ~]$ cd $ORACLE_HOME/dbs/

[oracle@oracle dbs]$ orapwd file=orapwtest password=cai entries=8   #file选项是文件名命名一般为orapw(sid)命名 我的sid是test 所以文件命名为orapwtest

                                                                                                                               #password选项是密码

                                                                                                                               #entries选项是这个密码文件中存放多少个类似于sys这样的dba用户(重复)
SQL> grant sysdba to SYS;

Grant succeeded.

SQL> select * from v$pwfile_users;

USERNAME               SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS                   TRUE  TRUE  FALSE

SQL> !
[oracle@oracle dbs]$ exit
exit

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


在用密码登录:

[oracle@oracle dbs]$ sqlplus "sys/cai@caitest as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 30 02:58:26 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

成功连接


##################################

迷途小运维随笔

作者:john

转载请注明出处

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值