在PLSQL中授予UTL_HTTP权限 [英] Grant UTL_HTTP permission in PLSQL
问题描述
我想从我的函数中的某个网页获取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 declared
I 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?
推荐答案
- 以
SYS AS SYSDBA
身份登录. - 执行
grant execute on sys.utl_http to "Database";
请勿使用任何方括号!
- Log on as
SYS AS SYSDBA
. - 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密码
- 以管理员身份运行
cmd.exe
. -
cd
到您的${ORACLE_HOME}/database
. - 在此处找到
PWDsomething.ora
文件(其中something
将是您的实例名称),然后将其名称复制到剪贴板中. - 运行
orapwd file=PWDsomething.ora password=SomePasswordOfMine force=y
,其中PWDsomething.ora
将替换为步骤3中的文件名,而SomePasswordOfMine
必须替换为您想要的密码.
- Run
cmd.exe
as administrator. cd
to your${ORACLE_HOME}/database
.- Find the
PWDsomething.ora
file there (wheresomething
will be your instance name), copy its name (into clipboard). - Run
orapwd file=PWDsomething.ora password=SomePasswordOfMine force=y
, wherePWDsomething.ora
will be replaced with the file name from the step 3 andSomePasswordOfMine
must be replaced by whatever password you wish to have.
这可能有用.
这篇关于在PLSQL中授予UTL_HTTP权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!