gpt4 book ai didi

hibernate - 使用Oracle 11g hibernate (严重)-权限不足

转载 作者:行者123 更新时间:2023-12-02 14:47:39 28 4
gpt4 key购买 nike

我正在使用Grails 1.3.4,后者使用了Hibernate,并且针对Oracle 11g数据库。我的应用程序启动失败,出现以下错误:

2010-11-04 09:45:34,671 INFO  [grails.spring.BeanBuilder] [RuntimeConfiguration] Configuring data source for environment: TEST 
2010-11-04 09:45:36,812 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-01031: insufficient privileges

2010-11-04 09:45:36,812 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] could not complete schema update
org.hibernate.exception.SQLGrammarException: could not get table metadata: MY_TABLE
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)

当我在Oracle中将以下内容添加到数据库用户角色时,它可以工作。但是,我的DBA在生产中表示,他不会授予ANALYZE ALL,因为在11G中不再需要它,并且这弄乱了他的统计信息。分辨率是多少?
GRANT ANALYZE ANY to APP_USER_ROLE;

以下是更多设置信息:

Grails DataSource.groovy
    dataSource {
driverClassName = "oracle.jdbc.driver.OracleDriver"
username = "APP_USER"
password = "APP_USER_PASS"
dbCreate = "update"
url = "jdbc:oracle:thin:@MY_servername:1521:MY_SCHEMANAME"
dialect="org.hibernate.dialect.Oracle10gDialect"
}
hibernate {
default_schema="WEBSYS"
}

Grails域对象使用表:
static mapping = {
table 'MY_TABLE'
id generator:'sequence',params:[sequence:'MY_SEQ']
}

Oracle用户和角色设置:
CREATE ROLE APP_USER_ROLE NOT IDENTIFIED;
GRANT QUERY REWRITE TO APP_USER_ROLE;
GRANT CREATE SESSION TO APP_USER_ROLE;
GRANT GLOBAL QUERY REWRITE TO APP_USER_ROLE;
GRANT APP_USER_ROLE TO APP_USER;
CREATE USER APP_USER
IDENTIFIED BY APP_USER_PASS
DEFAULT TABLESPACE APPL_DATA
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
GRANT APP_USER_ROLE TO APP_USER;
ALTER USER APP_USER DEFAULT ROLE ALL;
ALTER USER APP_USER QUOTA UNLIMITED ON APPL_DATA;

GRANT SELECT,UPDATE,DELETE,INSERT ON MYSCHEMA.MY_TABLE to APP_USER_ROLE;
GRANT SELECT ON MYSCHEMA.MY_SEQ to APP_USER_ROLE;

最佳答案

Grails可能需要该权限才能确定是否对未反射(reflect)在架构中的域对象进行了更改。

您是否需要grails自动更新生产模式?如果不是,请尝试删除生产环境的dbCreate = "update"

关于hibernate - 使用Oracle 11g hibernate (严重)-权限不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4099416/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com