How do I use Primary Key and RowID in Materialized View Logs and MVs
How do I use Primary Key and RowID in Materialized View Logs and Materialized Views????
I donât understand in the Materalized View Logs the diference between Primary Key and RowID. Besides, I could choose both Primary Key and RowID.
When I have to use RowID?? Why?? And Primary Key??? And both, Primary Key and RowID????
Thank you very much!
Yes, I have already read it...
But for example I donât Understand:
This is the example 8-1
CREATE MATERIALIZED VIEW LOG ON products
WITH SEQUENCE, ROWID
(prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_
category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_
size, supplier_id, prod_status, prod_list_price, prod_min_price)
INCLUDING NEW VALUES;
But if I create a Materialized View with TOAD if I choose a KEY field I receive the error:
ORA-12026: invalid filter column detected
Then I have to take out the Key (in the above example prod_id)
And then the script is
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE, PRIMARY KEY!!!!!!!!!!!!!!!!!!!!
(prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_
category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_
size, supplier_id, prod_status, prod_list_price, prod_min_price)
INCLUDING NEW VALUES;
I have PRIMARY KEY in the definition (I donât choose it) and I donât have the prod_id field
Why is it????
Note: If I execute the script to create the MV Log manually the PRIMARY KEY option NO IS in the script and the prod_id field either is in the script.
And on the other hand,
What is this:
CREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID;
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID;
CREATE MATERIALIZED VIEW LOG ON customers
WITH ROWID;
These MATERIALIZED VIEW LOG contain any fields????
Or it contain the primary key fields of this tables (sales, times and customers)??? Then, Why is it ROWID instead of PRIMARY KEY????
Thanks!
Similar Messages
-
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. -
Materialized view log and user....
Hi,
Assume that a user , let's call him A owns a table and another user B needs to create a materialized view log on the table who owns the A user.
Whereas the user B do have all object privileges(direct priv insert, update, delete.. not via a role) on the table of user A he cannot create a mv log on this table on his schema....
So, the stmts insert/update/delete on <tab_name> are successfully executed (having connected as user B).
The error message "ORA-00942: table or view does not exist " appears when i issue the command:
connect B/B;
create materialized view log on tab_name with sequence including new values;
Note: I use ORADB 10.2.0.4 and there is a synonym of tab_name to the user B (who tries to create the mv log on)...
Is the above req. possible in any way...???
Thank you,
SimThe documentation says the following:
The materialized view log is created in the same schema as the target master.HTH! -
View object SponsorVwView does not include a primary key attribute RowId
Hi,
I have an Entity Object and a View Object which do not have a primary key. So I use a ROWID to act as one. The only thing is that sometimes I get this error which causes the application to fail on the server:
JBO-30003: The application pool (gov.fda.cber.pts.model.services.CberPtsServiceLocal) failed to checkout an application module due to the following exception:
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.jbo.PersistenceException, msg=JBO-26028: View object SponsorVwView does not include a primary key attribute RowId of entity base SponsorVw.
Does anyone have any any ideas on this?
Thank you in advanceHi...
I believe you'll need a PK so Oracle will know how to update the MV. Is there any particular reason for you not having a PK in FAFG_ASSETS table? As an alternative, you may want to create a new column in this table and having a table trigger/sequence populating this column.
But It looks like you are using EBS, so, I don't know if you can add new columns to tables.
See if this thread can help you:
Re: ORA-12014: table 'XXX' does not contain a primary key constraint
Regards,
Marcos -
How i can Find primary key combination?
Hi,
I have small doubt how i can find primary key combination for a record in siebel application.( For example Opportunity list applet or Account list applet or etc.. what is the primary key combination and how i can find that combination for a particular record)
Thanks & RegardsHi
From the applet Identify the Business Component (BC)
From the BC idnetify the table, and the property user key sesuence will give you the proper combination. Column conflic_id is used for handling remote synchronization.
For BC based on S_PARTY, such as COntact, the table mentionned in User PRop will give your the main table used in this case.
Best Regards
EvtLogLvl -
How to get the Primary key from Synonym
Hi ,
I want to get the Primary Keys for my tables . I used
java.sql.DatabaseMetaData databasemetadata = connection.getMetaData();
ResultSet rs = databasemetadata.getTables(null, null, "%", null);
rs.next();
System.out.println(" TABLE_CAT "+ rs.getString(1));
System.out.println(" TABLE_SCHEM "+rs.getString(2));
System.out.println(" TABLE_NAME "+rs.getString(3));
System.out.println(" TABLE_TYPE "+rs.getString(4));
System.out.println(" REMARKS "+rs.getString(5)); gives :
TABLE_CAT null
TABLE_SCHEM PROGRESS
TABLE_NAME ApplicConv
TABLE_TYPE SYNONYM
REMARKS null
Now if I use :
rs = databasemetadata.getPrimaryKeys(null,"PROGRESS","Applicconv");
System.out.println("Is result set Non empty "+rs.next()); gives :
Is ResultSet non empty false .
Can you tell me why this result is empty? Is it because of my table is a Synonym?
If it is Synonym how to get the primary key ?You can use DatabaseMetaData#getPrimaryKeys.
-
Creating an unique index instaed of using primary key index
Hi ,
I heard in a debate sometimes it's better to create a unique index on a column and using it instaed of using primary key index in oracle.I couldn't understand what the reason propely.
Can anyone please help me in thsi topic if it is a valid one .
Thanks in advanceHi,
They are exactly NOT identical.
1. Unique key can have NULL values where primary keys can't.
2. Primary key is fundamentally those keys which do not change. I mean updating a primary key is not a good idea.
SQL> drop table test;
Table dropped.
SQL> create table test ( a number(2));
Table created.
SQL> ed
Wrote file afiedt.buf
1* create unique index test_idx on test(a)
SQL> /
Index created.
SQL> ed
Wrote file afiedt.buf
1* insert into test values(NULL)
SQL> /
1 row created.
SQL> drop table test;
Table dropped.
SQL>
SQL> create table test ( a number(2) primary key);
Table created.
SQL> insert into test values(NULL);
insert into test values(NULL)
ERROR at line 1:
ORA-01400: cannot insert NULL into ("HR"."TEST"."A")
SQL>Cheers,
Edited by: Avinash Tripathi on Nov 24, 2009 11:17 AM -
I have upgraded my OX from mountain lion to mavericks . the installer is asking for previous product key. How to know about previous key as the trial version is installed and I have paid for upgrade cost? I dont have the previous product key.
virenkhare wrote:
I have upgraded my OX from mountain lion to mavericks . the installer is asking for previous product key. How to know about previous key as the trial version is installed and I have paid for upgrade cost? I dont have the previous product key.
There are no keys, there is no trial version of OSX (ML or Mavericks) and Mavericks is free
What have you downloaded, and where did you get it -
How to CREATE MATERIALIZED VIEW LOG (MV fast refresh) with some JOINS
Hi @ all,
i'm trying to create a MATERIALIZED VIEW LOG for a fast refresh of a MATERIALIZED VIEW.
It works fine with a simple Request in the MATERIALIZED VIEW:
CREATE MATERIALIZED VIEW MV_ZOTD43_P
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT * FROM ZOTD43_P;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON ZOTD43_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_ZOTD43_P', 'f');
But when I use a complex SQL-Request with some JOINS (one of the Table with spatial Data) in the MATERIALIZED VIEW, I get an error:
CREATE MATERIALIZED VIEW MV_TEST
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT lptd04_p.sst_nr AS sst_nr,
lptd03_p.aaaa AS aaaa,
lptd04_geom.geom as geom
FROM lptd04_p lptd04_p
JOIN lptd01_p lptd01_p ON lptd01_p.cre_nr = lptd04_p.sst_nr
JOIN lptd04_geom ON lptd04_geom.sst_nr = lptd04_p.sst_nr
JOIN lptd03_p lptd03_p ON lptd03_p.lief_nr = lptd04_p.lief_nr;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON LPTD04_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_TEST', 'f');
Error report:
SQL Error: ORA-12004: REFRESH FAST kann für Materialized View "GDI"."MV_GDI_SST_STAMM" nicht benutzt werden
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2255
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2461
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2430
ORA-06512: in Zeile 1
12004. 00000 - "REFRESH FAST cannot be used for materialized view \"%s\".\"%s\""
*Cause: The materialized view log does not exist or cannot be used. PCT
refresh is also not enabled on the materialized view
*Action: Use just REFRESH, which will reinstantiate the entire table.
If a materialized view log exists and the form of the materialized
view allows the use of a materialized view log or PCT refresh is
possible after a given set of changes, REFRESH FAST will
be available starting the next time the materialized view is
refreshed.
Am I doing something wrong or is it not possible CREATE MATERIALIZED VIEW LOG when the MATERIALIZED VIEW got some JOINS?
Regards,
GreqThanks for the link Alessandro ,
the error seems something to do with the Column-Type SDO_GEOMETRY, so
i create a new thread in the Spatial Discussion forum:
FAST REFRESHing of Oracle Materialized Views containing SDO_GEOMETRY column
Regards,
Greq -
Using oracle text on a non-materialized view
I'm having trouble tracking down an error when using oracle text on a non-materialized view (indexes are on the referenced columns). My database has a users table and a user history table which saves the old values when a user profile changes. My view performs a "union all" so I can select from both at once.
I would like to use oracle text to perform a "contains" on the view whenever someone signs up to see if any current users or historical entries contain the desired username.
The following works fine:
contains(user_history_view, 'bill')but when I reference anything in the contains clause, i get a "column is not indexed" error:
contains(user_history_view, signup.user_name) --signup.username is 'bill'Here is a stripped-down demonstration (I am using version 10.2.0.4.0)
create table signup (
signup_id number(19,0) not null,
signup_name varchar2(255),
primary key (signup_id)
create table users (
user_id number(19,0) not null,
user_name varchar2(255),
primary key (user_id)
create table user_history (
history_id number(19,0) not null,
user_id number(19,0) not null,
user_name varchar2(255),
primary key (history_id),
foreign key (user_id) references users on delete set null
create index user_name_index on users(user_name)
indextype is ctxsys.context parameters ('sync (on commit)');
create index user_hist_name_index on user_history(user_name)
indextype is ctxsys.context parameters ('sync (on commit)');
create index signup_name_index on signup(signup_name)
indextype is ctxsys.context parameters ('sync (on commit)');
create or replace force view user_history_view
(user_id, user_name, flag_history) as
select user_id, user_name, 'N' from users
union all
select user_id, user_name, 'Y' from user_history;
--user bill changed his name to bob, and there is a pending signup for another bill
insert into users(user_id, user_name) values (1, 'bob');
insert into user_history(history_id, user_id, user_name) values (1, 1, 'bill');
insert into signup(signup_id, signup_name) values(1, 'bill');
commit;
--works
select * from user_history_view users, signup new_user
where new_user.signup_id = 1
and contains(users.user_name, 'bill')>0;
--fails
select * from user_history_view users, signup new_user
where new_user.signup_id = 1
and contains(users.user_name, new_user.signup_name)>0;I could move everything into a materialized view, but querying against real-time data like this would be ideal. Any help would be greatly appreciated.Hi,
this is to my knowledge not possible. It is hard for Oracle to do, think about a table with many rows, every row with that column must be checked. So I think only a single varchar2 is possible. Maybe for you will a function work. It is possible to give a function as second parameter.
function return_signup
return varchar2
is
l_signup_name signup.signup_name%type;
begin
select signup_name
into l_signup_name
from signup
where signup_id = 1
and rownum = 1
return l_signup_name;
exception
when no_data_found
then
l_signup_name := 'abracadabra'; -- hope does not exist
return l_signup_name;
end;Now you can use above function in the contains.
select * from user_history_view users --, signup new_user
--where new_user.signup_id = 1
where contains(users.user_name, return_signup)>0;I didn't test the code! Maybe you have to adjust the function for your needs. But it is a idea how this can be done.
Otherwise you must make the check by normaly check the columns by simple using a join:
select * from user_history_view users, signup new_user
where new_user.signup_id = 1
and users.user_name = new_user.signup_name;Herald ten Dam
htendam.wordpress.com -
Creation of Materialized view and Materialized view log.
I wanted to create materialized view with 'REFRESH FAST ON COMMIT' option.
1) Table1 --it is partitioned range + list -- Added primary key
2) view1 -- having primary keys on view's base table
Steps:
1) create materialized view log on Table1 ; -- default primary key
2) create materialized view log on view1. --- It is giving below error.
ORA-00942: table or view does not exist
i wanted to create Materialized view like below
create materialized view
REFRESH fast ON commit
as
select ...
... from table1
where c1 in (select c1 from view1 where ... );
Question:
1) As i am getting above error while creating MV log on view. Can we create MV log on view or we have to create MV log on view base table?
2) To create MV with ''REFRESH FAST ON COMMIT' option , do we need to have primary key on master tables?
Any pointers on this will really helpful.
Thanks
PrasadAlso created MV LOG on 3 tables and tried with joins ..
create materialized view
REFRESH fast ON commit
as
select ...
... from table1 , tab2 t2,tab3 t3
where ....
and ...
Get same error ORA-12052: cannot fast refresh materialized view AVSYS.EVENT_LOG_MV
2052. 00000 - "cannot fast refresh materialized view %s.%s"
*Cause: Either ROWIDs of certain tables were missing in the definition or
the inner table of an outer join did not have UNIQUE constraints on
join columns.
*Action: Specify the FORCE or COMPLETE option. If this error is got
during creation, the materialized view definition may have be
changed. Refer to the documentation on materialized views. -
Fast Forward and Rewind keyboard shortcuts in Log and Capture
In FCP, I want to assign the Fast Forward and Rewind buttons (in the Log and Capture mode) to buttons on the keyboard. I've assigned the functions using the Keyboard Layout in the Tools menu but it doesn't seem to be working like it should. In Log and Capture when I use the mouse to press the Fast Forward button, FCP stops the miniDV deck and fast forwards the tape as fast as possible without showing any picture. However, when I invoke the keyboard shortcut I created all I get is the picture moving a few fames per second instead of the tape stopping and fast forwarding as fast as possible. The same happens with the Rewind keyboard shortcut as well. Any ideas as to why, and how I might be able to fix this?
The computer I'm currently working on is a Dual 2 GHz PowerMac G5, 2.5 GB RAM, Final Cut Studio (Final Cut Pro 5.0.4).
–Michael
Message was edited by: Michael StarksWhen I press the fast forward or rewind button while logging a miniDV tape the video stops and then the tape fast forwards or rewinds at a MUCH faster rate than L or J ever give me. That is the behavior I am trying to get from a keyboard shortcut.
Not possible via keyboard shortcuts, unfortunately.
Even if you map the Rewind and Fast Forward functions to keys in a Custom Keyboard Layout - for those who didn't know, yes, there are specific commands for those functions even though they are not mapped by default - those shortcuts will not within the L&C window. We're stuck pressing the buttons.
Forgot to mention: the only time you're able to invoke the true fast forward or rewind function is using Shift-I/O (that is, Go to In Point or Out Point). Of course that only works if you have the necessary In/Out point set... -
Query on Materialized view and materialized view log
I am creating a materialized view something like this.but getting following error:
ERROR at line 1:
ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
SQL> create snapshot log on scott.emp;
Materialized view log created.
SQL> create materialized view scott_emp refresh fast on demand as select deptno,sum(sal) sum_sal from scott.emp group by deptno;
ERROR at line 1:
ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
Note when i have my query in materialized view as "select * from emp;" in place of
"select deptno,sum(sal) sum_sal from scott.emp group by deptno;" This code works fine.
How do i have a materialized with with a group by clause.
Thanks in AdvanceGot the answer myself.
I wasnt adding all the required columns.
CREATE MATERIALIZED VIEW LOG ON scott.emp
WITH SEQUENCE, ROWID (<all the required columns>)
INCLUDING NEW VALUES;
Anyways,
Thanks guys... -
Truncate table and materialized view log
I user oracle 10 R2
I have a table and on that table a materialized view log.
I execute in a pl/sql procedure:
1) execute immediate('drop materialized view log on tab1');
then:
2) execute immediate('truncate table tab1');
3) Now I insert a lot of records in tab1
4) execute immediate('create materialized view log on tab1 WITH rowid INCLUDING NEW VALUES');
When I create the materialized view log I recieved this message:
ora32321: refresh fast on tab2 unsupported after detail table truncate
Why?Refresh fast after truncate operation on container table is not supported, regardless the container table is or is not partitioned.
Perform a refresh complete.
ORA-32321 :
Cause: A detail table has been truncated and no materialized view
supports fast refersh after a detail table has been truncated
Action: Use REFRESH COMPLETE. Note: you can determine why your
materialized view does not support fast refresh after TRUNCATE
using the DBMS_MVIEW.EXPLAIN_MV() API. -
Materialized view (creating and complete refresh)
Good day.
I have a huge query that is used to create a materialized view. The query consist of 9 joins, a lot of aggregations, some subqueries, so we can say it is rather huge. The query itself executes for about 30 seconds and returns about 200 rows. The materialized view creates and refreshes for more than 30 minutes. Can someone please explain me the mechanism of materialized view creation which causes such bad performance.
We use Oracle Database 9.2.0.4.
Thank you in advance.I've fount the solution. May be it will be useful for someone not regarding that 9.2 database is less used today than 10.2.
I studied carefully the plan of the query and the plan of insert statement that is used when creating materialized view and found the cause of trouble. Insert statements generates VIEW PUSHED PREDICATE and BITMAP CONVERSION FROM ROWIDS when parsing. Bitmap conversion can be removed by setting environment parameter btree_bitmap_plans to false (a well-known issue), but I decided not ot change the production environment. The pushed predicate can be removed by using hint NO_PUSH_PRED to each subquery used in a materialized view. This step reduced the time of materialized view creation and execution to about a minute.
Thank everyone who tried to help.
Maybe you are looking for
-
To include a header in Payslip - Form Editor
Dear Friends, It would be really great if someone could help me in this regard. My client would like to add the name of the Company on top of the payslip. Currently from Line 1 something is displayed in form editor. Where should i do the header inclu
-
Unable to connect to report server Error: Message : ErrorCode : 10061
I have configured a report server oracle 10.1.0.2 app server on solaris 10. when the user tries to connect through the front end application web he gets the below error: Type : System.Net.WebException, System, Version=2.0.0.0, Culture=neutral, Public
-
N85 is slow - tried various kinds of resets
My N85 is ridiciously slow, I've tried *#7370# and *#7780#. Doesn't solve my problem. Apparently there is a third way to reset the phone, holding down *, 3 and the green button while booting up - but my phone prompts for the pin-code, and I can't bot
-
How do you unblock you tube?
When I go to you tube it says plug ins blocked . How do I get you tube to play?
-
Just reinstalled Windows, Can't restore iTunes backup
I just reinstalled Windows 7 on my computer, and after installing the latest version of iTunes available from Apple, I can't restore any backup I made prior to the reinstall, with iTunes giving me error code -69. I've tried reinstalling iTunes, but n