Home >Database >Oracle >How to check the table space corresponding to the user in Oracle

How to check the table space corresponding to the user in Oracle

hzc
hzcOriginal
2020-06-16 14:51:2210462browse

How to check the table space corresponding to the user in Oracle

#How does oracle check the table space corresponding to the user?

Query users

View all users in the database, provided that you have an account with dba authority, such as sys, system:

select * from dba_users;

View all users you can manage:

select * from all_users;

View current user information:

select * from user_users;

Query the table space corresponding to the user:

select username,default_tablespace from dba_users;

Specify the table space for the user:

alter user user name default tablespace table space name;

Specify the temporary table space for the user:

alter user user name temporary tablespace table space name;

Delete user:

drop user user name cascade;

Delete Table space:

drop tablespace table space name including contents and datafiles cascade constraint;

Path to find workspace:

select * from dba_data_files;

Oracle Check the size and usage of the table space sql statement

Query the name and size of the table space (copy as it is, do not change)

SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;

Check the name and size of the physical file in the table space (copy it as it is, do not change it)

SELECT tablespace_name,file_id,file_name,
round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files ORDER BY tablespace_name;

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to check the table space corresponding to the user in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn