- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
4#
发表于 2012-4-11 19:14:58
ODM TEST:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
select * from v$version;
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> drop user test;
User dropped.
SQL>
SQL>
SQL> create user test identified by test default tablespace users;
grant connect,resource to test;
User created.
SQL> alter user test quota 100M on users;
Grant succeeded.
SQL>
User altered.
SQL> SELECT
2 username,
3 tablespace_name,
4 privilege
5 FROM (
6 SELECT
7 grantee username, 'Any Tablespace' tablespace_name, privilege
8 FROM (
9 -- first get the users with direct grants
10 SELECT
11 p1.grantee grantee, privilege
12 FROM
13 dba_sys_privs p1
14 WHERE
15 p1.privilege='UNLIMITED TABLESPACE'
16 UNION ALL
17 -- and then the ones with UNLIMITED TABLESPACE through a role...
18 SELECT
19 r3.grantee, granted_role privilege
20 FROM
21 dba_role_privs r3
22 START WITH r3.granted_role IN (
23 SELECT
24 DISTINCT p4.grantee
25 FROM
26 dba_role_privs r4, dba_sys_privs p4
27 WHERE
28 r4.granted_role=p4.grantee
29 AND p4.privilege = 'UNLIMITED TABLESPACE')
30 CONNECT BY PRIOR grantee = granted_role)
31 -- we just whant to see the users not the roles
32 WHERE grantee IN (SELECT username FROM dba_users) OR grantee = 'PUBLIC'
33 UNION ALL
34 -- list the user with unimited quota on a dedicated tablespace
35 SELECT
36 username,tablespace_name,'DBA_TS_QUOTA' privilege
37 FROM
38 dba_ts_quotas
39 WHERE
40 max_bytes = -1 )
41 WHERE tablespace_name LIKE UPPER('SYSTEM')
42 OR tablespace_name = 'Any Tablespace'
43 and username='TEST';
USERNAME TABLESPACE_NAME PRIVILEGE
------------------------------ ------------------------------ ----------------------------------------
TEST Any Tablespace UNLIMITED TABLESPACE
conn test/test
SQL> select * from session_privs;
PRIVILEGE
----------------------------------------
CREATE SESSION
UNLIMITED TABLESPACE
CREATE TABLE
CREATE CLUSTER
CREATE SEQUENCE
CREATE PROCEDURE
CREATE TRIGGER
CREATE TYPE
CREATE OPERATOR
CREATE INDEXTYPE
10 rows selected.
conn / as sysdba
SQL> revoke UNLIMITED TABLESPACE from test;
Revoke succeeded.
conn test/test
SQL> select * from session_privs;
PRIVILEGE
----------------------------------------
CREATE SESSION
CREATE TABLE
CREATE CLUSTER
CREATE SEQUENCE
CREATE PROCEDURE
CREATE TRIGGER
CREATE TYPE
CREATE OPERATOR
CREATE INDEXTYPE
9 rows selected
SQL> create table tv(t1 int) tablespace sysaux;
Table created.
SQL> insert into tv values(1);
insert into tv values(1)
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'SYSAUX'
conn / as sysdba
SQL> alter system set deferred_segment_creation=FALSE;
System altered.
conn test/test
SQL> create table tvs(t1 int) tablespace sysaux;
create table tvs(t1 int) tablespace sysaux
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'SYSAUX' |
|