我是Oracle DB的新手,我真的不确定应该为用户设置什么样的特权,以便他可以执行基本命令,例如创建,删除,删除,插入,更新,选择表。
实际上,我已经为用户帐户设置了所有这些特权。 但是在运行迁移时,它失败,并在控制台窗口中显示以下错误:
2019-05-27 08:29:07.837809线程ID:1(ERROR)OracleRelationalCommand.Execute():Oracle.ManagedDataAccess.Client.OracleException(0x80004005):ORA-01031:权限不足 ORA-06512:在第2行 在OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32&cursorId,布尔bThrowArrayBindRelatedErrors,SqlStatementType sqlStatementType,Int32 arrayBindCount,OracleException&exceptionForArrayBindDML,布尔&hasMoreRowsInDB,布尔bFirstIterationDone)中 在OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText,OracleParameterCollection paramColl,CommandType commandType,OracleConnectionImpl connectionImpl,Int32 longFetchSize,Int64 clientInitialLOBFS,OracleDependencyImpl orclDependencyImpl,Int64 []&scnFromExecution,Oracle Parameter,&ActionBind ,布尔值isFromEF) 在Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery() 在Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.Execute处(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个参数值) Oracle.ManagedDataAccess.Client.OracleException(0x80004005):ORA-01031:权限不足 ORA-06512:在第2行 在OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32&cursorId,布尔bThrowArrayBindRelatedErrors,SqlStatementType sqlStatementType,Int32 arrayBindCount,OracleException&exceptionForArrayBindDML,布尔&hasMoreRowsInDB,布尔bFirstIterationDone)中 在OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText,OracleParameterCollection paramColl,CommandType commandType,OracleConnectionImpl connectionImpl,Int32 longFetchSize,Int64 clientInitialLOBFS,OracleDependencyImpl orclDependencyImpl,Int64 []&scnFromExecution,Oracle Parameter,&ActionBind ,布尔值isFromEF) 在Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery() 在Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.Execute处(IRelationalConnection连接,DbCommandMethod executeMethod,IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary
2个参数值) 在Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands,IRelationalConnection连接) 在Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) 在Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration,String contextType) 在Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action操作) ORA-01031:权限不足 ORA-06512:在第2行
因此,这里涉及的sql命令看起来是BEGIN EXECUTE IMMEDIATE …
。我不太确定应该设置哪种特权才能成功执行。您能否看一下上面的错误信息,以给我一些建议来为我的用户帐户正确设置特权?
谢谢!
PS:显示我已设置的所有特权的屏幕截图:
答案 0 :(得分:0)
看起来CREATE TABLE
特权只有在要创建的表不包含任何自动递增的主键时才可以使用吗?
在我看来,这还远远不够,并且我尝试添加另外2个特权(肯定但不十分清楚是哪个欺骗或两者都起作用):CREATE CLUSTER
和CREATE SEQUENCE
。
看起来在创建表时,它需要首先创建一些序列(用于标识列)或为主键创建集群...
实际上,我只是尝试在RESOURCE
角色中查找特定用户所缺少的任何可能的特权,并且发现了上面提到的两种最可能的特权。
现在可以正常工作,可以创建所有表了:)阻止了我大约1天的时间(当然并不总是专注于此,而是真正地等待并思考原因)。