Failed to create a materialized view log on master table - oracle

CREATE MATERIALIZED VIEW LOG ON acquisitions
TABLESPACE users
WITH PRIMARY KEY
INCLUDING NEW VALUES;
I am trying to create a materialized view log on my master table acquisition. The master table is in the same database as materialized view. I am trying to satisfy all the criteria
to reproduce commit on refresh .Creating a mv log is one of those. But I got this error:
SQL Error: ORA-00439: feature not enabled: Advanced replication
00439. 00000 - "feature not enabled: %s"
*Cause: The specified feature is not enabled.
*Action: Do not attempt to use this feature.
I am using ORACLE 11g. Is this is bug in ORACLE 11g ?

CREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID, SEQUENCE(amount_sold, time_id, prod_id)
INCLUDNG NEW VALUES; strong text
try this example ,may be it helps

Related

Permissions error encountered during Oracle materialized view creation

I am trying to create a materialized view in Oracle 19C.
The schema I'm creating it in (schema B) has CREATE TABLE and CREATE MATERIALIZED VIEW permissions and when I run the following code
create materialized view matview_info build immediate refresh on demand as select * from a.info;
it generates the view perfectly well.
However, when I drop the materialized view and then try and set it up again, but with automatic refresh through refresh fast start as follows:
CREATE MATERIALIZED VIEW matview_info BUILD IMMEDIATE REFRESH FAST START WITH (SYSDATE) NEXT ((SYSDATE) + 3/ 24) WITH ROWID ON DEMAND DISABLE QUERY REWRITE AS SELECT * FROM a.info;
I receive the following error message:
[Error] Execution (16: 25): ORA-12018: following error encountered during code generation for "B"."MATVIEW_INFO"
ORA-00942: table or view does not exist
My TOAD client indicates the error is referencing the 'a.info' table - but this is working fine when I don't include the 'fast start' part of the code. I also have set up a materialized view log on the base table.
Execution of a simple select on a.info from schema B returns data from the table. When logged in as schema A, I have given schema B select and references on a.info.
Can anyone advise please as to the cause of this ORA-00942 error and how I can potentially solve it?
Thanks

error creating materialized view in oracle - ORA-12052

good night i am trying to create a materialized view in oracle and i have the following error message. I know there are several restrictions but I can't identify what the error is. please appreciate your help.
obs:
-the update method must be incremental.
none of the tables have primary keys and I can't create them because I don't have access.
CREATE MATERIALIZED VIEW LOG ON ordenes
WITH ROWID
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON tabla_hija
WITH ROWID
INCLUDING NEW VALUES;
create materialized view vm_prueba2
refresh fast on demand
with rowid
as
select ordenid,o.empleadoid,o.clienteid,fechaorden,descuento,nvl(c.desccripcion,'')as ddesc,e.desccripcion
from ordenes o,tabla_hija c,tabla_hija e
where
( o.clienteid=c.valor(+) and c.id_tabla=1 or c.valor is null ) and
( o.empleadoid=e.valor(+) and e.id_tabla=2 or e.valor is null )order by ordenid asc;
Informe de error -
ORA-12052:
12052. 00000 - "cannot fast refresh materialized view %s.%s"
*Cause: Either ROWIDs of certain tables were missing in the definition or
the inner table of an outer join did not have UNIQUE constraints on
join columns.
*Action: Specify the FORCE or COMPLETE option. If this error is got
during creation, the materialized view definition may have be
changed. Refer to the documentation on materialized views.
"ROWIDs of certain tables were missing in the definition"
You need to include the rowids of each source table in your materialized view:
create materialized view vm_prueba2
refresh fast on demand
with rowid
as
select
o.rowid o_rowid,
c.rowid c_rowid,
e.rowid e_rowid,
ordenid,
o.empleadoid,
o.clienteid,
fechaorden,
descuento,
nvl(c.desccripcion,'') as ddesc,
e.desccripcion
from ordenes o, tabla_hija c, tabla_hija e
where
( o.clienteid=c.valor(+) and c.id_tabla=1 or c.valor is null ) and
( o.empleadoid=e.valor(+) and e.id_tabla=2 or e.valor is null );
I would also recommend not sorting your MV content, as it will add unnecessary overhead to the generation. The order of the rows stored on disk doesn't matter, and it will generate a lot of extra disk I/O while it performs the sort in the Temp tablespace.
The sort will most likely be dropped by Oracle for the refreshes anyway, as Oracle creates its own SQL automatically and only uses yours for the initial MV creation. Save your sorts for client/user queries.

Materialized view log creation

I have a materialized view on a table on remote DB using DB link.
The below query works and able to view the result.
select * from dept_owner.department#dept_link;
But getting error while trying to create a materialized view.
CREATE MATERIALIZED VIEW "ORADBA"."department" ("DEPT_NUM", "DEPT_NAME")
REFRESH FAST ON DEMAND START WITH sysdate+0 NEXT (trunc(sysdate + 1) + 5/24)
AS select DEPT_NUM,DEPT_NAME from dept_owner.department#dept_link;
Error,
ORA-23413: table "dept_owner"."department" does not have a
materialized view log
23413. 00000 - "table "%s"."%s" does not have a materialized view log"
*Cause: The fast refresh can not be performed because the master table
does not contain a materialized view log.
*Action: Use the CREATE MATERIALIZED VIEW LOG command to create a
materialized view log on the master table.
I created VIEW LOG in my DB for this view, but still getting the above error.
CREATE MATERIALIZED VIEW LOG ON "ORADBA"."DEPARTMENT" WITH ROWID EXCLUDING NEW VALUES;
I have the same materialized view on another environment with the same DB link and it works. Not sure what is missing here.
Questions:-
I have this materialized view on both the Dev DB and IT DB. IT DB materialized view is working for long time. Running into issue when creating the materialized view in Dev DB.
Do we need to create a VIEW LOG on the remote DB link DB and give grants for users from both Dev and IT DB?
Do we need to create VIEW LOG in Dev and IT DB?

SQL Error: ORA-32361

When I create real-Time Materialized Views in Oracle Database 12c Release 2 I get SQL Error: ORA-32361. What does it mean?
My view is simple, without any aggregation.
CREATE MATERIALIZED VIEW example_t_mv
REFRESH FAST ON DEMAND
ENABLE QUERY REWRITE
ENABLE ON QUERY COMPUTATION
AS
SELECT et.some_value_1, et.some_value_2
FROM example_t et WHERE et.some_value_2 < 10;
SQL Error: ORA-32361: cannot ENABLE ON QUERY COMPUTATION for the
materialized view
Create MVLog and try to create the MV
CREATE MATERIALIZED VIEW LOG ON example_t
WITH ROWID, SEQUENCE(some_value_1, some_value_2)
INCLUDING NEW VALUES;

Oracle - I can't use Materialized View's PREBUILD statement with other MV clauses

I'm trying to build a Materialized View on top of a prebuilt table. I can use the below syntax with no modifiers and it works fine.
CREATE MATERIALIZED VIEW TESTRESULT
ON PREBUILT TABLE
SELECT ...
FROM ...
WHERE ...
However, when adding extra clauses to the Materialized View, I get the error "Missing Keyword". I'm not sure what I'm missing and I can't find any documentation online in conjunnction with building on top of a prebuilt table and adding extra clauses.
CREATE MATERIALIZED VIEW TESTRESULT
NOCACHE
LOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
REFRESH FORCE ON DEMAND
WITH PRIMARY KEY
ON PREBUILT TABLE
AS
SELECT ...
FROM ...
WHERE ...
Oracle Verision : 10g
The ON PREBUILT TABLE option is not compatible with some of your options, as described in the CREATE MATERIALIZED VIEW documentation:
The CACHE, LOGGING, PARALLEL and COMPRESS are table properties inherited from the already built table and are therefore incompatible with PREBUILT.
the BUILD option is there to specify when the table must be populated. However the table is already populated since you've used the PREBUILT option, and the two options are therefore incompatible.
Also make sure you have the arguments is the right order.
The following works:
SQL> CREATE TABLE TEST(ID NUMBER PRIMARY KEY);
Table created
SQL> CREATE TABLE testresult(ID NUMBER);
Table created
SQL> CREATE MATERIALIZED VIEW TESTRESULT
2 ON PREBUILT TABLE
3 REFRESH FORCE ON DEMAND
4 WITH PRIMARY KEY
5 AS
6 SELECT ID
7 FROM TEST;
Materialized view created

Resources