My environment
I'm using Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Explanation of the situation
I was creating a user with the following command
create user USRPRACTICA2 identified by 1234 default tablespace users;
So ok, I assigned it a default tablespace, but I HAVEN'T SPECIFIED any quota limit. So then I went to the Oracle docs, and I read this:
By default, a user has no quota on any tablespace in the database. If the user has the privilege to create a schema object, you must assign a quota to allow the user to create objects. Minimally, assign users a quota for the default tablespace, and additional quotas for other tablespaces in which they can create objects.
So then I said well, ok! Now I want to test if this user really CAN'T create tables for example, if I didn't assigned it a quota.
Then, I granted it these privileges:
grant create session to USRPRACTICA2;
grant create table to USRPRACTICA2;
Well, now I shouldn't be able to create tables since I didn't specify a quota on the tablespace users. Let's try it.
I create a connection with USRPRACTICA2 to oracle, I try to create a table, and this is what happens:
SQL> CREATE TABLE EMP
2 (EMPNO NUMBER(4) NOT NULL,
3 ENAME VARCHAR2(10),
4 JOB VARCHAR2(9),
5 MGR NUMBER(4),
6 HIREDATE DATE,
7 SAL NUMBER(7, 2),
8 COMM NUMBER(7, 2),
9 DEPTNO NUMBER(2));
Tabla creada.
Oops! The table was created.
At this moment is when I think "well, we should now try to figure out what is the quota assigned to that user on that tablespace, maybe there's a default quota in oracle". So I tried this:
SQL> select tablespace_name, username, max_bytes
2 from dba_ts_quotas
3 where username = 'USRPRACTICA2' and TABLESPACE_NAME = 'USERS';
no rows selected
At this point I was thinking "this is a nonsense, maybe I didn't write the query properly", so I tried this:
SQL> select * from dba_ts_quotas;
TABLESPACE_NAME USERNAME BYTES MAX_BYTES BLOCKS MAX_BLO
------------------------------ -------------------------------------------------------------------------------------------------------------------------------- ---------- ---------- ----------
SYSAUX AUDSYS 655360 -1 80
SYSAUX GSMADMIN_INTERNAL 917504 -1 112
SYSAUX DBSFWUSER 0 -1 0
SYSAUX APPQOSSYS 0 -1 0
SYSAUX GGSYS 0 -1 0
SYSAUX OLAPSYS 0 -1 0
6 rows selected.
So with this information I guessed that, for sure, no quota was assigned for on users tablespace for the user that I created.
Also, I guessed that in oracle it should be stored some value with the default quota on tablespaces if you don't set one. Furthermore, that user also doesn't have unlimited space on the tablespace, because It would have appeared in that view with a "MAX_BYTES -1" value.
I browsed a lot looking for a default quota value in oracle, and all I could get is that snippet from oracle saying "If the user has the privilege to create a schema object, you must assign a quota to allow the user to create objects". But obviously like I showed here, It should be a default quota value somewhere.
To finish, I just tried another thing. If you do assign a quota value for the user like this
alter user USRPRACTICA2 quota 1M on USERS;
Now if you query the tablespace quotas, you'll find the information
SQL> select tablespace_name, username, max_bytes
2 from dba_ts_quotas
3 where username = 'USRPRACTICA2' and TABLESPACE_NAME = 'USERS';
TABLE USERNAME MAX_BYTES
----- ------------ ----------
USERS USRPRACTICA2 1048576
So my question here is...
Is there a default quota value assigned to a user in a tablespace if you don't specify it? If so, how can I show that value?