Oracle 视图 V$TABLESPACE 官方解释,作用,如何使用详细说明

本站中文解释

V$TABLESPACE,也叫做“表空间视图”,是Oracle数据库中的一个系统视图,它包含了当前实例上每个表空间的当前信息,以及表空间、段和文件的详细信息。它常用来检查表空间和文件的当前状态以及检查表空间使用情况等。

V$TABLESPACE的使用方法:

1. 查看表空间的信息:

SELECT ts.tablespace_name,
ts.status,
tf.file_name,
tf.bytes / 1024 / 1024 文件大小,
tf.autoextensible,
tf.maxbytes / 1024 / 1024 最大文件大小
FROM v$tablespace ts, v$datafile tf
WHERE ts.ts# = tf.ts#;

2. 查询表空间的使用情况:

SELECT ts.tablespace_name,
ts.contents,
ts.extent_management,
ts.allocation_type,
df.bytes / 1024 / 1024 空间大小,
nvl(sum(dfs.bytes) / 1024 / 1024, 0) 已使用,
nvl(sbts.bytes / 1024 / 1024, 0) 空闲空间
FROM v$tablespace ts, v$datafile df, v$tablespace_usage_metrics dfs, v$sort_segment sbts
WHERE ts.ts# = df.ts#
AND dfs.tablespace_id (+) = df.ts#
AND sbts.tablespace_id (+) = df.ts#
AND dfs.tablespace_name (+) = ts.tablespace_name
GROUP BY ts.tablespace_name, ts.contents, ts.extent_management, ts.allocation_type, df.bytes, nvl(sbts.bytes, 0);

官方英文解释

V$TABLESPACE displays tablespace information from the control file.

Column Datatype Description

TS#

NUMBER

Tablespace number

NAME

VARCHAR2(30)

Tablespace name

INCLUDED_IN_DATABASE_BACKUP

VARCHAR2(3)

Indicates whether the tablespace is included in full database backups using the BACKUP DATABASE RMAN command (YES) or not (NO); NO only if the CONFIGURE EXCLUDE RMAN command was used for this tablespace

BIGFILE

VARCHAR2(3)

Indicates whether the tablespace is a bigfile tablespace (YES) or a smallfile tablespace (NO)

FLASHBACK_ON

VARCHAR2(3)

Indicates whether the tablespace participates in FLASHBACK DATABASE operations (YES) or not (NO)

ENCRYPT_IN_BACKUP

VARCHAR2(3)

Indicates whether encryption is turned ON or off at the tablespace level:

  • ON – Encryption is turned ON at the tablespace level

  • OFF – Encryption is turned OFF at the tablespace level

  • NULL – Encryption is neither explicitly turned on nor off at the tablespace level (default or when cleared)

CON_ID

NUMBER

The ID of the container to which the data pertains. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data


数据运维技术 » Oracle 视图 V$TABLESPACE 官方解释,作用,如何使用详细说明