Oracle: Finding the stored procedure that modifies record on a table - oracle

I've got a C# code that calls stored procedures and UPDATES a table. Can I monitor each operation made on this table by a SID.

Yes, you can do this at the database level using Oracle auditing. See here for good writeup and examples of its use.

Related

Is there a way to check what oracle stored procdure is loading while running

I have a stored procedure which has been running for a long time and I don't find any entry for that in v$session_longops. Is there a way to check on the current status of that?
Also, am pretty new to oracle. So is there a way to check on the amount of data the proc is trying to load into a table just like work flow monitor in informatica?
I am a dev and am using Oracle 12c.
Check with a view called gv$session. Column sql_text should let you identify your session and column rows_processed should tell you how many rows, if any, have been processed.
You may need to ask your DBA to grant you access to that view.

Where and how are procedure and packages store or saved in oracle database? Do oracle store compiled version separately?

in plsql when I create and compile a procedure, whether inside a package or standalone, how specification and body of procedure is saved in database?
Like all the other data about objects etc, the text of the code is stored in the dictionary tables. You can see the package contents by querying user_source, all_source or dba_source, depending on which level you're viewing the data at.
The actual compiled version of the code that Oracle keeps is, as far as I know, an internal thing that isn't available to be queried in the dictionary tables.

Generate DDL for Oracle Stored Procedure Dependency Graph

With TOAD I know I can view the dependency (uses) graph of a stored procedure using the schema browser. And, the Oracle utility procedure deptree_fill can do something similar. What I want to do is script out all of the stored procedures, functions and table definition DLLs into a file that I can use to recreate those objects in another database. Is there a tool or an existing script for this purpose? My own searching has not found a solution. In my particular case the stored procedure uses a dozen other procedures, a few functions and twenty tables.
Edit 1
Maybe my original question was not clear. What I am looking for is something that will take the stored procedure I am interested in and script it and all of its dependency graph into one or more files.
The schema I am dealing with has hundreds of objects in it and the dependency graph has ~50 objects in it. So I'd rather not dig through large lists in TOAD or write an Oracle script myself if I can avoid it.
All sources can be extracted using the dbms_metadata package.
To get the source of a table:
select dbms_metadata.get_ddl('TABLE', 'SOME_TABLE')
from dual;
To get the source of a stored procedure:
select dbms_metadata.get_ddl('PROCEDURE', 'SOME_PROC')
from dual;
Using that you can create a SQL script that extracts everything and then spool the result to a file.
More details about the various functions in dbms_metadata can be found in the manual:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_metada.htm#i1015856
Hmm, it is quite easy to find in google.
Get table DDL: How to get Oracle create table statement in SQL*Plus
Code of stored procedures can be found in table USER_SOURCE.
Also, for exporting schema to another DB you can use oracle utilities: http://docs.oracle.com/cd/B28359_01/server.111/b28319/exp_imp.htm#g1070082
In Toad see the Generate Schema Script window. You can get to it from the Database|Export menu. There are many options there to include/exclude what you want.

Dynamic SQL-Loader control file

I have 20 tables that are temp-tables where we load and validate data constantly and I have a control file for each table.
How can I have a unique control file that just changes the table the data is loaded into?
Any suggestion?
Thanks in advance!
---Oracle info---
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
Suggest you write your control file load the data into a synonym rather than into the specific table. Begin each load run by redefining the synonym to the table you want.
Maybe you can use multiple INTO TABLE clauses, and distinguish bitween them, somehow, with the WHEN clause.
Look here for more details

Sybase Temporary Table and Indexes

Is this a misconception?
Sybase query optimizer can not consider index on temporary table if it is created and used in same batch or procedure.
I'm a bit confused about this as there seem to be differing opinion.
Thanks heaps.
That's quite simple.
The optimizer calculates the query plan before execution and the temporary table is created when executing the stored procedure.
A way to pass this problem is to create the temporary table and its index before the execution of the stored procedure :)

Resources