ORA-12052 when create materialized view
I following the sample in Oracle document to create materialized viewCREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID, SEQUENCE(amount_sold, time_id, prod_id) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID, SEQUENCE (time_id, calendar_year) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE (prod_id,prod_name) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,
SUM(s.amount_sold) AS sum_sales
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
GROUP BY t.calendar_year, p.prod_id, p.prod_name; This works. BUt I actually does not want do aggregation. Thus I changed the MV creation statement toCREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,s.amount_sold
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id;I got errorSQL Error: ORA-12052: cannot fast refresh materialized view GLU.SALES_MV
*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.Please help or point me to the relevant document.
Thanks
damorgan, Thank you for you reply.
the inner table of an outer join did not have UNIQUE constraints on join columns.
I am not sure how much clearer and explanation can be written.If you look at the query, you will find that there is no outer join in the query.
sales table does not have unique constraints on prod_id and time_id. If this is the cause of the problem, I cannot change the data but is there a work around. That is way I ask for specific doc. In 11g documents, I only find some info on CREATE MV. That is mainly on syntax but not on requirement.
Similar Messages
-
Error when Create Materialized View
Hi
When I tried to create MV show me error :
SQL> @CRIA_MV_ARC_BW.SQL
AND INDUSTRIAL.CD_FABRICA = SUBSTR(ARC.DS_ARC, 1, 3)
ERROR at line 88:
ORA-01031: insufficient privilegesI am using Oracle 9.02 and there are Grant for all Tablles , my query of creation is:
CREATE MATERIALIZED VIEW CLIBGF.MV_ARC_BW
NOCACHE
LOGGING
NOPARALLEL
BUILD IMMEDIATE
REFRESH FORCE
START WITH TO_DATE('26-nov-2009 02:00:00','dd-mon-yyyy hh24:mi:ss')
NEXT trunc(sysdate) + 1/12
ENABLE QUERY REWRITE
AS
SELECT MAX(NVL((SELECT DECODE(A.T$CDNG$O,'F',DECODE(TRIM(B.T$CALC$O),'S','C',A.T$CDNG$O),A.T$CDNG$O)
FROM TRITON.TTDFAT995501 A, TRITON.TTDFAT996501 B
WHERE A.T$OCOM$O + 0 = ARC.CD_UNIDADE_EXPEDIDORA
AND A.T$NDOC$O = NOTAS.CD_NOTA
AND (A.T$OCOM$O = B.T$OCOM$O AND A.T$NREF$O = B.T$NREF$O)
AND ROWNUM =1),
0)) NEGOCIO,
ARC.CD_CLIENTE CD_CLIENTE,
CLIENTE.T$NAMA DS_CLIENTE,
ARC.CD_ARC,
ARC.CD_STATUS,
ARC.CD_STATUS || ' - ' || STATUS.DS_STATUS STATUS,
TO_CHAR(ARC.DT_EMISSAO, 'DD/MM/YYYY') DT_EMISSAO,
TO_CHAR(ACAO_INV.DT_REALIZADO, 'DD/MM/YYYY') DT_REALIZADO_INVESTIGACAO,
ARC.CD_MARCA || ' - ' || MARCA.T$DSMA$O MARCA,
ARC.CD_PRODUTO CD_PRODUTO,
EMBALAGEM.T$CDAC$O || ' - ' || EMBALAGEM.T$DESC$O DS_EMBALAGEM,
SUBSTR(ARC.DS_ARC, 1, 3) CD_COMPANHIA_PRODUTORA,
ARC.CD_MOTIVO_RECLAMACAO CD_MOTIVO_RECLAMACAO,
MOTIVO.DS_ITEM DS_MOTIVO_RECLAMACAO,
DECODE(ARC.FL_PROCEDENCIA, 0, 'PROCEDENTE', 1, 'IMPROCEDENTE', ' ') PROCEDENCIA,
SUM(NVL((SELECT SUM(NVL(T$IQUA$O, 0))
FROM TRITON.TTDFAT995501 A, TRITON.TTDFAT996501 B
WHERE A.T$OCOM$O + 0 = ARC.CD_UNIDADE_EXPEDIDORA
AND A.T$NDOC$O = NOTAS.CD_NOTA
AND (A.T$OCOM$O = B.T$OCOM$O AND A.T$NREF$O = B.T$NREF$O)),
0)) NR_QUANTIDADE_VENDIDA,
ARC.NR_QUANTIDADE_AFETADA NR_QUANTIDADE_AFETADA,
ARC.NR_QUANTIDADE_AFETADA_REAL NR_QUANTIDADE_AFETADA_REAL,
DS_JUSTIFICATIVA DSJUST
FROM ARCTB_ARC ARC,
ARCTB_NOTAS NOTAS,
ARCTB_TABELA_MOTIVO MOTIVO,
ARCTB_ACAO_IMEDIATA ACAO_INV,
ARCTB_ACAO_IMEDIATA ACAO_IME,
ARCTB_STATUS STATUS,
TRITON.TTCCOM010501 CLIENTE,
TRITON.TTCCOM936501 CIDADE,
TRITON.TTIITM001810 D,
TRITON.TTIITM983501 PRODUTO,
TRITON.TTFGLD010806 CC,
TRITON.TTCCOM983501 MARCA,
TRITON.TTCCOM000501 CIA,
TRITON.TTIITM982501 NAT,
SEI.SIBTB_MULTIMARCA MULTIMARCA,
SEI.SIBTB_DIRETORIA_DEPTO DIRETORIA,
TRITON.TTCCOM994501 USUARIO,
ARCTB_GERENCIA_INDUSTRIAL INDUSTRIAL,
TRITON.TTIITM984501 EMBALAGEM
WHERE ARC.CD_ARC = NOTAS.CD_ARC(+)
AND ARC.CD_ARC = ACAO_INV.CD_ARC(+)
AND ACAO_INV.CD_TIPO_ACAO(+) = 0
AND ACAO_INV.CD_ACAO_IMEDIATA(+) = 999
AND ARC.CD_ARC = ACAO_IME.CD_ARC(+)
AND ACAO_IME.CD_TIPO_ACAO(+) = 1
AND ACAO_IME.CD_ACAO_IMEDIATA(+) = 999
AND ARC.CD_CLIENTE = CLIENTE.T$CUNO(+)
AND CLIENTE.T$ESTA$L = CIDADE.T$ESTA$L(+)
AND CLIENTE.T$CDMU$L = CIDADE.T$MUNI$L(+)
AND TRIM(REPLACE(ARC.CD_PRODUTO, '-', '')) =
TRIM(REPLACE(D.T$ITEM(+), '-', ''))
AND TRIM(REPLACE(ARC.CD_PRODUTO, '-', '')) =
TRIM(REPLACE(PRODUTO.T$ITEM$O(+), '-', ''))
AND PRODUTO.T$PROC$O = NAT.T$PROC$O(+)
AND EMBALAGEM.T$CDAC$O(+) = PRODUTO.T$CDAC$O
AND ARC.CD_MOTIVO_RECLAMACAO = MOTIVO.CD_ITEM(+)
AND ARC.CD_MARCA = MARCA.T$CDMA$O(+)
AND SUBSTR(ARC.DS_ARC, 1, 3) = CIA.T$NCMP(+)
AND ARC.CD_STATUS = STATUS.CD_STATUS(+)
AND TRIM(ARC.CD_CENTRO_CUSTO) = TRIM(CC.T$DIMX(+))
AND CC.T$DTYP(+) = 2
AND CC.T$SUBL(+) = 0
AND ARC.CD_DEPTO_MULTIMARCA = MULTIMARCA.CD_MULTIMARCA(+)
AND ARC.CD_DEPTO = DIRETORIA.CD_DEPTO(+)
AND ARC.CD_USUARIO = TRIM(USUARIO.T$CDUS$O(+))
AND ARC.CD_STATUS IS NOT NULL
AND ARC.CD_MOTIVO_RECLAMACAO = MOTIVO.CD_ITEM(+)
AND INDUSTRIAL.CD_FABRICA = SUBSTR(ARC.DS_ARC, 1, 3)
GROUP BY TO_CHAR(ARC.DT_EMISSAO, 'YYYY'),
TO_CHAR(ARC.DT_EMISSAO, 'MM'),
ARC.CD_ARC,
ARC.DS_ARC,
ARC.DS_SUPERVISOR,
ARC.CD_STATUS,
STATUS.DS_STATUS,
TO_CHAR(ARC.DT_EMISSAO, 'DD/MM/YYYY'),
TO_CHAR(ACAO_INV.DT_ORIGINAL, 'DD/MM/YYYY'),
TO_CHAR(ACAO_INV.DT_REALIZADO, 'DD/MM/YYYY'),
TO_CHAR(ACAO_IME.DT_ORIGINAL, 'DD/MM/YYYY'),
TO_CHAR(ACAO_IME.DT_REALIZADO, 'DD/MM/YYYY'),
TO_CHAR(ARC.DT_PROCEDENCIA, 'DD/MM/YYYY'),
TO_CHAR(ARC.DT_RECEBIMENTO, 'DD/MM/YYYY'),
TO_CHAR(NVL(ARC.DT_APROVACAO_INDUSTRIAL,
ARC.DT_APROVACAO_COMERCIAL),
'DD/MM/YYYY'),
ARC.CD_CLIENTE,
CLIENTE.T$NAMA,
CIDADE.T$DSCA$L,
ARC.CD_MARCA,
MARCA.T$DSMA$O,
ARC.CD_PRODUTO,
D.T$SEAK,
EMBALAGEM.T$CDAC$O || ' - ' || EMBALAGEM.T$DESC$O,
NAT.T$DESC$O,
ARC.NR_LOTE,
ARC.DT_FABRICACAO,
SUBSTR(ARC.DS_ARC, 1, 3),
CIA.T$CITY,
ARC.CD_MOTIVO_RECLAMACAO,
MOTIVO.DS_ITEM,
DECODE(ARC.FL_PROCEDENCIA,
0,
'PROCEDENTE',
1,
'IMPROCEDENTE',
ARC.DS_DISPOSICAO,
ARC.CD_CENTRO_CUSTO,
CC.T$DESC,
ARC.NR_QUANTIDADE_AFETADA,
DS_JUSTIFICATIVA,
DS_DISPOSICAO,
CD_RESPONSAVEL_CAUSA,
ARC.NR_QUANTIDADE_AFETADA_REAL,
ARC.DT_ATENDIMENTO,
MOTIVO.CLASSIFICACAO,
ARC.DS_COORDENADOR,
ARC.FL_ATENDIMENTO,
TO_CHAR(ARC.DT_ATENDIMENTO, 'DD/MM/YYYY'),
ARC.DS_COORDENADOR_INVESTIGACAO,
INDUSTRIAL.REGIAO
ORDER BY ARC.CD_ARC DESC;
Edited by: muttleychess on Nov 25, 2009 10:25 AMPlease see my privilege
GRANTEE PRIVILEGE ADM
CLIBGF CREATE TABLE NO
CLIBGF CREATE ANY VIEW NO
CLIBGF CREATE SNAPSHOT NO
CLIBGF SELECT ANY TABLE NO
CLIBGF CREATE ANY TRIGGER NO
CLIBGF CREATE ANY SNAPSHOT NO -
"Invalid Metadata Objects" when creating materialized views
Hi experts,
I have run into some trouble. I had an analytic workspace that grew too fast (see 11.2.0.2 AW size grows steadily with every cube build so I deleted it and created a new one.
It seemed to build fine using the tip that David Greenfield gave us in the mentioned forum post, but when I try to enable materialized views (which I had enabled in the previous workspace) I'm gettig the following error:
Your metadata changes have been saved, with the following errors
Invalid Metadata Objects:
Invalid Object "TABLESPACE.LECTURAS": "CREATE MATERIALIZED VIEW "TABLESPACE"."CB$LECTURAS"
ORGANIZATION CUBE ON TABLESPACE.TABLESPACE_AW(
FACT "LECTURAS_STORED"("LECTURAS_MEASURE_DIM" 'LECTURA') IS "LECTURA",
DIMENSION "TIEMPO" IS "TIEMPO" USING "TIEMPO_TIEMPO_HOUR_ID_UNIQUE_KEY" ,
DIMENSION "GEOGRAFIA" IS "GEOGRAFIA" USING "GEOGRAFIA_GEOGRAFIA_CONTADOR_ID_UNIQUE_KEY" )
BUILD DEFERRED
REFRESH ON DEMAND
FORCE
USING TRUSTED CONSTRAINTS
AS
SELECT
TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') "TIEMPO",
T1."COD_METERID" "GEOGRAFIA",
SUM(T1."VAL_AI_HOR") "LECTURA"
FROM
TABLESPACE."LECTURA_HORARIA_FINAL" T1
GROUP BY
(TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') , T1."COD_METERID")
ORA-00942: table or view does not exist
Running this same script in SQLDeveloper yields the same error at line 17, which is the FROM clause. BUT I can run the SELECT statement by itself and returns the expected result. So the table exists in the correct tablespace.
I must be missing something big...
Thanks in advance.
Joan
P.S.: In the code above I'm using "TABLESPACE" in substitution for the real username and tablespace name (which is the same) for privacy reasons.When you ran the select statement, were you connected as the same user that you used to try to enable the MVs?
Can you create a standard (non cube) MV with the same select statement? (Connected as the same user you used in AWM.)
"CREATE MATERIALIZED VIEW "TABLESPACE"."MV_TEST"
BUILD DEFERRED
REFRESH ON DEMAND
FORCE
USING TRUSTED CONSTRAINTS
AS
SELECT
TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') "TIEMPO",
T1."COD_METERID" "GEOGRAFIA",
SUM(T1."VAL_AI_HOR") "LECTURA"
FROM
TABLESPACE."LECTURA_HORARIA_FINAL" T1
GROUP BY
(TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') , T1."COD_METERID")
{code} -
Insufficient Privileges when create materialized view as user system
If I login as system (connect sys/****@DevDB) and try to create a materialized view for another schema (e.g. XDCONTROLDB), I get the insufficient privileges error. If I login as sys as sysdba then I can create successfully.
I have searched some ariticles in Google and grant create any snapshot, create any table, create any view, global query rewrite, select any table system privileges to system but still get the same error.
Any other privileges I need to grant to system?
Cheers
below is a sample script to create the view which get the error:
CREATE MATERIALIZED VIEW XDControlDB."XDTest1" PCTFREE 10
PCTUSED 0 MAXTRANS 255
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0)
TABLESPACE "USERS"
BUILD IMMEDIATE
REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
ENABLE QUERY REWRITE AS
SELECT * From XDControlDB.RiskInstance;
Message was edited by:
user500168
Message was edited by:
user500168Thanks for your reply. After I grant privileges to system, I login as system and try to create the view as below which I get the insufficient privileges error:
CREATE MATERIALIZED VIEW XDControlDB."XDTest1" PCTFREE 10
PCTUSED 0 MAXTRANS 255
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0)
TABLESPACE "USERS"
BUILD IMMEDIATE
REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
ENABLE QUERY REWRITE AS
SELECT 1 From XDControlDB.RiskInstance;
As you can see, I try to create the view under a schema called 'XDCONTROLDB'. If I login as sys as sysdba, then it create successfully.
After I create UserA, and grant the privileges I mentioned in the ealier post, I login as UserA, and run the statement above I get the same privileges error. But if I change the stament to below which will create the view under UserA's schema, then it create successfully:
CREATE MATERIALIZED VIEW UserA."XDTest1" PCTFREE 10
PCTUSED 0 MAXTRANS 255
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0)
TABLESPACE "USERS"
BUILD IMMEDIATE
REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
ENABLE QUERY REWRITE AS
SELECT 1 From XDControlDB.RiskInstance;
Looking for your suggestions,
Cheers -
ORA-12899 when recreating materialized view
Hi All,
I have a PL/SQL procedure to load data in partitioned base tables and a refreh force meterilized view to compute data from base partition table. I just droped the materialized view and try to recreate it.
I am facing an issue with Ora-12899 value too large for column "SYS".SNAP$".AUTO_FUN (actual: string 201, maximum: string 200).
I google and search in Metalink & Oracle forum for couple days but i didnt find a valuable solution.
Does you guy have some adivces for me to avoid this error.
Note: Before I can drop and re-create this materialized view without an error. I just faced this issue a few day ago.
TIA,
Lux
Edited by: lux2 on Mar 8, 2010 11:07 PMAs below result from the query on both client and servier side.
I see no different between the two.
At server side:
PARAMETER VALUE
NLS_CALENDAR GREGORIAN
NLS_COMP BINARY
NLS_CURRENCY $
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_DUAL_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_LANGUAGE AMERICAN
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NUMERIC_CHARACTERS .,
NLS_SORT BINARY
NLS_TERRITORY AMERICA
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
at Client side:
PARAMETER VALUE
NLS_CALENDAR GREGORIAN
NLS_COMP BINARY
NLS_CURRENCY $
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_DUAL_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_LANGUAGE AMERICAN
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NUMERIC_CHARACTERS .,
NLS_SORT BINARY
NLS_TERRITORY AMERICA
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR -
Ora-04045 when refreshing materialized view
Can any one help with this error ora-04045 .I get this error when refreshing the materialized view for the first.second time when i refresh the materialized view it gets refreshed.
My database version is 8.1.7.xYes it is enabled.if you refresh for the 1 time it show object invalid when you refresh again it refreshes and object is valid.i am using dbms_refresh pacakge to do this.one more problem is that i have made a procedure in which i am calling dbms_refresh pakcage 8 times to refresh 8 views.if 1 gets refreshed then 2 will not it will fail.i don't understand this behaviour
-
Ora-00904 when creating a view
Hello everyone,
I'm trying to create a view based on 6 tables, and I'm getting an ORA-00904: Invalid column name error. I also tried to do a basic select * from table_name and inserted one of the restrictions in my where clause and am getting the same error. I've checked and re-checked the column names in my script.
Can anything else be causing this error?
RoseCREATE OR REPLACE VIEW GEN_VISTA_VW (PERSON_ID,
LAST_NAME, MIDDLE_NAME, FIRST_NAME, ADDRESS, LINE2, LINE3, COMMUNITY, POSTAL_CODE, HOME_PHONE, BUS_PHONE, PROVINCE, HOME_SCHOOL_ID, EMPNO, POSITION, REG_NUMB)
AS (SELECT
PERSON.PERSON_ID,
PERSON.LAST_NAME,
PERSON.MIDDLE_NAME,
PERSON.FIRST_NAME,
PERADDR.LINE1,
PERADDR.LINE2,
PERADDR.LINE3,
PERADDR.CITY,
PERADDR.ZIP,
PERPHONE.PHONE_NO,
TBLLOC.PHONE_NO,
PERADDR.STATE,
TBLLOC.LOCATION_CODE,
EMPCOMP.EMPNO,
TBLPOS.POSITION_TITLE,
EMPQUAL.REG_NUMB
FROM
PERSON,
PERADDR,
PERPHONE,
TBLLOC,
TBLPOS,
EMPCOMP,
EMPQUAL
WHERE
person.person_id = tblpos.person_id
AND person.person_id = perphone.person_id
AND person.person_id = peraddr.person_id
AND person.person_id = empqual.person_id
AND person.person_id = empcomp.person_id
AND tblpos.location_code = tblloc.location_code)
Thank you -
ORA-01841 when refreshing materialized view
Hi,
I have to upgrade my database from oracle 8.1.7.4 to 9.2.0.1.
I have tested two ways to do it :
1) I upgraded my database from 8i to 9i with the u0801070.sql script.
2) I created an empty 9i database and then I exported the data from the 8i database and imported them to the 9i database.
The two procedures worked fine.
But now, when I try to refresh the mateiralized views with DBA Studio on the database upgraded via export/import, I obtain the error : ORA-01841.
On the database upgraded via u0801070.sql, I don't have the problem.
Why do I have this error ?
Regards,
Rachel TREBUCHET DANJOUError: ORA 1841
Text: (full) year must be between -4713 and +4713 / +9999
Cause:
Action:
*** Important: The notes below are for experienced users - See Note 22080.1
Explanation:
Eg: In a clause like "to_date('XXXX','YYYY')" XXXX is outside of the
range -4713 and +4713.
Note that Year 0 is invalid too. See Bug 106242 for an explanation..
Typically this involves "to_date('00','YYYY')" or similar which is
invalid. It is probably better to use 'RR' rather than 'YY' which
prefixes with an appropriate century.
Eg:
select to_char(to_date('00','yyyy')) from dual;
ORA-01841: (full) year must be between -4713 and +4713
select to_char(to_date('00','rr')) from dual;
01-MAR-2000
Year 2000
~~~~~~~~~
You may also see this error if using a TO_DATE() function
on a date column (or SYSDATE) and your sessions NLS_DATE_FORMAT
includes a 2 digit year mask (RR or YY).
eg: alter session set nls_date_format='DD-MON-RR';
select to_date(sysdate,'DD-MON-YYYY') from dual;
"ORA-01841: (full) year must be between -4713 and +9999, and not be 0"
This is because TO_DATE() expects to work on a CHARACTER
data type and so there is an implicit conversion from
DATE to CHAR.
eg: In the above example SYSDATE of 01-JAN-2000 is implictly
converted to the character string "01-JAN-00", which is
then converted back to a date using a DD-MON-YYYY date format.
This gives a year of 0000 which is invalid, hence ORA-1841.
Note: From Oracle 7.2 onwards the UPPER bound is +9999 and not +4713
Regards,
Reza -
ORA-01031 when creating a view
Hi guys,
I transported a view(custom view ZVIEW) from Development to Production and found that the view was missing the database of the production system.
When i tried to create the same view usin SE14 am getting a warning
ORA-01031: insufficient privileges
DDL time(___1): .......119 milliseconds
The SQL statement was not executed
Statements for View ZVIEW_STD_TIME could not be executed
Request for ZVIEW_STD_TIME could not be executed
in the system the SAPR3 and OPS$PRDADM has sysdba privilege so i guess SYSCONN need not be implemented.
Please help.
Thanks and regards,
SiddharthaHi Rabi,
Check below sap notes.
Note 985607 - ORA-01031 Creating views after upgrade to Oracle 10g
Note 1028220 - ORA-01031: Insufficient privileges despite SAPCONN role
Regards
Ashok -
ORA-25175 when trying to create materialized view, organization index SOLV
Hi,
I'm trying to create a materialized view to compensate for non-normalized table.
I have table anormal, and mv is to be on distinct agency, company in that table.
Here goes:
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
NLSRTL Version 10.2.0.3.0 - Production
SQL> create table anormal (company varchar2(8) not null
2 ,dept varchar2(8) not null
3 ,agency varchar2(8) not null
4 ,constraint anormal_pk primary key (company,dept));
Table created.
SQL> insert into anormal values('c1', 1, 'Ajax');
1 row created.
SQL> insert into anormal values('c1', 2, 'Ajax');
1 row created.
SQL> insert into anormal values('c1', 3, 'Acme');
1 row created.
SQL> insert into anormal values('c2', 1, 'Acme');
1 row created.
SQL> insert into anormal values('c2', 2, 'Acme');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from anormal;
COMPANY DEPT AGENCY
c1 1 Ajax
c1 2 Ajax
c1 3 Acme
c2 1 Acme
c2 2 Acme
SQL> create materialized view agency_comp_mv
2 organization index --primary key (agency, company)
3 build deferred
4 refresh on demand
5 as
6 select distinct agency, company from anormal
7 /
select distinct agency, company from anormal
ERROR at line 6:
ORA-25175: no PRIMARY KEY constraint found
SQL>The error tells me that there is no primary key, but is there any way to add such?
- or is my problem rather that I cannot use DISTINCT with organization index?
Regards
Peter
bump
Message was edited by:
Peter Gjelstrup
<SOLVED>
Message was edited by:
Peter GjelstrupThanks William,
I tried with ON PREBUILT TABLE, just to see what happens.
Building on my OP:
SQL> create table iot(agency varchar2(8) not null, company varchar2(8) not null
2 ,constraint iot_pk primary key (agency,company))
3 organization index;
Table created.
SQL> insert into iot select distinct agency, company from anormal;
4 rows created.
SQL> commit;
Commit complete.
SQL> create materialized view iot on prebuilt table
2 as
3 select distinct agency, company from anormal;
Materialized view created.
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1
SQL> insert into anormal values('c3', 2, 'Foo');
insert into anormal values('c3', 2, 'Foo')
1 row created
SQL> select * from anormal;
COMPANY DEPT AGENCY
c1 1 Ajax
c1 2 Ajax
c1 3 Acme
c2 1 Acme
c2 2 Acme
c3 2 Foo
6 rows selected.
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1
3 rows selectedNow, try to refresh and MV
SQL> alter materialized view iot refresh complete;
Materialized view altered.
SQL> select object_type, to_char(last_ddl_time, 'hh:mi:ss'), status
2 from user_objects where object_name = 'IOT';
OBJECT_TYPE DDL_TIME STATUS
TABLE 10:40:42 VALID
MATERIALIZED VIEW 10:41:13 VALID
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1Agency "Foo" is not in MV,
Looks like that IOT select'ed from is indeed the MV:
SQL> drop table iot;
drop table iot
ERROR at line 1:
ORA-12083: must use DROP MATERIALIZED VIEW to drop "STIK"."IOT"
SQL>So, seems that Maxim is right, it just can't be done. And it seems my options are:
Create HEAP organized MV or
Create and maintain IOT
Regards
Peter -
Create materialized view, ORA-00942
I would like to create a materialized view on user scott@orcl for user colinsuper. User scott@orcl have
"CREATE ANY MATERIALIZED VIEW" permissions. Why does I get an ORA-00942 error?
Remote-Database: remote_orcl.world
Remote-Database-User: lindasuper
Remote-Database-Table: cars
scott@orcl>create synonym cars for lindasuper.cars@remote_orcl.world
2 /
Synonym created.
scott@orcl>select car_no cno, car_bez cbez from cars
2 where rownum <= 1;
cno cbez
3 32-mxl
scott@orcl
scott@orcl
scott@orcl>CREATE MATERIALIZED VIEW colinsuper.CARS_MV
2 TABLESPACE my_tablespace
3 BUILD IMMEDIATE
4 USING INDEX TABLESPACE my_idx
5 REFRESH
6 START WITH sysdate
7 NEXT ROUND(SYSDATE)+5/24
8 WITH PRIMARY KEY
9 ENABLE QUERY REWRITE
10 AS
11 SELECT car_no cno
12 car_bez cbez
13 FROM cars
14 /
CREATE MATERIALIZED VIEW colinsuper.CARS_MV
FEHLER in Zeile 1:
ORA-00942: Tabelle or View does not exist
scott@orcl>
scott@orcl>
scott@orcl>When I am creating the materialized view without the user colinsuper, materialized view
is creating without problems.
scott@orcl>CREATE MATERIALIZED VIEW CARS_MV
2 TABLESPACE my_tablespace
3 BUILD IMMEDIATE
4 USING INDEX TABLESPACE my_idx
5 REFRESH
6 START WITH sysdate
7 NEXT ROUND(SYSDATE)+5/24
8 WITH PRIMARY KEY
9 ENABLE QUERY REWRITE
10 AS
11 SELECT car_no cno
12 car_bez cbez
13 FROM cars
14 /
Materialized View wurde erstellt.
scott@orcl>
scott@orcl>I think there is somthing wrong with the permissions of colinsuper!?Is this colinsuper a user in the remote database.
ORA-00942: table or view does not exist
Cause:
The table or view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required. Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it.
Action:
Check each of the following:
the spelling of the table or view name.
that a view is not specified where a table is required.
that an existing table or view name exists.
Contact the database administrator if the table needs to be created or if user or application privileges are required to access the table.
Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted. -
Create Materialized view Error ORA-22818
Hi,
I am creating a materialized view based on a complex query with inline queries, below is a simplified version of the query:
CREATE MATERIALIZED VIEW CM_FA_PEND_mvu
TABLESPACE CISTS_TH
BUILD IMMEDIATE
REFRESH COMPLETE
ENABLE QUERY REWRITE
AS
SELECT/*+ index (a,XT094S3) index (b,XT232S1) index (c, XM143P0) index (d, XM185S1)*/
a .fa_id,
a.fa_type_cd,
a.fa_status_flg,
a.disp_grp_cd,
(SELECT dl.descr
FROM ci_disp_grp_l dl
WHERE dl.disp_grp_cd = a.disp_grp_cd AND dl.language_cd = 'ENG')
disp_grp_cd_descr
FROM ci_fa a,
ci_sp_mtr_hist b,
ci_mtr_config c,
ci_reg d,
ci_fapr_faty e
WHERE a.fa_type_cd = e.fa_type_cd
AND a.sp_id = b.sp_id(+)
AND b.mtr_config_id = c.mtr_config_id(+)
AND c.mtr_id = d.mtr_id(+)
AND a.fa_status_flg = 'P'
AND e.fa_type_prof_cd = 'METERED'
AND ( (b.removal_dttm IS NULL))
I am getting error "ORA-22818: subquery expressions not allowed here". the problem is in columns "disp_grp_cd_descr" (when I remove this column from the query, the MView is created successfully)
Is using inline queries as columns a limitation on creating materialized view?
Is there a workaround ?
Thanks
AKNo version and no exception ... the full text is necessary the number alone insufficient ... to help you much other than recommend you read this:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10810/basicmv.htm#DWHSG8195
where it says:
"The SELECT clause in the materialized view creation statement defines the data that the materialized view is to contain. Only a few restrictions limit what can be specified. Any number of tables can be joined together. Besides tables, other elements such as views, inline views (subqueries in the FROM clause of a SELECT statement), subqueries, and materialized views can all be joined or referenced in the SELECT clause. You cannot, however, define a materialized view with a subquery in the SELECT list of the defining query. You can, however, include subqueries elsewhere in the defining query, such as in the WHERE clause."
Something you could have found in a second or two in the docs at http://tahiti.oracle.com by searching for "Materialized Views Restrictions"
But without your version and the actual error message this may not apply. -
ORA-04052 creating Materialized View
ORA-04052 creating Materialized View
Hi All !!
I'm trying to create a Materialized view and his query definition uses an active public database link. When I ran the script for creating the view I get the following message:
ERROR in line 1:
ORA-04052: error occurred when looking up remote object
USER.TABLE@ORCL2
ORA-00604: error occurred at recursive SQL level 1
ORA-03106: fatal two-task communication protocol error
ORA-02063: preceding line from ORCL2
But when I execute his definition query all is ok, the query works fine.
I mean, I'm using the following sentence to create the view:
CREATE MATERIALIZED VIEW my_view TABLESPACE tbsname BUILD IMMEDIATE
REFRESH FORCE
WITH ROWID
ENABLE QUERY REWRITE
AS
SELECT ...
FROM SCHEMA_NAME.TABLE_NAME@ORCL2;
The above sentence give me ORA-04052. Nevertheless the SELECT... FROM SCHEMA_NAME.TABLE_NAME@ORCL2; works fine...
I checked for the GLOBAL_NAMES parameter and it is set to FALSE. Please help me, How can I fix this problem ?
I'm using Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production running over Win XP for create the view.
The Database Link points to Oracle Database 10g Release 10.1.0.4.0 - 64bit Production running over Solaris
Thanks in advance !!I've checked the NLS_LANG settings in both servers, and are set to AMERICAN. NLS TERRITORY are set to America also.
-
Illegal use of LONG datatype error message when i create materialized view
Hello to all
I want create read only materialized view replication environment two of our tables have LONG datatype when i create materialized view against on them
I recieve this error message
CREATE MATERIALIZED VIEW MDB.TOAD_PLAN_TABLE TABLESPACE aramis REFRESH FORCE WITH ROWID AS SELECT * FROM MDB.TOAD_PLAN_TABLE@arahisto
Error report:
SQL Error: ORA-00997: illegal use of LONG datatype
00997. 00000 - "illegal use of LONG datatype"
Do you know any resort solution for it?
thanksYou can not use longs in materialized views over a database link, you can however take a part of a long over to a materialized view.
I have gotten this to work in the past l had to create a PL/SQL function that you can use to extract the character data from the long column and use that to
as part of the function you will need to pass in the columns of the table that will identify the unique records so you can pick out the long column
example function
-- you will need to make sure this funtion is in the remote location as you can not select longs accross a DB LINK.
CREATE OR REPLACE FUNCTION MDB.TOAD_PLAN_LONG_CONV
(pass in the primary key columns for the table)
RETURN VARCHAR2
IS
v_long VARCHAR2(32767) ;
BEGIN
BEGIN
-- need to select the long column into the PL/SQL variable
SELECT long_column
INTO v_long
FROM MDB.TOAD_PLAN_TABLE
WHERE key_columns = passed columns ;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE = '-01406' THEN
NULL ;
ELSE
RAISE ;
END IF ;
END ;
RETURN SUBSTR(v_long,1,4000) ;
END ;
Then when you create the materialized view utilize that function on the long column.
create or replace materialized view MDB.TOAD_PLAN_TABLE TABLESPACE aramis REFRESH FORCE WITH ROWID
AS
SELECT column1, .... columnx,
MDB.TOAD_PLAN_LONG_CONV@arahisto (primary key column list) as long_column_name
FROM MDB.TOAD_PLAN_TABLE@arahisto ;
See if this will work for you? Keep in mind however this solution will not get the entire long column only as much as a PL/SQL variable will hold of it.
Mike -
Create materialized view with ora-12054 error
Oracle 10g R2 on AIX 5.3L
I create a script (with help of EM) for a materilaized view
CREATE MATERIALIZED VIEW "BAANDB"."R2_MV"
TABLESPACE "USERS" NOLOGGING STORAGE ( INITIAL 128K) USING INDEX TABLESPACE "BAANIDX" STORAGE ( INITIAL 256K)
REFRESH FORCE ON COMMIT
ENABLE QUERY REWRITE AS
SELECT CM.ROWID c_rid, PC.ROWID p_rid, CM."T$CWOC", "T$EMNO", CM."T$NAMA", CM."T$EDTE", PC."T$PERI", PC."T$QUAN", PC."T$YEAR", PC."T$RGDT" From BAANDB.TTPPPC235201 PC RIGHT OUTER JOIN BAANDB.TTCCOM001201 CM Using (T$EMNO)
but I got error
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
acooding to the oerr
// *Cause: The materialized view did not satisfy conditions for refresh at
// commit time.
// *Action: Specify only valid options.
what dose it mean? both my master tables are not IOT and are locale ones. It seems that only changing to ON DEMAND works. If I use the "REFRESH FORCE START ..NEXT", it also failed.
I have created the materalized view logs with rowid on each master table. I think my script met every prequirement of ON COMMIT.
table owner has "on commit refresh" privilegeAfter googling on line, someone mentioned that for "ON COMMIT" on join tables, we have to use th old OUTER JOINT syntax (+) on WHERE. The new "outer joint" in FROM clause won't work.
I tested it, it seemed to be true.
Maybe you are looking for
-
Semantics and its' role in Business Services
Role and importance of semantics in the context of services and SOA: Semantics refer to interpretation of information and not the literal definition of information/ data. Applying semantics to information turns it into knowledge. Semantics is the a
-
Movies in iTunes - Adding information
All, I have recently started ripping some of my DVD's, adding them to iTunes and will soon be playing them on an iPod. Problem is, I am searching for a way to add information such as: Actors Director Genre (That is film specific - as opposed to music
-
I have a film project that was shot with with seperate sound. I have gone in and make subclips of all takes in the film transfer and aif audio file. I have then merged each clip using IN points and made a cut using them. yesterday I exported the whol
-
Can not delete e-mail in Mac Mail 8.1
I have my e-mail accounts setup as IMAPS. All seems to function correctly. Except when I delete an e-mail in any of my accounts within the INBOX, they either pop right back up or after a few minutes show back up. If I delete it again, it usually stay
-
Hi We have Oracle eBS R12 on unix OS. The DB version is 10g R2. From the applications we submitted concurrent request to upload large amount of data. The undo tablespace increased rapidly and we kept creating new datafiles to accommodate the data, bu