5

我们希望在 Vertica 数据库中设置一个可以查看某些系统表(投影、projection_storage 和视图)的用户,但我们不希望该用户成为 dbadmin,因为我们不希望他们拥有在这些表上写权限。我尝试使用 GRANT 语句为普通用户提供对这些表的访问权限,但这似乎不起作用。每个用户只能在这些表中看到自己的记录。有没有办法像我描述的那样设置用户,还是我们需要让这个用户成为 dbadmin?

我们的用例是我们需要一个用户,该用户可以获取数据库中存在的模式列表并遍历每个模式,收集信息以存储在一个中心位置。如果我们的用户被授予使用各个模式的权限,那么他们可以获得这些模式的列表,但他们无法访问 projection_storage 和视图表中的必要记录。

谢谢!

4

5 回答 5

3

将架构授予USAGE用户或角色不足以让用户在projection_storage表中看到其投影。如果用户或角色有权SELECT访问表,则可以在 中查看这些表的投影projection_storage。我在 Vertica 7.1 中,我能够通过SELECT仅授予角色权限而不是授予单个用户 ID 来查看投影记录。

如果用户不需要访问表但需要列出模式中的表以用于某些报告目的,则一种选择是定期将内容转储projection_storage到不同的表并授予用户对该表的适当权限。

于 2014-11-13T21:32:28.573 回答
2

只是为了维护,您应该创建数据库角色!然后将这些角色的访问权限授予您的用户。否则维护对你来说将是地狱!

于 2013-05-20T22:19:57.907 回答
1

通常,我只是在模式上给用户 USAGE 。然后“GRANT SELECT on to ;”

他们对这些表有 INSERT 权限吗?

于 2012-02-29T19:03:11.033 回答
1

授予对表角色的选择访问权限,不会授予对元数据表(如 projection_storage)的完全访问权限。这似乎是一个错误。为了获得完整的访问权限,需要将选择授​​予个人用户 ID。

于 2013-06-24T11:11:34.790 回答
0

您可以按照以下步骤创建对架构具有选择权限的用户。我将举一个例子,在我的测试数据库中,我有一个模式'sid'和一个表'student_table'。

1) Login as a admin on your database .
    [dbadmin@localhost bin]$  vsql -u
    User name: dbadmin
    Password: 

2) Create the user with a password 

    dbadmin=> create user test identified by 'R';
    CREATE USER


3) Give the newly created user a Grant for the usage on the database.
    dbadmin=> Grant ALL on database vertica to test;
    GRANT PRIVILEGE

4) You can then grant the user the Usage to the schema 
    dbadmin=> Grant Usage on Schema sid to test;
    GRANT PRIVILEGE

5) Finally provide the select grant to the user on the table .
    dbadmin=> Grant select on sid.student_table to test ;
    GRANT PRIVILEGE
    dbadmin=> \q
6) Login with the new user 'test' , You will be able to access both projection storage and 
    your table sid.student_table

    [dbadmin@localhost bin]$ vsql -u
    vsql: Warning: The -u option is deprecated. Use -U.
    User name: test
    Password: 
    Welcome to vsql, the Vertica Analytic Database interactive terminal.

    test=> select * From sid.student_table;
     Student_ID | Last_name | First_Name | Class_Code |      Grade_pt      
    ------------+-----------+------------+------------+--------------------
           9999 | T_        | S%         | PG         | 98.700000000000000
    (1 row)

    test=> select * From projection_storage;
    -[ RECORD 1 ]-----------+-----------------------------------------
    node_name               | v_vertica_node0001
    projection_id           | 45035996273836526
    projection_name         | Student_Table_DBD_1_rep_tet1_v1_node0001
    projection_schema       | sid
    projection_column_count | 6
    row_count               | 9
    used_bytes              | 375
    wos_row_count           | 0
    wos_used_bytes          | 0
    ros_row_count           | 9
    ros_used_bytes          | 375
    ros_count               | 1
    anchor_table_name       | Student_Table
    anchor_table_schema     | sid
    anchor_table_id         | 45035996273756612
于 2016-12-07T04:53:35.193 回答