有没有办法检查数据是否曾经存在于 Oracle 中的表中?
使用闪回选项,我们可以检查数据as of timestamp sysdate - x
(其中 x 是我们希望查看过去数据的时间)
但我想知道 Oracle 是否提供了任何功能或实用程序,以便我们可以知道过去 1 周内某个表中是否存在某个特定数据或其他什么。
有时,闪回恢复区 (FRA) 已满,Oracle DBA 想知道它在使用什么、大小和占用者列表(存档、RMAN 备份片段或映像副本、闪回日志)。
兼容性:Oracle 12c、11g、10g
-- Utilisation (MB) du FRA
set lines 100
col name format a60
select
name,
floor(space_limit / 1024 / 1024) "Size MB",
ceil(space_used / 1024 / 1024) "Used MB"
from v$recovery_file_dest;
-- FRA Occupants
SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE;
-- Location and size of the FRA
show parameter db_recovery_file_dest
-- Size, used, Reclaimable
SELECT
ROUND((A.SPACE_LIMIT / 1024 / 1024 / 1024), 2) AS FLASH_IN_GB,
ROUND((A.SPACE_USED / 1024 / 1024 / 1024), 2) AS FLASH_USED_IN_GB,
ROUND((A.SPACE_RECLAIMABLE / 1024 / 1024 / 1024), 2) AS FLASH_RECLAIMABLE_GB,
SUM(B.PERCENT_SPACE_USED) AS PERCENT_OF_SPACE_USED
FROM
V$RECOVERY_FILE_DEST A,
V$FLASH_RECOVERY_AREA_USAGE B
GROUP BY
SPACE_LIMIT,
SPACE_USED ,
SPACE_RECLAIMABLE ;
-- After that you can resize the FRA with:
-- ALTER SYSTEM SET db_recovery_file_dest_size=xxG;
-- Or change the FRA to a new location (new archives will be created to this new location):
-- ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='/u....';
以下语句将闪回时间从默认的 1 天更改为 2 天:
SQL> 改变系统设置 db_flashback_retention_target = 2880;