Unique key violation i.e. primary key violation in JSF page
Hi, I am using Jdeveloper 11.1.1.5.0 and working with adf fusion web application. I have created entity object and view object. In view object I have primary key and I have set it's type to DB sequence. THe problem is though the attribute is DB sequence. IN JSF page it show unique key violation i.e. primary key violation. Please help me
So, do you have a trigger in the database that updates the value of the primary key? Or do you assign the value in some other way?
You can check [url http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/toc.htm]the docs for information about the ways it can be done.
Similar Messages
-
Primary Key Materlized View and primary key in master tables
We are using Oracle 11g2 and I created a materlized view on several master tables. The master tables all have primary key, but I did not include all primary key columns in the defining query.
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 it hit the performance. It takes 40 minutes for the MV to be created and 5 minutes to refresh for single row insert in each mater table. I would like to see it refresh in seconds.Retrieving rows from the mview is purely a function of the number of rows and indexing on the mview itself. Refreshing the mview wall time depends on the quality of the query used to refresh the mview. Whether you include PKs from the source table in the mview is of little, or no, consequence here. What matters is the execution path of the refresh query. Is there proper indexing on the underlying tables to support the joins. Did you use mlog$_s to enable fast refresh - are mlog$_s even usable for your mview. There are a number of possible causes to your problem and we do not have enough information to make an estimate of the problem.
BTW, if the mview could refresh in seconds w/o mlog$_s, you probably do not need an mview. -
How to khow how many foreign key are referenceing the primary key
sir i would like to know that how many foreign key are referencing the primary key of a table
is any command to know the table name
please suggest
thanks in advance..In the query below, table_name is the name of the table whose primary key is referenced.
SELECT b.owner owner
,b.constraint_name foreign_key
,b.constraint_type constraint_type
,b.table_name referencing_table
,b.r_constraint_name primary_key
,c.table_name referenced_table
,c.column_name referenced_column
FROM all_constraints a
,all_constraints b
,all_cons_columns c
WHERE a.owner = b.owner
AND a.table_name = :table_name
AND a.constraint_type = 'P'
AND b.r_constraint_name = a.constraint_name
AND b.constraint_type = 'R'
AND c.constraint_name = a.constraint_name
AND c.owner = a.owner;
If the name of the primary key is known, the query below
select * from all_constraints where constraint_type = 'R' and r_constraint_name = :pk_name -
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 -
Testing for unique records in a compound Primary Key table
I have a table with 2 fields being primary keys. I want to write a sql script to check if there are duplicates.
Here is what I have but not sure if this is working right. I have table with millions of records.
SELECT COUNT(CASE WHEN A.AUNQ >1 THEN 1 ELSE NULL END)
FROM
SELECT (List_Cd + Account_Key) PK_ListAcc, COUNT(List_Cd) AUNQ
FROM RAW_AML_LISTEDACCNTS_JUN GROUP BY List_Cd, Account_Key HAVING (COUNT(List_Cd) >1))
A;
Can someone help?
thanksYes, I agree. I am doing data profiling and testing all these tables. I am expecting that the results show me zero, however, if there were any problems with the settings, then I should get something. I think that the subquery is needed because if I used
what you suggested above I will get the following:
List_CD Account_Key
1 a
2 b
3 c
3 C
1 a
1 a
the results will be:
List_CD Account_Key CountOFAccount_Key
1 a
3
3 C
2
I now need to count that query results to get the total which should be 2
do you agree? I am just trying to confirm that the sql script I listed will give me this result correctly. -
Foreign key as part of primary key - bad idea
What are the pros and cons of using the primary key of the parent table as part of the primary key in the child tables versus just having it as a foreign key in the child tables?
Please share your experience on this. Thanks in advance.
Regards,
Richardsb92075 wrote:
but if the relacion is 0-1 to 1-1 ; better design 2 tablesWhy?
Blank columns require no special accommodation.Like most things, there's usually a case (even if it's a small subset of all possible cases) where this makes sense.
http://www.oracle.com/technology/oramag/oracle/09-mar/o29asktom.html “Wide Load Storage”
Would be one such case. -
Setting CMP Primary Key equal to DB primary key
Is their a mechanism in Oracle JDeveloper(or other tools) for setting the primary key of auto-generated CMP beans to equal the database primary key?
If so, could someone kindly share their views on the benefits/drawbacks of this approach to CMP?
-Teodoro SorgoBrice,
It sounds like you have a page process on every page. Why not just wait to process all of the data on the last page, using your own pl/sql process? Say you have pages 1-3 with items
P1_ID
P1_NAME
P2_DEPT
P2_LOCATION
P3_OTHER
Only have a process on Page 3 have that does
insert into table (id, name, dept, location, other) values
(:P1_ID, :P1_NAME, :P2_DEPT ...
Anton -
column with unique constraint + not null constraint = primary key! (to some extent) Is it correct?
I invite your ideashttp://www.techonthenet.com/oracle/unique.php
http://www.allapplabs.com/interview_questions/db_interview_questions.htm#q13
Difference between Unique key and Primary key(other than normal difference) -
How to handle the unique primary key validation when is a multipart key !
I dont know how to handle the primary key validation when the primary key is a multipart key.
Besides would like to know how to catch the TooManyObjectsException in order to custom the default exception message.
thank u.
regards,
Orlando AcostaAre you using EJB's, Toplink, or BC4J?
Thanks,
Rob
Team JDev -
Table creation from type - Primary key with 2 columns
Hello,
I have to create a table from a type that I created.
The thing is that I want to create a primary key using two column.
Because this table is junction table.
How can I do this ?
CREATE TABLE CONTENT OF CONTENT_T (ID_COMP primary key, ID_CHAR_J NOT NULL PRIMAR
Y KEY);
Oracle return:
CREATE TABLE CONTENT OF CONTENT_T (ID_COMP primary key,ID_CHAR_J NOT NULL PRIMARY KEY)
ERROR at line 1:
ORA-02260: table can have only one primary key
So I tried:
CREATE TABLE CONTENT OF CONTENT_T (ID_COMP,ID_CHAR_J NOT NULL PRIMARY KEY)
ERROR at line 1:
ORA-02338: missing or invalid column constraint specification
Tahnk's in advance.
Edited by: user8266437 on 29 avr. 2009 13:56
Edited by: user8266437 on 29 avr. 2009 13:56SCOTT@orcl_11g> CREATE OR REPLACE TYPE content_t AS OBJECT
2 (id_comp NUMBER,
3 id_char_j VARCHAR2 (10),
4 other_cols VARCHAR2 (10));
5 /
Type created.
SCOTT@orcl_11g> CREATE TABLE CONTENT OF CONTENT_T (PRIMARY KEY (ID_COMP, ID_CHAR_J))
2 /
Table created.
SCOTT@orcl_11g> INSERT INTO content VALUES (content_t (1, 'A', 'WHATEVER'))
2 /
1 row created.
SCOTT@orcl_11g> COMMIT
2 /
Commit complete.
SCOTT@orcl_11g> INSERT INTO content VALUES (content_t (1, 'A', 'DUPLICATE'))
2 /
INSERT INTO content VALUES (content_t (1, 'A', 'DUPLICATE'))
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C0062057) violated
SCOTT@orcl_11g> COMMIT
2 /
Commit complete.
SCOTT@orcl_11g> SELECT * FROM content
2 /
ID_COMP ID_CHAR_J OTHER_COLS
1 A WHATEVER
SCOTT@orcl_11g> -
Missing Primary Keys after migartion of a MSAccess 2003 DB to oracle 9.i
I migrate a MS Access 2003 DB to Oracle 9.i with the Oracle Migration Workbench 10.1.0.4.0. on a Windows 2k PC. All the Primary Keys of my tables are missed after migration and no Foreign Key is created.
In the MS Access Source Model Window of OMWB are the Primary Keys detected but in migration script or in oracle db after migration there is no Primary Key applied.
Dos anyone kows the reason for this behavior.
Thanks for help in advance.
Message was edited by:
user468547
Message was edited by:
user468547Here the summary of the Model.
Not mentioned parts are sero in the Oracle Model
MS Access Source Model
Table Violation Rules (0)
Relations ( 48)
Indexes (96)
Primary Keys (38)
Queries (0)
Tables (38)
Oracle Model
Database (1)
Check Constraints (0)
Foreign Keys (48)
Indexes (96)
Primary Keys /Unique ... (0)
Tables (38)
Types (2)
In the migration scripts the commands for creation of Foreign Keys are avaliable and delievers the error message ORA-02270. e.g.
REM
REM Message : Failed to create foreign key: dbwines.TBL_SERVICEPROFILESTBL_UETYPES; ORA-02270: no valid Primr- o. eindeutiger Key for this column
Here the content of the error.log
** Workbench Repository : Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Repository Connection URL: jdbc:oracle:thin:@pcathlon17002:1521:ORCL
** The following plugins are installed:
** Microsoft Access 2.0/95/97/2000/2002/2003 Plugin, Production Release 10.1.0.4.0
** Active Plugin : MSAccess
oracle.mtg.migration.MigrationSQLException: Failed to get information about Oracle Model Object.
Erschpfte Ergebnismenge:Failed to get information about Oracle Model Object.
Erschpfte Ergebnismenge
at oracle.mtg.oracleModel.server.OracleModelImpl.getObjectInformation(OracleModelImpl.java:476)
at oracle.mtg.oracleModel.ui.OracleModelTypes.getAllChildren(OracleModelTypes.java:95)
at oracle.mtg.plugin.ui.WorkbenchAllTreeNode.getChildren(WorkbenchAllTreeNode.java:133)
at oracle.mtg.migrationUI.TreeDataSource.getItemCount(TreeDataSource.java:128)
at oracle.ewt.dTree.DTreeDeferredParent.getItemCount(Unknown Source)
at oracle.ewt.dTree.DTreeBaseItem.isExpandable(Unknown Source)
at oracle.ewt.dTree.DTreeButtonDecoration.getHasButton(Unknown Source)
at oracle.ewt.dTree.DTreeButtonDecoration.paintDecoration(Unknown Source)
at oracle.ewt.dTree.DTreeStackingDecoration.paintDecoration(Unknown Source)
at oracle.ewt.dTree.DTree.paintCanvasInterior(Unknown Source)
at oracle.ewt.EwtComponent.paintInterior(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter._paintInterior(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.EwtComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.EwtComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.EwtComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.EwtComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.EwtComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.LWComponent._paintComponent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.paint(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paintExtents(Unknown Source)
at oracle.ewt.lwAWT.SharedPainter.paint(Unknown Source)
at oracle.ewt.lwAWT.BufferedApplet.paint(Unknown Source)
at oracle.ewt.lwAWT.BufferedApplet.update(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
** Shutdown : Mon Apr 10 18:36:10 CEST 2006
** Oracle Migration Workbench
** Production
** ( Build 20050629 )
** OMWB_HOME: C:\oracle\ora92\omwb
** user language: de
** user region: null
** user timezone:
** file encoding: Cp1252
** java version: 1.4.2_04
** java vendor: Sun Microsystems Inc.
** o.s. arch: x86
** o.s. name: Windows 2000
** o.s. version: 5.0
** Classpath:
..\lib\boot.jar
** Started : Mon Apr 10 18:36:14 CEST 2006
** Workbench Repository : Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Repository Connection URL: jdbc:oracle:thin:@pcathlon17002:1521:ORCL
** The following plugins are installed:
** Microsoft Access 2.0/95/97/2000/2002/2003 Plugin, Production Release 10.1.0.4.0
** Active Plugin : MSAccess
EXCEPTION : query()java.sql.SQLException: Stream wurde schon geschlossen
select MESSAGE_TYPE, LOG_ID, TO_CHAR(LOG_DATE, 'dd-MM-yyyy hh24:mi:ss') LOG_DATE, PROJECT_ID, PHASE, SUBPHASE, LOG_MESSAGE, OBJECT_TYPE, OBJECT_ID, CONTEXT_DATA from MTG_LOG_TABLE WHERE PROJECT_ID = 1 and (MESSAGE_TYPE != 9999) ORDER BY LOG_ID ASC
java.lang.NullPointerException
at oracle.mtg.migration.LogDisplayUtility.convertToDisplayStrings(LogDisplayUtility.java:185)
at oracle.mtg.migrationServer.LoggingImpl.getLogs(LoggingImpl.java:482)
at oracle.mtg.migrationUI.LoggingPane.setupLogTable(LoggingPane.java:291)
at oracle.mtg.migrationUI.LoggingPane.setupLogTable(LoggingPane.java:280)
at oracle.mtg.migrationUI.ProgressDialog.commandStarting(ProgressDialog.java:117)
at oracle.mtg.migrationUI.MigrationUI.commandStarting(MigrationUI.java:2427)
at oracle.mtg.migrationUI.MigrationWizard.doMigrate(MigrationWizard.java:401)
at oracle.mtg.migrationUI.MigrationWizard.runDialog(MigrationWizard.java:293)
at oracle.mtg.migrationUI.ActionMenuHandler._migrate(ActionMenuHandler.java:340)
at oracle.mtg.migrationUI.ActionMenuHandler._capture(ActionMenuHandler.java:291)
at oracle.mtg.migrationUI.ActionMenuHandler.run(ActionMenuHandler.java:85)
at oracle.mtg.migration.WorkerThread.run(Worker.java:268)
** Workbench Repository : Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Repository Connection URL: jdbc:oracle:thin:@pcathlon17002:1521:ORCL
** The following plugins are installed:
** Microsoft Access 2.0/95/97/2000/2002/2003 Plugin, Production Release 10.1.0.4.0
** Active Plugin : MSAccess
Thaks for help in advance
Regards Steffen -
PRIMARY KEY PARTITIONED INDEXES 생성방법 (ORA-2429, ORA-1408)
제품 : ORACLE SERVER
작성날짜 : 2004-08-13
PRIMARY KEY PARTITIONED INDEXES 생성방법 (ORA-2429, ORA-1408)
============================================================
PURPOSE
primary key partitioned indexes 를 생성하는 방법을 알아 봅니다.
SCOPE
Oracle Partitioning Option은 8~10g Standard Edition에서는 지원하지
않는다.
Example:
SQL> -- 먼저 partitioned table TEST_A 를 생성합니다.
SQL>
SQL> CREATE TABLE test_a (col1 number, col2 number, col3 varchar2(20))
2 PARTITION BY RANGE (col1, col2)
3 (partition part_test_a_1 values less than (10, 100),
4 partition part_test_a_2 values less than (20, 200),
5 partition part_test_a_3 values less than (30, 300),
6 partition part_test_a_4 values less than (40, 400));
Table created.
SQL> -- partitioned table TEST_B 를 생성합니다.
SQL>
SQL> CREATE TABLE test_b (col1 number, col2 number, col3 varchar2(20))
2 PARTITION BY RANGE (col1, col2)
3 (partition part_test_b_1 values less than (10, 100),
4 partition part_test_b_2 values less than (20, 200),
5 partition part_test_b_3 values less than (30, 300),
6 partition part_test_b_4 values less than (40, 400));
Table created.
SQL> -- TEST_A 테이블에
SQL> -- non-unique local partitioned index, IX_TEST_A 를 생성합니다.
SQL>
SQL> CREATE INDEX ix_test_a ON test_a(col1, col2)
2 LOCAL
3 (partition ix_test_a_1,
4 partition ix_test_a_2,
5 partition ix_test_a_3,
6 partition ix_test_a_4);
Index created.
SQL> -- TEST_B 테이블에
SQL> -- unique global partitioned index, IX_TEST_B 를 생성합니다.
SQL>
SQL> CREATE UNIQUE INDEX ix_test_b1 ON test_b(col1, col2)
2 GLOBAL PARTITION BY RANGE (col1, col2)
3 (partition ix_test_b1_1 values less than (20, 200),
4 partition ix_test_b1_2 values less than (maxvalue, maxvalue));
Index created.
SQL> -- TEST_A 테이블에 rimary key constraint (PK_TEST_A) 를 추가 합니다.
SQL>
SQL> ALTER TABLE test_a ADD CONSTRAINT pk_test_a
2 PRIMARY KEY (col2, col1);
Table altered.
SQL> -- index IX_TEST_A 를 drop 하려고 하면 다음 에러가 발생합니다.
SQL>
SQL> DROP INDEX ix_test_a;
drop index ix_test_a
ERROR at line 1:
ORA-02429: cannot drop index used for enforcement of unique/primary key
SQL> -- TEST_B 테이블에 partition IX_TEST_B1 에서 사용된 같은 columns 들을 사용해서
SQL> -- 새로운 두번째 index (IX_TEST_B2) 를 생성하려고 하면
SQL> -- 다음 에러가 발생합니다.
SQL>
SQL> CREATE INDEX ix_test_b2 ON test_b(col1, col2)
2 LOCAL;
create index ix_test_b2 on test_b(col1, col2)
ERROR at line 1:
ORA-01408: such column list already indexed
SQL> -- TEST_B 테이블에 primary key constraint (PK_TEST_B) 를 추가 합니다.
SQL>
SQL> ALTER TABLE test_b ADD CONSTRAINT pk_test_b
2 PRIMARY KEY (col1, col2);
Table altered.
SQL> -- index IX_TEST_B1 를 drop 하려고 하면 다음 에러가 발생합니다.
SQL>
SQL> DROP INDEX ix_test_b1;
drop index ix_test_b1
ERROR at line 1:
ORA-02429: cannot drop index used for enforcement of unique/primary key
SQL> -- indexes 들과 각 indexes 이 걸려있는 tables 의 목록입니다.
SQL>
SQL> SELECT index_name, partition_name, status
2 FROM user_ind_partitions
3 ORDER BY index_name, partition_name;
INDEX_NAME PARTITION_NAME STATUS
IX_TEST_A IX_TEST_A_1 USABLE
IX_TEST_A IX_TEST_A_2 USABLE
IX_TEST_A IX_TEST_A_3 USABLE
IX_TEST_A IX_TEST_A_4 USABLE
IX_TEST_B1 IX_TEST_B1_1 USABLE
IX_TEST_B1 IX_TEST_B1_2 USABLE
6 rows selected.
SQL> -- TEST_A 테이블에서 primary key constraint 를 drop 합니다.
SQL>
SQL> ALTER TABLE test_a DROP CONSTRAINT pk_test_a;
Table altered.
SQL> -- TEST_B 테이블에서 primary key constraint 를 drop 합니다.
SQL>
SQL> ALTER TABLE test_b DROP CONSTRAINT pk_test_b;
Table altered.
SQL> -- indexes 들과 각 indexes 이 걸려있는 tables 의 목록을 다시 봅니다.
SQL> -- 여기서 주의해서 보아야 할 것은 non-unique local partitioned index (IX_TEST_A)
SQL> -- 은 drop 되지 않고 USABLE 상태로 남아 있다는 것입니다.
SQL> -- 이렇게 되는 이유는 index (IX_TEST_A) 가 non-unique 이기 때문입니다.
SQL> -- 반면 unique global partitioned index (IX_TEST_B) 은 drop 되었습니다.
SQL>
SQL> SELECT index_name, partition_name, status
2 FROM user_ind_partitions
3 ORDER BY index_name, partition_name;
INDEX_NAME PARTITION_NAME STATUS
IX_TEST_A IX_TEST_A_1 USABLE
IX_TEST_A IX_TEST_A_2 USABLE
IX_TEST_A IX_TEST_A_3 USABLE
IX_TEST_A IX_TEST_A_4 USABLE
만일 index 가 primary key 에 정의되어 있는 columns 들과 같은 columns
을 사용해서 만들어 졌다면 primary key 는 그 underlying index 를 사용합니다.
이것은 index 가 unique 이건 non-unique 이건 또는 global 이건 local partioned index
이건 관계없이 적용됩니다.
위의 예제에서 primary key 가 non-unique index 위에 생성되었다는 것을
주의해 보시기 바랍니다. 이렇게 되는 이유는 index 안의 값들이 사실
모두 unique 하기 때문입니다. 그렇지 않을 경우 다음 에러가 발생하게 됩니다.
"ORA-02437: cannot enable (STEELY.PK_TEST_B) - primary key violated."
2개의 indexes 가 같은 순서의 같은 columns 을 사용해서 만들어 질 수는 없습니다.
위의 예제에서 TEST_B 테이블에 두번째 index (IX_TEST_B2) 를 만들려고
했을때 다음에러가 발생하는것을 확인할 수 있었습니다.
"ORA-01408: such column list already indexed."
하지만 columns 들의 순서를 바꾼다면 같은 columns 들을 사용하더라도
추가적으로 indexes 를 생성할 수 있습니다.
index (IX_TEST_A) 와 primary key (PK_TEST_A) 에 정의된 column 순서는
반대로 되어 있습니다. 그러나 primary key 는 IX_TEST_A 를 underlying index
로 사용하고 있습니다.
테이블에서 primary key constraint 가 drop 되었을때
만일 index 가 UNIQUE index 로 생성되었다면 대응하는 index 또한 drop 됩니다.
이 현상은 LOCAL 또는 GLOBAL partitioned indexes 모두에 적용됩니다.
partitioning 을 최대한 활용하기 위해서는 partitioned tables/indexes
를 생성할 때에 STORAGE clause 를 반드시 사용해야 합니다.
Reference Documents
<Note:74224.1>First, thanks for posting the code that lets us reproduce your test. That is essential for issues like this.
Because the primary key is global you will not be able to use
INCLUDING INDEXES
WITH VALIDATION;And you will need to add the primary key to the temp table
ALTER TABLE DEMO_INTERVAL_DATA_LOAD_Y ADD CONSTRAINT IDX_DEMO_ROLL_Y PRIMARY KEY (ROLL_NUM);The the exchange will work. You will need to rebuild the primary key after the exchange. -
DEFECT: Sql Server table displays wrong primary key columns.
This is what Sql Developer shows on the Keys tab of a table display pointing to a table in Sql Server 2000:
FK_ConsolidationAccount_AccountType Account_Id 1 FOREIGN KEY
FK_ConsolidationAccount_AccountType AccountType_Id 1 FOREIGN KEY
FK_ConsolidationAccount_AccountType ParentAccount_Id 1 FOREIGN KEY
FK_ConsolidationAccount_ConsolidationAccount Account_Id 1 FOREIGN KEY
FK_ConsolidationAccount_ConsolidationAccount AccountType_Id 1 FOREIGN KEY
FK_ConsolidationAccount_ConsolidationAccount ParentAccount_Id 1 FOREIGN KEY
PK_ConsolidationAccount Account_Id 1 PRIMARY KEY
PK_ConsolidationAccount AccountType_Id 1 PRIMARY KEY
PK_ConsolidationAccount ParentAccount_Id 1 PRIMARY KEY
This is the correct information for that table:
FK_ConsolidationAccount_AccountType AccountType_Id 1 FOREIGN KEY
FK_ConsolidationAccount_ConsolidationAccount ParentAccount_Id 1 FOREIGN KEY
PK_ConsolidationAccount Account_Id 1 PRIMARY KEYTake a look to the action:
ORA-02437: cannot validate (string.string) - primary key violated
Cause: attempted to validate a primary key with duplicate values or null values.
Action: remove the duplicates and null values before enabling a primary key.
Nicolas. -
Diff b/w surragate keys and primary keys
Can any one of u pls explain the difference between primary key and surragate keys,pls explain me with simple example
Hi rajesh,
surrogate key: For every master data record, system create a SID (Surrogate ID). If that particular master data record is used in infocube, system store the SID corresponding to that master data in dimension table and the dimension id of the dimension table is stored in infocube Fact 'F' table.
Primary key: while creating a table we will select unique field and create as primary key..for eg empid acts as a unique key (primary key) for emp table. through this primary key we can identify the table to get the data from the table.
i hope this helps u.
regards
anil -
Problem with foreign and primary keys migration from SQL Server to Oracle
Hi folks, i'm using SQL Developer to migrate from a SQL Server database to Oracle and i'm stuck with a couple issues:
The worst of them so far is the fact that i can't migrate any of the PKs and FKs. After successfully capturing the SQL Server DB model and converting it to Oracle, when the tool generates the scripts, all ALTER TABLE queries that add the PKs and FKs have their target columns duplicated.
for example: when i'm trying to migrate a simple table that contains an Id (PK) and Name columns, the tool generates the following scripts:
PROMPT Creating Table TestTable...
CREATE TABLE TestTable (
Id NUMBER(10,0) NOT NULL,
Name VARCHAR2 NOT NULL
PROMPT Creating Primary Key Constraint PK_TestTable on table TestTable ...
ALTER TABLE TestTable
ADD CONSTRAINT PK_TestTable PRIMARY KEY
Id,
Id
ENABLE
As for the FKs, the tool duplicates the columns as well:
ALTER TABLE SomeTable
ADD CONSTRAINT FK_SomeTable_SomeTable2 FOREIGN KEY
SomeTable2Id,
SomeTable2Id
REFERENCES SomeTable2
Id,
Id
ENABLE
Does anyone have a clue on how to solve these issues? I'd be greatly thankful for any answers!Hi Fernando,
I was unable to replicate this issue. My primary / foreign keys where defined using unique columns.
PROMPT Creating Primary Key Constraint PK_Suppliers on table Suppliers ...
ALTER TABLE Suppliers
ADD CONSTRAINT PK_Suppliers PRIMARY KEY
SupplierID
ENABLE
I tried a few things like
capturing twice and renaming both models the same
renaming the converted models
but with no luck.
I think this issue is occuring either at the capture or convert phase.
1) Are you performing the capture online or offline?
2) Can you provide a the entire DDL for one of these tables and its indexes to see if I can replicate?
3) Did the capture or convert fail or have to be redone at any stage ?
I all else fails I would attempt a capture and convert again using a brand new repository (create a new schema in Oracle and associate the migration repository with it).
Regards,
Dermot
SQL Developer Team
Edited by: Dermot ONeill on Oct 22, 2009 12:18 PM
Maybe you are looking for
-
Using a Mac laptop and Airport to get on to Xbox Live
There are numerous threads floating about on this though most didn't seem to work for me however I have managed to get this working and thought it may be useful to share my technique. FYI I am using an early 2008 MBP 2.4 running OS X 10.5.2 1. Connec
-
Every time I sync my iCal on my computer through iTunes with my iPhone 4 or iPad, duplicate entries are generated on both systems. What am I doing wrong or how can I avoid the duplications? I have been doing this for several years and this problem is
-
PXE Boot With intel Based IMAC
Hello, I am trying to boot my IMAC from the network with PXE Boot with no success. I found some documents (very little) about how to boot mac from network using diffrent mac with app called netboot, but i assume that because my imac is intel based it
-
Exchange Server 2010 third party certification installation
Hi, Is there any step by step instructions on how to install a third party certificate on the first exchange node in DAG and then how to export the third party certificate to second exchange node ? In addition I have two VM's which are running TMG (T
-
Raise event from 3:d party application in iView
Hi, I have two iViews that should communicate with each other, one is a Web Dynpro app, the other is a 3:d party application not at all related to SAP. The 3:d party app is hosted on a different server within the same domain as the portal. My questio