I have a stored procedure in teradata.
I would like to capture activities within it at run time.
Is there a way i can get the procedure name while it is being executed.
I can then use the procedure name and the message while logging.
I am trying to avoid hard coding of the procedure name.
Can you please let me know if there are any parameters in teradata that support this or any other suggestions ?
Thanks !
Related
We need to use GenerateTableFetch to fetch huge data from teradata using nifi. But since Teradata is not present as a database type it generate Limit keyword. I am able to replace it with Sample keyword. But sample everytime give random value so how can i use Nifi with Teradata for huge table?
Maybe try the "MS SQL 2008" adapter, it generates a TOP statement as well as a ROW_NUMBER() OVER clause. If that doesn't work, we'd need a TeradataDatabaseAdapter implementation, please feel free to file an improvement Jira as needed.
I have a driver table with a flag that determines whether that record has been processed or not. I have a stored procedure that reads the table, picks a record up using a cursor, does some stuff (inserts into another table) and then updates the flag on the record to say it's been processed. I'd like to be able to execute the SP multiple times to increase processing.
Obvious answer seemed to be to use 'for update skip locked' in the select for the cursor but it seems this means I cannot commit within the loop (to update the processed flag and commit my inserts) without getting the fetch out of sequence error.
Googling tells me Oracle's AQ is the answer but for the time being this option is not available to me.
Other suggestions? This must be a pretty common request but I've been unable to find anything that useful.
TIA!
A
I'm trying to figure out why insert and update statements take a lot longer to run on the production server versus the test server. I don't know how to go about monitoring the state of the block as it is running in SQL Developer. Something like a rownum plus sysdate output after so many rows have been inserted would be a good start.
Is there a way to output dbms_output.put_line statements while the block is running?
I am currently running SQL Developer 3.1.07 on Oracle 11g.
EDIT TO ADD SOLUTION:
PROCEDURE log_timestamp (
PI_trans_num number
) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO timestamp_log (log_timestamp, trans_num)
VALUES (SYSTIMESTAMP, PI_trans_num);
COMMIT;
END log_timestamp;
One of the better ways of monitoring PL/SQL performance on a row-by-row basis is to use DBMS_Profiler, which will give you execution statistics for each row and how many times it executed.
It won't diagnose a SQL execution problem of course, but it will highlight how much of your execution time is spent on executing each statement.
Another method is to use DBMS_Application_Info.
You can add metadata to your session in v$session to share progress by setting "action name", and by maintaining progress reports through v$session_longops.
dbms_output.put_line statements will only be shown after the pl/sql block has been executed so they're not suitable for identifying problems while code is running.
If you want to keep track of long running processes you could log to a database table using an autonomous transaction (so you don't interfere with the current transaction) and monitor the logging table.
Taking an alternative approach, you could look at the explain plans for the insert and update statements being run on both the test and production servers. This might identify a difference on the production system which will explain the time difference.
Could you tell me please if it is possible to identify missing indexes for a select query using SQLite database?
Or is there any tool that can help?
Thank you!
Use EXPLAIN QUERY PLAN command to identify missing index for given SQL query. For example, the following result indicates you may need an index for a in table t1.
sqlite> EXPLAIN QUERY PLAN SELECT a, b FROM t1 WHERE a=1;
SCAN TABLE t1
If you have a lot of SQL queries and want to quickly identify missing index, I wrote a tool which helps analyze many SQL queries and saves you much time in the repeating process.
Using the sqlite3 command line tool, first enter
.expert
And then run your query as normal.
I am using Enterprise block and not able to figure this out.
I am using oracle procedure for inserting records into the database from my asp.net application in VB.net
Though it is inserting records as it should When I try to access the dataset returned I am not able to see the just inserted record details.
In my Oracle procedure I have Output Cursor which should return several column values from the just inserted record.
Please help.
This is a bit of a work around to what you're currently doing, but if you're still having issues with this, I'd suggest running ExecuteNonQuery for inserting and then ExecuteDataTable with the data you supplied to call a SELECT on your data.
Keep in mind, however, that this method's performance may be a bit slower (DB call to insert, followed by a DB call and return to select the data), but you will not need to worry about your cursor anymore (not sure what kind of performance gain, if any, this might have).