Creating dynamic materialized views: insufficient Privileges?
Hi allI am currently doing a procedure that will recreate materialized views as columns are deleted or added to a table by the selection of the user to the application level. I wrote the procedure, and it displays the correct syntax to create a materialized view. However once I pass this dynamic sql statement to be executed immediately, it fails, saying: I don't have sufficient privileges. I have sysdba grants on this user in my dev environment. What Miss me? Has it something to do with immediate execution and the privileges associated with the use that? Any help would be greatly appreciated!
Kind regards
TimS
Within a stored (by default) procedure DEFINER rights, only the privileges that are granted directly to the user, not those granted through a role as SYSDBA, are available.
-If you change the stored procedure to use the rights of the applicant, the privileges granted through a role are visible. However, this requires that the appellant, not the owner of the procedure has the permissions to create the materialized view.
-If you grant the CREATE MATERIALIZED VIEW privilege (and all other privileges your code requires) directly to the user, which would also solve the problem.
Justin
Tags: Database
Similar Questions
-
Materialized view - insufficient privileges
Hi all
I have two schemes called user1 and user2. I have a MV in user2 and want to refresh from User1 by using dbms_mview. A. but I get the error 'insuffieient 'privilege'. I know that I can solve it by granting alter a materialized to the USER1 user view. But, is it possible to give access to refresh some particualr MV (resident in other schema) of a user.
Thanks in advance.
JaggyamYou may be able to create a stored procedure in the User2, containing the code to refresh the MV. Then you can give User1 EXECUTE privileges on this stored procedure.
* Not tested
-
Error ORA-01115 creating the materialized view
Hi friends,
When I create a materialized view it by throwing some error
CREATE THE PNR_RES_MV MATERIALIZED VIEW
TABLESPACE FAS
NOCACHE
LOGGING
NOCOMPRESS
NOPARALLEL
IMMEDIATE CONSTRUCTION
REFRESH THE STRENGTH TO DEMAND
WITH THE PRIMARY KEY
AS
SELECT C_CREATION_DATE, C_PNR, B.CARRIER_CD1, B.CARRIER_CD2, B.CURRENT_STATUS_CD, A.CANCELLED_IND, A.BOOKING_OFFC_NMBR,-, B.LEG_NMBR, C_PAX_NMBR
COUNT (CASE WHEN TRIM (B.CURRENT_STATUS_CD) = "HK" AND (TRIM (C_CHANGE_OR_CANCELL_IND) = "OR C_CHANGE_OR_CANCELL_IND IS NULL) THEN 1 OTHER TRAILING NULL) CONFIRMED_COUNT,.
COUNT (CASE WHEN (B.CURRENT_STATUS_CD) TRIM = "HK" AND (TRIM (C_CHANGE_OR_CANCELL_IND) = "or C_CHANGE_OR_CANCELL_IND IS NULL) null THEN 1 OTHER END) cancELLED_COUNT
OF PNR_RES_LEG_PAX_MV B, PNR_RES HAS
WHERE A.PNR = B.PNR
AND a.CREATION_DATE = b.CREATION_DATE
- and A.BOOKING_OFFC_NMBR = '1F'
- AND C_PNR = 'XE76V. '
AND A.FILE_UPDATE_DATE. A.UPDATE_DATE IN (SELECT MAX (D.FILE_UPDATE_DATE |)) (UPDATE_DATE) OF PNR_RES D WHERE D.PNR = B.PNR AND D.CREATION_DATE = B.CREATION_DATE)
GROUP OF C_CREATION_DATE, C_PNR, B.CARRIER_CD1, B.CARRIER_CD2, B.CURRENT_STATUS_CD, A.CANCELLED_IND, A.BOOKING_OFFC_NMBR;When executing it it gives this error
ORA-01115: reading block IO file error 4 (block # 63757)
ORA-01110: data file 4: ' D:\APP\IGT\ORADATA\ORCL\USERS01. DBF'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read the file
S/O-error: (27 OS) the drive cannot find the sector requested.And I checked through RMAN
RMAN > validate the audit logic datafile 4;
From post 11 March 14
using the control file of the target instead of recovery catalog database
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID = 127 type device = DISK
channel ORA_DISK_1: starting from the data file validation
channel ORA_DISK_1: datafile (s) for specification validation
Enter a number of file datafile = 00004 name = D:\APP\IGT\ORADATA\ORCL\USERS01. DBF
RMAN-00571: ===========================================================
RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.
RMAN-00571: ===========================================================
RMAN-03009: failure to validate the command channel ORA_DISK_1 11/03/2014 13:0
04:12
ORA-19501: read error on the file 'D:\APP\IGT\ORADATA\ORCL\USERS01. DBF', block numbe
r 63745 (block size = 8192)
ORA-27070: async read/write failed
OSD-04016: error queuing an asynchronous i/o request.
S/O-error: (27 OS) the drive cannot find the sector requested.Please suggest me what to do it is a mistake to associate related database or OS. DB version is - 11 GR 2
Kind regards
Arya
This is the error message that you should focus:
> O/S-error: (27 OS) the drive cannot find the sector requested.
Run disk checker utilities, eventually the file system is damaged.
Hemant K Collette
-
can I create a materialized view
with joins, group an and group these things in a single materialized view if yes then how?
Please use scott or HR diagram as I am new to oracle
Thks and greetingsHello
Try this
create materialized view log on hr.employees with rowid (employee_id, first_name,department_id) including new values; create materialized view log on hr.departments with rowid(department_id, department_name) including new values create materialized view mtr_vir refresh fast as SELECT FIRST_NAME,EMPLOYEE_ID,D.DEPARTMENT_ID FROM hr.EMPLOYEES e,hr.DEPARTMENTS d WHERE E.DEPARTMENT_ID=D.DEPARTMENT_ID GROUP BY D.DEPARTMENT_ID,FIRST_NAME,EMPLOYEE_ID
see you soon
VT
-
Create table ORA-01031: insufficient privileges
SQL > indicate user USER is 'TEST_RPT.
SQL > CREATE TABLE mytest (id NUMBER); - it does not work
CREATE TABLE mytest (id NUMBER)
* ERROR at line 1: ORA-01031: insufficient privileges
SQL > CREATE TABLE TEST_RPT.mytest (id NUMBER).
Table created. SQL >
SQL > select * from session_privs;
PRIVILEGE
----------------------------------------
ANY PROCEDURE DEBUG
DEBUGGING SESSION CONNECT
CREATE INDEXTYPE
OPERATOR TO CREATE
CREATE THE TYPE
CREATE THE TRIGGER
CREATE PROCEDURE
CREATE SEQUENCES
CREATE VIEW
CREATE SYNONYM
CREATE THE CLUSTER
CREATE TABLE
UNLIMITED TABLESPACE
ALTER SESSION STATEMENT
CREATE SESSION
Try this:
SELECT USER, SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM DUAL;
The two identical values? CURRENT_SCHEMA is what will determine the owner of the table you create, if you do not specify an owner.
This can be changed by
ALTER SESSION SET CURRENT_SCHEMA = whatever_you_want_it_to_be;
-
By creating the Materialized view all size changes to columns
I'm creatine a materialized view based on the table in a different database.
The table on which the created materialized view (database table) is to have the size of CHAR (1 byte) column. But in Materialized view this size columns showing as CHAR (3 bytes).
Could u please help me.., why this is happening?
Thank you
SachinSachin thombare wrote:
I'm creatine a materialized view based on the table in a different database.
The table on which the created materialized view (database table) is to have the size of CHAR (1 byte) column. But in Materialized view this size columns showing as CHAR (3 bytes).Could u please help me.., why this is happening?
Thank you
SachinHello
Do both the database involved in this have defined different character.
If Yes, then this is a known behavior.Concerning
Anurag Tibrewal. -
Insufficient private error when creating a materialized using link DB view!
Hello
I have a two db1 and db2 databases.
I created a link to database db2 to access schema user1 in db1.
When I try to create a materialized view by accessing the user1 user "user2" using table in the db2 database, I get error "ORA-1031: insufficient privilege.
User2 has privileges 'create view', 'create any view', 'create a materialized view' etc.
I am able to select the data in the table using the database link, but creating a materialized view gives this error.
I want to know if the "user1" user should be granted no privilege to User2, if so how is it possible that user2 dosent exist in db1.
IE I would order something like ' grant select on user1.table to user2@db2 "(ce travail dosent comme il dit user2@db2 dosent existe, bien évidemment par sa prise user2@db2 comme un nom d'utilisateur dans le schéma de db1)".
or is this a problem with User2 in the db2 database privileges, if so, what are all the privileges that have to give User2 in db2 schema.
Kind regardsHello
You can access the table directly using the link db...?
You create the MV on the local table...?try to check whether or not the following privileges are
CREATE A MATERIALIZED VIEW
CREATE TABLE
CREATE VIEW
UNLIMITED TABLESPACE and check the following* "CREATE A MATERIALIZED VIEW & SELECT ANY TABLE."
try and see
-Pavan Kumar N
-ORACLE OCP - 9i / 10g
https://www.oracleinternals.blogspot.com -
insufficient privileges when using dynamic sql statements in the procedure
Hello
I use following script on oracle 10g. and get the error not enough privs. Please advice.
SQL > show user
The user is 'GRSADM '.
SQL > create or replace procedure grsadm.test_proc as
a varchar2 (2000);
Start
a: =' VIEW to CREATE or REPLACE
TEST_VIEW
IN SELECT
"FLAS" one
THE DOUBLE ';
immediately run one;
end;
Created procedure.
SQL > start
grsadm.test_proc;
end;
Start
grsadm.test_proc;
end;
Error on line 16
ORA-01031: insufficient privileges
ORA-06512: at "GRSADM. TEST_PROC', line 9
ORA-06512: at line 2
SQL > select * from session_privs
where the privilege as "VIEW %.
PRIVILEGE
----------------------------------------
CREATE A VIEW
REMOVE ANY VIEW
CREATE A MATERIALIZED VIEW
MODIFY A MATERIALIZED VIEW
REMOVE ANY MATERIALIZED VIEW
5 selected lines.
Published by: Rous Sharma on November 24, 2011 12:00GRSADM has a privilege ' CREATE (all) VIEW ' live?
And not via a role...SSM
Samir,
GRSADM is the owner of this procedure, it seems that the EXECUTE priv, that you suggested is already involved. -
Cannot create Materialized View using the PL/SQL procedure
Hello
I have a question related to the creation of materialized view.
I have a stored procedure that creates the materialized view. When you try to perform this procedure, I get not enough privileges error: ORA-01031.
When I run the content of this procedure as a PL/SQL block anonymous their materialized view is created without any complications.
Can you please advice me on this subject?
It is even possible to create a materialized view in the stored procedure as I found no info on this subject.
Thank you
PetrHi chudapet,
Whenever you make in procedure, you must have direct subsidies and not through a role.
Most likely the grant to create a materialized view is available via a role to your username.
Assign a direct grant to the user:grant create materialized view to scott; {code}
-
Create materialized view at the trigger.
Hello
I use version below:
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
PL/SQL Release 11.2.0.1.0 - Production
I created a materialized view query below:
CREATE THE FSG1_FUND000 MATERIALIZED VIEW
PCTUSED, PCTFREE 5 70
Users TABLESPACE
STORAGE (INITIAL 500K NEXT 500K)
Refresh a start fast with (sysdate) next (sysdate + (1 / 1440))
WITH rowid
AS
SELECT * FROM ABNDEV_T24. FSG1_FUND000@abndev;
This Mview if any insert or update only (WITHOUT DELETING) are coming which should be copy to another table. But in mView trigger does not work.
So pls advice me no alternative.
Querys trigger:
create or replace trigger trg_dummy
after insert or update on FSG1_FUND000
for each line
Start
If the insertion
insert into FSG1_FUND001 (RECID, XMLRECORD) values (: new.) RECID,: new. XMLRECORD);
elsif update then
insert into FSG1_FUND001 (RECID, XMLRECORD) values (: new.) RECID,: new. XMLRECORD);
end if;
end;
/
Kind regards
Villa
Hello
I learned and referred website as much as we can not able to create a trigger in MView (sorry we create trigger but none use of creation because in view no insert and update happened). So I drop completely the materialized view concepts and relaxation.
Instead of, I have using the procedure to insert records in a table and then I created one by dbms_scheduler job.
This discussion will be useful for any future reference.
-procedure-
create or replace procedure p2
as
Start
INSERT / * + APPEND * / INTO FSG1_FUND000 SELECT * FROM FSG1_FUND000@remote;
End; BluShadow
/
-----------------job--------------------
Begin
DBMS_SCHEDULER. () CREATE_JOB
job_name-online "JOB4."
job_type-online "PLSQL_BLOCK."
JOB_ACTION => ' BEGIN p2; END;',
start_date => SYSDATE,
repeat_interval => ' FREQ = MINUTELY; INTERVAL = 5;',
End_date => NULL,
-Online TRUE, enabled
comments => "Inserting a record in a table");
end;
/
-
Create Materialized view and Materialized view log.
I wanted to create a materialized view with option "REFRESH QUICKLY YOU COMMIT".
(1) table 1 - it is partitioned range + list - added primary key
(2) View1 - having primary keys on the base table of view
Steps to follow:
(1) create the materialized on Table1; view journal -primary key by default
(2) create the materialized on view1 view log. -It gives below error.
ORA-00942: table or view does not exist
I wanted to create Materialized view as below
create a materialized view
Quickly REFRESH ON validation
as
Select...
........
... from table1
where c1 (select c1 from View1 which...);
Question:
(1) because I am getting above error when creating journal of MV on the view. Can one create log view MV or we create a MV newspaper on the base table of view?
(2) to create the MV with "REFRESH QUICKLY YOU COMMIT' option, we need to have the primary key on the main tables?
Pointers on this will be really useful.
Thank you
Prasad
"When a materialized view is maintained by the
ON
COMMIT
method, the time required to perform the validation can be slightly longer than usual." This is because the refresh operation is performed as part of the validation process. This is why this method may not be suitable if many users at the same time change the tables on which is based the materialized view. »See: basis of materialized views (refreshment options) for all the other options and how they work.
-
A distributed query (remote several tables, several spaces), all refresh on demand. Note that I have no control over remote tables (impossible to create logs of MV, etc.) and I ask really just the difference in performance between the direct request and the MV.
My MV script:
CREATE MYSCHEMA MATERIALIZED VIEW. PRE-MEDICATION
STORAGE)
DEFAULT USER_TABLES
DEFAULT FLASH_CACHE
DEFAULT CELL_FLASH_CACHE
)
NOCACHE
NOLOGGING
NOCOMPRESS
NOPARALLEL
IMMEDIATE CONSTRUCTION
FULL REFRESH ON DEMAND
AS
< my query >
The query takes less than 2 seconds to turn, return of 600 lines. When you try to create the MV, I gave up after an hour. There is no index on the MV (of course, as I have not yet even created). The only hint in the query is to specify the table driven as the remote source.
I did not request (I'll do it if necessary) because I'm not as interested tuning the query as I am to determine why the MV would be so ridiculously slow compared to the query itself.>
The disappointing aspect of all this is that the query is essentially made of 3 tables remote (all from the same source, probably less than 1 k lines when joined to the top) and 1 local table (table of correspondence of line 37) while straight equi-joins.
>
Your solution is obvious.Create a local MV based ONLY on these 3 remote tables.
Then create your required local MV based on this new local MV first and your local table.
If these 3 remote lookup tables are even of the very useful by themselves and then create THREE local MVs, one for each of the remote tables.
And build your local MV required on the three new local VM and your local table.
You can add the MVs local to a group of refresh to refresh all at once with two approaches
An approach fracture rule often works well especially with as small as your tables.
-
'Invalid metadata objects' when creating materialized views
Hi experts,
I ran into some trouble. I had an analytic workspace that has grown too quickly (see 11.2.0.2 size AW grows regularly with each generation of cube so I deleted and created a new.)
He seemed to do very well with the tip David Greenfield, gave us in the mentioned forum post, but when I try to activate materialized views (that I had activated in the previous workspace) I am gettig the following error:
-----
Your metadata changes have been saved, with the following errors
Invalid metadata objects:
Invalid object "TABLESPACE. LECTURAS': 'CREATE A MATERIALIZED VIEW 'TABLESPACE' '. "CB$ LECTURAS.
ORGANIZATION OF CUBE ON THE TABLESPACE. () TABLESPACE_AW
MADE "LECTURAS_STORED"("LECTURAS_MEASURE_DIM" "LECTURA") IS "LECTURA"
DIMENSION "TIEMPO" IS "TIEMPO", WITH THE HELP OF "TIEMPO_TIEMPO_HOUR_ID_UNIQUE_KEY."
DIMENSION 'GEOGRAPHY' IS 'GEOGRAPHY' WITH THE HELP OF 'GEOGRAFIA_GEOGRAFIA_CONTADOR_ID_UNIQUE_KEY')
POSTPONED BUILD
UPDATE ON REQUEST
FORCE
WITH THE HELP OF CONSTRAINTS OF TRUST
AS
(
SELECT
TO_CHAR (T1." FEC_LECTURA', "dd/mm/yyyy hh24:mi:ss") "TIEMPO"
T1. "" COD_METERID ""GEOGRAPHY. "
SUM (T1." VAL_AI_HOR') "LECTURA".
Of
TABLESPACE. "' LECTURA_HORARIA_FINAL ' T1
GROUP BY
(TO_CHAR (T1." (FEC_LECTURA"," hh24:mi:ss dd/mm/yyyy '), T1. ("' COD_METERID")
)
ORA-00942: table or view does not exist
"
-----
This same script running in SQLDeveloper gives the same error in line 17, which is the FROM clause. BUT I can run the select by itself and returns the expected result. If the table exists in the correct storage space.
I must be missing something big...
Thanks in advance.
Joan
P.S.: In the above code I use 'SPACE' to replace the real name from username and a tablespace (which is the same) for reasons of confidentiality.When you run the select statement, you connect to the same user you are trying to activate the VM?
You can create a standard (No cube) MV with the same select statement? (Connected to the same user that 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}
-
Bug: Cannot create materialized view log on XE 11 G
Hello
I connect as try and HR user create materialized view log
I get the errorCREATE MATERIALIZED VIEW LOG ON HR.EMPLOYEES;
>
Error from the 1 in the command line:
CREATE LOG VIEW MATERIALIZED ON HUMAN RESOURCES. EMPLOYEES
Error in the command line: 1 column: 0
Error report:
SQL error: ORA-00439: feature not enabled not: Advanced replication
00439 00000 - "function not enabled: %s."
* Cause: The specified feature is not enabled.
* Action: Try not to use this feature.
>
You can create a materialized view log on 10G XE with no problems.
Kind regards
Jari
http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Is this a bug in 11g or 10g?
It was reported earlier in the beta forum now archived. {: identifier of the thread = 2214092}
The current doc lists the MV sites only (and 'No' to the function of replication advanced):
http://download.Oracle.com/docs/CD/E17781_01/license.112/e18068/TOC.htm#BABDFDAI -
Create Materialized View ORA-01723: columns of length zero are not allowed
I am trying to create a materialized view that derives from a column of a function and I get: ORA-01723: columns null are not allowed.
I use 10 gr 2 with the following definition (simple version):
CREATE MATERIALIZED VIEW ACES
SELECT
function_name (column_name) alias_de_colonne
FROM table_name;
I even tried to cast it as below:
CREATE MATERIALIZED VIEW ACES
SELECT
Cast (function_name (column_name) AS VARCHAR2 (200)) alias_de_colonne
FROM table_name;
My function has an exception to return a value, even if no value are.
I looked everywhere for the solution. Someone at - there a way around this problem? I really need my function to calculate the column because it has business rules that I can't join in my definition of the materialized view. My only hope around this is to insert values into a table and then create a materialized table view, I don't want to do that if someone has a solution around this.
Any help would be greatly appreciated.
Thank you
Kyle
Published by: Kyle Miller on April 19, 2011 08:28Have you tried to create a table with the correct structure and then by creating the view materialized, based on the predefined table as described here...
http://www.oaktable.NET/content/ultra-fast-MV-alteration-using-prebuilt-table-option
?
See you soon
Ben
Maybe you are looking for
-
Hi all Just bought a 2-channel digitizer high-speed USB-5133 and would pull in waveforms under LabVIEW 8.2. The instrument installed without event, works very well under NOR-SCOPE, is visible under the measurement and Automation explore (MAX version
-
How to create session refnum imaq?
Hello all,. I have an app where I would like to pass a Session IMAQ by refnum Sub several screws, however, I am unable to find all the information on the creation of Session IMAQ refnums. I saw it was in a previous post to an old version of labview,
-
Restoration of Windows Media Center Edition 2006
where can I get new for my computer restore disks laptop im running windows media center edition 2006
-
Lenovo PC Manager (China only)
Some of you may have noticed, two weeks to the sites of many models AIO support he was this new Lenovo PC Manager software. No further information was given and also the Readme file was unreadable. I was doing some research on the web - no result. Re
-
Disk Cleanup doesn't work do not