Allowing a users to select from a table

前端 未结 1 1215
迷失自我
迷失自我 2021-01-27 12:26

The emp table does exist for cis605 and I want to assign permissions to user. Any ideas to what I am doing wrong?

SQL> grant select on emp to user;

     G         


        
1条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-27 13:05

    In the first case it doesn't work because you need to either:

    1. Reference the table name including the schema it's in. i.e.

      SELECT * FROM schema.EMP;

    OR
    2. Create a [public] synonym in order to be able to "see" the table without including the schema in every SQL statement.


    In the second case you're trying to reference the schema, but getting the wrong one. The EMP table is typically found in the SCOTT schema, not SYSTEM. Though in your case maybe you need to do:

    grant select on cis605.emp to chap7;
    

    Also, having a user called "USER" is a bad idea - it's an Oracle keyword. (Though I guess this may just be for the purposes of example)

    0 讨论(0)
提交回复
热议问题