Oracle案例02——ORA-12034: "SCOTT"."USER_TABLE" 上的實體化視圖日誌比上次刷新後的內容新

来源:https://www.cnblogs.com/rangle/archive/2018/02/28/8480394.html
-Advertisement-
Play Games

最近同事在交接工作時,發現有幾個schedule job沒有執行成功,我這邊給看了下,其中一個是由於資料庫遷移,調用dblink的host主機IP在tnsnames中沒有變更導致,還有一個是無法視圖的報錯,即報錯信息如下: 一、錯誤日誌 通過查看schedual job報錯日誌,具體報錯信息如下 O ...


最近同事在交接工作時,發現有幾個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、全量刷新物化視圖

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • Apache是世界使用排名第一的Web伺服器軟體。它可以運行在幾乎所有廣泛使用的電腦平臺上,由於其跨平臺和安全性被廣泛使用,是最流行的Web伺服器端軟體之一。快速、可靠並且可通過簡單的API擴充,將Perl/Python等解釋器編譯到伺服器中。 特點: 功能強大、配置簡單、速度快、應用廣泛、性能穩 ...
  • 最近看自旋鎖的實現,自選鎖的迴圈查找鎖的主要實現類似如下,該實現使用到了內嵌的彙編(摘自sanos內核,源代碼有2處實現,一處使用intel彙編,是沒有問題的,另一處使用內嵌彙編語法,源代碼中為cmpxchgl %2, %0,是錯誤的,應該是cmpxchgl %0, %2) 內嵌彙編有個固定格式,如 ...
  • firewall-cmd:防火牆設置的命令行工具。 語法:firewall-cmd [OPTIONS...] 常見選項: -h:列印幫助信息; -V:列印版本信息; -q:退出,不用列印狀態信息。 狀態選項: --state:檢查防火牆進程是否激活有效。如果有效,返回0值;否則返回非0值。 --re ...
  • 如何在CentOS 7上部署Google BBR 本文章搬運自 https://www.vultr.com/docs/how-to-deploy-google-bbr-on-centos-7 【註:文章當時使用的內核版本是4.9.0 而目前是4.15.6(4.15版本高於4.9)】 步驟 1: 使用 ...
  • 錯誤1. ERROR: child process failed, exited with error number 100 可能原因: 1.沒有正確關閉服務 2.服務已經啟動 3.conf文件的參數配置錯誤。 錯誤2. "errmsg" : "not authorized on admin to ...
  • 一、概述 MongoDB複製群集支持節點故障自動切換,最小配置應包含3個節點,正常情況下應該至少包含兩個數據節點,第三個節點可以是數據節點也可以是仲裁節點。仲裁節點的作用是當出現偶數節點導致無法仲裁的時候參與進來進行投票使之變成奇數個投票點,仲裁節點可以看成是不包含任何數據集的副本節點。仲裁節點並不 ...
  • 來源地址:https://baike.baidu.com/item/NoSQL/8828247?fr=aladdin NoSQL,泛指非關係型的資料庫。隨著互聯網web2.0網站的興起,傳統的關係資料庫在應付web2.0網站,特別是超大規模和高併發的SNS類型的web2.0純動態網站已經顯得力不從心 ...
  • Window XP系統上安裝Oracle Database 10G,在Mac系統上使用Navicat遠程連接oracle資料庫(不需要安裝oracle客戶端,Navicat 11 已經集成了該客戶端) ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...