最近,我将 Oracle 数据库从一台机器复制到另一台机器。
- 原文:Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
- 副本:Oracle 数据库 11g 快捷版 11.2.0.2.0 版 - 生产 由于某种原因,以下查询适用于原始版本,但不适用于副本。
如果 t.tdt_id 被查询工作取代组中的 tdt_id (根据 td_tablespaces t )
有人可以解释为什么会这样,以及它是否与安装有关。两者的数据完全相同。
SELECT
tdt_name as "name",
tdt_contents as "Content",
tdt_status as "Status",
round(( subsize.SubSize_MB ), 2 ) as "size used",
round(( sum( MaxMB ) - subsize.SubSize_MB ), 2 ) as "size free"
FROM
td_tablespaces t
INNER JOIN
(
SELECT
tdt_id,
CASE
WHEN upper( d.df_autoextend ) = 'YES' THEN round(( sum( df_maxsize ) / 1024 ), 2 )
WHEN upper( d.df_autoextend ) = 'NO' THEN round(( Sum( df_size ) / 1024 ), 2 )
END as MaxMB
FROM
td_datafiles d
GROUP BY
tdt_id,
d.df_autoextend,
df_maxsize,
df_size
) sub
ON
t.tdt_id = sub.tdt_id
INNER JOIN
(
SELECT
tdt_id,
sum( df_size / 1024 ) -( df_free / 1024 ) SubSize_MB,
df_free / 1024 SubSize_Free
FROM
td_datafiles df
GROUP BY
tdt_id,
df_free
) subsize
ON
t.tdt_id = subsize.tdt_id
WHERE
ins_id = 2096
GROUP BY
tdt_id,
tdt_name,
tdt_contents,
tdt_status,
subsize.SubSize_MB,
SubSize_Free
ORDER BY tdt_contents