Updated on 2023-04-03 GMT+08:00

DBC.INDICES

DSC migrates dbc.indices to the corresponding mig_td_ext.vw_td_dbc_indices.

Example: databasename is migrated as mig_td_ext.vw_td_dbc_tables.schemaname.

Input

1
2
3
4
5
sel databasename,tablename FROM dbc.indices
WHERE tablekind='T' and trim(databasename) = '<dbname>'
AND
( NOT(TRIM(tablename) LIKE ANY  (<excludelist>))
) AND indextype IN ( 'Q','P');

Output

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
SELECT
         mig_td_ext.vw_td_dbc_indices.schemaname
                             
, mig_td_ext.vw_td_dbc_indices.tablename

     FROM
         mig_td_ext.vw_td_dbc_indices
     WHERE
                               
mig_td_ext.vw_td_dbc_indices.tablekind =  'T'
         
AND TRIM(mig_td_ext.vw_td_dbc_indices.schemaname) =
'<dbname>'
         
AND( NOT( TRIM(mig_td_ext.vw_td_dbc_indices.tablename) LIKE ANY (
ARRAY[ < excludelist > ] ) ) )
;

In dbc.indices implementation, the query should contain "AND indextype IN ( 'Q','P')". If the query does not contain "AND indextype IN ( 'Q','P')", then the query is not migrated and DSC logs the following error message:

"Query/statement is not supported as indextype should be mentioned with values 'P' and 'Q'."

dbc.sessioninfoV

Input

select username,clientsystemuserid,clientipaddress,clientprogramname 
  from dbc.sessioninfoV 
 where sessionno = 140167641814784;

Output

select usename AS username, NULL::TEXT AS clientsystemuserid
  , client_addr AS clientipaddress, application_name AS clientprogramname 
  from pg_catalog.pg_stat_activity 
 WHERE pid = 140167641814784;

dbc.sessioninfo

Input

SELECT  username
,clientsystemuserid
 ,clientipaddress
,clientprogramname
 FROM
dbc.sessioninfo
WHERE
sessionno = lv_mig_session ;

Output

select usename AS username, NULL::TEXT AS clientsystemuserid
  , client_addr AS clientipaddress, application_name AS clientprogramname 
  from pg_catalog.pg_stat_activity 
 WHERE pid = lv_mig_session;

Teradata "SET QUERY_BAND" with "FOR SESSION"

Input

set query_band = 'AppName=${AUTO_SYS};JobName=${AUTO_JOB};TxDate=${TX_DATE};ScriptName=${script_name};' for session ;

Output

set query_band = 'AppName=${AUTO_SYS};JobName=${AUTO_JOB};TxDate=${TX_DATE};ScriptName=${script_name};' /* for session */;

SESSION

Input

select Session ;
should be migrated as below:
SELECT pg_backend_pid();

Output

SELECT pg_backend_pid();