Update/Insert/Delete/Select Monitoring?
Hello,
is it possible to monitor user activity like upper mentioned statements and how can I realize that?
The information about the user-activity should be shown for each tables within a database.
Regards
Steve wrote:
Ok thanks a lot.
Is it also possible to audit procedures and views?Sure. Check the following link:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4007.htm#i2059073
Kamran Agayev A.
Oracle ACE
My Oracle Video Tutorials - http://kamranagayev.wordpress.com/oracle-video-tutorials/
Similar Messages
-
Hi guys,
I have created a copy of the AdventureWorks2012 DB called AdventureWorks2012_new on the same instance.
I have created the following trigger below but my friend who is a DBA told me that this is not correct and I should be using the inserted table when creating this trigger. I would like AdventureWorks2012_new DB to be updating/inserting/deleting data from
the same tables that have been updated/inserted/deleted in the AdventureWorks2012 DB. How exactly should I do this for all the tables in the whole database ? What I have written below is just for one of the tables, is there a quicker way to do it for all tables
in this DB so that it performs the actions mentioned above, automatically ? Help would be greatly appreciated so I can understand how this works, thanks
CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterUpdate]
ON [AdventureWorks2012].[HumanResources].[Department]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE AdventureWorks2012_new.HumanResources.Department
SET Name = t2.Name,
GroupName = t2.GroupName,
ModifiedDate = t2.ModifiedDate
FROM AdventureWorks2012.HumanResources.Department AS t2
INNER JOIN AdventureWorks2012_new.HumanResources.Department AS t1
ON t2.DepartmentID = t1.DepartmentID
ENDFor insert it's easy:
CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterInsert]
ON [AdventureWorks2012].[HumanResources].[Department]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
Insert INTO AdventureWorks2012_new.HumanResources.Department
(DepartmentID, Name, GroupName, ModifiedDate)
SELECT DepartmentID, Name, GroupName, ModifiedDate
FROM Inserted;
END
I didn't verify column names, so you may need to make sure to use correct column names for that table.
Setting replication is a bit advanced topic although BOL is clear and you may start here
http://technet.microsoft.com/en-us/library/ms151198.aspx
If it will be complicated for you, you can ask extra questions in the MSDN Replication forum.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Update/insert/delete data from xcelsius to Database via web service
Hi,
I need to create dashboard that go function can <b>update/insert/delete</b> data send to <u>Database</u> thru <u>web services</u>, as i know got 2 xcelsius add-on software which support those of function <b>InfoBurst</b> and <b>flynet </b>
<b>InfoBurst</b>
http://www.infosol.com/azbocug/minutes/4-Writeback%20to%20a%20Database%20with%20Xcelsius.pdf
<b>flynet </b>
http://www.flynetviewer.com/public/community/Blogs/FlynetXcelsiusServerUser/default.aspx
Except this 2 purchase add-on xcelsius, any other solution ?
Maybe need to write some in MSSQL or C# programming which enable insert, update, delete ...etc ?
*note: i not use Xcelsius Engage Server , i use Xcelsius Engage only
thanks,
regards
s1
Edited by: Leong Pui Kee on Mar 1, 2011 6:06 AMHi,
As of now in Xcelsius/Dashboard Design there is no feature or functionality to insert/update/delete data from database.
Solution:
Create a Web service in let’s say C# or Java, which will perform insert/update/delete operation.
In Xcelsius add Web Service connection and user above web service.
Xcelsius Web Service connection provides option to pass input values to a Web Service (Input Pane) and get the result (Output values pane).
We can pass values to be written to the database as a input to Web Service via Web Service connection from Xcelsius and write data to the database.
Note:
Performing delete operation from Xcelsius Dashboard could be risky and may delete important data from database. I would not prefer giving delete option/functionality in Xcelsius dashboard.
Hope this helps!
Thank you.
Regards,
Vinay Mhaske -
Hi guys, I'm trying to create a Stored procedure that will automatically add all 3 After triggers when executed on any given database, can someone please explain and give an example on how do I go about doing this ? I'd also like it to raise any errors
that may come across, thanks in advance.Lets start with the question why do you need the triggers at all. Since SQL Server 2005 we can use an OUTPUT clause.
This code can be re-written in SQL Server 2005 using the OUTPUT clause like below:
create table itest ( i int identity not null primary key, j int not null unique )
create table #new ( i int not null, j int not null)
insert into itest (j)
output inserted.i, inserted.j into #new
select o.object_id from sys.objects as o
select * from #new
drop table #new, itest;
go
Now from this example, you can see the integration of OUTPUT clause with existing DML syntax.
Another common scenario is auditing of data in a table using triggers. In this case, the trigger uses information from the inserted and updated tables to add rows into the audit tables. The example below shows code that uses OUTPUT clause in UPDATE and DELETE
statements to insert rows into an audit table.
create table t ( i int not null );
create table t_audit ( old_i int not null, new_i int null );
insert into t (i) values( 1 );
insert into t (i) values( 2 );
update t
set i = i + 1
output deleted.i, inserted.i into t_audit
where i = 1;
delete from t
output deleted.i, NULL into t_audit
where i = 2;
select * from t;
select * from t_audit;
drop table t, t_audit;
go
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Materialized Views: how can I find the number of updates, inserts, delete
We are using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod.
In a materialized view, with fast incremental refresh, done after every 5 minutes automatically, I want to store in a logging table the number of rows inserted,updated and deleted in the materialized view by that refresh.
One option is to create a job that should read the materialized view log table just before the refresh and store the required information in the logging table. But this information may not be accurate.
Is there any other way to collect this information for each refresh?Use auditing, or an before insert/update/delete trigger, that updates a counter
I hate myself for giving this advice, because it will bring you problems, with the MV update/refresh speed, table lock contention on the log-table....
Be carefull !!
Why not use auditing on the source table and why does anyone wants to know the number of changes??
Regards
FJFranken -
Updated, inserted, deleted records
Hello,
Oracle 10g R 2
Is there anyway to find the updated, deleted, or inserted records in a table?
Regards,NB wrote:
i need to log all the modifications done on table, (update, delete or insert) in another table
is there any thing to give me all the modified records, for example between sysdate -1 and sysdate?If you have a copy of "previous" data and the "current" data then you can use SQL set operations (MINUS, INTERSECT etc.) to determine which data has been inserted, updated and deleted.
If you don't actually record the inserts, updates and deletes as they happen, there is some possibility of using the archive logging of the database and then log mining to find out what happened to the data, but that data is only available for a limited time (assuming archive logging is enabled for the tables).
Essentially, if you don't have a historic copy of the data and you don't record the changes as they happen yourself, getting the information is going to be very tricky. -
Update/Insert/Delete into the same table
Hi,
I'm writing pl/sql code :
nvoice_id will be passed as parameter and based on invoice_id I need to see whether any records exist in history table.If not any then insert record into table.If more than one record exist then I need delete all except most recent one based hist_seq column in that table.
Then I need to update that record for description column .How to put dml operation one after another in an efficient manner?As one statement depend on another do I need to use autonomous transaction?
Thanks,
Kiranuser518071 wrote:
Hi,
I'm writing pl/sql code :
nvoice_id will be passed as parameter and based on invoice_id I need to see whether any records exist in history table.If not any then insert record into table.If more than one record exist then I need delete all except most recent one based hist_seq column in that table.
Then I need to update that record for description column .How to put dml operation one after another in an efficient manner?As one statement depend on another do I need to use autonomous transaction?
Thanks,
KiranBasic idea.
create procedure p_deal_with_invoice
p_invoice_id number
l_max_hist_seq number;
is
begin
select max(hist_seq)
into l_max_hist_seq
from your_table
where invoice_id = p_invoice_id;
if l_max_hist_seq is not null
then
delete from your_table
where invoice_id = p_invoice_id
and hist_seq != l_max_hist_seq;
update your_table set some_columns = some_new_value
where invoice_id = p_invoice_id
and hist_seq = l_max_hist_seq;
else
insert into your_table () values ();
end if;
end p_deal_with_invoice;
/An autonomous transaction would probably be the last thing you'd want here. Just a simple plsql procedure that accepts a INVOICE_ID as an input.
Cheers,
Edited by: Tubby on Jun 18, 2012 2:53 PM -
Update,Insert,Delete on table T1 as per matching or non-matching rows in T2
Hi,
Need a solution for the following:
I have two tables T1 and T2:
T1
NAME LINK
a a1
a a2
b b1
c c1
c c3
d d1
T2
NAME LINK
a a1
a a3
b b1
b b2
c c1
c c2
c c3
Requirement: data in table T1 should be same as T2 for the matching values in column 'NAME'. So finally data in T1 should be:
T1
NAME LINK
a a1
a a3 -- (a,a3) added and (a,a2) deleted
b b1
b b2 --(b.b2) added
c c1
c c2 --(c,c2) added
c c3
d d1 --(d,d1) left as it is as value 'd' not found in T2
Any help writing a procedure would be appreciated.
Thanks,
Priyankadelete t1
where name in (select name from t2);
insert into t1 (name, link)
select name, link from t2 -
Update/insert/delete in the same JSP
Dear all,
i want to develop a same JSP from which can update,delete or insert..is it possible??
thanks in advance..
sinarThe form display is dictated by how you process the submit. I would build the form by using standard html tags. Here is another pseudo example:
<FORM ACTION="target.jsp" >
<TABLE>
<TR>
<TD>
DeptNo
</TD>
<TD>
DName
</TD>
<TR>
<%
int nRow = 0;
%>
<jbo:RowsetIterate datasource="ds">
<%
// increment the row number
nRow++;
String sDeptno = "Deptno" + nRow;
String sDname = "Dname" + nRow;
String sRowKey = "RowKey" + nRow;
%>
<jbo:Row id="myrow" action="current">
<TR>
<TD>
<input type="text" name="<%=sDeptno%>" value='<jbo:ShowValue dataitem="Deptno" />' />
</TD>
<TD>
<input type="text" name="<%=sDname%>" value='<jbo:ShowValue dataitem="Dname" />' />
<input type="text" name="<%=sRowKey%>" value='<jbo:ShowValue dataitem="RowKey" />' />
</TD>
<TR>
</jbo:Row>
</jbo:RowsetIterate>
<input type="submit" />
</TABLE>
</FORM>
NOTE: This should get you started!!! -
Currently updated / Inserted data selection
Dear Experts,
Following is my table structure :
CREATE TABLE RR_SYSTEM_ERROR
PTYPE CHAR(1 BYTE),
CODE1 CHAR(5 BYTE),
CODE2 CHAR(5 BYTE),
QNO CHAR(5 BYTE),
ERR_DESC VARCHAR2(1000 BYTE),
DATE_STAMP TIMESTAMP(6)
Data :
PTYPE CODE1 CODE2 QNO ERR_DESC DATE_STAMP
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 11:56:56.000000 AM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 12:00:35.000000 PM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 11:58:33.000000 AM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 12:00:10.000000 PM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 11:52:02.000000 AM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 11:52:56.000000 AM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 11:54:33.000000 AM
C AE IQ 02163 ^^AT 09-11-2010 11:8:5 ERROR Msg: Error 12/13/2010 11:55:27.000000 AM
This table will have duplicate data in first five cloumns :.
The requirement is :
I have to filter the recently inserted or updated "ERR_DESC" in the table , selection of the data will be based on first 4 column,
How can i filter it ?... Kindly help me...
Regards
ASY@UAEHi,
You can use the correlated query as below.
select * from rr_system_error a
where a.date_stamp=(select max(date_stamp)
from RR_SYSTEM_ERROR b
where a.pype=b.type
AND a.code1=b.code1
AND a.code2=b.code2)Hope this helps..
Regards,
Achyut -
CLOB update ,insert and select
hi,
could any one tell me which is the best approach to insert, update and select CLOB valoues
and also which CLOB to use (ie java.sql.CLOB or oracle.sql.CLOB) in an oracle databaseI'd generally recommend to use the methods in java(x).sql only (for portability reasons).
Update:
ResultSet r = ...;
Clob text = r.getClob(1);
Writer w = text.setCharacterStream(0);
w.write("some text");Insert:
Problem: Clob instantiation.
Either ensure that an empty clob is created as default for clob colums
or use database-specific code like "insert into tab(id, text) values(1, dbms_lob.create_clob...)"
and update that row as above.
Select
Use getString for clobs or (to prevent truncating)
ResultSet r = ...;
Clob c = r.getClob(1);
Reader r = c.getCharacterStream(0);Regards, -
Can we have an example of using update, insert, and delete stored procedure
I would like to see an example of using retrieve (return resultset), update, insert, and delete stored procedures in JSF. I need to see syntax how JSF can call those stored procedures. This option is absolutely important when building web-application. Currently, I haven't found resource to do for this purpose yet. The database can be any such Oracle, DB2, pointbase, etc that support stored procedures.
Anyone knows?
Thanks,
Tue VuHi ttv,
I asked around a bit and here's some more info:
To bind a ResultSet to a read only Data Table component just set the "value" property of the Data Table component to point at it, and JSF will synthesize a DataModel around it.
* Note that because we can't call the stored procedure at design time, Creator can't do the fancy table layout stuff it does for rowsets. You'll need to hand craft the columns just like the Google Client example.
* As I mentioned previously, you will have to manually code the stored procedure access in your java code - see the code clip I mentioned in previous reply (and if this is via a stored procedure, then any textbook about JDBC will undoubtedly have examples). Simplest way might be a getter method on the page bean that contains the call to the stored procedure and returns the resulting ResultSet object.
* Don't forget to close the result set - we typically do this at the end of the request (i.e. add a close in the afterRenderResponse() method.
* Don't throw exceptions - or if you have to, make sure you close the result set in a finally clause (thrown exceptions bypass the afterRenderResponse method in the lifecycle).
* You give up on the caching provided by our RowSetDataModel (which can't be connected to a ResultSet even manually), so I would recommend that you only use datatables to display the data and then go to a single row page to do edits/deletes (similar to the TwoPage example in AppModel and the Update, Insert Delete tutorial).
And yes please do submit an example - we will gladly post it!!! :) The best way to submit this kind of thing would be through:
http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
on the right side, Related Links, under Creator Heros, click Submit Content and there you can send it in!
Hope this helps!
Val -
Urgent : Performance Issue DELETE , INSERT INTO SELECT, UPDATE
Hi,
NEED ASSISTANCE TO OPTIMIZE THE INSERT STATEMENT (insert into select):
=================================================
We have a report.
As per current design following steps are used to populate the custom table whcih is used for reporting purpose:
1) DELETE all the recods from the custom table XXX_TEMP_REP.
2) INSERT records in custom table XXX_TEMP_REP (Assume all the records related to type A)
using
INSERT..... INTO..... SELECT.....
statement.
3) Update records in XXX_TEMP_REP
using some custom logic for the records populated .
4) INSERT records in custom table XXX_TEMP_REP (Records related to type B)
using
INSERT..... INTO..... SELECT.....
statement.
Stats gathered related to Insert statement are:
Event Wait Information
SID 460 is waiting on event : db file sequential read
P1 Text : file#
P1 Value : 20
P2 Text : block#
P2 Value : 435039
P3 Text : blocks
P3 Value : 1
Session Statistics
redo size : 293.84 M
parse count (hard) : 34
parse count (total) : 1217
user commits : 3
Transaction and Rollback Information
Rollback Used : 35.1796875 M
Rollback Records : 355886
Rollback Segment Number : 12
Rollback Segment Name : _SYSSMU12$
Logical IOs : 1627182
Physical IOs : 136409
RBS Startng Extent ID : 14
Transaction Start Time : 09/29/10 04:22:11
Transaction_Status : ACTIVE
Please suggest how this can be optimized.
Regards,
NarenderHello,
Is there any relation with the Oracle Forms tool ?
Francois -
Stored proecedure tutorial for insert, delete, update,select
I want to integrate the stored procedure in my project
i am using jsp,
any one suggest me, stored proecedure tutorial for insert, delete, update,select
thanx.Whether you are using JSP or not should not affect your decision (though I would recommend checking out the MVC pattern, and recommend against doing data access code from your JSP's).
You simply need one tutorial on how to invoke a stored procedure. The stored procedure you write can have INSERT, SELECT, UPDATE, DELETE, whatever. You simply have to master the concepts involved in java.sql.CallableStatement. (And then you can get more fancy with vendor-specific extensions).
However, I am a bit confused. You want a tutorial on stored procedures, but then you indicate very normal DML statements like INSERT, UPDATE and DELETE. All of these (queries, DML and stored procedures) fall under the general umberella of JDBC. So, it is always a good place to start with a plain ole JDBC tutorial.
java.sun.com/docs/books/tutorial/jdbc/index.html
www.onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html
- Saish -
Selected Column insert, delete and updation at replication end
Hello,
In GoldenGate, is there a way to get a timestamp column at target table to get updated for some selected columns from source table only. For eg.
At source - Table Temp_Source , columns - Emp_Id (PK), Emp_Name, Department, Address
At target - Table Temp_Target, columns - Emp_Id (PK), Emp_Name, Department, Last_Update
The Last_Update column takes timestamp for last updation made at source table which is replicated at target end.
Now I just want the changes made in EMP_Id, EMP_Name , Department columns to be replicated at target table and also the Last_Update to get updated for changes made in these columns only. The changes made in Address column should not affect Last_Update at target end.
The extract or replication script for this should work for insert, update and delete scenarios for specified columns. Using COLS creates problem in insertion as it Abends the replication process.
Is there any way I can achieve this functionality??At target end I have written the following code in Replication process -
GetUpdates
IgnoreInserts
IgnoreDeletes
Map <source table>, target <target table>, COLMAP (USEDEFAULTS, LAST_UPDATE = @IF((EMP_ID <> BEFORE.EMP_ID OR EMP_NAME <> BEFORE.EMP_NAME OR DEPT <> BEFORE.DEPT), @getenv("GGHEADER", "COMMITTIMESTAMP"),REFRESH_TIMESTAMP));
But this code entertains only the Primary Key changes i.e. EMP_ID, I want the Last_update to get updated for changes in EMP_NAME and DEPT even but not for Address column change at source end.
Maybe you are looking for
-
How can i convert my encrypting file to a applet form to use it in IE?
Hi, i m a little new in JAVA. I searched about encryting methods. And i decide to built a encrypter that reads a string from a textbox and writes the encrypted form to another textbox.. this code is working in eclipse. but i cannot convert this to ap
-
TS3899 Mail not getting messages from specific address
I am consistently not receiving emails from a specific address in my Apple Mail inbox, but I have no filters enabled and the emails are not showing up in my spam and trash folders. If I follow directions for retrieving an email header in Gmail, I am
-
How do you sync calendar with dashboard calendar?
I accidentally selected 'no' when asked if dashboard could have access to my calendar (on my Macbook Air) and now I can't figure out how to sync the calendar with the dashboard's so that upcoming events appear on the widget.
-
Why does MMS work only after turning the iPhone off and on for iOS6?
I got the new iPhone 5. When sending/recieving pictures i have to turn the phone off and then on. For sending, it works for about 5 minutes and then i can't send anymore. I tried turning wifi off and leaving data on, turning LTE and wifi off with dat
-
I know this might be a stupid question but i would like to further my knowledge of the Mac OS. What would happen if you try to install PC software on a Mac without have loaded Bootcamp, just straight through the Mac OS. My assumptions are that it won