MV Incremental Refresh on join query of remote database tables
Hi,
I am trying to create a MV with incremental refresh option on a join query with 2 tables of remote database.
Created MV logs on 2 tables in the remote database.
DROP MATERIALIZED VIEW LOG ON emp;
CREATE MATERIALIZED VIEW LOG ON emp WITH ROWID;
DROP MATERIALIZED VIEW LOG ON dept;
CREATE MATERIALIZED VIEW LOG ON dept WITH ROWID;
Now, trying to create the MV,
CREATE MATERIALIZED VIEW mv_emp_dept
BUILD IMMEDIATE
REFRESH FAST
START WITH SYSDATE
NEXT SYSDATE1/(24*15)+
WITH PRIMARY KEY
AS
SELECT e.ename, e.job, d.dname FROM emp@remote_db e,dept@remote_db d
WHERE e.deptno=d.deptno
AND e.sal>800;
Getting ORA-12052 error.
Can you please help me.
Thanks,
Anjan
Primary Key is on EMPNO for EMP table and DEPTNO for DEPT table.
Actually, I have been asked to do an feasibility test whether incremental refresh can be performed on MV with join query of 2 remote database tables.
I've tried with all combinations of ROWID and PRIMARY KEY, but getting different errors. From different links, I found that it's possible, but cannot create any successful testcase anyway.
It will be very much helpful if you can correct my example or tell me the restrictions in this case.
Thanks,
Anjan
Similar Messages
-
Select type_address in Portal report's sql query using remote database
how do i select type_address item from remote database table ?
I've already create the database link called db_link.
I've already execute the sql statement in the specified database, and it works.
for example: ( sql plus in the specified database )
select syk.alamat_syarikat.alamat1 from MCS_SYARIKAT syk
for example: ( sql statement in portal report using database link )
select nama_syarikat, syk.alamat_syarikat.alamat1 from MCS_SYARIKAT@dblink syk
error massage:
Unable to describe SQL statement. Please correct it (WWV-13010)
Invalid SQL statement: select syk.alamat_syarikat.alamat1 from MCS_SYARIKAT@dblink syk (WWV-13005)
ORA-01001: invalid cursor (WWV-11230)
ORA-22804: remote operations not permitted on object tables or user-defined type columns (WWV-11230)
Failed to parse as MCS_PUBLIC - select syk.alamat_syarikat.alamat1 from MCS_SYARIKAT@dblink syk (WWV-08300)Here's the actual query:
SELECT BUILD_EXT_RES_LIST(EXT_FILE.ID) A
FROM EXT_FILE_RES, EXT_FILE
WHERE EXT_FILE_RES.ON_OWNER_PROFILE = 'Y' AND
EXT_FILE.OWNER_ID = :PROFILE AND
EXT_FILE.ID = EXT_FILE_RES.EXT_ID AND
(RES_SUBSCRIBER_YN(EXT_FILE.ID,:CURR_ID) = 'YES' OR
ADMINYESNO(:CURR_ID,:PROFILE) = 'YES')
ORDER BY EXT_FILE.FILE_NAMEAnd here's the actual error message:
1 error has occurred
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00904: "SER_IS_ADMINYESNO": invalid identifier -
Merge a remote database table using dblink
We have a merge statement running in source database which is merging to a table in remote database using db link. The remote table is partitonoed (interval) table.Source db is 10g and target is 11g.
this merge statement is failing with error saying,
error occurred at recursive SQL level 1
00942: table or view does not exist
ORA-02063: preceding 2 lines from ORCL_ONL_LIVE
If anyone have any idea about this error, please share with ususer585870 wrote:
We have a merge statement running in source database which is merging to a table in remote database using db link. The remote table is partitonoed (interval) table.Source db is 10g and target is 11g.
this merge statement is failing with error saying,
error occurred at recursive SQL level 1
00942: table or view does not exist
ORA-02063: preceding 2 lines from ORCL_ONL_LIVE
If anyone have any idea about this error, please share with us
How do you explain the ORA-00942 error first ? Are you able to select that table ? Can we see the merge statement ?
Nicolas. -
Query related to database tables
Hi,
Im having a requirement wherein i would like to create one ztable and the purpose is only to get the fields but not the values for the same. Bez, with the help of these fields in ztable and developing some logic and it shld be dynamic based on the no of fields appended into ztable.
To be clear, can i write a select query only to get the fields from the table but not the values ( in this no way i will get the values bez i won't insert any records for the same).
I thnk im clear from my end.
Thanks
rohithTo get the fields, you can write the query like this too :
tables: dd03l.
data: begin of itab occurs 0,
fieldname like dd03l-fieldname,
end of itab.
*parameters: p_tab like dd03l-tabname.
select fieldname from dd03l into table itab where tabname = 'VBAK'.
LOOP AT ITAB.
WRITE:/ itab-fieldname.
ENDLOOP. -
How to adjust adhoc query when the database table changed.
DearFreinds,
I have created an adhoc Query , however after few days there was a requirement to remove some fields and change the length of some fields . Now the Adhoc query showing as to adjust , however when iam trying to adjust nothing is happening. Could any one let me know how to adjust with the table strucutre in the adhoc query.
Regards
madhu.Hi Sumit,
Yes i have adjusted the database from se11 itself by going into utlity > adjust database . However i can still see the
adhoc query -> infoset asking me when iam trying to go in change mode saying the database table has been changed do you want to adjust .
I have adjusted by going to more functions still there is no change. Please let me know what exactly i have to do.
regards
madhu -
Help with SQL Query Involving Three Database Tables
Hi,
My SQL is very rusty since I have not touched it in over one year.
I was given an SQL question in a job interview and I am curious to know the right answer.
This was a pre-prepared written test and the interviewer did not know the answer.
There are three database tables: STUDENTS, COURSES and STUDENT_COURSES
Table STUDENTS has STUDENT_ID and STUDENT_NAME columns.
Table COURSES has COURSE_ID and COURSE_DESCRIPTION columns.
Table STUDENT_COURSES has columns STUDENT_ID and COURSE_ID.
Provide a query that returns all the students that are enrolled in all the courses.
Thanks,
Avi.It is probably good to say that this task may be solved such way, if database normalized and there are references
Basically here just is a variant of your solution
DROP TABLE student_course;
DROP TABLE student;
DROP TABLE course;
CREATE TABLE student
(student_id NUMBER(9) PRIMARY KEY,
student_name VARCHAR2(30));
CREATE TABLE course
(course_id NUMBER(9) PRIMARY KEY,
dscr VARCHAR2(100));
CREATE TABLE student_course
(student_id NUMBER(9),
course_id NUMBER(9));
ALTER TABLE student_course
ADD CONSTRAINT pk_st_crs PRIMARY KEY
(student_id, course_id);
ALTER TABLE student_course
ADD CONSTRAINT fk_student
FOREIGN KEY (student_id)
REFERENCES student(student_id);
ALTER TABLE student_course
ADD CONSTRAINT fk_course
FOREIGN KEY (course_id)
REFERENCES course(course_id);
INSERT INTO student
VALUES (1, 'NAME1');
INSERT INTO student
VALUES (2, 'NAME2');
INSERT INTO student
VALUES (3, 'NAME3');
INSERT INTO course
VALUES (101, 'Desc 1');
INSERT INTO course
VALUES (102, 'Desc 2');
INSERT INTO course
VALUES (103, 'Desc 3');
INSERT INTO student_course
VALUES (1, 101);
INSERT INTO student_course
VALUES (1, 102);
INSERT INTO student_course
VALUES (2, 101);
INSERT INTO student_course
VALUES (2, 103);
INSERT INTO student_course
VALUES (3, 101);
INSERT INTO student_course
VALUES (3, 102);
INSERT INTO student_course
VALUES (3, 103);
COMMIT ;
WITH st_crs_cnt AS
(SELECT student_id,
COUNT (*) tot
FROM student_course
GROUP BY student_id)
SELECT sc.student_id,
sc.tot
FROM st_crs_cnt sc
WHERE sc.tot = (SELECT COUNT (*) FROM course); -
Fast refresh of materialized view on remote database
Hi All,
I have the following scenario, two databases called ORCL_1 and ORCL_2
ORCL_1 (11.1.0.7) ORCL_2 (10.2.0.1)
EMPLOYEE (Master table)
DEPARTMENT (Master table)
I have created materialied view logs on both the master tables as follows...
create materialized view log on department
with rowid, sequence(department_id, department_name)
including new values
create materialized view log on employee
with rowid, sequence (employee_no, surname, firstname, title, department_id, dob, dependants)
including new values
On ORCL_1 i have created a materialized view as follows...
create materialized view employee_mview
build immediate
refresh on demand with rowid
as select e.employee_no, e.title, e.firstname, e.surname, d.department_name, d.department_id, e.dob, e.dependants, e.rowid emp_rowid, d.rowid dept_rowid
from employee@ORCL_2 e,
department@ORCL_2 d
where e.department_id = d.department_id
then i have a scheduled task, on ORCL_1, that execute "...dbms_mview.refresh ('mac_dba.employee_mview','?');...." every minute
this works fine, except for the fact that all the records are deleted from the materialized view and then all the records are re-inserted.
How can i get it so that only the records that have been added or amended, as per the materialized view logs, are refreshed to the materialized view.
thanks
MelHi Harry,
Have tried creating materialized view as follows...
create materialized view mac_dba.employee_mview
build immediate
refresh fast on demand with rowid
as select e.employee_no, e.title, e.firstname, e.surname, d.department_name, d.department_id, e.dob, e.dependants, e.rowid emp_rowid, d.rowid dept_rowid
from mac_dba.employee@ORCL_2 e,
mac_dba.department@ORCL_2 d
where e.department_id = d.department_id
I get the following error message
ORA-12028: materialized view type is not supported by master site
thanks
Mel -
Hi
i have a table named "gatepass" in database A.
i created public synonym
(create public synonym gatepass for schema.gatepass@databaselink) in database B for the table "gatepass" in database A.
when i query that table in db B through SQL prompt, it fetches data.
but when i query that table through form, form hangs(goes into working state) and ends.
where is the problem
plz help
thanxi use forms 6i.
in your database B create a view:
create or replace view gatepass_v as
select * from schema.gatepass@databaselink
and then create a synonym public over the new view.
and in your form use the sinonym public or the view.
test please. -
How to query a sql database table from webdynpro?
Hi All,
Can someone tell me the steps involved in accessing a sql server database table and retrieving the record set from a webdynpro application.
Thanks in advance.
Best regards,
DivyaHello Divya,
I would recommend you to read "Java Persistence" section in Development manual describing various options for database integration http://help.sap.com/saphelp_nw04/helpdata/en/61/fdbc3d16f39e33e10000000a11405a/frameset.htm
Tutorials
http://help.sap.com/saphelp_nw04/helpdata/en/46/ddc4705e911f43a611840d8decb5f6/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/frameset.htm
Web serices
http://help.sap.com/saphelp_nw04/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/frameset.htm
EJB
http://help.sap.com/saphelp_nw04/helpdata/en/19/f9bc3d8af79633e10000000a11405a/frameset.htm
Best regards, Maksim Rashchynski. -
hello Experts,
Is there any System table to get the Year.For Example to get the Month we can use T247 database table like this any system table to get year.
thanks
regards,
Ashok.Sorry can you explain what do you mean to get year ??
The below would give you the year.
Year = Sy-datum(4).
If you wish to convert it into words you can use SPELL_WORD and make sure to use currency with zero decimails..in that case it would return two thousand six in words. -
Full vs Incremental Refresh?
What is the main difference between full an incremental (auto)refreshes?
Documentation suggests that full refresh is recommended on the groups when data is changing very frequently while Incremental refresh is advised to use on the tables when data is more or less static.
1. Is there any way to justify/quantify what is the frequent data change (50% of records in 24 hours, etc..)?
2. In the documentation I also found that using Incremental Data Refresh TT will hook up triggers on the tables in the Oracle DB. Is that correct?
3. For Full DataRefresh TT will be using logs from Oracle DB to refresh the data in TT. In some cases logs in the Oracle DB are kept only for a specific number of days (i.e. 5 days). What will happen if those logs are not available?
4. Using Full refresh TT will be reloading all the data from the Oracle DB. Is there any impact for the data availability in TT by using Full refresh?
5. I believe that Full data refresh will be taking much more time compared to the Incremental data refresh. In this case if I set autorefresh to every 5 seconds, then basically I will end up with the infinite refresh. What is recommended frequency for Full and Incremental refreshes?
6. Full vs Incremental refresh. Which one is using less resources in Oracle DB and TT and why?
Thank you.Full refresh works by discarding all the data in the cache group tables and then reloading it all from Oracle on every refresh cycle. it is best when (a) the tables are very small and (b) the refresh interval is not too short.
Incremental autorefresh works by installing a trigger and a tracking table on each of the base tables in Oracle. As changes occur in Oracle they are tracked and when the next autorefrsh cycle comes around only the changes are propagated to the cache tables. Incremental is recommended when (a) the tables involved are of any substantial size and/or (b) when a short refresh interval is required. To try and answer your specific questions:
1. Is there any way to justify/quantify what is the frequent data change (50% of records in 24 hours, etc..)?
CJ>> Not really. This comes down to application requirements, how much load you can tolerate on Oracle etc.
2. In the documentation I also found that using Incremental Data Refresh TT will hook up triggers on the tables in the Oracle DB. Is that correct?
CJ>> Yes, a single trigger and a single tracking will be instantiated on each base table that is cached in cache group that uses incremental autorefresh.
3. For Full DataRefresh TT will be using logs from Oracle DB to refresh the data in TT. In some cases logs in the Oracle DB are kept only for a specific number of days (i.e. 5 days). What will happen if those logs are not available?
CJ>> No. Neither incremental nor full refresh uses Oracle logs. Full refresh simply queries the data in the table and incremental uses a combination of the data in the table and the tracking table.
4. Using Full refresh TT will be reloading all the data from the Oracle DB. Is there any impact for the data availability in TT by using Full refresh?
CJ>> Yes. Using full refresh TimesTen starts by emptying the cache table and so there is a significant impact on data availability. Incremental refresh does not have this issue.
5. I believe that Full data refresh will be taking much more time compared to the Incremental data refresh. In this case if I set autorefresh to every 5 seconds, then basically I will end up with the infinite refresh. What is recommended frequency for Full and Incremental refreshes?
CJ>> regardless of the refresh method chosen you should ensure that the refresh interval is set >> than the time it takes to perform the refresh. Setting it to a shorter value simply resuls in almost cointihnuous refresh and a much heavier load on Oracle. This is especially problematic with full refresh.
6. Full vs Incremental refresh. Which one is using less resources in Oracle DB and TT and why?
CJ>> Again it depends but in general incremental is the preferred choice.
In my experience I have rarely seen anyone use full autorefresh.
Chris -
Creating a hierarchy based on a remote database link
I am trying to create a hierarchy based on a synonym for a remote database table. The hierarchy wizard works correctly, and the table columns do appear as choices in the drop boxes. However, when I try to run the application, I get the error "No data found. This data does not exist or you do not have privileges to view it". Does anyone know how to resolve this error? Or how to work around this?
I can successfully create and query a form based on the remote table. And, I am able to create a hierarchy from other tables (which do not use a database link) without a problem.
Thanks for your help!This is the query which I am using to build a report
SELECT
rollup_timestamp "Date",
max(decode(target_guid,'199F0B201A3D71A63040BADFAA4F9E90',average,0)) host1,
max(decode(target_guid,'3FB1329F59339C07E11304B69DC4E594',average,0)) host2
FROM "sysman.MGMT$METRIC_DAILY"
WHERE
(target_guid='199F0B201A3D71A63040BADFAA4F9E90'
or
target_guid='3FB1329F59339C07E11304B69DC4E594')
AND
metric_name='Load'
AND
metric_column='memUsedPct'
AND
rollup_timestamp >= to_date('01-10-2009','dd-mm-yyyy') and rollup_timestamp <= sysdate
GROUP BY rollup_timestamp
ORDER BY "Date"
And for your previous question I couldn't even create a page.
Regards
Balaji
Edited by: user7290747 on 6/01/2010 16:17 -
How an INDEX of a Table got selected when a SELECT query hits the Database
Hi All,
How an Index got selected when a SELECT query hits the Database Table.
My SELECT query is as ahown below.
SELECT ebeln ebelp matnr FROM ekpo
APPENDING TABLE i_ebeln
FOR ALL ENTRIES IN i_mara_01
WHERE werks = p_werks AND
matnr = i_mara_01-matnr AND
bstyp EQ 'F' AND
loekz IN (' ' , 'S') AND
elikz = ' ' AND
ebeln IN s_ebeln AND
pstyp IN ('0' , '3') AND
knttp = ' ' AND
ko_prctr IN r_prctr AND
retpo = ''.
The fields in the INDEX of the Table EKPO should be in the same sequence as in the WHERE clasuse?
Regards,
VijiHi,
You minimize the size of the result set by using the WHERE and HAVING clauses. To increase the efficiency of these clauses, you should formulate them to fit with the database table indexes.
Database Indexes
Indexes speed up data selection from the database. They consist of selected fields of a table, of which a copy is then made in sorted order. If you specify the index fields correctly in a condition in the WHERE or HAVING clause, the system only searches part of the index (index range scan).
The primary index is always created automatically in the R/3 System. It consists of the primary key fields of the database table. This means that for each combination of fields in the index, there is a maximum of one line in the table. This kind of index is also known as UNIQUE. If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVING clause, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
reference : help.sap.com
thanx. -
JDBC Thin driver doesn't support writing data into remote database via database link
Dear Oracle Guru:
Please confirm: Oracle JDBC thin driver does not support writing data to remote database via database link.
The following errors occur when trying to write data into a remote database via database link through jdbc thin driver:
ORA-03106: fatal two-task communication protocol error
ORA-02063: preceding line from FDBE.PAPDSRAS1
ORA-02063: preceding 2 lines from PA
SQL statement is a prepared statement using a SQL like: insert into mytable@pa (col1,col2) values (?,?).
Thanks.
nullThanks, Dan.
I still think it is a driver problem, because I can do similar things in a stored procedure or in PL/SQL Developer to copy records from a local database table to a remote database table via database link (insert into mytable@pa select * from mytable). The value for distributed_transactions of our database is 10. -
Poor performance with Oracle Spatial when spatial query invoked remotely
Is anyone aware of any problems with Oracle Spatial (10.2.0.4 with patches 6989483 and 7003151 on Red Hat Linux 4) which might explain why a spatial query (SDO_WITHIN_DISTANCE) would perform 20 times worse when it was invoked remotely from another computer (using SQLplus) vs. invoking the very same query from the database server itself (also using SQLplus)?
Does Oracle Spatial have any known problems with servers which use SAN disk storage? That is the primary difference between a server in which I see this poor performance and another server where the performance is fine.
Thank you in advance for any thoughts you might share.OK, that's clearer.
Are you sure it is the SQL inside the procedure that is causing the problem? To check, try extracting the SQL from inside the procedure and run it in SQLPLUS with
set autotrace on
set timing on
SELECT ....If the plans and performance are the same then it may be something inside the procedure itself.
Have you profiled the procedure? Here is an example of how to do it:
Prompt Firstly, create PL/SQL profiler table
@$ORACLE_HOME/rdbms/admin/proftab.sql
Prompt Secondly, use the profiler to gather stats on execution characteristics
DECLARE
l_run_num PLS_INTEGER := 1;
l_max_num PLS_INTEGER := 1;
v_geom mdsys.sdo_geometry := mdsys.sdo_geometry(2002,null,null,sdo_elem_info_array(1,2,1),sdo_ordinate_array(0,0,45,45,90,0,135,45,180,0,180,-45,45,-45,0,0));
BEGIN
dbms_output.put_line('Start Profiler Result = ' || DBMS_PROFILER.START_PROFILER(run_comment => 'PARALLEL PROFILE')); -- The comment name can be anything: here it is related to the Parallel procedure I am testing.
v_geom := Parallel(v_geom,10,0.05,1); -- Put your procedure call here
dbms_output.put_line('Stop Profiler Result = ' || DBMS_PROFILER.STOP_PROFILER );
END;
SHOW ERRORS
Prompt Finally, report activity
COLUMN runid FORMAT 99999
COLUMN run_comment FORMAT A40
SELECT runid || ',' || run_date || ',' || run_comment || ',' || run_total_time
FROM plsql_profiler_runs
ORDER BY runid;
COLUMN runid FORMAT 99999
COLUMN unit_number FORMAT 99999
COLUMN unit_type FORMAT A20
COLUMN unit_owner FORMAT A20
COLUMN text FORMAT A100
compute sum label 'Total_Time' of total_time on runid
break on runid skip 1
set linesize 200
SELECT u.runid || ',' ||
u.unit_name,
d.line#,
d.total_occur,
d.total_time,
text
FROM plsql_profiler_units u
JOIN plsql_profiler_data d ON u.runid = d.runid
AND
u.unit_number = d.unit_number
JOIN all_source als ON ( als.owner = 'CODESYS'
AND als.type = u.unit_type
AND als.name = u.unit_name
AND als.line = d.line# )
WHERE u.runid = (SELECT max(runid) FROM plsql_profiler_runs)
ORDER BY d.total_time desc;Run the profiler in both environments and see if you can see where the slowdown exists.
regards
Simon
Maybe you are looking for
-
Pacific Sales Purchases inside BBY
Warning to customers buying merchandise at pacific sales inside the best buy store. So I bought an appliance at the store, paid with my BBY credit card and at that time (end of April) they had that promotion that you get 6% back when you use your car
-
Hi experts, my client has made an recent upgrade to ecc 6, and now wants to take use some functionalities of the new version. One of the first it's to stop using all the RFC's that comunicate with foreign systems and change it to Web services. My que
-
Strange Grid Pattern when Using Smart Filter
I added a smart filter to my image in Photoshop CS5 and performed a Highlights and Shadows adjustment, and there's now a faint diamond-shaped grid pattern over the entire image. This shows through all adjustment layers but disappears when I turn off
-
Problem: I have a Sun box with 2 nodes (2 CPU's with non-shared memory but shared hard disk). A Java developed system will be running concurrently on both nodes (i.e. failure reduction). The problem is that both processes need access to a common regi
-
Hi regarding table maintance generator
Hi I created a Z tabel with fields as in standard table say MARA. when I create entries in SM30 i.e table maintanance generator it has to validate the data by checking aginst valid set of values in check table i.e MARA. can anybody make me know how t