Creating the materialized view using the database link
Hi Guys,
I am using the Oracle 11g release version.
Following is my question,
I had created the Database link to get the data from remote DB table.
Using that DB link, i can access the required table using SELECT statment.
When i tried to create the materialized using that DB link.
I am getting the error SQL Error: ORA-00942: table or view does not exist.
Can anyone please find the root cause and provide the solution for this?
TIA,
Dhivakar.
Hi Dhivakar,
try like this
CREATE DATABASE LINK test
CONNECT TO scott IDENTIFIED BY tiger
USING 'orcl';
Pls make sure the table name.which ur using to create the materialized view.Thanks
Venkadesh
Similar Messages
-
Creating a new folder using a Database Link
I'm trying to create a new folder from another database with Discoverer Administrator. The schema that I'm using is the same on each database but when I select the other database using the database link, Discoverer Administrator will get all the user accounts on the other database but if that user exists on the default database I will only see the objects owned for that user on the default database. If I select a user that is only on the remote database I will see the objects from the remote database. Is this a Bug? I was able to do this using Disco Admin 9.0.4 and EUL 5.02 on an Oracle 8i database. I just migrated my EUL to an Oracle 10g database using EUL 5.1.1 and Disco Admin 10.1.2.
Yes this a bug, Bug No. 4324352 &Note:459996.1
You follow this workaround
After the Folder creation
1. Choose Folder Properties (right-click on Folder)
2. Change database from <default database> to <DBLINK>
Thanks
Mohamed -
Creating a materialized view for another user
I don't seem to find the correct setup for this....
With the user "dummy"
CREATE MATERIALIZED VIEW dummy.thetable BUILD IMMEDIATE REFRESH FORCE ON DEMAND AS select * from real.thetable;
And the materialized view is created ok.
With a DBA user:
CREATE MATERIALIZED VIEW dummy.thetable BUILD IMMEDIATE REFRESH FORCE ON DEMAND AS select * from real.thetable;
ORA-01031: insufficient privileges
I don't want to be switching back and forth from the user to create materialized views, am I missing a permission here? DBA of course has create any materialized viewFrom the SQL Reference Guide:
To create a materialized view in another user’s schema:
- You must have the CREATE ANY MATERIALIZED VIEW system privilege.
- The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database), and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
I suspect that, if you first GRANT CREATE TABLE TO DUMMY, you will be able to create the MV. -
Creating a Materialized View in Oracle 8i
Hello -
What are the steps and privileges required to create a materialized view in Oracle 8i?
ThanksTo create a materialized view in your own schema:
You must have been granted the CREATE MATERIALIZED VIEW system privilege and either the CREATE TABLE or CREATE ANY TABLE system privilege.
You must also have access to any master tables of the materialized view that you do not own, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
To create a materialized view in another user's schema:
You must have the CREATE ANY MATERIALIZED VIEW system privilege.
The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database), and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
Thanks
Manish -
Materialized views used by answers
Hi,
I had create some materialized views for some graphs created on answers of Analytics. The problem i have is that the graphs still take much time to show the results, the materialized views has summarized measures from they original table which is of 33 millions rows to 2000 rows.
Is there any option do i have to check on the Administration of ORACLE Business Intelligence for the materialized views being take by the queries?
thanks a lotTables were not created and imported into the physical Layer
- What was imported into the physical layer if not tables?
Do i have to add the materialized views in the physical Layer?
- If query rewrite is turned on then the materialized views don't have to be. Oracle can rewrite sql in the backgrounf
I haven't eneabled the QUERY REWRITE, so maybe with this can used it.
- Worth a shot
Where do i have to check the statistics? in OEM or Settings-Manage Sessions ?
- You can use OEM to analyze tables and materialized views (and their indexes)
- Speaking of indexes - Are the indexes being used or is table access done with full table scans
- Beach -
Creating a Materialized View from different agregate queries
I want to create a materialized view. The problem is that doing so can get sticky. The view should have one row, with each column representing the return of an aggregate function on the base table. Here is a query that returns this kind of result:
select
(select count(rowid) from pasta) "PASTA_ROWS",
(select count(salt) from pasta where salt='F') "SALT_IS_FEMALE_ROWS"
from dual;
You can see that by selecting the subqueries from dual, I get the return to be in seperate columns. The problem is that when I try creating a Materialized view, I get an error.
ERROR at line 8:
ORA-22818: subquery expressions not allowed here
So, is there a simple SQL query that will return the values I am asking for, in seperate columns, but will not make the materialized view produce an error?
Thanks,
Edward
For your reference, here is a describe of the pasta table:
SQL> desc pasta
Name Null? Type
CHEESE NUMBER(4)
TOMATO VARCHAR2(20)
SALT VARCHAR2(1)
OREGANO VARCHAR2(20)
OLIVE_OIL VARCHAR2(40)Edward:
Something like this should work:
SELECT COUNT(*) PASTA_ROWS,
SUM(DECODE(salt,'F',1,0)) SALT_IS_FEMALE_ROWS
FROM pastaTTFN
John -
How to pull materialized view code from database
I wana to view the code for the materialized view from the data base server.Whats the statment to fetch the code of materialized view from the database.
Neeraj GoelThere is table user_mviews,from where we get query and others related matter to materialized views.
Neeraj Goel -
Creating a material with just the basic view using BAPI
Hi
I intend to create a new material with just the basic view using BAPI BAPI_MATERIAL_SAVEDATA -
To do this - I believe I have to fill in the structure HEADDATA data - ( mandatory ) with the required values - I fill values for fields IND_SECTOR, MATL_TYPE & basic view ( check this field ) and leave the MATERIAL field as blank (assuming internal numbering ) and then fill values of the CLIENTDATA structure with values for the basic data view.
Is this correct ? Will my material number created be returned in the RETURN structure - how do I look for the material number exclusively in my RETURN structure ?hi
good
go through this progarm which ll give you detail idea about BAPI_MATERIAL_SAVEDATA
REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
LINE-COUNT 065(001).
TABLES: T001L, "Storage Locations
MARA, "General Material Data
MAKT, "Material Descriptions
MBEW, "Material Valuation
MARC. "Plant Data for Material
DATA: BAPI_HEAD LIKE BAPIMATHEAD,
BAPI_MAKT LIKE BAPI_MAKT, "Material Description
BAPI_MARA1 LIKE BAPI_MARA, "Client Data
BAPI_MARAX LIKE BAPI_MARAX,
BAPI_MARC1 LIKE BAPI_MARC, "Plant View
BAPI_MARCX LIKE BAPI_MARCX,
BAPI_MBEW1 LIKE BAPI_MBEW, "Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX,
BAPI_RETURN LIKE BAPIRET2.
DATA: BEGIN OF INT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF INT_MAKT.
DATA: BEGIN OF INT_MAT OCCURS 100,
WERKS(4), "Plant
MTART(4), "Material type
MATNR(18), "Material number
MATKL(9) , "Material group
MBRSH(1), "Industry sector
MEINS(3), "Base unit of measure
GEWEI(3), "Weight Unit
SPART(2), "Division
EKGRP(3), "Purchasing group
VPRSV(1), "Price control indicator
STPRS(12), "Standard price
PEINH(3), "Price unit
SPRAS(2), "Language key
MAKTX(40), "Material description
END OF INT_MAT.
SELECT-OPTIONS:
PLANT FOR MARC-WERKS OBLIGATORY MEMORY ID PLT,
MATERIAL FOR MARA-MATNR MEMORY ID MAT,
MATLTYPE FOR MARA-MTART MEMORY ID MTY,
DIVISION FOR MARA-SPART MEMORY ID DIV.
PARAMETERS: F_FILE LIKE RLGRAP-FILENAME
DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
IF GETDATA = 'X'.
PERFORM DOWNLOAD_DATA.
PERFORM DOWNLOAD_FILE.
ENDIF.
IF UPDDATA = 'X'.
PERFORM UPLOAD_FILE.
PERFORM UPDATE_MM.
ENDIF.
FORM DOWNLOAD_DATA.
SELECT * FROM MARC WHERE LVORM EQ ' '
AND WERKS IN PLANT
AND MATNR IN MATERIAL.
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
CHECK MATLTYPE.
CHECK DIVISION.
CLEAR MBEW.
SELECT SINGLE * FROM MBEW WHERE MATNR = MARC-MATNR
AND BWKEY = MARC-WERKS.
CLEAR MAKT.
SELECT SINGLE * FROM MAKT WHERE SPRAS = 'EN'
AND MATNR = MARC-MATNR.
WRITE:/ MARC-WERKS, "Plant
MARA-MTART, "Material type
MARA-MATNR, "Material number
MARA-MATKL, "Material group
MARA-MBRSH, "Industry sector
MARA-MEINS, "Base unit of measure
MARA-GEWEI, "Weight Unit
MARA-SPART, "Division
MARC-EKGRP, "Purchasing group
MBEW-VPRSV, "Price control indicator
MBEW-STPRS, "Standard price
MBEW-PEINH, "Price unit
MAKT-SPRAS, "Language key
MAKT-MAKTX. "Material description
INT_MAT-WERKS = MARC-WERKS. "Plant
INT_MAT-MTART = MARA-MTART. "Material type
INT_MAT-MATNR = MARA-MATNR. "Material number
INT_MAT-MATKL = MARA-MATKL. "Material group
INT_MAT-MBRSH = MARA-MBRSH. "Industry sector
INT_MAT-MEINS = MARA-MEINS. "Base unit of measure
INT_MAT-GEWEI = MARA-GEWEI. "Weight Unit
INT_MAT-SPART = MARA-SPART. "Division
INT_MAT-EKGRP = MARC-EKGRP. "Purchasing group
INT_MAT-VPRSV = MBEW-VPRSV. "Price control indicator
INT_MAT-STPRS = MBEW-STPRS. "Standard price
INT_MAT-PEINH = MBEW-PEINH. "Price unit
INT_MAT-SPRAS = MAKT-SPRAS. "Language key
INT_MAT-MAKTX = MAKT-MAKTX. "Material description
APPEND INT_MAT.
CLEAR INT_MAT.
ENDSELECT.
ENDFORM.
FORM DOWNLOAD_FILE.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Download Successfully to your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPLOAD_FILE.
call function 'WS_UPLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Upload Successfully from your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPDATE_MM.
LOOP AT INT_MAT.
Header
BAPI_HEAD-MATERIAL = INT_MAT-MATNR.
BAPI_HEAD-IND_SECTOR = INT_MAT-MBRSH.
BAPI_HEAD-MATL_TYPE = INT_MAT-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
Material Description
REFRESH INT_MAKT.
INT_MAKT-LANGU = INT_MAT-SPRAS.
INT_MAKT-MATL_DESC = INT_MAT-MAKTX.
APPEND INT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = INT_MAT-MATKL.
BAPI_MARA1-BASE_UOM = INT_MAT-MEINS.
BAPI_MARA1-UNIT_OF_WT = INT_MAT-GEWEI.
BAPI_MARA1-DIVISION = INT_MAT-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = INT_MAT-WERKS.
BAPI_MARC1-PUR_GROUP = INT_MAT-EKGRP.
BAPI_MARCX-PLANT = INT_MAT-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
Accounting
BAPI_MBEW1-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
BAPI_MBEW1-STD_PRICE = INT_MAT-STPRS.
BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
BAPI_MBEWX-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
WRITE:/ BAPI_HEAD, BAPI_MARC1.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = INT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error Message ', BAPI_RETURN.
ENDIF.
ENDLOOP.
ENDFORM.
*---End of Program
thanks
mrutyun^ -
Creating Materialized View with the Distinct key word
Hi
I need help to create Materialized View with the Distinct key word.
my query is
select distinct col1, col2 from t1;
is there any alternate of DISTINCT because I can not refresh the MV as fast on demand if I am using it and Fast on Demand is a must for me.hi
check out this link
http://download-west.oracle.com/docs/cd/B12037_01/server.101/b10736/basicmv.htm#i1007299
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/intro.htm#sthref183
hope this helps
CHeers -
Creating a Materialized View Log After the Data has been instered
Hi,
I am trying to create a method of replication from Oracle to MySQL using the Materialized View Log table.
This has been done before and works quite well, the only problem is that I am trying to impliment the log after the table has been created and populated and wish to push all the existing data through the log file...
Does anyone know if it is possible to refresh the Materialized View Log and not a Materialized View.
The way the replication is intended to work is:
Oracle> Data inserted into table
Oracle> writes the vector data to the MVL
Script> Monitors the MVL and can see the changes being made to the Oracle Table
Script> Updates MySQL with the data and removes the rows from the MVL
MySQL is then used with other unix systems
Currently we export the data from the table using Triggers and a cronjob running every x minute to check for changes in the TriggerTables
Many thanks for your time on this, I have been checking for almost a whole working day and not found the answer to this problem.Thats what I thought, the MVL will only read data that has changed since it was created and wont have the option to load in all the data as though it was made before the table was created.
From what I have read, the MVL is quicker than a Trigger and I have some free code that prooved to work from a MVL using it as a reference to know what records to update. There is not that much to a MVL, a record ID and type of update, New, Update or Delete.
I think what I will have to do is work on a the same principle for the MVL but use a Trigger as this way we can do a full reload if required at any point.
Many thanks for your help. -
Can we create materialized view on the top of another materialized view.
Hi ,
can we create materialized view on the top of another materialized view.
Thanks
NaveenWelcome , Just remember is not good apporch to do that since performance when MV refresh
Please mark this thread as answered . -
Hi,
We have installed Oracle 12c Oracle Developer Tools for Visual Studio (Visual Studio is 2010 edition). With this tool we can manage tables, views, etc... but we also need to manage more database objects such as materialized views, materialized view logs and db links.
Is there any option to manage this object from Server Explorer and to add the script in the Database Project? At the same time, the schema compare tools does not include this object types. Is there any option to compare them?
Thanks.As you noticed, not all database objects are available in Server Explorer, and because of this they can't have scripts generated for them, nor can they be compared with Schema Compare.
In a pinch, you should be able to use SQL Developer to do this. -
How can I fast refresh the materialized view !!
I created a MV base on some tables in order to improve the querey speed.
but the mv I have created falied to refresh fast.
because there are two same table in the from clause:
jcdm jc1,jcdm jc2
create materialized view temp_mv
nologging
pctfree 0
storage (initial 2048k next 2048k pctincrease 0)
parallel
build immediate
refresh force
on demand
as
select
TAB_GSHX.rowid hx_rid,
TAB_GSHD.rowid hd_rid ,
JC1.rowid jc1_rid ,
JC2.rowid jc2_rid ,
YSHD_ID HXID,
JC1.JCDM QFD,
JC2.JCDM JLD
FROM
TAB_GSHX,
TAB_GSHD,
jCDM JC1,
JCDM JC2
WHERE
YSHD_ID=YSHX_ID
AND YSHD_QFD=JC1.JBJC_ID
AND YSHD_JLD=JC2.JBJC_ID
AND TO_CHAR(YSHX_time,'YYYYMMDD')='20030101'
the column msgtxt of the table MV_CAPABILITIES_TABLE is :
"the multiple instances of the same table or view" and " one or more joins present in mv".
How can I succeed in fast refresh the above temp_mv!!!
thanks.lianjun,
When you are using Oracle9i there is a procedure which can help you setup the materialized view. If some option isn't working it gives you hint why it doesn't work.
The procedure is dbms_mview.explain_mview.
Take a look at the documentation how to use it. (In the Oracle9i DWH guide the package is explained.)
Hope this helps
With kind regards,
Bas Roelands -
Creating a Mat View having the same name with that of the table name
Hi everyone,
After dropping the mat view name "QQ.TRDLN_DIM_MV", I'm trying to re-create it by having the same name as that of the table but I got an error stating that "name is already used by an existing object". How can create a mat view to look like the object owned by schema "GQ", having a name that is the same as that of the table name, without dropping the table?
OWNER_O OBJECT_TYPE CREATED LAST_DDL_ TIMESTAMP STATUS OBJECT_NAME
===
GQ MATERIALIZED VIEW 05-NOV-08 13-DEC-08 2008-11-05:06:31:46 VALID TRDLN_DIM_MV
GQ TABLE 05-NOV-08 15-DEC-08 2008-11-05:06:31:00 VALID TRDLN_DIM_MV
QQ TABLE 17-AUG-07 16-MAR-09 2007-08-17:17:05:21 VALID TRDLN_DIM_MV
SQL>CREATE MATERIALIZED VIEW QQ.TRDLN_DIM_MV
2 TABLESPACE FPLC01S
3 NOCACHE
4 NOLOGGING
5 COMPRESS
6 PARALLEL ( DEGREE 2 INSTANCES 1 )
7 BUILD IMMEDIATE
8 REFRESH FORCE ON DEMAND
9 WITH PRIMARY KEY
10 AS
11 select /*+ NO_REWRITE */ trdln_id,
12 trdln_skid,
13 trdln_end_date,
14 first_value(trdln_end_date) over (partition by trdln_id order by trdln_end_date DESC) as MaxDate
15 from QQ.trdln_dim;
from QQ.trdln_dim
ERROR at line 15:
ORA-00955: name is already used by an existing object
I appreciate your help. Many thanks in advance!
Regards,
RadicYou'd have to rename the table (using ALTER TABLE tablename RENAME TO othername; ) before you create the MV.
You can't have both existing with the same name in the same schema.
What you see in the GQ schema is that the "table" is the underlying table for the Materialized View.
When you do a CREATE MATERIALIZED VIEW MY_MV AS ...
Oracle creates two objects with the same name, one being the Materialized View MY_MV and the other being the table MY_MV which is the physical storage. {Remember that a Materialized View is a means of getting a physical representation of a View}.
In the QQ schema what you have is either
a. a real Table
or
b. an improperly dropped MV, resulting in the underlying Table still present. -
BAPI FM to set the "Material Number used by Vendor" and the "Order Unit"
Hi,
is there any bapi or fm to set these two fields in the purchase view of the material?
to create the material i've used the "BAPI_MATERIAL_SAVEDATA" but i don't have a clue where those field's can be set.
thkzs to all in advanced
Regards
JaimeSolved using Batch input
Maybe you are looking for
-
NOTHING_FOUND exception while running a webdynpro application
I have a webdynpro view which has two containers. one of them contains a view with some ui elements and the other is to display an ALV table . When i run my application, i get a NOTHING_FOUND exception. is it something in the system or i am doing som
-
Alternative to DML Error Logging
I am supposed to catch invalid records in error table with the ORA exception. I am using 10g. Using DML Error logging i cannot catch primary key violations. Using for loop it will be very slow because there are lots of records. How to catch invalid r
-
How to transfer iPhoto library into another existing iPhoto library?
Hi. I need to transfer iPhoto (the whole library - created folders and the events the way they been downloaded from camera) from Imac iPphoto to an existing MacBook iPhoto library. I did find in here how to transfer the entire library to the new comp
-
How to get P1102w printing wirelessly
I have given up trying to get my LaserJet P1102w to print wirelessly. I have tried hours and hours of troubleshooting and resintalling. I just shared it and will print that way. How do I turn off the wireless functionality? I can log into the web in
-
[Help] Installation hangs on "generating locales".
Hello everybody, I tried to install AL. (I love the philosophy and stuff. It's the perfect distro imo.) It worked on my Virtual Box, but when it just freezed on "generating locales". Is this a real problem? Can I solve it? I'm rather new to arch but