Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Materialized view ingenious use _ table synchronous use of materialized view method

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

After the materialized view is created, a table with the same name as the materialized view is automatically created, and two objects appear in the dba_objects, the OBJECT_TYPE is TABLE and MATERIALIZED VIEW. This object appears in both user_mviews and user_tables.

The materialized view takes up space as large as base table, but the value displayed in user_segments.segment_type is table instead of MATERIALIZED VIEW

PRESERVE TABLE Clause

This clause lets you retain the materialized view container table and its contents after the materialized view object is dropped. The resulting table has the same name as the dropped materialized view.

Reservation table clause

This clause allows you to retain the materialized view container table and its contents after the physical view object is deleted. The generated table has the same name as the deleted instantiated view.

Therefore, you can use the materialized view for table synchronization, establish an incremental refreshed materialized view for the table to be synchronized, and synchronize at a fixed time every day. If it is time to switch the materialized view to a table, you only need to manually DBMS_MVIEW.REFRESH to refresh the last bit of data and then drop materialized view MV_name PRESERVE TABLE to realize the table synchronization.

After drop materialized view MV_jobs PRESERVE TABLE, USER_MVIEWS has lost MV_jobs, but user_tables, dba_objects, dba_segments and MV_jobs,select * from MV_jobs will not make an error.

After drop materialized view MV_jobs, USER_MVIEWS, user_tables, dba_objects and dba_segments are all gone. MV_jobs,select * from MV_jobs will not report an error.

Conn hr/hr

Create materialized view MV_jobs refresh complete on demand as select * from jobs

Drop materialized view MV_jobs PRESERVE TABLE

Select * from MV_jobs;-- has a result

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report