如何在每天下午 5 点刷新的 Oracle EBS 12.2 中创建物化视图

How to create a materialized view in Oracle EBS 12.2 that refreshed daily at 5PM

我正在尝试在已编辑的 Oracle E-Business Suite 12.2 安装上的 11g Oracle 数据库中的 xxcus 自定义模式中创建实体化视图。我想从 xxcus 模式上的 Oracle Apex 安装以及通过数据库 link 访问这个物化视图。 Oracle 建议数据库 link 使用它们自己的名为 xxcus_ro.

的模式

对于 EBS,您必须根据 Oracle 支持文档 ID 1577661.1 以特殊方式创建物化视图。首先你创建一个视图:

create or replace view apps.xxar_invoice_totals_mv# as       
   select rctv.trx_number invoice_number,
          rctv.rac_bill_to_customer_name,
          rctv.rac_bill_to_customer_num,
          sum(rctla.extended_amount) invoice_total
   from   apps.ra_customer_trx_v       rctv,
          ar.ra_customer_trx_lines_all rctla
   where  rctla.customer_trx_id = rctv.customer_trx_id
   group  by rctv.trx_number,
          rctv.rac_bill_to_customer_name,
          rctv.rac_bill_to_customer_num;

然后您 运行 exec ad_zd_mview.upgrade('APPS', 'XXAR_INVOICE_TOTALS_MV') 按照 Oracle EBS 希望的创建方式创建物化视图。

虽然这有效并创建了实体化视图,但它创建的视图使用 REFRESH FORCE ON DEMAND 并且 ad_zd_mview.upgrade 没有参数来指定刷新间隔。 Doc ID 1577661.1 也没有提及任何关于刷新的内容。

我在找到有关文档 ID 1577661.1 之前想要创建的原始物化视图:

create materialized view xxcus.xxar_invoice_totals_mv as
tablespace APPS_TS_TX_DATA
pctused    40
pctfree    10
initrans   2
maxtrans   255
storage    (
            initial          40k
            next             40k
            minextents       1
            maxextents       unlimited
            pctincrease      0
            freelists        1
            freelist groups  1
            buffer_pool      default
           )
nocache
logging
noparallel
build immediate
refresh complete
start with to_date('7-Sep-2020 10:25:00','dd-mon-yyyy hh24:mi:ss')
next to_date(to_char(sysdate+1,'yyyy-mon-dd')||' 20:10','yyyy-mon-dd HH24:MI')
as
select rctv.trx_number invoice_number,
       rctv.rac_bill_to_customer_name,
       rctv.rac_bill_to_customer_num,
       sum(rctla.extended_amount) invoice_total
from   apps.ra_customer_trx_v       rctv,
       ar.ra_customer_trx_lines_all rctla
where  rctla.customer_trx_id = rctv.customer_trx_id
group  by rctv.trx_number,
       rctv.rac_bill_to_customer_name,
       rctv.rac_bill_to_customer_num;

如何在 EBS 12.2 中创建一个每天早上 5 点刷新的物化视图?

试试这个:

ALTER MATERIALIZED VIEW XXAR_INVOICE_TOTALS_MV
 REFRESH COMPLETE
 NEXT TRUNC(SYSDATE) + 5;

除非您对实体化视图没有以下限制:

https://docs.oracle.com/cd/E11882_01/server.112/e25554/basicmv.htm#i1007007