Create database link under LEB Live Oracle RAC DB between Oracle and LEB Live Postgres DB
Oracle DB ONLINEDB/TATSH: 172.29.15.244/172.29.15.245
PostgreSQL DB REPORTING: 172.29.15.224
Node1:
[oracle@nclbrac1 ~]$ sudo su
[sudo] password for oracle:
[root@nclbrac1 oracle]# yum install unixODBC postgresql-odbc unixODBC-devel
[root@nclbrac1 oracle]# vi /etc/odbc.ini
[myrpt]
Driver = /usr/lib64/psqlodbc.so
Description = PostgreSQL Data Source
ServerName = 172.29.15.224
PORT = 5432
Username = REPORTING
Password = FGjTn737MXcGvVvsCtR0
Database = REPORTING
OPTION =0
TRACE = OFF
[myntf]
Driver = /usr/lib64/psqlodbc.so
Description = PostgreSQL Data Source
ServerName = 172.29.15.224
PORT = 5432
Username = NOTIFICATION
Password = d5o3b4ScjRe7dv8nxzZW
Database = NOTIFICATION
OPTION =0
TRACE = OFF
[root@ EGNC-DB-01 oracle]# exit
exit
[oracle@nclbrac1 ~]$ cd $ORACLE_HOME/network/admin
[oracle@nclbrac1 admin]$ cp tnsnames.ora tnsnames1032023.ora
Tnsnames.ora:
myrpt =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP) (HOST = 172.29.15.244) (PORT=1521))
)
(CONNECT_DATA = (SID= myrpt))
(HS=OK))
myntf =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP) (HOST = 172.29.15.244) (PORT=1521))
)
(CONNECT_DATA = (SID= myntf))
(HS=OK))
[oracle@nclbrac1 admin]$ sudo su
[root@nclbrac1 admin]# su grid
[grid@nclbrac1 admin]$ cd /u01/app/19.3.0.0/grid/network/admin
[grid@nclbrac1 admin]$ cp listener.ora listener28032023.ora
Listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = myrpt)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(PROGRAM = dg4odbc)
(ENV = "LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/u01/app/oracle/product/19.0.0/dbhome_1/lib:/usr/
lib:/usr/lib64")
(SID_DESC =
(SID_NAME = myntf)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(PROGRAM = dg4odbc)
(ENV = "LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/u01/app/oracle/product/19.0.0/dbhome_1/lib:/usr/
lib:/usr/lib64")
Using user oracle
srvctl stop listener -n nclbrac1
srvctl start listener -n nclbrac1
srvctl status listener
tnsping myrpt
tnsping myntf
lsnrctl status
[grid@nclbrac1 admin]$ vi listener.ora
[grid@nclbrac1 admin]$ exit
exit
[root@nclbrac1 admin]# exit
exit
[oracle@nclbrac1 admin]$ srvctl stop listener -n nclbrac1
[oracle@nclbrac1 admin]$ srvctl start listener -n nclbrac1
[oracle@nclbrac1 admin]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): nclbrac2,nclbrac1
[oracle@nclbrac1 admin]$ tnsping myrpt
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 01-MAR-2023 14:19:40
Copyright (c) 1997, 2022, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST =
172.29.15.244) (PORT=1521))) (CONNECT_DATA = (SID= myrpt)) (HS=OK))
OK (0 msec)
[oracle@nclbrac1 admin]$
[oracle@nclbrac1 admin]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 01-MAR-2023 14:20:11
Copyright (c) 1991, 2022, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 01-MAR-2023 14:18:26
Uptime 0 days 0 hr. 1 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/19.3.0.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/nclbrac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.29.15.244)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.29.15.246)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=nclbrac1.tatsh.com)(PORT=5500))
(Security=(my_wallet_directory=/u01/app/oracle/product/19.0.0/dbhome_1/admin/dwdb/
xdb_wallet))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nclbrac1.tatsh.com)(PORT=5555))
(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nclbrac1.tatsh.com)(PORT=5510))
(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+APX" has 1 instance(s).
Instance "+APX1", status READY, has 1 handler(s) for this service...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_ASMDATA" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_FRA" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_GOLDENGATE" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR_VOTE" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_REDOLOG" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "SYS$GGDW.OGG$Q_EXTDW.DWDB" has 1 instance(s).
Instance "dwdb1", status READY, has 1 handler(s) for this service...
Service "SYS$GGOLTP.OGG$Q_EXTOLTP.ONLINEDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "SYS$SYS.OGGQ$RPFDBUAE.ONLINEDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "SYS$SYS.OGGQ$RPUNIUAE.ONLINEDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "dwdb" has 1 instance(s).
Instance "dwdb1", status READY, has 1 handler(s) for this service...
Service "dwdbXDB" has 1 instance(s).
Instance "dwdb1", status READY, has 1 handler(s) for this service...
Service "myrpt" has 1 instance(s).
Instance "myrpt", status UNKNOWN, has 1 handler(s) for this service...
Service "onlinedb" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "onlinedbXDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@nclbrac1 admin]$
[oracle@EGNC-DB-01 admin]$ tnsping myrpt
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 01-MAR-2023 13:45:57
Copyright (c) 1997, 2022, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST =
172.29.15.244) (PORT=1521))) (CONNECT_DATA = (SID= myrpt)) (HS=OK))
OK (0 msec)
[oracle@EGNC-DB-01 admin]
Configuring gateway initmyrpt.ora file.
This file does not exist and you have to create it.
[oracle@oldb-it admin]$ cd $ORACLE_HOME/hs/admin
vi initmyrpt.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
#
# HS init parameters
#
HS_FDS_CONNECT_INFO="myrpt" #ODBC DSN
HS_FDS_TRACE_LEVEL=off
HS_FDS_SHAREABLE_NAME=/usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE
HS_NLS_NCHAR=UCS2
HS_LANGUAGE=AMERICAN_AMERICA.AR8MSWIN1256
cp initmyrpt.ora initmyntf.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
# HS init parameters
#
HS_FDS_CONNECT_INFO="myntf" #ODBC DSN
HS_FDS_TRACE_LEVEL=off
HS_FDS_SHAREABLE_NAME=/usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE
HS_NLS_NCHAR=UCS2
HS_LANGUAGE=AMERICAN_AMERICA.AR8MSWIN1256
Creating the database link and getting the data.
Start sqlplus and type the following command (user and password are the
same as in odbc.ini):
[oracle@ IT-TEST-DB01 admin]$ sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 21 13:18:29 2022
Version 19.14.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0
SQL> create public database link myrpt connect to "REPORTING" identified
by "********" using 'myrpt';
SQL> create public database link myntf connect to "NOTIFICATION"
identified by "d5o3b4ScjRe7dv8nxzZW" using 'myntf';
Database link created.
SQL> select count(*) from "REPORTING"."CriteriaOperators"@"myrpt";
COUNT(*)
----------
27
SQL> select count(*) from "REPORTING"."DomainColumns"@"myrpt";
COUNT(*)
----------
3086
select count (*) from "NOTIFICATION"."TriggerRules"@"myntf";
COUNT(*)
----------
12
SQL>exit
Node2:
[oracle@nclbrac2 ~]$ sudo su
[sudo] password for oracle:
[root@nclbrac2 oracle]# yum install unixODBC postgresql-odbc unixODBC-devel
[root@nclbrac1 oracle]# vi /etc/odbc.ini
[myrpt]
Driver = /usr/lib64/psqlodbc.so
Description = PostgreSQL Data Source
ServerName = 172.29.15.224
PORT = 5432
Username = REPORTING
Password = FGjTn737MXcGvVvsCtR0
Database = REPORTING
OPTION =0
TRACE = OFF
[myntf]
Driver = /usr/lib64/psqlodbc.so
Description = PostgreSQL Data Source
ServerName = 172.29.15.224
PORT = 5432
Username = NOTIFICATION
Password = d5o3b4ScjRe7dv8nxzZW
Database = NOTIFICATION
OPTION =0
TRACE = OFF
[root@ EGNC-DB-01 oracle]# exit
exit
[oracle@nclbrac1 ~]$ cd $ORACLE_HOME/network/admin
[oracle@nclbrac1 admin]$ cp tnsnames.ora tnsnames1032023.ora
Tnsnames.ora:
myrpt =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP) (HOST = 172.29.15.244) (PORT=1521))
)
(CONNECT_DATA = (SID= myrpt))
(HS=OK))
myntf =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP) (HOST = 172.29.15.244) (PORT=1521))
)
(CONNECT_DATA = (SID= myntf))
(HS=OK))
[oracle@nclbrac1 admin]$ sudo su
[root@nclbrac1 admin]# su grid
[grid@nclbrac1 admin]$ cd /u01/app/19.3.0.0/grid/network/admin
[grid@nclbrac1 admin]$ cp listener.ora listener28032023.ora
Listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = myrpt)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(PROGRAM = dg4odbc)
(ENV = "LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/u01/app/oracle/product/19.0.0/dbhome_1/lib:/usr/
lib:/usr/lib64")
(SID_DESC =
(SID_NAME = myntf)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(PROGRAM = dg4odbc)
(ENV = "LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/u01/app/oracle/product/19.0.0/dbhome_1/lib:/usr/
lib:/usr/lib64")
Using user oracle
srvctl stop listener -n nclbrac1
srvctl start listener -n nclbrac1
srvctl status listener
tnsping myrpt
tnsping myntf
lsnrctl status
[grid@nclbrac1 admin]$ vi listener.ora
[grid@nclbrac1 admin]$ exit
exit
[root@nclbrac1 admin]# exit
exit
[oracle@nclbrac1 admin]$ srvctl stop listener -n nclbrac1
[oracle@nclbrac1 admin]$ srvctl start listener -n nclbrac1
[oracle@nclbrac1 admin]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): nclbrac2,nclbrac1
[oracle@nclbrac1 admin]$ tnsping myrpt
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 01-MAR-2023 14:19:40
Copyright (c) 1997, 2022, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST =
172.29.15.244) (PORT=1521))) (CONNECT_DATA = (SID= myrpt)) (HS=OK))
OK (0 msec)
[oracle@nclbrac1 admin]$
[oracle@nclbrac1 admin]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 01-MAR-2023 14:20:11
Copyright (c) 1991, 2022, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 01-MAR-2023 14:18:26
Uptime 0 days 0 hr. 1 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/19.3.0.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/nclbrac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.29.15.244)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.29.15.246)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=nclbrac1.tatsh.com)(PORT=5500))
(Security=(my_wallet_directory=/u01/app/oracle/product/19.0.0/dbhome_1/admin/dwdb/
xdb_wallet))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nclbrac1.tatsh.com)(PORT=5555))
(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nclbrac1.tatsh.com)(PORT=5510))
(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+APX" has 1 instance(s).
Instance "+APX1", status READY, has 1 handler(s) for this service...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_ASMDATA" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_FRA" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_GOLDENGATE" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR_VOTE" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_REDOLOG" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "SYS$GGDW.OGG$Q_EXTDW.DWDB" has 1 instance(s).
Instance "dwdb1", status READY, has 1 handler(s) for this service...
Service "SYS$GGOLTP.OGG$Q_EXTOLTP.ONLINEDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "SYS$SYS.OGGQ$RPFDBUAE.ONLINEDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "SYS$SYS.OGGQ$RPUNIUAE.ONLINEDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "dwdb" has 1 instance(s).
Instance "dwdb1", status READY, has 1 handler(s) for this service...
Service "dwdbXDB" has 1 instance(s).
Instance "dwdb1", status READY, has 1 handler(s) for this service...
Service "myrpt" has 1 instance(s).
Instance "myrpt", status UNKNOWN, has 1 handler(s) for this service...
Service "onlinedb" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
Service "onlinedbXDB" has 1 instance(s).
Instance "onlinedb1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@nclbrac1 admin]$
[oracle@EGNC-DB-01 admin]$ tnsping myrpt
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 01-MAR-2023 13:45:57
Copyright (c) 1997, 2022, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST =
172.29.15.244) (PORT=1521))) (CONNECT_DATA = (SID= myrpt)) (HS=OK))
OK (0 msec)
[oracle@EGNC-DB-01 admin]
Configuring gateway initmyrpt.ora file.
This file does not exist and you have to create it.
[oracle@oldb-it admin]$ cd $ORACLE_HOME/hs/admin
vi initmyrpt.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
#
# HS init parameters
#
HS_FDS_CONNECT_INFO="myrpt" #ODBC DSN
HS_FDS_TRACE_LEVEL=off
HS_FDS_SHAREABLE_NAME=/usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE
HS_NLS_NCHAR=UCS2
HS_LANGUAGE=AMERICAN_AMERICA.AR8MSWIN1256
cp initmyrpt.ora initmyntf.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
# HS init parameters
HS_FDS_CONNECT_INFO="myntf" #ODBC DSN
HS_FDS_TRACE_LEVEL=off
HS_FDS_SHAREABLE_NAME=/usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE
HS_NLS_NCHAR=UCS2
HS_LANGUAGE=AMERICAN_AMERICA.AR8MSWIN1256
SQL> select count(*) from "REPORTING"."CriteriaOperators"@"myrpt";
COUNT(*)
----------
27
SQL> select count(*) from "REPORTING"."DomainColumns"@"myrpt";
COUNT(*)
----------
3086
select count (*) from "NOTIFICATION"."TriggerRules"@"myntf";
COUNT(*)
----------
12