Question

I have an oracle database (DB1) which, via a db-link to DB2, refreshes materialized views every midnight using a scheduled JOB.

The refresh of the MVs occurs ussing a procedure which runs over every table name in a schema and refreshed each table, one by one.

Recently, there have been electricity issues where DB2 is stationed. If DB2 is offline whilst DB1 starts its job the materialized views on DB1 become empty. Why does the refresh not simply fail if there is no connection? How can I stop this from happening?

Thanks in advance

Was it helpful?

Solution

Are you sure that the refresh process isn't erroring out (in which case the error would be written to the alert log)?

Are you doing complete refreshes? Or incremental refreshes? Are you doing atomic refreshes? Or non-atomic refreshes? My guess is that you are doing a complete, non-atomic refresh (which, behind the scenes, means that you are doing a TRUNCATE and direct-path INSERT) where the TRUNCATE succeeds but the direct-path INSERT fails. You could do a complete, atomic refresh instead which would be doing a DELETE and INSERT. This will, however, be slower than a non-atomic refresh when the remote database is available and it will generate more REDO. Or, potentially, you could do an incremental refresh instead but that would, at a minimum, require that materialized view logs are created on the remote database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top