SQL & PL/SQL :: Constraints And Delete Cascade Events
May 9, 2011
I have a table with 2 defined FK constraints which fires delete cascade events.
I want to deny deletions when the event is fired from one of the tables and permit them when the event is fired from the other table.
Is it possible?
Is any way to solve which table fires the event?
View 2 Replies
ADVERTISEMENT
Oct 9, 2012
I have to write a procedure that accepts schema name, table name and column value as parameters....I knew that i need to use metadata to do that deleting manually.
View 9 Replies
View Related
Mar 27, 2007
We have a bunch of tables with FKs but we do not have the 'on delete cascade' option on these FKs. If I want to delete records in the database do I have to write delete statements for each table starting with the lowest child or is there a cascade option I can use with the delete statement?
View 1 Replies
View Related
Oct 27, 2013
, we have used alter table to change the constraint in on delete cascade. there is two option. what is different between both ofthem. Example:1)Alter table t3 add constraint t2_F foreign key (id) references t2(id,column2,column3) on delete cascade ;or2)Alter table t3 add constraint t2_F foreign key (id) references t2 on delete cascade ;
know first one that particular column will set to on delete cascade.What is the use of second one in this case we are not using column name in "foreign key (id) references t2 on delete cascade ;"
View 9 Replies
View Related
Feb 14, 2013
I want to delete data from say 100 tables without disable the constraints.
Tables having foreign key.. which is giving error if I select table randomly to delete.
I want to know the query which will give me the sequence of all tables based upon dependencies, so that If i delete the data on that sequence, it wont give me child record exists error.
View 8 Replies
View Related
May 28, 2010
do we have ON_UPDATE_CASCADE? or there is no ON_UPDATE_CASCADE is oracle and we have just ON_DELETE_CASCADE
View 1 Replies
View Related
Oct 9, 2012
The database is 11.2.0.3 on a linux machine. I issued the following command, but the session was a little slow. The table size is about 50 GB and has 3 indexes. I specified "degree=8" for parallel processing.
When gathering statistics on the table , parallel slaves were invoked and gathering statistics on the table has finished fast enough. However, when it goes to gathering statistics on the indexes, only one active session was invoked, and thus "degree=8" option was ignored.
My question is :
Do I need to use dbms_stats.gahter_index_stats instead of "cascade" option in order to gather statistic on the indexes with parallelism?
exec dbms_stats.gather_table_stats(ownname=>'SDPSTGOUT',tabname=>'OUT_SDP_CONTACT_HIS',estimate_percent=>10, degree=>8 , method_opt=>'FOR ALL COLUMNS SIZE 1',Granularity=>'ALL',cascade=>TRUE)
View 2 Replies
View Related
Jun 13, 2012
I want to create a store procedure to copy data from a source tables(which may not have any constraints defined) to a table which has primary key, foreign key and unique key constraints.
Any records which are rejected due to these constraints not being satisfied need to go another table.
Once the initial data load is done, these procedures need to be automated(through cron) to do the future incremental uploads in the same manner.
View 6 Replies
View Related
May 4, 2011
i want to write, just ONE trigger that handles all DMS events at schema level and writes the field changes to a specific log table. i wanna to write like 'FOR EACH FIELD' as for each row (& also each table). it turns in the fields section and if the 'old' and 'new' values isnt same, it triggers this function & writes changes to log.
ex. is like:
FOR EACH ROW
FOR EACH FIELD
if (old.value != new.value)
insert into LOG(..., old.name,new.name) values (..., old.value, new.value)
NEXT // FIELD
NEXT // ROW
View 19 Replies
View Related
Jul 5, 2012
I have a table with around half a million rows. I would like to determine how many sequential events occur per device per unique group of events. The requirement is that the events continue to occur within 1 second of each other, every second, with no gaps. For example, in the sample below there is a sequence of 2 events for device 2737, and another sequence of 5 events for device 2737. If there was a 1 second interval with no event (Signal_time) then that would be the end of one group of events, this is also shown below.
Using Oracle 11.2.0.2.0
DEVICE_ID SIGNAL_TIME
4401 17-JUN-12 12.59.59 PM
2332 02-MAY-12 12.59.59 PM
1086 30-MAY-12 12.59.58 PM
2737 17-JUN-12 12.59.58 PM -- start of one group / sequence of events
2737 17-JUN-12 12.59.58 PM -- end of one group / sequence of events
[Code]...
-- start of one group / sequence of events
2737 16-JUN-12 11.59.59 PM
2737 16-JUN-12 11.59.59 PM
2737 17-JUN-12 12.00.00 AM
2737 17-JUN-12 12.00.01 AM
-- end of one group / sequence of events
2737 17-JUN-12 12.00.03 AM
-- this is excluded from the above group of 5 events, but this may be the start of another group
Required output
Device--Count(*)--Start_Signal_Time-----------End_Signal_Time------------Duration (seconds)
2737----5-------------16-JUN-12 11.59.58 PM---17-JUN-12 12.00.01 AM--4
2737----2-------------17-JUN-12 12.59.58 PM---17-JUN-12 12.59.58 PM--1
View 3 Replies
View Related
Aug 31, 2010
In my awr reports I have CPU time(in seconds) as one of top 5 timed events.Does that mean oracle is waiting for my cpu to execute the statements.But my cpu usage is 0-10% always
View 4 Replies
View Related
May 20, 2013
One fo my Db having reliable message as top first timed events.
Event Waits Time(s) Avg wait (ms) % DB time Wait Class
reliable message 685,139 24,625 36 29.58 Other
View 1 Replies
View Related
Jun 2, 2010
I am trying to create a trigger to stop events from being deleted if the date is before the current date. This is the SQL syntax for my table
CREATE TABLE event
(event_id numeric(5) not null,
concert_id numeric(5) not null,
event_date date,
);
What I have attempted so far is:
CREATE OR REPLACE TRIGGER event_deleting
BEFORE DELETE ON event
FOR EACH ROW
BEGIN
IF DELETING THEN
[code]......
This gives me a few warnings, the first is that a DECLARE is missing and the second is a INTO is missing.
View 1 Replies
View Related
Nov 6, 2012
registration forms for events (like Technology days and so on) with Apex? I want to build up something like that where customers can register for several events.
What is needed:
registration form with a limited registration (e. g. 80 customers) e. g. create a trigger?
show how many seats are still available
cancel of the registration
I´m using Apex 4.1
View 0 Replies
View Related
Jun 17, 2013
Can I disable tracing just on deadlocks events on 11gR2?One of our applications provoke several deadlocks. I've warned the developers team several times, but it's taking time to solve it. However, these deadlocks generate trace files of several sizes (from 300M to 3G ..)The Deadlock Graph on them are very useful but the PROCESS STATE section are too long, and until the developers team fix the problem they are just filling up my user dump dest. Can I disable them or disable the PROCESS STATE section from them?
View 2 Replies
View Related
Oct 15, 2013
I am using 11.2.0.3.0 version of oracle. As told by the DBAs that two days back the system realised high wait_class i.e 'Application' wait, and its a lot high than regular value as per our system and we need to dig it down, to avoid any future issue. now using below query , i found that the high wait time due to wait class 'Application' is actually belongs to particular event 'SQL*Net break/reset to client', and the sample time was '9 AM' morning.
select time,
round(max(case when event = 'SQL*Net break/reset to client' then time_waited_delta/1e3/decode(total_waits_delta,0,1,nvl(total_waits_delta,1)) end) ,2) SQL_break_reset_client,
round(max(case when event = 'Wait for Table Lock' then time_waited_delta/1e3/decode(total_waits_delta,0,1,nvl(total_waits_delta,1)) end),2) Wait_for_Table_Lock ,
round(max(case when event = 'enq: KO - fast object checkpoint' then
[code]....
Now i want to track it down further to the 'session/sql query/application' level resulting into such high value of wait time. so i queried, dba_hist_ active_ session_history, for the same sample duration (8.30 to 9 am) having event 'SQL*Net break/reset to client', and got two sessions(123,154) and their serial# , but there i got one sql_id(3ahgrey10ogh i.e a 'SELECT' query) specific to one session(123) but for other(125) no sqlid, and also SUM (wait_time + time_waited) is showing '0'.
Then i just removed the sampletime filter from the below query and observed that the same 'same session(123)+session serial#' was activated since 4 days back and was experiencing same waitevent 'SQL*Net break/reset to client', (it was having normal wait event 'db file sequential read' for sometime then after it went for this event ).
SELECT user_id,
PROGRAM,
machine,
session_id,
SESSION_SERIAL#,
sample_time-7/24,
session_state,
[code]....
View 14 Replies
View Related
Mar 12, 2013
We have been using XLA to capture events on TimesTen for a while now without any issues. We were on TimesTen 7.0.5 and then moved to 11.2.2.3.0 and now 11.2.2.4.0. The XLA processes used Java 6 64 bit and works well with TimesTen versions 11.2.2.4.0 - 64 bit and 11.2.2.3.0 - 64 bit, without any issues.
However, we recently upgraded to Java 7 64 bit both during build time of our XLA processes as well during runtime. The problem we see now is that XLA process upon startup processes events for a while and then after that doesnt receive any events. The process doesn't throw any errors/exceptions. If we restart the XLA process, all the unprocessed events are received and then it behaves normally for a while after which it fails to receive any further events.
Is there any issue with Java 7 64 bit and the TimesTen XLA API? I read the TimesTen 11.2.2.4.0 manual and it says that Java 7 and the ttjdbc7.jar have been certified to work well. Was just wondering if there were any other issues.
In addition, to debug the problem, we ran XLA on a single node and on a two safe setup. The same observations are noted. On Java 6, the process runs just fine capturing all events without any issues, but with Java 7, the issues persist.
In addition, we are only performing updates/inserts on to TimesTen, no delete actions. The OS on which TimesTen's and XLA runs is Red Hat Enterprise Linux Server release 5.7 (Tikanga).
View 2 Replies
View Related
Aug 31, 2013
DB version: 11.2.0.3
I have enabled the below trace event before running query on my session.
ALTER SESSION SET events = '19027 trace name context forever, level 0x1000';ALTER SESSION SET tracefile_identifier = store_trace;
Then I ran my query, and upon the finishing of the query, I ran the below to disable trace.
ALTER SESSION SET events = '19027 trace name context off, level 0x1000';
Now I checked back on the trace folder in my Oracle DB directory structure, but cannot find any file created by using the above set tracefile_identifier. I had previously run the query with "sql_trace" ON with tracefile_identifier, and successfully got the tracefile generated by using the identifier.
View 4 Replies
View Related
Sep 13, 2013
11.2.0.3 EVENTS: Null(blank) or called a 'null event' See link. Checked the docs. I don't see anythingI think a null (blank) is for an idle wait since per the V$ACTIVE_SESSION_HISTORY spec these are not record. Am I correct?What is a 'null event'. I see a paper from Oracle magician dating to 9i that says this is an 'oracle goof'. Descriptions of Wait Events
View 5 Replies
View Related
Oct 19, 2010
I have a partitioned table with degree for parallelism defined as 10.
I am getting maximum wait events on PX Deq: Execute Reply.For 2 hours trace the wait event is almost 1.5 hour.
I have done some seraching and i found this.
Quote:
In principle:A parallel query against a partitioned table will use one slave per partition if the query is thought to span multiple partitions, and it can use all slaves on a single partition if the query is thought to target just one partition. Unfortunately, this is NOT strictly true.
It is possible for the optimizer to decide to use parallelism at degree M when accessing N partitions. Sometimes this can lead to very inefficient, brute-force, processing when a more efficient path is available. This can be a particular problem with multi-table joins that should be partition-wise joins. You may be better off leaving the tables defined as non-parallel and adding explicit parallel hints to the code for critical queries.
So i have following questions
1) What is the meaning of PX Deq: Execute Reply.
2) Is this not recommended to use DEGREE clause in Partitioning.
3) Defining DEGREE clause in partioning of table will automatically executes DML on table PARALLELY same a PARALLEL hint clause
View 6 Replies
View Related
Jun 29, 2011
I ran an AWR report. The database looks fine, but a data load that loaded 1 Million rows an hour is now doing 500K per hour.
Wait Class Waits %Time -outs Total Wait Time (s) Avg wait (ms) %DB time
DB CPU 224 80.70
Other 2,668 0 28 10 9.99
System I/O 4,753 0 9 2 3.23
Administrative 1 0 6 5543 2.00
Commit 357 0 4 11 1.46
[code]....
The network value for wait: 630,601. What does this mean? Anything I should look at? When it was 1million per hour, the value was 4,563,000.
Top 5 Timed Foreground Events
Event Waits Time(s) Avg wait (ms) % DB time Wait Class
DB CPU 224 80.70
unspecified wait event 2,666 28 10 9.99 Other
control file sequential read 4,753 9 2 3.23 System I/O
switch logfile command 1 6 5543 2.00 Administrative
log file sync 357 4 11 1.46 Commit
View 8 Replies
View Related
Feb 8, 2012
I have to create the matrix report which shows calender. Looks Like this.
View 14 Replies
View Related
Jun 24, 2013
We are using 11.2.0.3.0 on solaris 10 facing slow performance, following are the Wait Events in AWR report, Also if any specific document to analyze AWR report and to pin point the performance bottleneck.
Foreground Wait Events
**********************
Avg
%Time Total Wait wait Waits % DB
Event Waits -outs Time (s) (ms) /txn time
-------------------------- ------------ ----- ---------- ------- -------- ------
direct path read 308,729 0 21,191 69 58.0 39.5
db file sequential read 208,754 0 3,742 18 39.2 7.0
cursor: pin S 19,541,899 0 2,561 0 3,668.5 4.8
[code]....
View 2 Replies
View Related
Feb 20, 2013
Would like to know the execution series of an application(From a particular screen) through Oracle trace events.
View 1 Replies
View Related
Feb 25, 2008
How do know all the constraints that are present on the data in a table in oracle ??
View 2 Replies
View Related
Nov 1, 2013
I want to display columns along with their constraints using describe command
Is it possible?
SQL> desc dept;
Name Null? Type
----------------------------------------- -------- -------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
View 1 Replies
View Related
Mar 7, 2010
Basically, I need to fulfil the constraint:
"student cannot have more than 100 points"
I need to use a trigger to do this, but I don't understand how this would work.
Written in plain english I imagine it work work something like:
AFTER UPDATE
WHERE student.lessonid = lesson.lessonid
IF SUM(lesson.points) > 100 then ROLLBACK
lessonid is the only field relating the two tables.
--
How to fulfill that criteria, whether it be using triggers or not.
View 7 Replies
View Related
Mar 21, 2011
How to create any constraints other than NOT NULL in PLSQL RECORD.
View 5 Replies
View Related
Mar 5, 2012
Ive created a scenario to what im trying to achieve here so ignore how its set-up attribute wise.
CREATE TYPE object_obj AS OBJECT (
obj_id NUMBER,
NAME VARCHAR2(20),
age NUMBER) NOT FINAL;
/
CREATE TYPE object_ext UNDER object_obj (
course_name VARCHAR2(20));
/
CREATE TYPE object_ext2 UNDER object_obj (
location VARCHAR2(20);
/
CREATE TABLE object_tab OF object_obj(obj_id PRIMARY KEY);
/
Now for the course_name i need to make sure it can only be on of these three values ('Science','Math','English'). I can't find a way to apply this constraint without making a table. But then that creates another issue of how to insert the data from the main supertype (object_obj) and i only want the object_tab table and view the subtypes via a select query.
View 28 Replies
View Related
Aug 23, 2013
When a table structure is copied from another table.What are the constraints copied and why?Unique keyPrimary keyForeign KeyCheckNot null.
View 10 Replies
View Related