oracle - Result of the V$tablespace is confusing-
问题描述
Lately, I am checking the information about tablespaces for that I executed a query on v$tablespace. Everything is understandable except two things that confuse me –</p>
First the column TS# according to the documentation this column shows “Number of Tablespaces” I don’t understand what that means – I only have 5 tablespaces but it does not correspond to that. What numbers it is showing?
Second, the query repeating the names of tablespaces, I don’t understand why? By the way, I am connected to my database using the “Sys” user through “CDB$ROOT” database. The query I am using
SELECT * FROM v$database;
Here is the result that it returns
解决方案
首先是 TS# 列 .... 它显示的是什么数字?
它是表空间的 ID。
我通过“CDB$ROOT”数据库使用“Sys”用户连接到我的数据库。
这是关键点:您将看到有关为所有数据库容器定义的表空间的信息。
如果您以 SYSTEM 用户的身份连接了一个特定的可插入数据库,那么您在 V$TABLESPACE 上的查询中只会看到五行。
查询重复表空间的名称,我不明白为什么
答案在于 CON_ID 的值。让我们解码它,看看结果告诉我们什么:
select ts.*
,case
when ts.con_id = 0 then 'CDB'
when ts.con_id = 1 then 'Root'
when ts.con_id = 2 then 'Seed'
else 'PDB' end as scope
from v$tablespace ts
order by ts.con_id
,ts.ts#
/
输出
TS# NAME INC BIG FLA ENC CON_ID SCOP
---------- ------------------------------ --- --- --- --- ---------- ----
0 SYSTEM YES NO YES 1 Root
1 SYSAUX YES NO YES 1 Root
2 UNDOTBS1 YES NO YES 1 Root
3 TEMP NO NO YES 1 Root
4 USERS YES NO YES 1 Root
0 SYSTEM YES NO YES 2 Seed
1 SYSAUX YES NO YES 2 Seed
2 UNDOTBS1 YES NO YES 2 Seed
3 TEMP NO NO YES 2 Seed
0 SYSTEM YES NO YES 3 PDB
1 SYSAUX YES NO YES 3 PDB
2 UNDOTBS1 YES NO YES 3 PDB
3 TEMP NO NO YES 3 PDB
5 USERS YES NO YES 3 PDB
这一切都包含在文档中。了解更多。
推荐阅读
- javascript - 更好的时间复杂度总是转化为更快的运行时间吗?
- pine-script - TradingView 不计算并显示 MFI 指标的正确值
- ios - LLVM:如何使用 __sanitizer_cov_trace_pc_guard_init 通过 Clang 获取符号名称?
- apache-spark-sql - 如何使用 Spark SQL 将数据写入 BigQuery?
- flutter - Chromebook 上的颤振
- javascript - 如何将 axios.get 中的值传递到 tagify 白名单中?
- reactjs - ApexCharts 将类转换为功能组件
- css - wikisource 书籍的对齐方式
- nginx - 奇怪的 nginx 错误:400 客户端过早关闭连接
- reactjs - 反应引导选项卡组件呈现所有选项卡