[英]Create table on another schema
Situation is that user1 gives permision to user2: 情况是user1给user2提供了权限:
GRANT CREATE ANY TABLE, SELECT ANY TABLE TO user2;
And after logging on user2, I'm trying to create table: 登录user2后,我正在尝试创建表:
CREATE TABLE user1.test(id NUMBER PRIMARY KEY);
the result is ORA-01031 - insufficient privileges
I can create table on own schema and select tables from other schemas. 结果是
ORA-01031 - insufficient privileges
我可以在自己的模式上创建表并从其他模式中选择表。 I thought that CREATE ANY TABLE
solves the problem, but it looks other way. 我认为
CREATE ANY TABLE
解决了这个问题,但它看起来是另一种方式。 Ah, and both users have unlimited tablespace. 啊,两个用户都有无限的表空间。 What else should I guarantee?
我还能保证什么?
Perhaps you need to also grant CREATE ANY INDEX
? 也许您还需要授予
CREATE ANY INDEX
? You are creating an index when you add the primary key. 您在添加主键时创建索引。 You can quickly test this by omitting the PK constraint.
您可以通过省略PK约束来快速测试。
"create any table" is too powerful a privilege to be granting to non-DBA's. “创建任何表”对于授予非DBA来说是一种非常强大的特权。 A better approach would be to create a "create table" procedure in the target schema that accepts sanitised components of the required DDL, and grant execute privilege on that to the required users.
更好的方法是在目标模式中创建一个“创建表”过程,该过程接受所需DDL的已清理组件,并为此向所需用户授予执行权限。
A suitable interface would be something like ... 一个合适的界面就像......
create procedure
create_table(
table_name varchar2,
columns varchar2,
etc varchar2)
... so that you can ... ......这样你就可以......
begin
user1.create_table(
table_name => 'TEST',
columns => 'id NUMBER PRIMARY KEY',
etc => '');
end;
... and have the procedure construct and execute the DDL for you. ...并让程序构造并执行DDL。
用户GRANT为SCHEMA_NAME创建任何索引
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.