在PLSQL中授予UTL_HTTP权限 [英] Grant UTL_HTTP permission in PLSQL

查看:582
本文介绍了在PLSQL中授予UTL_HTTP权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的函数中的某个网页获取HTML内容.我读过我可以用PLSQL中的UTL_HTML包来做到这一点.因此,我在项目中编写了以下代码:

I would like to get HTML content from a certain webpage in my function. I read I can do it with the UTL_HTML package in PLSQL. So I made the following code in the project:

v_webcontent := utl_http.request(v_weblink);

此处先声明了v_webconent和v_weblink.在功能中运行此命令会导致PLSQL异常:PLS-00201: identifier 'UTL_HTTP' must be declared我猜这个问题是因为该软件包不可用(通过此链接:

Here the v_webconent and v_weblink are declared earlier. running this in de function gives an PLSQL exception: PLS-00201: identifier 'UTL_HTTP' must be declaredI guess this problem is because the package isn't available (from this link: same error message).

我听从了建议.因此,我以SYSTEM角色的身份在sql developer中创建了一个新的数据库连接(SYS不起作用,它说我只能使用SYSDBA或SYSOPER登录,但两者都不会采用我在数据库中创建的标准密码).然后,我在上面的链接中输入了代码.

I followed the advice. So I created a new database connection in sql developer as the SYSTEM role (SYS didn't work, it sayd I could only logon using SYSDBA or SYSOPER but both wouldn't take the standard password I created with the database). Then I entered the code in the link above.

GRANT EXECUTE ON SYS.UTL_HTTP TO [database];

我创建的用户名为数据库".它首先给我一个没有[]方括号的错误.表格或视图不存在,因此我将其放在方括号中.现在出现错误:

The user I created is named 'Database'. It first gave me an error without the [] square brackets. Table or view does not exist so I then put the brackets around it. Now it gives error:

    Error starting at line : 1 in command -
GRANT EXECUTE ON SYS.UTL_HTTP TO [database]
Error report -
SQL Error: ORA-00987: missing or invalid username(s)
00987. 00000 -  "missing or invalid username(s)"
*Cause:    
*Action:

所以我不知道如何解决此问题. OP在上面的链接中说他还有另一个错误,因此我还检查了我是否没有同样的问题.我输入了:

So I have no idea how to fix this. In the link above OP said that he got an other error, so I also checked if I didn't have the same problem. I entered:

SELECT * FROM dba_objects WHERE object_name='UTL_HTTP'

它返回了4个条目.与所有者:SYS,SYS,PUBLIC和APEX_040000.

It returned 4 entry's. With owners: SYS, SYS, PUBLIC and APEX_040000.

有人可以帮助我吗?我需要以SYS身份登录并且使用什么密码?

Can somebody help me? Do I need to logon as SYS and with what passwords?

推荐答案

  1. SYS AS SYSDBA身份登录.
  2. 执行grant execute on sys.utl_http to "Database"; 请勿使用任何方括号!
  1. Log on as SYS AS SYSDBA.
  2. Execute grant execute on sys.utl_http to "Database"; Do not use any square brackets!

应该可以.

咨询意见:请勿将数据库用户命名为数据库".

Piece of advice: Do not name your DB user 'Database'.

要重置您的SYS密码

  1. 以管理员身份运行cmd.exe.
  2. cd到您的${ORACLE_HOME}/database.
  3. 在此处找到PWDsomething.ora文件(其中something将是您的实例名称),然后将其名称复制到剪贴板中.
  4. 运行orapwd file=PWDsomething.ora password=SomePasswordOfMine force=y,其中PWDsomething.ora将替换为步骤3中的文件名,而SomePasswordOfMine必须替换为您想要的密码.
  1. Run cmd.exe as administrator.
  2. cd to your ${ORACLE_HOME}/database.
  3. Find the PWDsomething.ora file there (where something will be your instance name), copy its name (into clipboard).
  4. Run orapwd file=PWDsomething.ora password=SomePasswordOfMine force=y, where PWDsomething.ora will be replaced with the file name from the step 3 and SomePasswordOfMine must be replaced by whatever password you wish to have.

这可能有用.

这篇关于在PLSQL中授予UTL_HTTP权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆