ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORA-01031 insufficient privileges

ORA-01031 insufficient privileges

原创 Linux操作系统 作者:lyf625 时间:2010-11-15 16:24:48 0 删除 编辑
SQL> conn sys/xxxdb@xxxdb as sysdba
ERROR:
ORA-01031: insufficient privileges

原因:没有密码文件
orapwd

oracle@standby:~/product/10.2/db_1/network/admin> oerr ora 1031
01031, 00000, "insufficient privileges"
// *Cause: An attempt was made to change the current username or password
//         without the appropriate privilege. This error also occurs if
//         attempting to install a database without the necessary operating
//         system privileges.
//         When Trusted Oracle is configure in DBMS MAC, this error may occur
//         if the user was granted the necessary privilege at a higher label
//         than the current login.
// *Action: Ask the database administrator to perform. the operation or grant
//          the required privileges.
//          For Trusted Oracle users getting this error although granted the
//          the appropriate privilege at a higher label, ask the database
//          administrator to regrant the privilege at the appropriate label.
oracle@standby:~/product/10.2/db_1/network/admin>


SQL> conn / as sysdba
Connected.
SQL> show parameter remot

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_archive_enable                string      true
remote_dependencies_mode             string      TIMESTAMP
remote_listener                      string
remote_login_passwordfile            string      EXCLUSIVE
remote_os_authent                    boolean     FALSE
remote_os_roles                      boolean     FALSE
SQL>


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

SQL> grant dba to sys;

Grant succeeded.

SQL> select * from session_roles;

no rows selected


oracle@standby:~/product/10.2/db_1/dbs> orapwd
Usage: orapwd file= password= entries= force= nosysdba=

  where
    file - name of password file (mand),
    password - password for SYS (mand),
    entries - maximum number of distinct DBA,
    force - whether to overwrite existing file (opt),
    nosysdba - whether to shut out the SYSDBA logon (opt for Database Vault only).
  There are no spaces around the equal-to (=) character.
 
 下面通过ORAPWD工具新建一个密码文件,指定一个新的密码:

$ cd $ORACLE_HOME/dbs
 
$ orapwd file=orapwbjtest password=newpasswd entries=100

其中password用来设置SYS用户密码,而entries表示密码文件中可以保存多少条记录。
需要注意,这个值并不是一个确切的数量,真正可以保存的记录数可能会有所出入,这和1个操作系统块能保存多少条记录有关系。

 


 
oracle@standby:~/product/10.2/db_1/dbs>orapwd file=orapwxxxdb password=xxxdb  
oracle@standby:~/product/10.2/db_1/dbs> cat orapwxxxdb
]\[ZORACLE Remote Password fileNTERNAD0830AC0E3C3D9D2SYS163AF67D38AAF55Foracle@standby:~/product/10.2/db_1/dbs>

SQL>conn sys/xxxdb@xxxdb as sysdba
Connected.

参看:http://yangtingkun.itpub.net/post/468/482002
http://www.comp.dit.ie/btierney/oracle11gdoc/server.111/b28310/dba007.htm

Example

The following command creates a password file namedorapworclthat allows up to 30 privileged users with different passwords.

orapwdFILE=orapworcl ENTRIES=30

ORAPWDCommand Line Argument Descriptions

The following sections describe theORAPWDcommand line arguments

下面我遇到的ORA-01031错误密码文件权限引起的):

db_Standby-> sqlplus sys/lyf625@master_db as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 12 09:24:40 2010

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

ERROR:
ORA-01031: insufficient privileges

db_master-> orapwd file=orapwtest password=lyf625 entries=10 force=y;

OPW-00001: Unable to open password-file
db_master-> pwd
/u01/app/oracle/product/10.2.0/db_1/dbs
db_master-> ls -l
total 7016
-rw-rw----  1 oracle oinstall    1170 Nov 15 09:39 ab_+ASM.dat
-rw-rw----  1 oracle oinstall    1544 Oct 25 11:34 hc_+ASM.dat
-rw-rw----  1 oracle oinstall    1544 Oct 25 11:34 hc_test.dat
-rw-r-----  1 oracle oinstall   12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall    8385 Sep 11  1998 init.ora
-rw-r-----  1 oracle oinstall    1430 Nov 12 14:40 inittest.ora
-rw-rw----  1 oracle oinstall      24 Oct 25 11:34 lk+ASM
-rw-rw----  1 oracle oinstall      24 Nov 12 14:44 lkMASTER
-rw-rw----  1 oracle oinstall      24 Oct 25 11:34 lkTEST
-rw-r-----  1 oracle oinstall    1536 Oct 25 11:34 orapw+ASM
-rw-r--r--  1 root   root        1536 Oct 25 12:09 orapwtest
-rw-r-----  1 oracle oinstall 7094272 Nov 12 08:00 snapcf_test.f
-rw-r-----  1 oracle oinstall    1536 Oct 25 11:34 spfile+ASM.ora
-rw-r-----  1 oracle oinstall    3584 Nov 15 11:51 spfiletest.ora
-rw-r-----  1 oracle oinstall    2560 Nov 12 12:01 spfiletest.ora.bak
db_master-> su - root
[root@db_master ~]# cd /u01/app/oracle/product/10.2.0/db_1/dbs
[root@db_master dbs]# chown -R oracle:oinstall ./orapwtest
[root@db_master dbs]# ls -l
total 7016
-rw-rw----  1 oracle oinstall    1170 Nov 15 09:39 ab_+ASM.dat
-rw-rw----  1 oracle oinstall    1544 Oct 25 11:34 hc_+ASM.dat
-rw-rw----  1 oracle oinstall    1544 Oct 25 11:34 hc_test.dat
-rw-r-----  1 oracle oinstall   12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall    8385 Sep 11  1998 init.ora
-rw-r-----  1 oracle oinstall    1430 Nov 12 14:40 inittest.ora
-rw-rw----  1 oracle oinstall      24 Oct 25 11:34 lk+ASM
-rw-rw----  1 oracle oinstall      24 Nov 12 14:44 lkMASTER
-rw-rw----  1 oracle oinstall      24 Oct 25 11:34 lkTEST
-rw-r-----  1 oracle oinstall    1536 Oct 25 11:34 orapw+ASM
-rw-r--r--  1 oracle oinstall    1536 Oct 25 12:09 orapwtest
-rw-r-----  1 oracle oinstall 7094272 Nov 12 08:00 snapcf_test.f
-rw-r-----  1 oracle oinstall    1536 Oct 25 11:34 spfile+ASM.ora
-rw-r-----  1 oracle oinstall    3584 Nov 15 11:51 spfiletest.ora
-rw-r-----  1 oracle oinstall    2560 Nov 12 12:01 spfiletest.ora.bak

db_Standby-> sqlplus sys/lyf625@master_db as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 12 10:06:51 2010

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>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13024285/viewspace-678146/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-03-06

  • 博文量
    41
  • 访问量
    57165