Create table Car (Car_cd VARCHAR2(5), Car_Desc VARCHAR2(50) ); alter table Car add constraint Car_PK primary key (Car_CD); INSERT INTO Car (Car_Cd, Car_Desc) VALUES ('CORLA','COROLLA'); Commit; [code]....
The requirement necessitates a new table to map car to manufacturer. This mapping table may later be expanded to contain other attributes Engine, MPG, etc to hold details specific to a car.But this is in future.
--Not able to create this as Car_cd is already a PK in this table and therefore has Unique Index ALTER TABLE Car_Mapping_Details ADD CONSTRAINT Car_Mapping_Details_fk1 FOREIGN KEY (Car_Cd)REFERENCES Car (Car_Cd); [code]....
But in this case the Car_Mapping_Details.Car_cd is itself is a primary key and therefore has Unique index.Although I was able to create foreign key constraint on Car_mapping_details.car_cd column (which is also Primary Key), I was not able to create Foreign Key Index on this column. It gives me Quote:ORA-01408: such column list already indexed.In other words, not creating foreign index for foreign key column lead to table-level lock? Or will the Unique Index in that primary key column be sufficient to avoid table-level lock?
I have an urgent requirement to kill an existing session if a new session starts for the same user. I have been reading lot of blogs and posts on the above topic, but could clearly tell me how to do it.
I thought of putting a process in 101 page when login button is pressed to catch this and kill the old session.
We are using Apex 4.0/Oracle 10gR2/ Hp-Ux, We noticed that there is a process Running in Two Sessions that seems running since 3 Hours using 60% CPU,** 30% given below sql it executes in two Sessions!
declare function x return boolean is begin -- if instr(upper(:F4000_P4651_PLUG_SOURCE),'ORDER BY')>0 then declare l_position number := 0; begin loop l_position := instr(upper(:F4000_P4651_PLUG_SOURCE),'ORDER BY ',l_position + 1) ; exit when instr(upper(:F4000_P4651_PLUG_SOURCE),'ORDER BY ',l_position + 1) = 0 ;
I'm facing a problem with the starting of java programs on my Win XP system. The startup most often takes from 5 to 60min. Only in rare cases java programs start-up normally. I've these problems with Eclipse, Nitro and ProM which are all Java-based tools.
I have used STraceNT to find the cause of my problems but I couldn't figure it out. I've attached the STraceNT log file for the execution of ProM. The program runs until the last line in the log while starting without showing up anything. After 20min suddenly the programs shows up and works as it normally does. The last line in the log where the software hangs for this long time is a call to WaitForeSingleObject. Before that it seams to allocate memory. I could see similar patterns in the executions of the other java programs, but I still can't see where the problem lies. I also tried removing the JRE and install different versions.
May any one confirm that the below issue is not only to RAC but also on normal database enterprize edition 11.2.0.3 ? Bug 12865902 - NOWAIT lock requests could hang (like Parallel Queries may hang "enq: TS - contention") in RAC (Doc ID 12865902.8)
currently i am using for update nowait concurrently for 50 processes on similar table with similar query and getting performance issue.
SELECT txn_ID,status_FLAG INTO txn_id,status_flag FROM cp_txn_detail WHERE txn_ID = pi_txn_ID FOR UPDATE NOWAIT;
I recompile a package in a session,and found the session is hang, I know there are have others session run the package,how can i find what session run by the package?
So I try to back it up first by using the below command:
RMAN> backup archivelog all;
Starting backup at 04-JUN-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set [code]......
I know that I have to extend the db_recovery_file_dest directory for "limit exceed" error but how can I safely delete the archivelog in order to bring up the database?
I have an Oracle IMP that seems to complete, but there are two things that I don't understand:
1) The tables seem to load successfully in about 4 hours. After the tables are loaded, the IMP procedure appears to hang for10+ hours. I can query the tables at this time, so I'm not sure what it's doing. Is it maybe applying constraints?Is it normal for applying constraints to take 3-4X as long as importing the data?
2) I see a few of these messages in the alert log during the import.Thread 1 cannot allocate new log, sequence 2754 I don't see errors in the IMP log so are these messages informational or warnings, or will there be something wrong with my imported data?
We would take backup regulary by RMAN(catalog). Last two days we could not take backup. Backup start but after take backup some datafile then rman does not do anything.
all of the client cann't connect the db,and using sqlplus / as sysdba also cann't login there are many error of TNS-12535 and in the listener.log
alert.log: Sun Apr 29 18:10:36 2012 opidcl aborting process unknown ospid (42992060) as a result of ORA-604 Sun Apr 29 18:10:54 2012 opidcl aborting process unknown ospid (26280196) as a result of ORA-604
We had several unexplained lock-ups of APEX in our environment in the last months. This all happened after we moved to GlassFish with the APEX Listener. The symptoms were always that all connections in the JDBC connection pool were in use and we had to restart the GlassFish server instance to free them up.
The culprit is the caching folder that the APEX Listener uses for file caching. We use this to cache image downloads from the database through a procedure, and the caching folder was set to /tmp/apex/cache. I believe this is the default setting. All went well, when the procedure was called the images were downloaded from the database and cached under /tmp/apex/cache. However, for some (as yet unexplained) reason, Linux sometimes removes this folder from the /tmp file system. This seems to happen from time to time after an unknown period of inactivity. We didn't reboot the server. After the folder is gone, the APEX Listener is unable to recreate it, keeps on creating new database connections until the maximum configured is reached, and we need to restart the GlassFish instance to free them up. This also recreates the caching folder.
Our environment: GlassFish 3.1.1+3.1.2, APEX Listener 1.1.3, Oracle Linux 6.2. I didn't try out the new APEX Listener 1.1.4 yet so I'm not sure if this has been fixed in the last version.(kind of reminds me of the problem where the APEX config file is by default placed under /tmp and also disappears from time to time)
I have an already populated table that refers to a wrong foreign key in another table. I have table abc that has the column fk_id. this column currently refers to column x_id1 in the table abc while it should refer to column x_id2 in xyz. I am trying to replace the data but I guess I miss something in the logic or the right way of doing it:
commit; insert all into abc values (10,'ab1',1) into abc values (11,'ab2',2) into abc values (12,'ab3',5) into abc values (13,'ab4',7) into abc values (14,'ab5',9) into xyz values (1,1,'d1') into xyz values (2,2,'d2') into xyz values (5,3,'d3') into xyz values (7,4,'d4') into xyz values (9,5,'d5') select * from dual; commit;
--this following select returns 5 rows
select * from abc, xyz where abc.fk_id = xyz.x_id1;
-- the following update only updates 3 rows and sets the other 2 -- to null!
update abc set fk_id = (select x_id2 from xyz where xyz.x_id1 = abc.fk_id); commit;
I'm not really sure why oracle is not finding my Foreing Key, I'm creating an easy set of table for a company and I'm declaring all Primary keys and foreing keys as necessary and this is my
I have a parent table called dept and one child table emp which is referenced on deptno and now both have data . Now i want to truncate the dept table and i have truncated emp table after it when i am trying to truncate dept table then oracle throws a error that is-
"ORA-02266: unique/primary keys in table referenced by enabled foreign keys" ,
but when i tried to delete some records 1 by 1 then these have delete but truncate is not still working. why? if i have 10 millon records.
You should almost always index foreign keys because they are frequently used in joins. In addition, if you intend to delete or update unique or primary keys on the parent table, you should index the foreign keys to improve the locking of child records.what I don't understand are, I should create index on foreign key column in parent table or child table or both ?
Is there any view in oracle which gives the foreign key mapping.
E.g.
Table DEPT has DEPTNO as PK. Table Emp has DEPTNO as FK to DEPT.DEPTNO.
I can get the information for DEPT table from R_CONSTRAINT_NAME column of all_constraints table.My requirement is to get the the which column of Emp table refers to DEPT.DEPTNO column .
Say we have an employee(id_emp) table with a primary key on id_emp. We have also some history tables emp_stuff with columns say (id_emp, dat_event, some_stuff) with primary key id_emp, dat_event.
This means that we have a unique index on (id_emp,dat_event). We also have a foreign key id_emp that references employee(id_emp). When we update id_emp on employee, we still have a lock on emp_stuff. According to this (end of the page) :
Quote:So, in short, with releases prior to Oracle Database 11g Release 1, you will want an index on the foreign key of the child table if you do any of the following:
Update the parent table primary key Delete from the parent table Merge into the parent table
So is id_emp in emp_stuff considered as indexed (through the unique index of the primary key) or do we have to add an explicit index like this CREATE INDEX emp_stuff ON emp_stuff(id_emp) to avoide child table locks?
I am trying to establish PK-FK relationship between 2 tables. Table 1 has VACC_ID as a primary key. Table 2 has VACC_ID and SCH_ID as the primary keys. I am trying to add VACC_ID from Table 2 as a FK to Table 1. This is the code I used
I also tried to add it without writing the query and editing the Table 1. By default, I am getting 2 columns(both VACC_ID) in the local column being referenced to the 2 primary keys(VACC_ID and SCH_ID) of table 2. I also uploaded the screeshot of the error, when I run the query.
In my point of view, deferral FK (DFK) are stronger than non-deferral FK (NDFK). In other words, every NDFK can be moved to DFK. Is there a performance issue ?
Now I want to change the deptno from 10 to 20 and 20 to 10 in dept table . So the ouput will be like
deptno| dname|dseq| 20 | CS | 1 10 | SC | 2
when i am deleting that row I am getting error "ORA-02292: integrity constraint (ROP_FK) violated - child record found".IF i am trying to update i am getting unique key contractin failure.
(Even I cannot update the rest of the column values in dept table as it is also having foreign key dependency) i need to put a sql script in production so that it will interchange.
In my sql developer I have created a table. Created primary keys. Using alter table I have also created the foreign key. Now I need to add one more foreign key to the same table. Do I have to drop the existing foreign key and then create the 2 new foreign keys using the alter table condition or can I retain the existing FK and just use alter table to add another FK.