由于权限不足,无法迁移Oracle数据库(最初创建表)?

2nc8po8w  于 2023-06-22  发布在  Oracle
关注(0)|答案(1)|浏览(179)

我是Oracle DB的新手,真的不确定我应该为用户设置什么样的特权,以便他们可以执行基本命令,如创建,删除,插入,更新,选择表。
我已经为我的用户帐户设置了所有这些权限。但是在运行migrate时,它失败了,并在控制台窗口中显示以下错误:
2019 - 05 - 27 08:29:07.837809 ThreadID:1(ERROR)OracleRelationalCommand. Execute():异常(0x80004005):ORA-01031:权限不足ORA-06512:在OracleInternal的第2行。服务对象。OracleConnectionImpl.验证执行(Int32 & cursorId,Boolean bThrowArrayBindRelatedErrors,SqlStatementType sqlStatementType,Int32 arrayBindCount,OracleException & exceptionForArrayBindDML,Boolean & hasMoreRowsInDB,Boolean bFirstIterationDone)。服务对象。OracleCommandImpl. ExecuteNonQuery(String commandText,OracleParameterCollection paramColl,CommandType commandType,OracleConnectionImpl connectionImpl,Int32 longFetchSize,Int64 clientInitialLOBFS,OracleDependencyImpl或clDependencyImpl、Int64 []& scnFromExecution、OracleParameterCollection & bindByPositionParamColl、Boolean & bBindParamPresent、OracleException & exceptionForArrayBindDML,OracleConnection connection,OracleLogicalTransaction & oracleLogicalTransaction,Boolean isFromEF)。ManagedDataAccess。客户。OracleCommand。ExecuteNonQuery()在Oracle中。EntityFrameworkCore.储藏室内部。OracleRelationalCommandBuilderFactory。OracleRelationalCommandBuilder。OracleRelationalCommand。执行(IRelationalConnection连接,DbCommandMethod executeMethod,IReadOnlyDictionary 2 parameterValues) Failed executing DbCommand (292ms) [Parameters=[], CommandType='Text', CommandTimeout='0'] BEGIN EXECUTE IMMEDIATE 'CREATE TABLE "CUSTOMER" ( "Id" NUMBER(10) GENERATED BY DEFAULT ON NULL AS IDENTITY NOT NULL, ... )'; END; 2019-05-27 08:29:07.842817 ThreadID:1 (ERROR) OracleRelationalCommand.Execute() : Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-01031: insufficient privileges ORA-06512: at line 2 at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone) at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, Boolean isFromEF) at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery() at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary 2 parameterValues)Oracle。ManagedDataAccess。客户。异常(0x80004005):ORA-01031:权限不足ORA-06512:在OracleInternal的第2行。服务对象。OracleConnectionImpl.验证执行(Int32 & cursorId,Boolean bThrowArrayBindRelatedErrors,SqlStatementType sqlStatementType,Int32 arrayBindCount,OracleException & exceptionForArrayBindDML,Boolean & hasMoreRowsInDB,Boolean bFirstIterationDone)。服务对象。OracleCommandImpl. ExecuteNonQuery(String commandText,OracleParameterCollection paramColl,CommandType commandType,OracleConnectionImpl connectionImpl,Int32 longFetchSize,Int64 clientInitialLOBFS,OracleDependencyImpl或clDependencyImpl、Int64 []& scnFromExecution、OracleParameterCollection & bindByPositionParamColl、Boolean & bBindParamPresent、OracleException & exceptionForArrayBindDML,OracleConnection connection,OracleLogicalTransaction & oracleLogicalTransaction,Boolean isFromEF)。ManagedDataAccess。客户。OracleCommand。ExecuteNonQuery()在Oracle中。EntityFrameworkCore.储藏室内部。OracleRelationalCommandBuilderFactory。OracleRelationalCommandBuilder。OracleRelationalCommand。在Microsoft上执行(IRelationalConnection连接,DbCommandMethod executeMethod,IReadOnlyDictionary 2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary 2 parameterValues)。EntityFrameworkCore.移民。内部。MigrationCommandExecutor。Microsoft的ExecuteNonQuery(IEnumerable1 migrationCommands,IRelationalConnection connection)。EntityFrameworkCore.移民。内部。移民Microsoft上的Migrate(String targetMigration)。EntityFrameworkCore.设计。内部。迁移操作。Microsoft的UpdateDatabase(String targetMigration,String contextType)。EntityFrameworkCore.设计。OperationExecutor。OperationBase。执行(措施)ORA-01031:权限不足ORA-06512:在2号线 所以看起来这里涉及的SQL命令是BEGIN EXECUTE IMMEDIATE …`。我不太确定应该设置什么样的特权才能成功执行。根据上面的错误信息,我如何为我的用户帐户正确设置权限?
PS:截图显示我设置的所有权限:

apeeds0o

apeeds0o1#

看起来CREATE TABLE特权只有在要创建的表不包含任何自动递增的主键时才有效。
在我的情况下,这真的不够,我已经尝试添加2个特权(当然,但不知道是哪一个还是两个都有):CREATE CLUSTERCREATE SEQUENCE。看起来在创建我的表时,它需要先创建一些序列(对于标识列)或为主键创建集群...
实际上,我只是尝试在RESOURCE角色中查找我的特定用户缺少的任何可能的特权,我发现了上面提到的2个最可能的特权。
它现在工作得很好,所有的表都可以创建得很好:)阻止我大约1天(当然不是总是专注于它,而是真正等待和思考原因)。

相关问题