ORA-01031但如果我检查它说我有特权

时间:2016-08-14 09:15:28

标签: java sql oracle

 ALTER USER SYS succeeded.
 ALTER USER SYS succeeded.

Error starting at line 11 in command:
GRANT SYSOPER TO SYS WITH ADMIN OPTION
Error report:
SQL Error: ORA-01031: insufficient privileges
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.

Error starting at line 12 in command:
GRANT SYSDBA TO SYS WITH ADMIN OPTION
Error report:
SQL Error: ORA-01031: insufficient privileges
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.

我不明白为什么它会给我这个错误。当我在cmd检查权限时,它表示我确实拥有权限,而且一切正常。当我在SYS和HR用户管理所有内容时,会出现此错误。在这种情况下我应该怎么做,因为我在整个互联网上找到的任何东西都无法帮助我。

我确实需要此权限,因为我的java没有连接到数据库。请问任何想法!

1 个答案:

答案 0 :(得分:2)

  

ALTER USER SYS succeeded.

为什么要改变SYS用户? SYS帐户是数据库的基础。更改此帐户可能会对数据库造成奇怪的影响并干扰应用程序的运行。如果您提出Oracle支持问题,也可能会产生问题(尽管我怀疑您没有合同)。

  

GRANT SYSDBA TO SYS WITH ADMIN OPTION

重复一下,为什么要改变SYS用户?它是数据库中功能最强大的帐户,已具备所需的所有权限。

  

"我确实需要这个权限,因为我的java没有连接到数据库。"

这是否意味着您尝试使用SYS帐户将Java应用程序连接到数据库?嗯,这几乎总是一个坏主意。应用程序应该使用具有所需权限的精确权限的定制帐户,而不是具有数据库完全功能的通用帐户。 (除非您的应用程序位于一个特殊的应用程序子集中供DBA和专家用户使用,但是 - 没有违法行为 - 您的问题的性质表明您不应该构建其中一个。)

这让我觉得an XY question。 而不是试图修复(即打破)SYS帐户,如果你解决了为什么你的应用程序不能连接到数据库会更好。这就是你真正需要解决的问题。