Home > Database > Oracle > How to query the table space where the table is located in Oracle

How to query the table space where the table is located in Oracle

WBOY
Release: 2022-05-18 17:26:45
Original
25773 people have browsed it

In Oracle, you can use the select statement to query the table space where the table is located. The syntax is "select TABLESPACE_NAME from tabs where TABLE_NAME = 'uppercase table name'"; "TABLESPACE_NAME" represents the table space name.

How to query the table space where the table is located in Oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How oracle queries the table space where the table is located

The basic format of the SELECT statement is:

SELECT 要查询的列名 FROM 表名 WHERE 限制条件
Copy after login

ps: If you want to query all the contents of the table, put the columns to be queried Names are represented by an asterisk *.

The syntax for querying the table space where a table is located is:

select TABLESPACE_NAME from tabs where TABLE_NAME = 表名;
Copy after login

It should be noted that the table name needs to be in uppercase letters.

Extended knowledge:

Oracle tablespaces (tablespaces) are a logical concept. Data files are what actually store data. . An Oracle database can have one or more table spaces, and a table space corresponds to one or more physical database files.

Table space is the smallest unit for Oracle database recovery, housing many database entities, such as tables, views, indexes, clusters, rollback segments, temporary segments, etc.

oracle query all table spaces

Method 1: dba_tablespaces

select * from dba_tablespaces;
Copy after login

Method 2: v$tablespace

select * from v$tablespace;
Copy after login

Delete table space

Delete an empty table space, which does not contain physical files

DROP TABLESPACE tablespace_name;
Copy after login

Delete an empty table space, which contains physical files

DROP TABLESPACE tablespace_name INCLUDING DATAFILES;
Copy after login
Copy after login

Delete a non-empty table space, which does not contain physical files

DROP TABLESPACE tablespace_name INCLUDING DATAFILES;
Copy after login
Copy after login

Delete Non-empty table space, containing physical files

DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;
Copy after login

Recommended tutorial: "Oracle Video Tutorial"

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template