8/22/18

How to extract comma separated values from a String or Column or Field in Oracle

Ex: Address >     123 Main St,New York , NY , 00123

SELECT  REGEXP_SUBSTR (Address, '[^,]+', 1, 1)    AS Street
,       REGEXP_SUBSTR (Address, '[^,]+', 1, 2)    AS City
,       REGEXP_SUBSTR (Address, '[^,]+', 1, 3)    AS State
,       REGEXP_SUBSTR (Address, '[^,]+', 1, 4)    AS Zip
FROM    table_x

8/21/18

APT_Communicator::connectTo: connect() failed due to Unix error = 10,061 (Unknown error) on node HOST_NAME using ConnectionInfo object 'TCP, connection Host: HOST_NAME (IP_ADDRESS), TCP port number: 0', RETRYING connect()

Problem(Abstract)

Errors related to this issue:

unable to connect to port 10000 on conductor; socket = 0, Unknown error

APT_Communicator::connectTo: connect() failed due to Unix error = 10,061 (Unknown error) on node HOST_NAME using ConnectionInfo object 'TCP, connection Host: HOST_NAME (IP_ADDRESS), TCP port number: 0', RETRYING connect()

Resolving the problem

Hosts should have at least the following 2 entries:

# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost

You should be able to ping localhost via V4 and V6 IP topologies:
ping -4 localhost
ping -6 localhost

Set $APT_USE_IPV4=1 as the default in all projects or set this as Windows default environment.
Steps to set $APT_USE_IPV4 DataStage Administrator client:
  1. Select Projects tab
  2. Select Project
  3. Click Properties
  4. Click Environment button
  5. Click Parallel Category
  6. Locate APT_USE_IPV4 and set to TRUE

8/16/18

Last Day of current month and Previous month Oracle sql

SELECT LAST_DAY(SYSDATE) last_day_current_month,
   LAST_DAY(add_months(SYSDATE,-1)) last_day_prev_month
   FROM DUAL;

6/15/18

HOW TO TAKE BACKUP OF DB2 OFFLINE

+++++++++++++++ TO TAKE BACKUP OF DB2 ++++++++++++++++++++++++
1) STOP DATASTAGE FROM CONTROL PANNEL
2)  STOP ASB AGENT FROM SERVICES
3) cd C:\IBM\WebSphere\AppServer\profiles\InfoSphere\bin
   stopServer.bat server1

after the successfull stop message then run the below backup commands.

DB2 CONNECT TO XMETA
DB2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
DB2 CONNECT RESET
DB2 DEACTIVATE DATABASE XMETA
DB2 BACKUP DATABASE XMETA TO "D:\Backups\DB2_Backup" EXCLUDE LOGS WITHOUT PROMPTING
DB2 CONNECT TO XMETA
DB2 UNQUIESCE DATABASE
DB2 CONNECT RESET



1)
cd C:\IBM\WebSphere\AppServer\profiles\InfoSphere\bin
startServer.bat server1
2) START ASB AGENT FROM SERVICES
3) START DATASTAGE FROM CONTROL PANNEL



++++++++++++++++++++++++++++++ RESTORE DB +++++++++++++++++++++++++
1) STOP DATASTAGE FROM CONTROL PANNEL
2)  STOP ASB AGENT FROM SERVICES
3) cd C:\IBM\WebSphere\AppServer\profiles\InfoSphere\bin
   stopServer.bat server1

after the successfull stop message then run the below backup commands.

DB2 CONNECT TO XMETA
DB2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
DB2 CONNECT RESET
DB2 RESTORE DATABASE XMETA FROM "C:\Downloads\DB2_Backup" TAKEN AT 20161102134130 WITHOUT PROMPTING
DB2 CONNECT TO XMETA
DB2 UNQUIESCE DATABASE
DB2 CONNECT RESET

3/22/18

Log everything to log file from unix shell script

Add the below lines at the begining of the script:

logfile=/folder/folder1/logfile.txt
exec > $logfile 2>&1

1/25/18

ODBC Stage Error

Select Statement:
select column1
         ,column2
         ,[column3 #]
        ,column4
from table

Error Message :
Error Message :  SDE_ext: ODBC Info:  SQLSTATE = 42S22: Native Error Code = 207: Msg = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'column3 ,[column4'.

Solution:
the '#' symbol needs to be converted to internal format of datastage.

So, changing the select statement to below will work.

Modified Select Statement:
select column1
         ,column2
         ,[column3 __035__]
        ,column4
from table