y********o 发帖数: 2565 | 1 MySQL里面有不同的databases, 比如你可以 show databases 得到一个数据库名称列表
。在Oracle里面与此相对应的是叫做tablespace吗?
假设我是DBA, 对数据库myTestDB有绝对权限。我想创建几个其他用户,让他们对
myTestDB只有read only权限。
我这样试了一下:
create user johndoe
default tablespace myTestDB
identified by thepassword
temporary tablespace temp;
然后我说
grant create session to johndoe;
grant select on myjunktable to johndoe;
grant select on anotherjunktable to johndoe;
结果不对,好像johndoe被另立门户成了一个独立的database。瞧:
SQL> desc myjunktable;
ERROR:
ORA-04043: object myjunktable does not exist
看 |
f********t 发帖数: 74 | 2 I don't think you understand tablespace correctly. tablespaces are used to
organize the datafiles. One datafile can belong to only one tablespace,
while a tablespace can have many datafiles. It is one of the logic structure of the database. A tablespace is not a database and it is not eual to schema either.
You can make a tablespace read only by using ALTER TABLESPACE command.
If you have not created myjunktable, it does not exist for sure.
CREATE USER command should work fine. |
y********o 发帖数: 2565 | 3 Thanks and yes, I don't know what exactly tablespace is.
Also, I am only interested in creating users who have read only permissions
on all tables. I am not interested in creating read-only tables/datafiles/
tablespaces per se.
Can you share some of your wisdom please? |
f********t 发帖数: 74 | 4 Select is an object privilege.
Just grant the privilege to the users, your grant command should work. |
f********t 发帖数: 74 | 5 1. assume user A created myjunktable
2. user A, or SYSDBA, or other users who have been granted select privilege
with grant option on this table can grant the select privilege to other
users
3. put schema in the grant command like
GRANT SELECT ON A.myjunktable to johndoe;
4. test it by using SELECT command after you login as johndoe
good luck |
y********o 发帖数: 2565 | 6
privilege
Thank. Looks like it works now. I followed your instruction.
But johndoe would have to explicitly prefix myjunktable with the schema as
shown below:
select * from A.myjunktable; ---- (1)
In other words, if johndoe issues this:
select * from myjunktable; ----- (2)
Oracle complains that table or view does not exist (ORA-00942).
So, there is no way that (2) would work for johndoe, given this situation,
right? It'll work only if johndoe has a table called myjunktable, am I right
【在 f********t 的大作中提到】 : 1. assume user A created myjunktable : 2. user A, or SYSDBA, or other users who have been granted select privilege : with grant option on this table can grant the select privilege to other : users : 3. put schema in the grant command like : GRANT SELECT ON A.myjunktable to johndoe; : 4. test it by using SELECT command after you login as johndoe : good luck
|
f********t 发帖数: 74 | 7 You are right. you have to specify the schema. myjunktable belong to schema
A. |
y********o 发帖数: 2565 | 8 OK, got it. Thanks.
schema
【在 f********t 的大作中提到】 : You are right. you have to specify the schema. myjunktable belong to schema : A.
|