首页 > 其他分享 >19c 闪回的局限性能

19c 闪回的局限性能

时间:2023-01-04 14:57:36浏览次数:40  
标签:闪回 dba INTERVAL 局限性 common flashback data 19c view

###sample 1     db_flashback_retention_target 保留时间

 

 3、配置闪回保留时间

SQL> show parameter db_flashback_retention_target

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_flashback_retention_target integer 1440

db_flashback_retention_target参数用来控制flashback log 数据保留的时间,默认值是1440,单位是minute,即24小时。
————————————————
版权声明:本文为CSDN博主「酷毙的我啊」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_35578748/article/details/113090463

 

select * from flashback_transaction_query a where a.table_name='DEPT';

附注:interval用法

Oracle语法:

INTERVAL '{ integer | integer time_expr | time_expr }' { { DAY | HOUR | MINUTE } [ ( leading_precision ) ] | SECOND [ ( leading_precision

[, fractional_seconds_precision ] ) ] } [ TO { DAY | HOUR | MINUTE | SECOND [ (fractional_seconds_precision) ] } ]

leading_precision值的范围是0到9, 默认是2. time_expr的格式为:HH[:MI[:SS[.n]]] or MI[:SS[.n]] or SS[.n], n表示微秒.

该类型与INTERVAL YEAR TO MONTH有很多相似的地方,建议先看INTERVAL YEAR TO MONTH再看该文.

INTERVAL '20' DAY - INTERVAL '240' HOUR = INTERVAL '10-0' DAY TO SECOND

表示: 20天 - 240小时 = 10天0秒

INTERVAL '30.12345' SECOND(2,4)

表示: 30.1235秒, 因为该地方秒的后面精度设置为4, 要进行四舍五入.

查询tableA中10分钟前的数据(闪回查询,前提:undo没有被覆盖..如果undo被覆盖,查询会失败)

Select * From table dept As Of Timestamp (systimestamp - Interval '10' minute);
————————————————
版权声明:本文为CSDN博主「酷毙的我啊」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_35578748/article/details/113090463

 

 

###sample 2 只能在cdb 级别查询 dba_resource , pdb 查询dba_resource  会报告没有权限的报错,即便授权了

SQL> grant select on dba_source to dba;

SQL> grant select on dba_source to dba container=all;

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.

SYMPTOMS

When using flash back query it works on a custom user table, but when querying dba_source or all_source it returns the current data not matter what timestamp or SCN is used.

The problem happens in CDB/PDB Multitenant environment

The problem does not happen in non-CDB environment.

Also the issue does not happen for normal tables (user tables) even in Multitenant environment. So the problem exists for SQLs using dictionary views in PDB.

There isn't any restriction for flashback queries in CDB/PDB after restriction was lifted from 12.1.0.2.

In CDB, the plan goes for base tables than the extended data link.

CAUSE

The problem happens with the extended data link table used for accessing dictionary views (DBA_/ALL_) from PDB.

The flashback is not enabled for extended data link tables for dictionary views when accessed from PDBs. This is due to some limitation.
 

When it is executed from CDB, all base tables like USER$ etc are accessed and flashback is enabled for that and gives expected results as of timestamp or SCN.

 

SOLUTION

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

Disabling the common data view mechanism gives the expected output for the SQL using DBA_SOURCE from PDB.
alter session set "_common_data_view_enabled"=false;

Note: You can also use hint as below to disable common data view.

i.e.

SELECT /*+ opt_param('_common_data_view_enabled','false') */ COUNT(*)
FROM DBA_SOURCE AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '10' MINUTE)
WHERE OWNER='<Owner_Name>' and NAME= '<Package_Name>' and type = 'PACKAGE BODY'
ORDER BY LINE;     PDB 级别


PDB 级别这样查询,修改参数

alter session set "_common_data_view_enabled"=false;

SELECT /*+ opt_param('_common_data_view_enabled','false') */ COUNT(*)
FROM DBA_SOURCE AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1440' MINUTE)
where owner = 'IG' and name = 'PR_EAST_INIT' and type = 'PACKAGE BODY'
ORDER BY LINE;


SQL>
SELECT /*+ opt_param('_common_data_view_enabled','false') */ COUNT(*)
FROM DBA_SOURCE AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1440' MINUTE)
where owner = 'IG' and name = 'PR_EAST_INIT' and type = 'PACKAGE BODY'
4 ORDER BY LINE;

COUNT(*)
----------
0

SQL> select text from dba_source as of timestamp to_timestamp('2022-12-05 11:30:00', 'YYYY-MM-DD HH24:MI:SS') where owner = 'IGR' and name = 'PR_' order by line;
select text from dba_source as of timestamp to_timestamp('2022-12-05 11:30:00', 'YYYY-MM-DD HH24:MI:SS') where owner = 'IGRSVISE' and name = 'PR_' order by line
*
ERROR at line 1:
ORA-08180: no snapshot found based on specified time

 

标签:闪回,dba,INTERVAL,局限性,common,flashback,data,19c,view
From: https://www.cnblogs.com/feiyun8616/p/17024788.html

相关文章

  • [Oracle19C 数据库管理] dbca silent创建数据库
    创建的数据库的GlobalDatabaseName是CDBTEST,实例名字是CDBTEST.多租户CDB,带一个PDB叫做PDB1.带有范例数据库hr。字符集AL32UTF8。实例对应的LISTENER是LISTENER1......
  • Oracle使用闪回恢复表数据
    1、先去回收站看看相关数据的信息select*fromuser_recyclebin2、确认后使用闪回来恢复表数据flashbacktable要恢复的表名tobeforedrop;如果在删除表数据后,有......
  • Oracle 19c RAC 自动应用RU补丁简明版
    环境:OracleRAC(GI19.3+DB19.3)本文应用补丁信息,19.16RU:p34130714_190000_Linux-x86-64.zip本文主要演示使用opatchauto自动应用补丁的过程。1.更新OPatch......
  • Oracle19C windows安装部署
    1、解压安装包WINDOWS.X64_193000_db_home.zip2、双机setup.exe文件。服务器先决条件检查点击关闭。数据库监听配置数据库初始化设置......
  • 运用ogg实现oracle 10g到19c schema级别的同步
    文档课题:运用ogg实现oracle10g到19cschema级别的同步.源端:192.168.133.108数据库oracle10.2.0.464位,实例名:orcl目标端:192.168.133.109数据库oracle19.16.0.0......
  • 公有镜像仓库的优势和局限性
    ​公有镜像仓库是指暴露在互联网、可以从互联网的任意位置拉取镜像的镜像仓库,比如docker.io、quay.io等熟知的公有镜像仓库,企业可以通过公有镜像仓库优缺点对比来拉取合适的......
  • 公有镜像仓库的优势和局限性
     公有镜像仓库是指暴露在互联网、可以从互联网的任意位置拉取镜像的镜像仓库,比如docker.io、quay.io等熟知的公有镜像仓库,企业可以通过公有镜像仓库优缺点对比来拉取合适......
  • Kotlin 和 Java 泛型的局限性、泛型擦除、星投影
    Hi大家好,我是DHL。公众号:ByteCode,专注分享有趣硬核原创内容,Kotlin、Jetpack、性能优化、系统源码、算法及数据结构、动画、大厂面经全文分为视频版和文字版,文字版:文......
  • 运用ogg实现oracle 10g到19c的单表迁移
    文档课题:运用ogg实现oracle10g到19c的单表迁移.核心思想:利用导入导出初始化数据后通过OGG同步增量数据.源端:192.168.133.108数据库oracle10.2.0.464位,实例名:orcl目......
  • 运用ogg迁移oracle 11g到19c
    文档课题:运用ogg迁移oracle11g到19c.核心思想:利用数据泵导入导出功能初始化数据后通过OGG同步增量数据.源端:192.168.133.103数据库oracle11.2.0.464位,实例名:orcl目......