(PROGRAM=dg4odbc) ) ) Legendas:Nome do host= dbc11gPorta da conexao = 2100Agora vamos configurar o TnsNames# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora# Generated by Oracle configuration tools.orcl = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = db11g)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )# Configurcao servicos de conexao heterogeniapgdb= (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = db11g)(PORT = 2100)) (CONNECT_DATA = (SID=pgdb)) (HS=OK) ) Legendas:Nome do Banco Oracle= orclNome do Banco PG = pgbd Agora vamos levantar o listener :[oracle@db11g admin]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-APR-2014 10:21:37Copyright (c) 1991, 2011, Oracle. All rights reserved.Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.3.0 - ProductionSystem parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.oraLog messages written to /u01/app/oracle/diag/tnslsnr/db11g/db11g/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db11g)(PORT=2100)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db11g)(PORT=2100)))STATUS of the LISTENER------------------------Alias db11gVersion TNSLSNR for Linux: Version 11.2.0.3.0 - ProductionStart Date 28-APR-2014 10:21:37Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/db11g/db11g/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db11g)(PORT=2100)))Services Summary...Service "pgdb" has 1 instance(s). Instance "pgdb", status UNKNOWN, has 1 handler(s) for this service...Service "orcl" has 1 instance(s). Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...The command completed successfully Agora vamos configurar o odbc do linux para usar o driver que instalamos e configurar o data source name (dsn) :[root@db11g ~]# vi /etc/odbcinst.ini# Example driver definitions# See /usr/share/doc/unixODBC*/README.64bit for more information# Use these definitions with the original unixODBC package# Driver from the postgresql-odbc package# Setup from the unixODBC-libs package[PostgreSQL]Description = ODBC for PostgreSQLDriver = /usr/local/lib/psqlodbcw.soSetup = /usr/lib/libodbcpsqlS.so#Driver64 = /usr/lib64/psqlodbc.so#Setup64 = /usr/lib64/libodbcpsqlS.soFileUsage = 1Edite o arquivo odbc.ini para configurar o dsn:[Data Sources]pgdb = Banco pgdb[pgdb]Driver = PostgreSQLDatabase = pgdbServername = 192.168.1.55Port = 5411Username = admPassword = admReadOnly = YesVarMaxAsLong = NoAgora com tudo quase pronto , vamos criar o arquivo de configuracao do hs no Oracle:Crie o arquivo /u01/app/oracle/product/11.2.0/db_1/hs/admin/initpgdb.oraHS_FDS_CONNECT_INFO = pgdbHS_FDS_TRACE_LEVEL = ONHS_FDS_MAP_NCHAR=FALSEHS_KEEP_REMOTE_COLUMN_SIZE=ALLHS_LANGUAGE=american_america.WE8ISO8859P1HS_FDS_DEFAULT_OWNER=postgresqlHS_FDS_SHAREABLE_NAME = /usr/local/lib/psqlodbcw.soHS_FDS_SUPPORT_STATISTICS = FALSEHS_FDS_SQLLEN_INTERPRETATION=32HS_TRANSACTION_MODEL=READ_ONLY_AUTOCOMMITHS_FDS_REPORT_REAL_AS_DOUBLE = TRUEHS_NLS_LENGTH_SEMANTICS=CHARset ODBCINI=/etc/odbc.iniset ODBCINSTINI=/etc/odbcinst.iniAqui temos varias informacoes tais como idioma, driver a ser utilizado, a base a ser acessada etc...Agora so precisamos criar um dblink no Oracle Utilizar a conexao heterogenea:create database link pgdb connect to adm using 'pgdb';Agora podemos realizar uma consulta no banco remoto:select * from teste@pgdb ;Isso e realmente muito util em empresas que utilizam bases mistas e muitas vezes tem a necessidade de realizar a integracao destes dados no intuito de dar suporte a tomada de decisoes .