我设立utPL/SQL我的Oracle数据库,一切似乎正确安装,但是当我尝试运行基本的测试运行,它会得到一个错误:ORA-04047: object specified is incompatible with the flag specified
utPLSQL安装 - 执行ut.run()时出现ORA-04047错误;
问题
有了一个基本的创建空的测试包,我跑行begin ut.run(); end;
这使我有以下错误:
Error starting at line : 1 in command -
BEGIN ut.run(); END;
Error report -
ORA-04047: object specified is incompatible with the flag specified
ORA-06512: at "UNIT_TEST_REPOS.UT_RUNNER", line 88
ORA-06512: at "UNIT_TEST_REPOS.UT_RUNNER", line 112
ORA-06512: at "UNIT_TEST_REPOS.UT", line 292
ORA-06512: at "UNIT_TEST_REPOS.UT", line 267
ORA-06512: at line 1
04047. 00000 - "object specified is incompatible with the flag specified"
*Cause: The object type implied by the flag does not match the type
of object specified.
*Action: Specify the correct object, or use the appropriate flag
应该发生的是,它说以下内容:
Between string function
Finished in .451423 seconds
0 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)
我做了什么:
- 使用the installation guide here,我跑了Windows脚本,通过执行
create_utplsql_owner.sql
创建的测试用户的模式,执行install.sql
脚本,执行create_synonyms_and_grants_for_public.sql
。这些都是安装指南要求执行的所有脚本。一切似乎都奏效了 - 我没有看到任何错误。 (双重检查了install.log文件 - 没有错误)。 在getting started tutorial为utPLSQL文档,我已经创建了(大部分是空的)测试包,正如在标题说明创建测试包
create or replace package test_betwnstr as -- %suite(Between string function) end;
语境
我与Oracle合作经验有限。在digging around之后,我得到了更多可能导致错误的上下文 - 它似乎可能与冲突的名称有关,但我没有看到哪些名称会冲突。再次,这只是从一个全新的utPLSQL安装,所以它似乎有些东西是错误配置,但我不知道是什么...
我看了其他问题,但他们有关不足用户权限..我用管理员帐户(称为CORE)运行脚本。 utPL/SQL的
版本:3.0.2
的Oracle版本:11.2
更新1
我看着那个错误指向,我看到的UT代码行代码在“UNIT_TEST_REPOS.UT”,第267行是以下内容:ut.run(ut_varchar2_list(sys_context('userenv', 'current_schema')), a_reporter, a_color_console, a_coverage_schemes, a_source_file_mappings, a_test_file_mappings, a_include_objects, a_exclude_objects);
所以看起来有什么不对user environment
或current-schema
设置?我查找了那些(SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER') FROM DUAL;
)的值,并且它返回了CORE - 我用来安装脚本的sys admin用户名。
更新2
排序可以得到它的工作...当我最初运行的命令,我连我的默认用户CORE。我创建了一个新的连接作为我的UNIT_TEST_REPOS模式,然后我可以通过使用命令select ut.run() from dual;
使它“工作”,并将它作为表返回。
UNIT_TEST_REPOS.UT_VARCHAR2_ROWS('Finished in 0 seconds', '0 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)', ' ')
这个工作对我的空试验的情况,但是当我继续教程,并添加实际测试的情况下,它给了我同样的结果...
所以,通过连接为一个不同的模式,我可以没有错误地执行代码。但它不能看到其他用户的测试,所以这不是一个解决方案...
更新3
使用SQLTools而不是SQL Developer来查看数据库,并表现出更多的细节错误信息。
我也发现有关Oracle错误信息在谷歌图书Oracle数据库的秘密,它有这一段:
If a name cannot be resolved in the specified context, "ORA-06564: object object_name does not exist" is raised, where object_name is the value of the parameter NAME passed to the procedure NAME_RESOLVE. If an existing object is resolved in the wrong context, the exception "ORA-04047: object specified is incompatible with the flag specified" is thrown. (bold emphasis mine)
此外,当我试图执行测试脚本,而在在UNIT_TEST_REPOS模式,并将其显式调用测试在我的核心架构,
begin ut.run('CORE'); end;
它得到了同样的错误之前。
从本书的建议看来,听起来好像utPLSQL在其框架中使用的标志有错误。但它看起来像教程一样......
当我创建测试包时,我通常使用类似于BEGIN UTPLSQL.RUN(owner_in =>'MY_USER',testpackage_in =>'MY_UNIT_TEST_PACKAGE')的代码运行测试; END;'。请注意,我正在运行utPL/SQL的2.2版本,所以可能事情已经改变。 –
@BobJarvis我曾尝试过,但它给出了语法错误,因为我怀疑会发生。看起来,开发人员从v2完全重写了v3,因此语法发生了巨大变化。 我不认为问题是与运行()线,但与配置设置... – plasmaTonic
感谢您的这篇文章。我完全错过了utplsql进行了升级。本周最佳新闻。我已经使用2.2了大约十年了。抱歉,我无法帮助您解决问题,但我今天晚上要下载新版本。 – APC