如何检查用户是否在表空间上有配额

Aym*_*dou 5 oracle

我的目标是检查表空间上的用户配额:

不幸的是,该表dba_ts_quotas提供了表空间上已使用空间的详细信息。

我想查看所有在 tbs 上有配额的用户,即使他们不使用表空间上的任何空间。

有没有解决方案来检查用户是否在 tbs 上有配额?

a_h*_*ame 7

DBA_TS_QUOTAS 还包含有关分配配额的信息,即使用户没有创建任何表。

从手册

MAX_BYTES - 用户的配额(以字节为单位),如果没有限制则为 -1

例子:

SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 18 10:35:29 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select tablespace_name, username, bytes, max_bytes
  2  from dba_ts_quotas
  3  where tablespace_name = 'USERS'
  4    and username = 'FOOBAR';

no rows selected

SQL> create user foobar
  2    identified by welcome
  3    default tablespace users
  4    quota 10M on users;

User created.

SQL> select tablespace_name, username, bytes, max_bytes
  2  from dba_ts_quotas
  3  where tablespace_name = 'USERS'
  4    and username = 'FOOBAR';

TABLE USERNA      BYTES  MAX_BYTES
----- ------ ---------- ----------
USERS FOOBAR          0   10485760

1 row selected.

SQL>
Run Code Online (Sandbox Code Playgroud)