Oracle案例02——ORA-12034: "SCOTT"."USER_TABLE" 上的实体化视图日志比上次刷新后的内容新
最近同事在交接工作时,发现有几个schedule job没有执行成功,我这边给看了下,其中一个是由于数据库迁移,调用dblink的host主机IP在tnsnames中没有变更导致,还有一个是无法视图的报错,即报错信息如下:
一、错误日志
通过查看schedual job报错日志,具体报错信息如下
ORA-12034:"SCOTT"."USER_TABLE" 上的实体化视图日志比上次刷新后的内容新
ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2563
ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2776
ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2745
ORA-06512: 在 line 2
二、错误原因
一般出现这个错误是在刷新物化视图,方式为fast的时候会出现(ORA-12034 is a timing issue that occurs when performing a fast refresh of a materialized view.)
When a materialized view log is created for a master table, and a materialized view has been created with the REFRESH FAST option, the following timestamps will be used when validating log age.
At the materialized view site:
- Information about the last refresh time for each materialized view. The last refresh time is recorded as the timestamp when the last refresh completed successfully.
At the master table site:
- Information about the last refresh time for every materialized view using a materialized view log on that site.
The timestamps at the master site are used for two purposes:
- To maintain information concerning which rows are needed to fast refresh each individual registered materialized view.
- To maintain information concerning which rows can be purged from the materialized view log.
When a fast refresh starts, the last refresh timestamp from the materialized view site for the refreshing materialized view is compared to the oldest timestamp of ANY materialized view using the same materialized view log as the one currently being refreshed. If the oldest timestamp is newer than the materialized view site timestamp, ORA-12034 is raised. By doing this it is ensured that all changed rows since the last refresh will be refreshed, and if this can't be ensured, a complete refresh is forced. There's no exception to this behavior, and violating this main rule will result ORA-12034.
1、Dropping / recreating the materialized view log on the master table.(在主表上删除或重建物化视图日志)
If a materialized view was created at time T1 and materialized view log was created at time T2, we can't ensure that all changes made between T1 and T2 will be in the materialized view after fast refresh. Therefore complete refresh is mandatory.
2、Creating the materialized view before the materialized view log.(物化视图创建早于物化视图日志)
The explanation here is the same as in Section 2.1.
3、The previous refresh for the materialized view did not complete successfully.(之前的物化视图刷新没有成功)
When a refresh starts, the last refresh time of the materialized view is set to '01-JAN-1950'. This guarantees that if the refresh fails for any reason, then an ORA-12034 error will be signaled and a complete refresh will be forced. When the refresh succeeds, this date is updated to the proper time. If it doesn't get updated because of some failure during the refresh, the next time the refresh runs, '01-JAN-1950' is used to validate the log age.
4、 Creating a materialized view takes longer than the time it takes all other materialized views currently using the materialized view log to refresh.
If there are other materialized views using the materialized view log on the master table, and all of these other materialized views start their refreshes AFTER the new materialized view creation has started but complete their refreshes BEFORE the new materialized view creation has completed, then fast refreshes will fail with ORA-12034. Materialized view registration is based on the starting time of the creation, but as the last step of the operation. If that start time is older than the oldest timestamp currently registered, the new materialized view will not be registered. A complete refresh is required to register the materialized view, but it may not avoid the ORA-12034 error the next time a fast refresh is attempted. There are three ways to resolve this problem: - Stop the refresh of at least one other materialized view that is using the materialized view log before
creating the new one.
- In production system the previous option might not be possible. For this situation, a temporary materialized view can be created which uses the same log. If this temporary materialized view is not refreshed while the new materialized view is created, the new materialized view creation can complete successfully.
- Use deployment templates to create the materialized view environment at materialized view sites. This problem will not occur if deployment templates are used. See the Advanced Replication documentation for information about deployment templates.
5 、Certain DDL changes to the master table have been performed.
6、 Master table reorganization.
7、 Materialized view registration failed at the master site.
8、Incorrect conversion of a materialized view log from ROWID to primary key.
9、Manual deletion of sys.slog$ entry for the materialized view.
三、解决方案
1、全量刷新物化视图
exec dbms_mview.refresh('SCOTT.USER_TABLE','C');
exec dbms_mview.refresh('SCOTT.USER_TABLE');
2、调整快速舒心日志内容
select * from sys.slog$
SELECT SOWNER, VNAME, MOWNER, MASTER, to_char(SNAPTIME,'yyyy-mm-dd hh24:mi:ss') FROM SYS.SNAP_REFTIME$;
insert into sys.slog$ values('DHSH','USER_BASIC',NULL,171,NULL,to_date('2014-01-07 15:44:18','yyyy-mm-dd hh24:mi:ss'),null,null);
commit;
四、附录
1、MOS方案
Diagnosing ORA-12034 Materialized View Log Younger Than Last Refresh (文档 ID 204127.1)
(1)Error Definition and Description
Error Definition Oracle 8i and below: ORA-12034: "snapshot log on "%s"."%s" younger than last refresh"
Oracle 9i and above: ORA-12034: "materialized view log on "%s"."%s" younger than last refresh" Cause: The materialized view log was younger than the last refresh.
Action: A complete refresh is required before the next fast refresh. Note: A complete refresh can be done using the command: execute dbms_mview.refresh('"CORP"."NM_SV_RANGE"','C');
2、全量刷新物化视图
Oracle案例02——ORA-12034: "SCOTT"."USER_TABLE" 上的实体化视图日志比上次刷新后的内容新的更多相关文章
- oracle 物化视图 ORA-23413: 表 "xxx"."xx" 不带实体化视图日志
DROP materialized view log on TAB_NAME ; --不是view名,是表名 CREATE MATERIALIZED VIEW LOG ON TAB_NAME W ...
- Oracle实体化视图
1.减轻网络负担:通过MV将数据从一个数据库分发到多个不同的数据库上,通过对多个数据库访问来减轻对单个数据库的网络负担. 2.搭建分发环境:通过从一个中央数据库将数据分发到多个节点数据库,达到分发数 ...
- 上传通用化 VHD 并使用它在 Azure 中创建新 VM
本主题逐步讲解如何使用 PowerShell 将通用化 VM 的 VHD 上传到 Azure.从该 VHD 创建映像,然后从该映像创建新 VM. 可以上传从本地虚拟化工具或其他云导出的 VHD. 对新 ...
- Oracle物化视图,物化视图日志,增量刷新同步远程数据库
1.创建DBLINK -- Drop existing database link drop public database link LQPVPUB; -- Create database link ...
- Oracle数据库入门——物化视图日志结构
物化视图的快速刷新要求基本必须建立物化视图日志,这篇文章简单描述一下物化视图日志中各个字段的含义和用途. 物化视图日志的名称为MLOG$_后面跟基表的名称,如果表名的长度超过20位,则只取前20位,当 ...
- Oracle数据库入门——如何根据物化视图日志快速刷新物化视图
Oracle物化视图的快速刷新机制是通过物化视图日志完成的.Oracle如何通过一个物化视图日志就可以支持多个物化视图的快速刷新呢,本文简单的描述一下刷新的原理. 首先,看一下物化视图的结构:SQL& ...
- 案例导入和导出Scott用户
ylbtech-Oracle:案例导入和导出Scott用户 导入和导出Scott用户 1. 导出Scott用户下的所有对象返回顶部 1.1, Microsoft Windows [版本 ] 版权所有 ...
- Oracle Recovery 02 - 常规恢复之不完全恢复
背景:这里提到的常规恢复指的是数据库有完备可用的RMAN物理备份. 实验环境:RHEL6.4 + Oracle 11.2.0.4 单实例. 二.常规恢复之不完全恢复:部分数据丢失 2.1 重做日志文件 ...
- ORACLE配置tnsnames.ora文件实例
ORACLE配置tnsnames.ora文件实例客户机为了和服务器连接,必须先和服务器上的监听进程联络.ORACLE通过tnsnames.ora文件中的连接描述符来说明连接信息.一般tnsnames. ...
随机推荐
- C语言中结构体定义
struct test { int a; }; /* 定义一个结构体,名字是test,这样就可以使用struct test 来定义变量.比如 struct test a; */ typedef str ...
- JAVA学习6:用Maven创建Spring3 MVC项目
一. 环境 spring-framework-3.2.4.RELEASE jdk1.7.0_11 Maven3.0.5 eclipse-jee-juno-SR2-win32 二. ...
- 获取app应用的包名
1.获取哪个app包名,就打开哪个app 2.在dos窗口下输入: adb shell "dumpsys window | grep mCurrentFocus" 获取包名
- PHP如何判断对象为空的方法分享
1.网上很多方法分享说用empty()方法判断对象是否为空.empty()的方法介绍:格式:bool empty ( mixed var )功能:检查一个变量是否为空返回值:若变量不存在则返回 TRU ...
- Ubuntu14.04下编译安装或apt-get方式安装搭建Apache或Httpd服务(图文详解)
不多说,直接上干货! 写在前面的话 对于 在Ubuntu系统上,编译安装Apache它默认路径是在/usr/local/apache2/htdocs 或者编译安装httpd它默认路径是在/usr/lo ...
- JS的正则表达式 - RegExp
RegExp 对象 RegExp 对象表示正则表达式,它是对字符串执行模式匹配的强大工具. 正则表达式的创建方式 1.文字格式,使用方法如下: /pattern/flags (即:/模式/标记) 2 ...
- 关于80286——《x86汇编语言:从实模式到保护模式》读书笔记15
一.80286的工作模式 80286首次提出了实模式和保护模式的概念. 实模式:和8086的工作方式相同: 保护模式:提供了存储器管理机制和保护机制,支持多任务. 二.80286的寄存器 (一)通用寄 ...
- PHP中的PHP_EOL和DIRECTORY_SEPARATOR
1. PHP_EOL是php中的换行符,跨平台 1.1.换行符: unix系列用 \n windows系列用 \r\n mac用 \r PHP中可以用PHP_EOL来替代,以提高代码的源代码级可移植性 ...
- 万物智联,腾讯云 IoT 边缘计算揭秘——云+未来峰会开发者专场回顾
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 背景:现在是万物互联的时代,智能穿戴设备,智能家居,无人商业,改变了我们的生活方式.预计到2021年,全球物联网设数将达到150亿,超过手机 ...
- IE浏览器报Promise未定义
用vue-cli做的项目,用了promise,结果IE下报promise未定义,甚至在比较老的andriod手机浏览器上会显示空白页面,解决方案如下: 首先安装:babel-polyfill npm ...