ENQ: TX - conflict in line for the foreign key lock
Hi allMy DB is 11.2 exadata machine.
I've got to get a case and don't know how to explain it.
session 1:
create the parent table)
ID number primary key);
create the child table)
parent references ID number,
name varchar2 (20));
insert into values parent (3);
session 2:
Insert children values (3, 'aa');
Session 2 crashes.
I'm curious to know how oracle knows that 3 in the parent table can be inserted? Otherwise, why not oracle comes throwing ORA - 02291:parent key is not immediately that I have ' insert into child values (3, 'aa');
Best regards
Leon
user6806750 wrote:
>
So I agree with the OP: the second operation should immediately receive the error 'parent does not exist', instead of block.
>How about this scenario
Session 1:1. insert into parent(id) values (3); 2. commit; 3. delete from parent where id = 3
Session 2:
1. insert into child values (3,'aa');
What a result for the session 2 you expect in this case?
Let me repeat a sentence of my previous post:
Theoretically, the general rule is that account required to a SQL statement (whose key foreign is just one particular case) two different operations should only be serialized when both transactions run a kind of DML statement that could be contrary to the assertion.
Now give me a scenario where two operations in effect running a kind of DML which could be contrary to the assertion of FK:
-session 1 deletes a parent, which could be contrary to the assertion of FK because there may be child-lines 'under' parent.
-session 2 inserts a child, which could be contrary to the assertion of FK because there could be a mother line for that child.
ERGO: sessions 1 and 2 in your scenario above must be serialized.
Still once, this was not the case in the scenario of the OP: FK assertiveness could never be breached by what session 1 (insert a new parent).
>
I don't see what that has to do with "modes of locking for insert, update, delete statements" (what do you mean by there btw?)
>
Thus,.
Oracle of the second session always will go, lock in exclusive mode the entry created in the child table and then try to check for the presence of record in the parent table by reading it in shared mode (why reading is in shared mode must be clear from the scenario described above). Because the parent record is locked in exclusive mode, it cannot hold a shared lock, so he waits. So, if we need a different result if the first session of the insertions and deletions a record, Oracle, stumbled on the lock, you need to know what type of operation has led to the blocking.
Something like that...
The problem with the implementation of the Oracle of the assertion of FK is it locks data to serialize an assertion of the FK validation.
Theoretically, this is the wrong approach. When dealing with simultaneous transactions and validation of constraints in several rows, it should return a predicate to first lock and then read the other rows (without lock somehow) to validate the assertion. Scientific research for this return began in the 1970s: http://dl.acm.org/citation.cfm?id=360369
Tags: Database
Similar Questions
-
Insert a line containing the same data but repeated for each foreign key availabl
So I use Jdeveloper11g.
I have a question where I have 2 tables, shops and rooms. Rooms now has a foreign key StoreId, which corresponds to the primary ID of stores and they are connected in a relationship 1 to many. Now I have over 600 stores. And only 2 have all the pieces that were (the building which is not even a main store in most of the rooms). The rest are not, but what I need is to assign to each store with the same name room1 1 room.
So the name would be the same, the primary key could get it I hope some sequences, but the foreign key ID, that StoreID field would have to change and insert for each store.
Is there a way to query sql for this type? Any means which is not manually create a 1 room, then assign to 1 store and repeating the process 600 times?
Thanks in advanceHello
It looks like you want
INSERT INTO rooms (roomid, roomname, storeid) SELECT roomidseq.NEXTVAL , 'room1' , storeid FROM stores ;
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
In the case of a DML (such as INSERT) operation the sample data should show what look like the paintings before the DML, and results will be the content of the or a modified tables after the DML.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
SQL statement error INSERT The conflicted with the FOREIGN KEY constraint
I recently installed a reporting for vmware vsphere software, but I get a SQL error. I opened a request for assistance with vmware, but so far they have not come up with a solution. The error is caused by: com.microsoft.sqlserver.jdbc.SQLServerException: instruction INSERT The conflicted with the FOREIGN KEY constraint 'FK_CB_VSM_NETWORK_VC_ID '. The conflict occurred in database 'VCChargebackVCC02', table "dbo." " CB_VSM_SERVER', column 'VC_ID '. I don't know a lot about SQL, so I'm lost in the extent of troubleshooting is concerned. If anyone has any ideas I'd love to hear them.
SQL questions are better posed on Technet. They are better equipped to manage the
http://social.technet.Microsoft.com/forums/en-us/categories/
-
Create a line for the new entity using createInstance2 with AttributeList
I use JDeveloper 11.1.2.3.I am creating a method in the Module of the Application to create a new entity row in a child table.
I think I'm to provide the value of the foreign key for the parent table in the AttributeList argument.
I have search the Forum and carried out a large number of "Googling", but have not been able to find an example where AttributeList is not null.
Can you point me to an example?
Thank you
I created a method in bean managed to add a line through the iterator for the "join table", passing the primary key for each parent table.
protected void createHistoryForProblem (String or activity, long fkProbrcptReceiptDtl)
{
Get the link for the page container
BindingContainer bindingContainer = this.getBindingContainerByPath("com_gac_apps_receiving_view_requestConformityPaperworkPageDef");
DCIteratorBinding dcib = (DCIteratorBinding) bindingContainer.get("AllDetailForAProblemForAReceiptIterator");
RowSetIterator rsi = dcib.getRowSetIterator ();Insert a new line
Line newContactRow = rsi.createRow ();disable data validation
newContactRow.setNewRowState (Row.STATUS_INITIALIZED);initialize the columns in the row.
newContactRow.setAttribute ("FkProbrcptReceiptDtl", fkProbrcptReceiptDtl);
newContactRow.setAttribute ("FkProbrcptReceiptActvy", 2);
Insert the new line
rsi.insertRow (newContactRow);
rsi.setCurrentRow (newContactRow);
OperationBinding operationBinding = bindingContainer.getOperationBinding ("Commit");Object result = operationBinding.execute ();
If (! operationBinding.getErrors () .isEmpty ())
{
StringBuffer sb = new StringBuffer();
List errors = operationBinding.getErrors ();
for (object error: errors)
{
SB. Append (error + "/ n");
}
throw new RuntimeException ("error occurred during the Commission of the data in createHistoryForProblem-" + sb.toString ());
}
} -
Optimize the foreign key for the removal of the cascade constraint.
Hello
JDeveloper version: 11.1.2.3.0
I saw this blog and found something new to me: http://snag.gy/qI6dY.jpg
Jdeveloper user interface, there is an option to select all tables to select the foreign key and set it for the removal of the waterfall.
My project is deployed on multiple databases. I wonder where this change is registered. None of the project files is modified.
Can I make this change (from limitations to the waterfall) for each database that I use?
Here is the blog where I saw that: http://tompeez.wordpress.com/2013/04/22/master-detail-insertdelete-sample/
I have my object associations optimized for the removal of the waterfall, but without the option above together, I always get constraint violations...
Concerning
Not sure however if you set the option the DOF looks like
"EMP_JOB_FK' FOREIGN KEY ('JOB_ID') CONSTRAINT REFERENCES 'HR '. "" SELECT JOBS "("JOB_ID') WE DELETE CASCADE If you set the option to cascade for fk Job_id from the employees table.
Timo
-
file navigation links to 2 lines for the size of the phone
Hi everyone, Happy Thursday (or brain dead Thursday for me)!
I'm working on a new project "sensitive." As a new project, I am starting with the smallest width and work my way up.
I have a simple navigation at the top of the page with links to "roll-over" six texts.
On the smaller size (smart phone - 320px), I need to "Pack" 2-line text links, then a line for each of the large sizes. I also need to move a chart which is directly below the links down to account for the additional line, and then back up again when the size of the window changes. For some reason, I can't understand how to do this. In addition, the navigation will be added to an existing HTML page when finished.
My question is:
How can I tell Edge to move the NAV of two lines of text on a single line (and move the chart) when I hit a specific window size (application)?
I have questions for the media established in the CSS for the HTML part of the page. Could I simply "show/hide" a div in particular, one with two lines for the nav and the other with a single line using CSS, or is there a better way?
If it is possible to do so at the idea of div "show/hide", it would be better (or even possible) to make animations of different navigation for each media queries (if necessary)?
Sorry for my temporary (I hope!) "brain dead" condition :-)
James
Hi, James.
You could go about it like that, but I wanted to point you to EdgeCommons (http://www.edgecommons.org), maintained by Simon Widjaja. It has a great video that explains how it works:
Hope this is useful!
-Elaine
-
How can I get the lines for the date between 2 different days
Hi all,
How can I get the lines for the date between 2 different days.
Sample data:
Table name: Articles
Title start_date end_date
Heading1 08-22-2011 2011-09-11
2011-08-01-2011-09-01 Title2
Title 3 2011-08-21 08-21-2011
title4 2011-08-28 2011-09-11
Result will be:
Title start_date end_date
Heading1 08-22-2011 2011-09-11
2011-08-01-2011-09-01 Title2
title4 2011-08-28 2011-09-11
This is my example query:
SELECT * FROM items WHERE trunc (es.date_start) > = TO_DATE('2011-08-22', 'YYYY-MM-DD') AND trunc (es.date_end) < = TO_DATE ('2011-08-28', 'YYYY-MM-DD')
but I can not get the expected results. Any help would be much appreciated.
Thanks in advancenot read your question properly before...
Please try this
Select * FROM items
WHERE (TO_DATE ('2011-08-22', 'YYYY-MM-DD') between TRUNC (es.date_start))
AND TRUNC (es.date_end)) OR
(TO_DATE ('2011-08-28', 'YYYY-MM-DD') between TRUNC (es.date_start))
AND TRUNC (es.date_end)) -
Identify the missing lines for the hierarchy
Oracle 10.2.0.1
Windows XP
create table vill (identification number (5), area varchar2 (20), subarea1 varchar2 (20), subarea2 varchar2 (20), location varchar2 (20));
Insert in the vill values(1,'AREA1','SUBAREA1','SUBAREA2','AREA1');
Insert in the vill values(2,'AREA1','SUBAREA1','SUBAREA2','SUBAREA1');
Insert in the vill values(3,'AREA1','SUBAREA1','SUBAREA2','SUBAREA2');
Insert in the vill values(4,'AREA1','SUBAREA1','SUBAREA2','VILL1');
Insert in the vill values(5,'AREA1','SUBAREA1','SUBAREA2','VILL2');
Insert in the vill values(6,'AREA1','SUBAREA1','SUBAREA2','VILL3');
Insert in the vill values(7,'AREA1','SUBAREA1','SUBAREA2','VILL4');
-Before is a perfect set of lines because it has all the lines in the area, subarea1 and subarea2.
Insert in the vill values(8,'AREA2','SUBAREA1','SUBAREA2','AREA2');
Insert in the vill values(9,'AREA2','SUBAREA1','SUBAREA2','SUBAREA1');
Insert in the vill values(10,'AREA2','SUBAREA1','SUBAREA2','VILL5');
Insert in the vill values(11,'AREA2','SUBAREA1','SUBAREA2','VILL6');
Insert in the vill values(12,'AREA2','SUBAREA1','SUBAREA2','VILL7');
Insert in the vill values(13,'AREA2','SUBAREA1','SUBAREA2','VILL8');
Insert in the vill values(14,'AREA3','SUBAREA1','SUBAREA2','AREA3');
Insert in the vill values(15,'AREA3','SUBAREA1','SUBAREA2','SUBAREA2');
Insert in the vill values(16,'AREA3','SUBAREA1','SUBAREA2','VILL9');
Insert in the vill values(17,'AREA3','SUBAREA1','SUBAREA2','VILL10');
Insert in the vill values(18,'AREA3','SUBAREA1','SUBAREA2','VILL11');
Insert in the vill values(19,'AREA3','SUBAREA1','SUBAREA2','VILL12');
Insert in the vill values(20,'AREA4','SUBAREA1','SUBAREA2','SUBAREA1');
Insert in the vill values(21,'AREA4','SUBAREA1','SUBAREA2','SUBAREA2');
Insert in the vill values(22,'AREA4','SUBAREA1','SUBAREA2','VILL13');
Insert in the vill values(23,'AREA4','SUBAREA1','SUBAREA2','VILL14');
Insert in the vill values(24,'AREA4','SUBAREA1','SUBAREA2','VILL15');
Insert in the vill values(25,'AREA4','SUBAREA1','SUBAREA2','VILL16');
commit;
Select * from city;
Power required:ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 1 AREA1 SUBAREA1 SUBAREA2 AREA1 2 AREA1 SUBAREA1 SUBAREA2 SUBAREA1 3 AREA1 SUBAREA1 SUBAREA2 SUBAREA2 4 AREA1 SUBAREA1 SUBAREA2 VILL1 5 AREA1 SUBAREA1 SUBAREA2 VILL2 6 AREA1 SUBAREA1 SUBAREA2 VILL3 7 AREA1 SUBAREA1 SUBAREA2 VILL4 8 AREA2 SUBAREA1 SUBAREA2 AREA2 9 AREA2 SUBAREA1 SUBAREA2 SUBAREA1 10 AREA2 SUBAREA1 SUBAREA2 VILL5 11 AREA2 SUBAREA1 SUBAREA2 VILL6 12 AREA2 SUBAREA1 SUBAREA2 VILL7 13 AREA2 SUBAREA1 SUBAREA2 VILL8 14 AREA3 SUBAREA1 SUBAREA2 AREA3 15 AREA3 SUBAREA1 SUBAREA2 SUBAREA2 16 AREA3 SUBAREA1 SUBAREA2 VILL9 17 AREA3 SUBAREA1 SUBAREA2 VILL10 18 AREA3 SUBAREA1 SUBAREA2 VILL11 19 AREA3 SUBAREA1 SUBAREA2 VILL12 20 AREA4 SUBAREA1 SUBAREA2 SUBAREA1 21 AREA4 SUBAREA1 SUBAREA2 SUBAREA2 22 AREA4 SUBAREA1 SUBAREA2 VILL13 23 AREA4 SUBAREA1 SUBAREA2 VILL14 24 AREA4 SUBAREA1 SUBAREA2 VILL15 25 AREA4 SUBAREA1 SUBAREA2 VILL16 25 rows selected.
Why?ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 26 AREA2 SUBAREA1 SUBAREA2 SUBAREA2 27 AREA3 SUBAREA1 SUBAREA2 SUBAREA1 28 AREA4 SUBAREA1 SUBAREA2 AREA4
Because as I said above that rowset for the euro1 area is perfect because in the location column there are lines for the euro1, SUBAREA1 and SUBAREA2 area. is exists, whereas if we see that there are no lines for AREA2 with the value SUBAREA2 in the place, even regarding the Domain3, there is no line that has the value of the SUBAREA1 location and even for AREA4, there is no line as location = AREA4. It is a table which is having all the names of place with nested values; for example, we can see that vill7 is exist in zone2 including SUBAREA1 (COLUMN NAME) = "SUBAREA1" AND SUBAREA2 (COLUMN NAME) = "SUBAREA2", but I would like to know location = SUBAREA2 then it will say no line, I want to generate all the lines that is to have no value in the column location for said AREA/SUBAREA1/SUBAREA2 column. Table is sorted by ID. Total column lines are 45800.
OkSQL> select * from vill where area='AREA1' and location='SUBAREA1'; ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 2 AREA1 SUBAREA1 SUBAREA2 SUBAREA1
It is also ok, but if saidSQL> select * from vill where area='AREA2' and location='SUBAREA1'; ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 9 AREA2 SUBAREA1 SUBAREA2 SUBAREA1
< <-Yes, this line I want to generate, because there should be a line whose location = "SBUAREA2" but why? Because otherwise how do I know what is the hierarchy of the SUBAREA2; While vill 5,6,7 and 8 were SUBAREA2 as "SUBAREA2".SQL> select * from vill where area='AREA2' and location='SUBAREA2'; no rows selected
I'm not sure how I am clear in my question, please let me know if I need to provide more details.
Thank you.user12050217 wrote:
... query should return:ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 131 my state my city my city street 2
Sorry, I don't understand that one line. Was it a mistake? I think I understand all the other lines that you want to, but I do not understand why you want the one above. Did you mean
ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 131 my state my city street 2 street 2
?
If this is not the case, why you don't want the row immediately above? Why don't you also:
` ID AREA SUBAREA1 SUBAREA2 LOCATION ---------- -------------------- -------------------- -------------------- -------------------- 131 my state new city new city street 2
?
Assuming it was just a mistake, the following Gets the results you want
WITH rows_needed AS ( SELECT area , area AS subarea1 , area AS subarea2 , area AS location FROM vill WHERE area != subarea1 OR area != subarea2 OR area != location UNION SELECT area , subarea1 , subarea1 AS subarea2 , subarea1 AS location FROM vill WHERE subarea1 != subarea2 OR subarea1 != location UNION SELECT area , subarea1 , subarea2 , subarea2 AS location FROM vill ) SELECT ( SELECT MAX (id) FROM vill ) + ROWNUM AS id , area, subarea1, subarea2, location FROM rows_needed WHERE (area, subarea1, subarea2, location) NOT IN ( SELECT area, subarea1, subarea2, location FROM vill ) ;
except that it is for an indefinite period including the ID will assign to what line. I guess that doesn't matter, as long as 130 to 137 numbers are used (or 131 to 138, if that is what you really want).
When I run your code on the table he returned me the desired output, but when I run it on my actual table that is having 45800 lines, then he messed up some results, because I think that in your code, I should mention the clause ORDER BY ID somewhere... Therefore, in this example I mention different IDS while inserting the lines. Your code worked very well because it is having only 25 rows with ID Ordered, while my actual table is to have 45800 lines in the table, there is no guarantee of ID ordered... so I think that its a problem with the order by clause, ID... but I don't know where I should put this clause
What is the significance of id? Is this just a unique key? That's, I guess that each line must have an id and two rows can have the same id, but, aside from that, it doesn't matter what line has which id.
The query I posted yesterday assumes that subarea1 and subarea2 were functionally dependent on the area. as in the example of data you posted yesterday. I see your last post that's not true, and which explains erroneous results.As I said yesterday, if you are actually setting up new lines in the table, you must use a sequence to generate identifiers.
-
Please, I have the following question on the foreign key and the ora-00904
Thanks in advance!
I created the table:
Create the Department table
(
DNAME varchar (15) NOT NULL,
deptID number (5) NOT NULL,
Primary key (dname, deptid)
)
then...
Create table Manager
(
MgrID number (10) not null,
Not null, name varchar (10)
Start_date date not null,
Primary key (mgrid),
CONSTRAINT fk_department
FOREIGN KEY (dname, deptip)
Department of REFERENCES (dname, deptid)
)
Trying to create the table with the constraint, it yeilds one:
ORA-00904: "DNAME": invalid identifier
+.. .with an asterisk under "dname" in line: FOREIGN KEY (dname, deptip) +.
I tried joining my name of the column with quotation marks ("" "); capitalized for consistency; and we tried creating and editing then - all to nothing will do. I also tried to use the user interface with Oracle Express Edition and the moment where I click on create, the same error appears. Could someone help please straighten out me up - was this threat for four days.
Thanks again!Hello
Welcome to the forum!
Columns that will reference the other table must be declared just like all the other columns; including the names in a FOREIGN KEY constraint is not auotmatically define them.
It works:CREATE TABLE Manager ( mgrid NUMBER (10) NOT NULL, Name VARCHAR (10) NOT NULL, Start_date DATE NOT NULL, dname VARCHAR2 (15), -- New deptid NUMBER (5), -- New PRIMARY KEY (mgrid), -- CONSTRAINT fk_department FOREIGN KEY (dname, deptid) REFERENCES department (dname, deptid) );
(assuming that the departments table, you posted, there).
Is there a reason why you use VARCHAR instead of VARCHAR2?
In the departments table, do you really need both dname and deptid in the primary key? For example, if you have a line with name = "ACCOUNTING" and deptid = 10; is it possible that you could have another line with deptid = 10 and some different dname, say 'REASEARCH '? It is more common to only have a deptid as primary key and have columns in the foreign key constraints that reference.
-
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:
-
Term plurals changes the name of the foreign key in the relational model
Hello
I use a glossary with plurals for entities such as Budget turned to the budgets of the table in the relational model. Unfortunately (for me) it also changes the name of the foreign key. In the related entity, an attribute (for example) is Budget_fiscal year, I expect in the relational model, being the same, but it is transformed into budgets_fiscal_year (budgets in the plural rather than keep him in singular form).
How can I avoid any change in the attribute names (in the process of engineering in the relational model) but always turn the names of entities from the singular to the plural names for tables?
Thank you and best regards
Robert
Hi Philippe
Your suggestion 1) works - thank you! budgets_fiscal_year is the attribute of pk exercise in my budget of the entity. It seems a standard behavior of the Data Modeler to compose the UID of the relationship of budgets_fiscal_year (for some reason, this column is not taken the logical model, but the relational model). I would prefer that it be appointed budget_fiscal_year.
I have not defined any parameter for this (intentionally). But maybe somewhere there by default. Could you tell me where the design parameters in Data Modeler to learn how to configure the definitions mentioned in 2)?
As I'm always busy with the model of reverse engineering data, I'll wait for DM 4.1.1.888.
Best regards
Robert
-
Schema import Gets the foreign key number
Hi all;
Scott has a table named rank-> he has primary key-> different tablespace
Sharma has a table named emp-> he has foreign key-> different tablespace
$ imp/System Manager queue = refresh_sharma.dmp log = refresh_sharma_imp.log fromuser = touser = sharma sharma
Import: Free 11.2.0.1.0 - Production Thursday, may 7, 18:35:03-2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT: V11.02.00 direct
import in US7ASCII and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 (possible character set conversion) character set
Customer export uses the (possible character set conversion) WE8MSWIN1252 character set
. import of objects in SHARMA SHARMA
. . import of partition "CONT_EMP": "P1" 4000 imported lines
. . import of partition "CONT_EMP": "P2" 5000 imported lines
. . import of partition 'CONT_EMP': 'P3' 5000 imported lines
. . "DEPT" table import 12 lines imported
. . import of table 'EMP' 68278 imported lines
. . importing table "EMP_AUDIT" 4 imported lines
. . table 'Method' import 68000 lines imported
. . importing table "EMP_PERS_INFO" 68278 imported lines
. . importing table "EMP_PROJ_INFO" 68278 imported lines
. . table 'LOGTAB' import 603 lines imported
. . table import "PAYROLL" 186282 imported lines
. . import of table 'of the PROJECT"22 rows imported
. . importation of "TAB1" 4000000 imported table rows
. . table import 'TRANSPORT' 0 rows imported
IMP-00017: statement failed with error ORACLE 1031:
'ALTER TABLE 'EMP' ADD 'EMP_EMPLEV_C12_FK' OF CONSTRAINT FOREIGN KEY ("EMP_LEVE" '.
""L") REFERS TO"SCOTT" CATEGORY"("GRADE_NAME") ENABLE NOVALIDATE.
IMP-00003: ORACLE error 1031
ORA-01031: insufficient privileges
About to activate the constraints...
IMP-00017: statement failed with error ORACLE 2430:
' ALTER TABLE 'EMP' ENABLE CONSTRAINT "EMP_EMPLEV_C12_FK"
Import completed successfully with warnings.
30, 31 line number is display error.
'ALTER TABLE 'EMP' ADD 'EMP_EMPLEV_C12_FK' OF CONSTRAINT FOREIGN KEY ("EMP_LEVE" '.
""L") REFERS TO"SCOTT" CATEGORY"("GRADE_NAME") ENABLE NOVALIDATE.
After the import operation, to recreate the foreign key is the right option. but
By performing the import operation, how can all I avoid this error dump file or log file?
I don't want to use constraints = N.
Thanks in advance
You gave * of * SCOTT * at * SHARMA. The grant received by SHARMA not getting exported when you export SHARMA. So, it is not imported when you import SHARMA. If you did an export and import of SCOTT before SHARMA, the award of the cross-schema would have also been imported. (Subsidies granted by a user are exported with the user, the subsidies received by a user are not exported with the user).
Hemant K Collette
-
Add the foreign key refers to a different schema
Hello
We have a database with schemaA and schemaB and we use a data model for schemaA with SQL Data Modeler.
Our data model is based on SchemaA and we do not want add schemaB or create subview in our current model for schemaB since our dev team do not want schemaB in the model
We have created a synonym in tableB schemaB shcemaA after granting select them, references to schemaA
We have added a foreign key on tableA in referencing TableB on schemaB schemaA.
for example. Add ALTER table tableA foreign constraint key(column-name) references tableB(colum-name)
So far so good.
But if we try to produce the DDL for tableA it has not provided the ALTAR of the foreign key that is based on shcmeaB
We know that we cannot add foreign key on dblinks.
How can I get the Modeler DDL from SQL data for tableA, including the foreign key
We appreciate the answers
Kind regards
Zafar
Hi zak,.
We have created a synonym in tableB schemaB shcemaA after granting select them, references to schemaA
We have added a foreign key on tableA in referencing TableB on schemaB schemaA.
You can do it in the database because TableB exists in the database and DB knows its definition, including the existing constraint of PK/UK.
This is the same model of data Modeler - you must have the definition of the table referenced in order to create the FK that refer to the constraint of PK/UK.
As it works now (we can change it) you can have modeled for SchemaA and ModelB for SchemaB. Then, you can drag & drop tableB form the Navigator to the diagram of the ModelA and TableB there will exist as an object remote read-only, you can use to create the FK.
With the help of subviews, DDL generation and configurations of reports, you can display the dev team than objects that they want to see - on the charts in generated DDL and reports.
Philippe
-
Rename the foreign key constraint
Hello
I have table tbl_a with a column a_col1 SEO tbl_b.b_col1
I want to create the name of the foreign key as FK_A_COL1 constraint which is FK_ < COLUMN NAME OF the CHILD >.
Foreign naming key standards does not have the use of the name of the child under the name column.
Is there any other solution/script to achieve this?
Thank you.fkeys = model.getFKIndexAssociationSet().toArray(); for (var i = 0; i
;//also can use fk.getTable().getAbbreviation()fkname = "FK_"+fk.getTable().getName();cols = fk.getColumns();for( var k = 0;k -
Identify the foreign key table
I have a table that has a few constraints that are foreign keys to other tables (see column FK_ETHNIC below). My naming conventions are consistent so they all start with 'FK_ ". In SQL, how can I find the table that the foreign key column references? I have a process that must find this table and then get all of its columns.
Thank you!
CREATE TABLE STU_BASE
(PK_ID VARCHAR2 (32), sys_guid() by default)
CONSTRAINT pk_stu_base
KEY ELEMENTARY SCHOOL
With the HELP of INDEX TABLESPACE sis_express_index
STORAGE (INITIAL 524288
NEXT 524288
PCTINCREASE 0),.
STUDENT_ID VARCHAR2 (15).
Fk_stu_base_ethnic FK_ETHNIC VARCHAR2 (32) CONSTRAINT
REFERENCES
Ethnic (PK_ID)
REMOVE THE NULL VALUE;
CREATE TABLE ETHNIC
(PK_ID VARCHAR2 (32), sys_guid() by default)
CONSTRAINT pk_ethnic
KEY ELEMENTARY SCHOOL
With the HELP of INDEX TABLESPACE sis_express_index
STORAGE (4096 INITIAL
NEXT 4096
PCTINCREASE 0),.
VARCHAR2 (2) ETHNIC,.
ETHNIC_DESC VARCHAR2 (30),
STATE_CODE VARCHAR2 (2),
FEDERAL_CODE VARCHAR2 (2))You could do a self-join with CONSTRAINTS (USER, ALL, s/n) views. You can search a constrainttype of 'R' and you can attach it to itself based on the R_OWNER and R_CONSTRAINT_NAME columns.
For example:
SELECT r1.owner AS child_owner , r1.table_name AS child_table , r2.owner AS parent_owner , r2.table_name AS parent_table FROM all_constraints r1 JOIN all_constraints r2 ON r2.owner = r1.r_owner AND r2.constraint_name = r1.r_constraint_name WHERE r1.constraint_type = 'R' ;
Published by: Centinul on February 16, 2012 15:36
Maybe you are looking for
-
Reduce consumption of battery motion and automatic brightness
Hi, I would like to know some things. First: activation reduce motion put on iPhone save the battery life since perspective wallpapers are being turned off when the low power Mode is on? Second: Automatic Rotation of the brightness to the wide and ho
-
With this new installation of Xubuntu (which is supposed to be quick enough) with Firefox included, all transactions processed through the browser are incredibly slow: typing, go to other pages or Web sites; move the cursor is painfully slow, and sti
-
PLM4P - Email ID not have exported
Hello1. I changed the e-mail address of a user in the export environment.2. the exported file.3. imported in the environment of import,4 address does not change.Another question, lower right of the screen, it shows UGM - v6.1.0.3 user group managemen
-
LR CC 2015.1 downgrade?
I lost Mobile Sync and other functions with LR CC 2015.2.1. I must return to 2015.1. I uninstalled 2015.2.1 through the CC app. Where can I download 2015.1 or whatever I need to do?Mike from SC(super frustrated with 'Expérience' CC)
-
Creative Cloud Desktop App error
When I try to download applications with the creative desktop application cloud I get an error and it asks me to reload applications, I reinstalled the app creative cloud a couple of times but I it get the same error. No idea on how to solve this pro