3 个解决方案
#1
物化视图在8i里似乎是叫snapshot的,后来才改名materialized view
#2
那么到底从哪个表能查出来最近一次刷新的时间呢
#3
==========================================
创建物化试图(快照)
==========================================
刷新类型:FAST REFRESH
Create Materialized View
Fast Refresh CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
BUILD IMMEDIATE
REFRESH <FAST | FORCE> ON <COMMIT | DEMAND>
AS (<SQL statement>);
-- create refresh log first
CREATE MATERIALIZED VIEW mv_simple
TABLESPACE data_sml
BUILD IMMEDIATE
REFRESH FAST ON COMMIT AS
SELECT *
FROM servers;
SELECT name, table_name, updatable, refresh_method,
refresh_mode
FROM user_snapshots;
set long 10000
SELECT name, query
FROM user_snapshots;
SELECT name, last_refresh
FROM user_mview_refresh_times;
刷新类型:Complete Refresh
CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
REFRESH <COMPLETE | FORCE>
START WITH <date>
NEXT <date_calculation>
[FOR UPDATE]
AS (<SQL statement>);
CREATE MATERIALIZED VIEW mv_complex
TABLESPACE data_sml
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1
AS SELECT s.srvr_id, i.installstatus, COUNT(*)
FROM servers s, serv_inst i
WHERE s.srvr_id = i.srvr_id
GROUP BY s.srvr_id, i.installstatus;
SELECT name, table_name, updatable, refresh_method
FROM user_snapshots;
SELECT name, table_name,
refresh_method
FROM user_snapshots;
col next format a30
SELECT name, type, next, start_with, refresh_group
FROM user_snapshots;
col query format a50
SELECT name, query, status
FROM user_snapshots;
创建物化试图(快照)
==========================================
刷新类型:FAST REFRESH
Create Materialized View
Fast Refresh CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
BUILD IMMEDIATE
REFRESH <FAST | FORCE> ON <COMMIT | DEMAND>
AS (<SQL statement>);
-- create refresh log first
CREATE MATERIALIZED VIEW mv_simple
TABLESPACE data_sml
BUILD IMMEDIATE
REFRESH FAST ON COMMIT AS
SELECT *
FROM servers;
SELECT name, table_name, updatable, refresh_method,
refresh_mode
FROM user_snapshots;
set long 10000
SELECT name, query
FROM user_snapshots;
SELECT name, last_refresh
FROM user_mview_refresh_times;
刷新类型:Complete Refresh
CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
REFRESH <COMPLETE | FORCE>
START WITH <date>
NEXT <date_calculation>
[FOR UPDATE]
AS (<SQL statement>);
CREATE MATERIALIZED VIEW mv_complex
TABLESPACE data_sml
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1
AS SELECT s.srvr_id, i.installstatus, COUNT(*)
FROM servers s, serv_inst i
WHERE s.srvr_id = i.srvr_id
GROUP BY s.srvr_id, i.installstatus;
SELECT name, table_name, updatable, refresh_method
FROM user_snapshots;
SELECT name, table_name,
refresh_method
FROM user_snapshots;
col next format a30
SELECT name, type, next, start_with, refresh_group
FROM user_snapshots;
col query format a50
SELECT name, query, status
FROM user_snapshots;
#1
物化视图在8i里似乎是叫snapshot的,后来才改名materialized view
#2
那么到底从哪个表能查出来最近一次刷新的时间呢
#3
==========================================
创建物化试图(快照)
==========================================
刷新类型:FAST REFRESH
Create Materialized View
Fast Refresh CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
BUILD IMMEDIATE
REFRESH <FAST | FORCE> ON <COMMIT | DEMAND>
AS (<SQL statement>);
-- create refresh log first
CREATE MATERIALIZED VIEW mv_simple
TABLESPACE data_sml
BUILD IMMEDIATE
REFRESH FAST ON COMMIT AS
SELECT *
FROM servers;
SELECT name, table_name, updatable, refresh_method,
refresh_mode
FROM user_snapshots;
set long 10000
SELECT name, query
FROM user_snapshots;
SELECT name, last_refresh
FROM user_mview_refresh_times;
刷新类型:Complete Refresh
CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
REFRESH <COMPLETE | FORCE>
START WITH <date>
NEXT <date_calculation>
[FOR UPDATE]
AS (<SQL statement>);
CREATE MATERIALIZED VIEW mv_complex
TABLESPACE data_sml
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1
AS SELECT s.srvr_id, i.installstatus, COUNT(*)
FROM servers s, serv_inst i
WHERE s.srvr_id = i.srvr_id
GROUP BY s.srvr_id, i.installstatus;
SELECT name, table_name, updatable, refresh_method
FROM user_snapshots;
SELECT name, table_name,
refresh_method
FROM user_snapshots;
col next format a30
SELECT name, type, next, start_with, refresh_group
FROM user_snapshots;
col query format a50
SELECT name, query, status
FROM user_snapshots;
创建物化试图(快照)
==========================================
刷新类型:FAST REFRESH
Create Materialized View
Fast Refresh CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
BUILD IMMEDIATE
REFRESH <FAST | FORCE> ON <COMMIT | DEMAND>
AS (<SQL statement>);
-- create refresh log first
CREATE MATERIALIZED VIEW mv_simple
TABLESPACE data_sml
BUILD IMMEDIATE
REFRESH FAST ON COMMIT AS
SELECT *
FROM servers;
SELECT name, table_name, updatable, refresh_method,
refresh_mode
FROM user_snapshots;
set long 10000
SELECT name, query
FROM user_snapshots;
SELECT name, last_refresh
FROM user_mview_refresh_times;
刷新类型:Complete Refresh
CREATE MATERIALIZED VIEW <schema.name>
PCTFREE <integer>
PCTUSED <integer>
TABLESPACE <tablespace_name>
REFRESH <COMPLETE | FORCE>
START WITH <date>
NEXT <date_calculation>
[FOR UPDATE]
AS (<SQL statement>);
CREATE MATERIALIZED VIEW mv_complex
TABLESPACE data_sml
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1
AS SELECT s.srvr_id, i.installstatus, COUNT(*)
FROM servers s, serv_inst i
WHERE s.srvr_id = i.srvr_id
GROUP BY s.srvr_id, i.installstatus;
SELECT name, table_name, updatable, refresh_method
FROM user_snapshots;
SELECT name, table_name,
refresh_method
FROM user_snapshots;
col next format a30
SELECT name, type, next, start_with, refresh_group
FROM user_snapshots;
col query format a50
SELECT name, query, status
FROM user_snapshots;