Buras
Buras

Reputation: 3099

How to recover queries with Teradata?

I am submitting queries with vb script (NOT sql assistant). Now I accidentally deleted that vb script file . How can I recover the queries that I submitted ? Where are they stored in Teradata ?

Upvotes: 1

Views: 9432

Answers (1)

dnoeth
dnoeth

Reputation: 60462

Most TD systems enable the Database Query Log (DBQL), so there's a high probability that your SQL was captured. You might try if you got access to it:

SELECT * FROM dbc.QryLogV 
WHERE UserName = USER;

But even if this works you might still not find the required queries, as all data is regularly moved from the DBQL base tables to a history database (probably every day). So you better contact your DBA and ask for assistance :-)

If QueryText in dbc.QryLogV is empty (or just partial text) you can check QryLogSQLV (hopefully it's populated):

SELECT * FROM dbc.QRryLogSQLV
WHERE QueryId IN 
 ( 
   SELECT QueryId FROM dbc.QryLogV 
    WHERE UserName = USER
    AND some more conditions to find the correct queries
 )

Upvotes: 5

Related Questions