How can you query the tablespace corresponding to a user using Oracle?

To inquire about the corresponding tablespace for a user, you can utilize the following SQL statement:

SELECT username, default_tablespace
FROM dba_users
WHERE username = 'your_username';

Replace “your_username” with the username you want to query. This statement will return the default tablespace for the specified username. If you want to query the default tablespace for all users, you can omit the WHERE clause.

Additionally, you can use the following SQL statement to query all the table spaces owned by the user:

SELECT username, tablespace_name
FROM dba_tablespaces
WHERE username = 'your_username';

Similarly, replace “your_username” with the username you want to query. This statement will return all tablespaces owned by the specified username. To query tablespaces for all users, you can omit the WHERE clause.

bannerAds