View of Materlized primary key and primary key in the master tables
We use the Oracle 11 g 2 and I created a view on several paintings of master materlized. The paintings of masters all have the primary key, but I understand not all primary key columns in the query definition.According to Oracle manual e10592
Specify WITH PRIMARY KEY to create a primary key materialized view. This is the default ....
The master table must contain an enabled primary key constraint, and the defining query of the materialized view
must specify all of the primary key columns directly.
My MV created OK and works. My question is what can be the impact on my MV? Could he hit to performance. It takes 40 minutes to the MV should be created and 5 minutes to refresh the one line insert in each table of mater. I would like to see it refresh in a few seconds.
Retrieve the lines of the mview is purely a function of the number of lines and indexing on the mview himself. Mview refreshing at the time of the wall depends on the quality of the query used to refresh the mview. If you include the PKs of the source table in the mview matter or not, here. What matters is the execution of the refresh request path. Is it okay to indexation on the underlying tables to support the joints. Did you use mlog$ _s to allow a quick refresh - mlog$ _s are still usable for your mview. There are a number of possible causes for your problem and we do not have enough information to make an estimate of the problem.
BTW, if the mview could refresh in a few seconds without mlog$ _s, probably unnecessary a mview.
Tags: Database
Similar Questions
-
Forgive my question. I am very new to Oracle.
How can I make sure that changes in the key primary supplier_id (concerning the supplier table) would also appear directly in the FOREIGN KEY (supplier_id) in the products table?
Is that not all the primary key and FOREIGN KEY on?
My paintings:
I created 2 tables and connect to apply in the data base referential integrity, as I learned.
CREATE TABLE - parent provider
(the numeric (10) of supplier_id not null,)
supplier_name varchar2 (50) not null,
Contact_Name varchar2 (50).
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id)
);
CREATE TABLE - child products
(the numeric (10) of product_id not null,)
supplier_id numeric (10) not null,
CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES beg (supplier_id)
);
I inserted the following text:
INSERT INTO provider
(supplier_id, supplier_name, contact_name)
VALUES
(5000, 'Apple', 'first name');
I expect that the supplier_id (5000) to the provider of the table also appears in the products table under key supplier_id having the same value which is 5000. But this does not happen.
How to get there?
Thanks in advance!
Hello
What is a foreign key in Oracle?
A foreign key is a way to ensure referential integrity in your Oracle database. A foreign key means that the values of a table must appear also in another table.
Ok!??
What is now the right way to implement referential integrity in your Oracle database that the values of a table must also be included in another table?
A foreign key referential integrity indeed enfore in ensuring that the value in the child table must have a corresponding parent key (otherwise you will encounter an error, as evidenced by "SomeoneElse"). However, it will never automatically insert a row in the other table.
If you are looking for a solution that automatically inserts a record in the other table, maybe you should go for triggers:
See:
-
foreign key with the apps table
Hello world
I created a custom table and I want to create a foreign key with per_all_people_f.
Code:
ALTER TABLE xxsshr.xxsm_sshr_hr_approver
ADD CONSTRAINT fk_person_id
FOREIGN KEY (person_id)
REFERENCES HR. PER_ALL_PEOPLE_F (person_id)
However, I get ora-00942: table or view does not exist.
We use 11.5.10 and g 10 dB
Thanks for any help...
ElmerThe XXSSHR account will need reference and select the privileges (and maybe others) on the PER_ALL_PEOPLE_F table. The ALTER TABLE statement must be run under the account XXSSHR after the above privileges are granted.
HTH
Srini -
How to upgrade the parent table and child by updating the parent table
I have a parent EMPLOYEE table that includes columns (sysid, serviceno, employeename...) sysid is the primary key, serviceno is the Unique key and I have DEPENDENT child table includes columns (sysid, employee_sysid, name, date of birth...) there still SYSID is a primary key for the table of dependants, employee_sysid is a foreign key in the EMPLOYEE table.
Now I want to change SYSID (with the help of the sequence) in the EMPLOYEE table that they want an update in the table of people dependent
Note: I have 10000 records in the EMPLOYEE table as I have 5 more children tables that need to update new SYSID.
Please help mefirst disable FOREIGN KEY constraints.
You can update Parent and child record with the help of the trigger.
Here I give you an examlpe... It can help u.create a parent (id number primary key, name varchar2 (100)) table
/
create table child_1 (primary key id, p_id number number, date of birth, date)
CONSTRAINT FK_id FOREIGN KEY (p_id) REFERENCES parent (ID))
/
create table child_2 (key primary id, p_id2, addr varchar2 number number (1000))
CONSTRAINT FK_id2 FOREIGN KEY (p_id2) REFERENCES parent (ID))
/Insert some test data for the parent tables and children.
change the constraint to disable child_2 table FK_id2
/
change the constraint to disable child_1 table FK_id2
/CREATE OR REPLACE TRIGGER delete_child
BEFORE parent UPDATE ON
FOR EACH LINE
BEGIN
UPDATE CHILD_1
P_ID =:NEW.ID SET
WHERE P_ID =:OLD.ID;
UPDATE CHILD_2
SET = P_ID2: NEW.ID
WHERE P_ID2 =:OLD.ID;
END;
/then Upadte parent table primary key col and check the children tables.
do enable constraints... -
How to extract 1 ASA and put them in the new table
Hello
Can someone tell me how to extract a table and put in the new table. (eg. I have a table with no 1 to 1000, I would extract only 1, 30, 60, 90,...) ?
Please advise me.
Thank you
concerning
-
How can I filter the data and display it in the html table?
Hello
How do I filter data that contains the database table and already displayed in html table, then when the user write a data to filter or search, it will automatically display the data in html table. ?
can someone help me to do this? Here is my php code for the table that will display the data:
<?php $servername = "localhost"; $username = "root"; $password = "pass"; $dbname = "ses"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT No, Calon, ID, Jurusan FROM candidates"; $result = $conn->query($sql); ?> <?php if ($result->num_rows > 0) { echo "<table > <tr> <th>NO</th> <th>Candidate</th> <th>ID Number</th> <th>Programme</th> <th>Edit</th> <th>Delete</th> </tr>"; // output data of each row while($row = $result->fetch_assoc()) { echo "<tr> <td align='center'>" . $row["No"]. "</td> <td>" . $row["Calon"]. "</td> <td>" . $row["ID"]. " </td> <td>" . $row["Jurusan"]. "</td> <td align='center'><a href='main2.php?edit=".$row["No"]."'>Edit</a></td> <td align='center'><a href='delete.php?del=".$row["No"]."'>Delete</a></td> </tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close(); ?>
hope someone can help me with this.
Thank you.
You must first create a search form for the user to enter a search word:
Then create a page named search_page.php and insert the following code into it and save it. The code in red below Gets information from the search form field name = "Calon" and the SQL query finds in the "Calon" database field for a game.
<>
$servername = "localhost";
$username = 'root ';
$password = "pass";
$dbname = 'his ';
Create the connection
$conn = new mysqli ($dbname, $servername, $username, $password);
Check the connection
If {($conn-> connect_error)
Die ("connection failed:".) $conn-> connect_error);
}
$Calon = trim($_POST['Calon']);
$sql = (' SELECT no, Calon, ID, Jurusan candidates WHERE Calon = "'.") $Calon.' » ") ;
$result = $conn-> Query;
?>
<>
If ($result-> num_rows > 0) {}
ECHO '.
"; ";NO. Candidate Identification number Program Edit Delete each line output
While ($row = {$result-> fetch_assoc())}
ECHO '.
";" . $row ["no"]. " " . $row ["Calon"]. " " . $row ['ID']. " " . $row ["Jurusan"]. " Edit Delete }
ECHO '.
} else {}
echo "0 results."
}
$conn-> close();
?>
-
DELETE_DOC and other records in the REVCLASSES table
Hello WebCenter content masters,
I am facing a strange and painful problem.
I have several documents with dDocName I got (not automatically generated). I deleted a bunch of them (about 100) using service RIDC DELETE_DOC. But when I try to check in new documents with the dDocName of these deleted items, I got an error:
intradoc.common.ServiceException:! csServiceDataException, CHECKIN_NEW_SUB, makeNewRevClass! $ * ScriptStack CHECKIN_NEW_SUB
3:doScriptableAction, dDocName is 638470463:doSubService, dDocName = 63847046CHECKIN_NEW_SUB, dDocName = 638470463:makeNewRevClass, dDocName = 63847046
...
Caused by: intradoc.data.DataException:! csDbUnableToExecuteQuery, IrevClasses (INSERT INTO RevClasses (dRevClassID\, dDocName\, dDocCreator\, dDocCreatedDate\, dDocLastModifier\, dDocLastModifiedDate\, dDocOwner\, dDocFunction) VALUES(2894314\, '63847046'\, 'admin'\, {ts '2013-06-11 09:15:59.745'}\, 'admin'\, {ts '2013-06-11 09:15:59.745'}\, 'admin'\, ''))! $ORA - 00001: unique constraint (PRD_OCS. DDOCNAME_REVCLASSES) violated
...
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (PRD_OCS. DDOCNAME_REVCLASSES) violated
So, I checked the REVCLASSES table and was surprised to see there are still records of deleted documents.
Select * from documenthistory where ddocname = '63847046' order of dactiondate desc;
24/05/13 14:13, 000000000 121467985 2172024 2172070 admin 63847046 delete Document Public
24/05/13 14:13, 000000000 121468000 2172024 2172070 admin 63847046 remove public review
15/05/13 02:04, 000000000 121481564 2172024 2172070 admin 63847046 Checkin Public
Select * from revision where ddocname = '63847046';
vacuum
Select * from revclasses where ddocname = '63847046';
2172070 63847046 2172024 15/05/13 02:04:41, System 455000000 15/05/13 02:04:41, 000000000 admin admin (null)
I can't understand what has happened and cannot reproduce the problem. Normally, I delete with DELETE_DOC no more documents exist in the REVCLASSES table.
I tried to run a Cycle of regeneration Collection, thinking it would be to clean up the database, but to no avail.
So my question is: is it possible to sort a cleaning of the database, which would remove this kind of mistake? or do I have to manually remove these records 'ghosts'?
Thank you for reading.
Hello!
You could run a check of database with the IdcAnalyze cmdlet.
This tool checks the tables and detect inconsistencies.
You will find in $DOMAIN_HOME/ucm/cs/bin
If there is something wrong, it will be detected and IdcAnalyze will generate scripts to correct inconsistencies.
Roman.
-
Dimension to build using the SQL table and process to populate the SQL table
I have a dimension in a cube that is manually* built by one of our power users. Now, I have to get all the information of members of this dimension in a SQL table (example: with columns... Level0, level0property, level1, level1property etc...) to use this table in the STUDIO for the responsibility of the Member.
Is there any easy process to do this? Currently I am building each line manually in the SQL table and there are 1100 + members in that manually built dimension. Please advice.Look at the outline of applied olap Extractor is a free utility
-
Index and tuning: Linking on the same table
Hello everyone,
I have a PL/SQL mechanism that is based on a select query which links a table (T_RECHRED) on himself.
Here's the SQL...
SELECT
DR. LSZ, DR. RECH_ID RECH_ID, GS. RECH_ID GS_ID
Of
DR. T_RECHRED, T_RECHRED GS
WHERE
DR. DATE_FROM GROUP GS. DATE_FROM
AND DR. BILL_AMOUNT = GS. BILL_AMOUNT *-1
AND DR. LSZ = GS. LSZ
AND DR. ALNR = GS. ALNR
AND DR.CAT! = 'GS' AND GS.CAT = 'GS '.
ORDER BY
DR. LSZ CSA, DR. POSITIONSTEXT1 DESC;
As you can see, the table is joined to itself with the following fields...
DATE_FROM, LSZ, ALNR and BILL_AMOUNT (with GS having the dial-up sign)
Both sides of the join (separation) selection is on the cat 'IS GS' c to one side and 'NOT GS' for the other side. The selection of GS catches / selects several hundred thousand lines, while the 'NO GS' selection selects several million lines.
This query (and the accompanying PL/SQL process) works very well...
-Reduces data volumes
-With the following filter...
AND GS. RECH_MONTH IN (200809, 200810)
... which returns the same amount of data as a select complete!
... but seems to work constantly on the volume of data.
The really stupid thing is that I had run it once (full volume) but have reshaped the tables and somehow fail to replicate the index configuration that I had before (it's really stupid of me!)
So, my question is the best way to address such a request?
My thoughts are these:
-J' have my filter clause in the right order? The "GS.CAT = 'GS' is the most 'limit' filter so I put this last." Is this correct?
-Do I have to put the joints in a "INNER JOIN" clause (leaving the "Cat" filter in the WHERE clause), or it makes no difference?
-Is that the join on the BILL_AMOUNT with the sign reversed (*-1) impact on performance?
-J' would have separate index (on each join column)? Or I should have an index composed on the join fields all (or almost)?
-The ORDER BY clause is important (and cannot be deleted) because the PL/SQL depends on a concrete order.
I've been googling and reading my book "Oracle Tuning" but can not find all the information on the links between the tables on themselves.
Advice you can give me on this, or links to the 'case studies' or 'HOWTO', would be welcome.
Thank you very much
Alan Searle
PS: I tried to run a "explain plan" and that seems to work through OK but no data (as far as I can see) is written to the "PLAN_TABLE. Any ideas what I'm doing wrong here?version of database? I suspect 10g or higher.
explain plan is now written in a global temporary table, it must be explained and look in the session.
-
create view materized without constraint primary key on the base table?
Hello
I tried to create a materized view, but I got this error:
SQL > CREATE MATERIALIZED VIEW FAST REFRESH TABLE1_MV
START BY
TO_DATE (April 25, 2009 03:00:13 ',' DD-MM-YYYY hh24:mi:ss')
NEXT
SYSDATE + 1
AS
Select * from TABLE1@remote_db
SQL > /.
CREATE MATERIALIZED VIEW FAST REFRESH TABLE1_MV
*
ERROR on line 1:
ORA-12014: table 'TABLE1' does not contain a primary key constraint.
Table1 in remote_db is not a primary key constraint. Is there anyway that I can create a view materized on a base table that is not a primary key constraint?
Thank you
LizMake sure user name used in remote_db database link has select privileges on Journal of MV. On the issue of db source:
SELECT LOG_TABLE FROM DBA_MVIEW_LOGS WHERE LOG_OWNER = 'TABLE1-owner' AND MASTER = "TABLE1";
This will give you MV table the journal name. On the issue of target side:
SELECT * from MV-LOG-NAME@remote_db;
And after your version.
SY.
-
Oracle 10g
Hi gurus
I test_mst table that has a primary key test_mst.test_id, I detail table test_dtl which has test_dtl.test_id of foreign key, now I have that I want to use the delete statement in test_mst then it should also remove the constraint of her child or null in test_dtl.test_id, can again do in oracle 10g?
Thanks in advance
Hi Mit.
example of cascade
create table bill( bill_id number not null primary key ) ; create table bill_item( bill_item_id number not null primary key, bill_id number references bill(bill_id) on delete cascade ) ; insert into bill values (1) ; insert into bill_item values (1, 1) ; delete bill ; select * from bill_item ; drop table bill_item purge ; drop table bill purge ; Table BILL created. Table BILL_ITEM created. 1 row inserted. 1 row inserted. 1 row deleted. no rows selected Table BILL_ITEM dropped. Table BILL dropped.
exemplary null
create table employer( employer_id number not null primary key ) ; create table employee( employee_id number not null primary key, employer_id number references employer(employer_id) on delete set null ) ; insert into employer values (1) ; insert into employee values (1, 1) ; delete employer ; select * from employee ; drop table employee purge ; drop table employer purge ; Table EMPLOYER created. Table EMPLOYEE created. 1 row inserted. 1 row inserted. 1 row deleted. EMPLOYEE_ID EMPLOYER_ID --------------------------------------- --------------------------------------- 1 Table EMPLOYEE dropped. Table EMPLOYER dropped.
-
Unique key on the partitioned table range
Hello
We use a range of composite range-hash partitioned table
Use index - try to do this have same tablespace to the local partitions but not liking it
ALTER table RETAILER_TRANSACTION_COMP_POR
Add primary key constraint RETAILER_TRANSACTION_COMP_PK (DWH_NUM)
using index
LOCAL
ORA-14039: partitioning columns must be a subset of the columns in a unique index key
Without local then fine but does not have same tablespace to walls and don't want to make this part of the partition key.
Range Tbal partitioned - it's just a UK to avoid duplicates[oracle@localhost ~]$ oerr ora 14039 14039, 00000, "partitioning columns must form a subset of key columns of a UNIQUE index" // *Cause: User attempted to create a UNIQUE partitioned index whose // partitioning columns do not form a subset of its key columns // which is illegal // *Action: If the user, indeed, desired to create an index whose // partitioning columns do not form a subset of its key columns, // it must be created as non-UNIQUE; otherwise, correct the // list of key and/or partitioning columns to ensure that the index' // partitioning columns form a subset of its key columns
-
Can't see the deleted on el capitan bootcamp partition and can recover hard disk space
making and removing the bootcamp partition should be always and only with BootcampAssitant!
-
Key Reg primary and foreign at the same table
Hello
It is - ok if create primary and foreign keys on the same table itself?
For example:
In a table X, I have two columns such as Codeunite and ParentUnitcode.
Is it ok if create Mt10 as principal and ParentUnitcode as foreign keys in the table itself?
The foreign key base table: OrganizationalUnit
Foreign key columns: ParentUnitCode
Primary/Unique key base: OrganizationalUnit
Primary/unique key col: Mt10
Can anyone answer me on that?
Concerning
RajeshOWB,
If the two tables are favouring a one-to-one relationship so there no need to have two separate tables and so you can have free referential foreign keys in the same table where the primary key.
-
How to fill out the table foreign key to the primary key form
Hi all
I'm stuck in this problem for 3 days, and I'm about to research and implement solutions on the internet.
I have two tables
create table prim (a number primary key, b varchar2 (100));
create table CHILD (a number references (a) prim, varchar2 (100)) c;
I created a page for PRIM table.
= page name form on PRIM2
I have manually two columns for the CHILD table to know
P26_A_1 (for the primary key in the CHILD table)
P26_C (for the column in the CHILD Table c)
now when the user clicks on the button CREATE, a row must be inserted into the child table.
I want to assign the P26_A to P26_A_1 during the validation process, so that a line must be inserted into the PRIM table as well as in the CHILD table.
How to do this?
I downloaded my application page in https://apex.oracle.com
my workspace identifiers are inferior to
name of the workspace = IMBERT
username = demo
password = demo
kindly guide me.
Thank you.
Hello
I created a new page (page 30) similar to your page and added the insertion of the child. It just check the page and code. It works now, when you insert the prim file is triggered a second trial which inserts the child record manually.
On page 26 it was some sort of mistake, was easier to create a new as it was almost a standard form.
Concerning
Bottom
Maybe you are looking for
-
Printer HP all at once be discovered
HP LaserJet 2300 USB connected to the MacBook, on the same network internet in the Mac desktop, iPad and MacBook Air and detectable as 'Local' printer for several years. Suddenly, printer 'offline' to all three wi - fi devices physically connected de
-
Entrance of sessions lack from the Tools menu
I just upgraded to Firefox 8. The entrance to 'sessions' disappeared from the menu 'tools '. I had about 20 sessions recorded and want them back. If this feaature was reemoved since Firefox, can someone tell me where the data can be stored on my haar
-
The automatic update sent two updates to do. I tried several times and it comes up saying: filter (KB911895) did not pass tests Windows Logo to verify its compatibility with Windows XP. So I went to Update.microsoft.com; Fix for the technical prob
-
Hey! I just bought a sansa clip and let me know if the sansa clip firmware is the same as the sansa clip + a. Thank you!
-
Hello I can connect via the web interface without problem. If I disconnect and try to connect, log in again, I access the page of connection, but when I submit it, it freezes. I have to restart the router to recover Someone has the same problems and