Wednesday 6 November 2019

Oracle Database 12C Central Inventory Re-Creation

Note:
You can create central Inventory for oracle in running up environment without any hesitation in this scenario I am using Oracle-EBS R12 for yours confident building at this activity I had been done.

ERROR:
----------------------
[oracle@ebstest ~]$ export ORACLE_HOME=/u02/oracle/furdb/db/tech_st/12.1.0
[oracle@ebstest ~]$ export PATH=$ORACLE_HOME/OPatch:$PATH
[oracle@ebstest ~]$ opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.16
Copyright (c) 2019, Oracle Corporation.  All rights reserved.


Oracle Home       : /u02/oracle/furdb/db/tech_st/12.1.0
Central Inventory : /u01/oracle/oraInventory
   from           : /u02/oracle/furdb/db/tech_st/12.1.0/oraInst.loc
OPatch version    : 12.2.0.1.16
OUI version       : 12.1.0.2.0
Log file location : /u02/oracle/furdb/db/tech_st/12.1.0/cfgtoollogs/opatch/opatch2019-11-07_10-52-44AM_1.log

LsInventorySession failed: OPatch failed to locate Central Inventory.
Possible causes are:
    The Central Inventory is corrupted
    The oraInst.loc file specified is not valid.

OPatch failed with error code 73


Solution:
------------------
[oracle@ebstest oraInventory]$ cd $ORACLE_HOME
[oracle@ebstest 12.1.0]$ cd oui/bin/
[oracle@ebstest bin]$ ls
addLangs.sh  attachHome.sh  detachHome.sh  filesList.bat  filesList.properties  filesList.sh  lsnodes  resource  runConfig.sh  runInstaller  runInstaller.sh  runSSHSetup.sh
[oracle@ebstest bin]$ ./runInstaller -silent -invPtrLoc "/etc/oraInst.loc" -attachHome ORACLE_HOME="/u02/oracle/furdb/db/tech_st/12.1.0" ORACLE_HOME_NAME="Ora121Home"
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 14579 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

'AttachHome' was successful.

[oracle@ebstest oraInventory]$ opatch lsinventory

Source: R&D / Oracle Support


Friday 18 October 2019

Step by Step to configure Oracle 12c Data Guard Physical Standby


Step by Step to configure Oracle 12c Data Guard Physical Standby
Description:-
o    This article we are going to see 12.1.0.2.0 standby database creation using rman.

Environment Details:-





Primary Server side Configurations:-

Step1:-Change Archivelog mode

[oracle@primary ~]$ sqlplus ‘/as sysdba’
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 12 05:10:47 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Current log sequence 4
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1660944384 bytes
Fixed Size 2925072 bytes
Variable Size 1056968176 bytes
Database Buffers 587202560 bytes
Redo Buffers 13848576 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
Step2:-Change force logging mode
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
SQL> select FORCE_LOGGING,log_mode from v$database;
FORCE_LOGGING  LOG_MODE
————        ————
YES                               ARCHIVELOG
Step3:-Adding Redologfile for standby database
SQL> alter database add standby logfile group 4 ‘/u01/app/oracle/oradata/PRIME/onlinelog/redo04.log’ size 50m;
Database altered.
SQL> alter database add standby logfile group 5 ‘/u01/app/oracle/oradata/PRIME/onlinelog/redo05.log’ size 50m;
Database altered.
SQL> alter database add standby logfile group 6 ‘/u01/app/oracle/oradata/PRIME/onlinelog/redo06.log’ size 50m;
Database altered.
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
GROUP# THREAD# SEQUENCE# ARC STATUS
———- ———- ———- — ———-
4 0 0 YES UNASSIGNED
5 0 0 YES UNASSIGNED
6 0 0 YES UNASSIGNED
Step4:-Adding the network entry in primary and standby side(Both servers)
Tnsnames entry:-
**************
PRIME =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1539))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prime)
)
)
STAND =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1539))
)
(CONNECT_DATA =
(SERVICE_NAME = stand)
)
)
Listener Entry:-
************
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prime)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/db_1)
(SID_NAME = prime)
)
(SID_DESC =
(GLOBAL_DBNAME = stand)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/db_1)
(SID_NAME = stand)
)
)
Output like the below
[oracle@primary admin]$ tnsping prime
TNS Ping Utility for Linux: Version 12.1.0.2.0 – Production on 12-JUN-2018 05:54:29
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.24)(PORT = 1539))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prime)))
OK (0 msec)
[oracle@primary admin]$ tnsping stand
TNS Ping Utility for Linux: Version 12.1.0.2.0 – Production on 12-JUN-2018 05:54:34
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.25)(PORT = 1539))) (CONNECT_DATA = (SERVICE_NAME = stand)))
OK (0 msec)
step5:-Changing parameters in primary database
SQL> ALTER SYSTEM SET db_unique_name=’PRIME’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET log_archive_config=’dg_config=(prime,stand)’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET log_archive_dest_1=’location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=prime’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET log_archive_dest_2=’service=stand async valid_for=(online_logfiles,primary_role) db_unique_name=stand’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET fal_server=’STAND’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET fal_client=’PRIME’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET standby_file_management=’AUTO’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET db_file_name_convert=’/u01/app/oracle/oradata/STAND/datafile’,’/u01/app/oracle/oradata/PRIME/datafile’ SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET log_file_name_convert=’/u01/app/oracle/oradata/STAND/onlinelog’,’/u01/app/oracle/oradata/PRIME/onlinelog’ SCOPE=SPFILE;
System altered.
Standby Server side Configurations:-
Step1:- Password file creation
copy the remote login password file (orapwprime) from the primary database server to the $ORACLE_HOME/dbs directory on the
standby database server, renaming it to orapwstand.
[oracle@primary dbs]$ scp orapwprime oracle@192.168.1.25:$ORACLE_HOME/dbs
oracle@192.168.1.25’s password:
orapwprime 100% 7680 7.5KB/s 00:00
oracle@standby dbs]$ mv orapwprime orapwstand
Step2:- Changing parameters in standby database
In the $ORACLE_HOME/dbs directory of the standby system, create an initialization parameter file named initstand.ora
Containing a single parameter: DB_NAME=stand
[oracle@standby admin]$ cd $ORACLE_HOME/dbs
[oracle@standby dbs]$ cat initstand.ora
db_name=stand
Step3:- Create directory Structure in Standby database
[oracle@standby dbs]$ cd $ORACLE_BASE/admin/
[oracle@standby admin]$ mkdir stand
[oracle@standby admin]$ cd stand
[oracle@standby stand]$ mkdir adump pfile dpdump
[oracle@standby stand]$ mkdir -p /u01/app/oracle/oradata/STAND/onlinelog
[oracle@standby stand]$ mkdir -p /u01/app/oracle/oradata/STAND/datafile
Step4:- start the standby database using pfile
[oracle@standby dbs]$ export ORACLE_SID=stand
[oracle@standby dbs]$ sqlplus ‘/as sysdba’
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 12 06:03:47 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> 
startup pfile=’initstand.ora’ nomount
ORACLE instance started.
Total System Global Area 218103808 bytes
Fixed Size 2922712 bytes
Variable Size 159385384 bytes
Database Buffers 50331648 bytes
Redo Buffers 5464064 bytes
Step5:- connect to the rman
[oracle@standby dbs]$ export ORACLE_SID=prime
[oracle@standby dbs]$ rman target sys/oracle@prime
Recovery Manager: Release 12.1.0.2.0 – Production on Tue Jun 12 06:28:27 2018
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRIME (DBID=2055869989)
RMAN> connect auxiliary sys/oracle@stand
connected to auxiliary database: STAND (not mounted)
RMAN>
 run 
{
allocate channel p1 type disk;
allocate channel p2 type disk;
allocate channel p3 type disk;
allocate channel p4 type disk;
allocate auxiliary channel s1 type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert ‘prime’,’stand’
set db_unique_name=’stand’
set db_file_name_convert=’/u01/app/oracle/oradata/PRIME/datafile/’,’/u01/app/oracle/oradata/STAND/datafile/’
set log_file_name_convert=’/u01/app/oracle/oradata/PRIME/onlinelog/’,’/u01/app/oracle/oradata/STAND/onlinelog/’
set control_files=’/u01/app/oracle/oradata/STAND/onlinelog/standby1.ctl’
set log_archive_max_processes=’5′
set fal_client=’stand’
set fal_server=’prime’
set standby_file_management=’AUTO’
set log_archive_config=’dg_config=(prime,stand)’
set compatible=’12.1.0.2.0′
set memory_target=’500m’
nofilenamecheck;
}
2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23>
using target database control file instead of recovery catalog
allocated channel: p1
channel p1: SID=54 device type=DISK
allocated channel: p2
channel p2: SID=42 device type=DISK
allocated channel: p3
channel p3: SID=53 device type=DISK
allocated channel: p4
channel p4: SID=50 device type=DISK
allocated channel: s1
channel s1: SID=23 device type=DISK
Starting Duplicate Db at 12-JUN-18
contents of Memory Script:
{
backup as copy reuse
targetfile ‘/u01/app/oracle/product/12.1.0.2/db_1/dbs/orapwprime’ auxiliary format
‘/u01/app/oracle/product/12.1.0.2/db_1/dbs/orapwstand’ targetfile
‘/u01/app/oracle/product/12.1.0.2/db_1/dbs/spfileprime.ora’ auxiliary format
‘/u01/app/oracle/product/12.1.0.2/db_1/dbs/spfilestand.ora’ ;
sql clone “alter system set spfile= ”/u01/app/oracle/product/12.1.0.2/db_1/dbs/spfilestand.ora””;
}
executing Memory Script
Starting backup at 12-JUN-18
Finished backup at 12-JUN-18
sql statement: alter system set spfile= ”/u01/app/oracle/product/12.1.0.2/db_1/dbs/spfilestand.ora”
contents of Memory Script:
{
sql clone “alter system set audit_file_dest =
”/u01/app/oracle/admin/stand/adump” comment=
”” scope=spfile”;
sql clone “alter system set dispatchers =
”(PROTOCOL=TCP) (SERVICE=standXDB)” comment=
”” scope=spfile”;
sql clone “alter system set log_archive_dest_1 =
”location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=stand” comment=
”” scope=spfile”;
sql clone “alter system set db_unique_name =
”stand” comment=
”” scope=spfile”;
sql clone “alter system set db_file_name_convert =
”/u01/app/oracle/oradata/PRIME/datafile/”, ”/u01/app/oracle/oradata/STAND/datafile/” comment=
”” scope=spfile”;
sql clone “alter system set log_file_name_convert =
”/u01/app/oracle/oradata/PRIME/onlinelog/”, ”/u01/app/oracle/oradata/STAND/onlinelog/” comment=
”” scope=spfile”;
sql clone “alter system set control_files =
”/u01/app/oracle/oradata/STAND/onlinelog/standby1.ctl” comment=
”” scope=spfile”;
sql clone “alter system set log_archive_max_processes =
5 comment=
”” scope=spfile”;
sql clone “alter system set fal_client =
”stand” comment=
”” scope=spfile”;
sql clone “alter system set fal_server =
”prime” comment=
”” scope=spfile”;
sql clone “alter system set standby_file_management =
”AUTO” comment=
”” scope=spfile”;
sql clone “alter system set log_archive_config =
”dg_config=(prime,stand)” comment=
”” scope=spfile”;
sql clone “alter system set compatible =
”12.1.0.2.0” comment=
”” scope=spfile”;
sql clone “alter system set memory_target =
500m comment=
”” scope=spfile”;
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set audit_file_dest = ”/u01/app/oracle/admin/stand/adump” comment= ”” scope=spfile
sql statement: alter system set dispatchers = ”(PROTOCOL=TCP) (SERVICE=standXDB)” comment= ”” scope=spfile
sql statement: alter system set log_archive_dest_1 = ”location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=stand” comment= ”” scope=spfile
sql statement: alter system set db_unique_name = ”stand” comment= ”” scope=spfile
sql statement: alter system set db_file_name_convert = ”/u01/app/oracle/oradata/PRIME/datafile/”, ”/u01/app/oracle/oradata/STAND/datafile/” comment= ”” scope=spfile
sql statement: alter system set log_file_name_convert = ”/u01/app/oracle/oradata/PRIME/onlinelog/”, ”/u01/app/oracle/oradata/STAND/onlinelog/” comment= ”” scope=spfile
sql statement: alter system set control_files = ”/u01/app/oracle/oradata/STAND/onlinelog/standby1.ctl” comment= ”” scope=spfile
sql statement: alter system set log_archive_max_processes = 5 comment= ”” scope=spfile
sql statement: alter system set fal_client = ”stand” comment= ”” scope=spfile
sql statement: alter system set fal_server = ”prime” comment= ”” scope=spfile
sql statement: alter system set standby_file_management = ”AUTO” comment= ”” scope=spfile
sql statement: alter system set log_archive_config = ”dg_config=(prime,stand)” comment= ”” scope=spfile
sql statement: alter system set compatible = ”12.1.0.2.0” comment= ”” scope=spfile
sql statement: alter system set memory_target = 500m comment= ”” scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 524288000 bytes
Fixed Size 2926320 bytes
Variable Size 444598544 bytes
Database Buffers 71303168 bytes
Redo Buffers 5459968 bytes
allocated channel: s1
channel s1: SID=22 device type=DISK
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format ‘/u01/app/oracle/oradata/STAND/onlinelog/standby1.ctl’;
}
executing Memory Script
Starting backup at 12-JUN-18
channel p1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/12.1.0.2/db_1/dbs/snapcf_prime.f tag=TAG20180612T064910
channel p1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 12-JUN-18
contents of Memory Script:
{
sql clone ‘alter database mount standby database’;
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_temp_fkxw4qob_.tmp”;
switch clone tempfile all;
set newname for datafile 1 to
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_system_fkxw1toz_.dbf”;
set newname for datafile 3 to
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_sysaux_fkxw0fh2_.dbf”;
set newname for datafile 4 to
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_undotbs1_fkxw3m3q_.dbf”;
set newname for datafile 6 to
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_users_fkxw3kvr_.dbf”;
backup as copy reuse
datafile 1 auxiliary format
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_system_fkxw1toz_.dbf” datafile
3 auxiliary format
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_sysaux_fkxw0fh2_.dbf” datafile
4 auxiliary format
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_undotbs1_fkxw3m3q_.dbf” datafile
6 auxiliary format
“/u01/app/oracle/oradata/STAND/datafile/o1_mf_users_fkxw3kvr_.dbf” ;
sql ‘alter system archive log current’;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/STAND/datafile/o1_mf_temp_fkxw4qob_.tmp in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 12-JUN-18
channel p1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/PRIME/datafile/o1_mf_system_fkxw1toz_.dbf
channel p2: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/PRIME/datafile/o1_mf_sysaux_fkxw0fh2_.dbf
channel p3: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/PRIME/datafile/o1_mf_undotbs1_fkxw3m3q_.dbf
channel p4: starting datafile copy
input datafile file number=00006 name=/u01/app/oracle/oradata/PRIME/datafile/o1_mf_users_fkxw3kvr_.dbf
output file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_undotbs1_fkxw3m3q_.dbf tag=TAG20180612T064916
channel p3: datafile copy complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_users_fkxw3kvr_.dbf tag=TAG20180612T064916
channel p4: datafile copy complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_sysaux_fkxw0fh2_.dbf tag=TAG20180612T064916
channel p2: datafile copy complete, elapsed time: 00:00:56
output file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_system_fkxw1toz_.dbf tag=TAG20180612T064916
channel p1: datafile copy complete, elapsed time: 00:01:07
Finished backup at 12-JUN-18
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=978589826 file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_system_fkxw1toz_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=978589826 file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_sysaux_fkxw0fh2_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=978589826 file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_undotbs1_fkxw3m3q_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=4 STAMP=978589826 file name=/u01/app/oracle/oradata/STAND/datafile/o1_mf_users_fkxw3kvr_.dbf
Finished Duplicate Db at 12-JUN-18
released channel: p1
released channel: p2
released channel: p3
released channel: p4
released channel: s1
Step6:- connect to the standby database
[oracle@standby dbs]$ export ORACLE_SID=stand
[oracle@standby dbs]$ sqlplus ‘/as sysdba’
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 12 06:35:29 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
Step7:- Physical Standby Database is Performing Correctly
SQL> SELECT sequence#, first_time, next_time, applied FROM v$archived_log ORDER BY sequence#;
SEQUENCE# FIRST_TIM NEXT_TIME APPLIED
———- ——— ——— ———
6 12-JUN-18 12-JUN-18 YES
7 12-JUN-18 12-JUN-18 YES
8 12-JUN-18 12-JUN-18 IN-MEMORY
Successfully configured the Oracle 12c Data Guard Physical Standby
Source: Internet






Wednesday 9 October 2019

DB-Link with Oracle database to Microsoft Sql Server via Oracle Gateways (Heterogenic Service)


Environment Details:
Operating Environment: Windows Server 2012 R2 Evolution Version
Database Environment: Microsoft Sql Server 2008 R2 32bit/64Bit
Oracle Database Environment: OS Linux 7.5 64bit With EBS R12 (12.1.3) and RDBMS 12.1.0.2.0 EE

Step – 1

A-      Installation of Oracle Gateways (Heterogenic Services) 11.2.0.4.0 64bit
Patch No: (p13390677_112040_MSWIN-x86-64_5of7)

Note:
Oracle Gateways certified version for 64bit-ODBC and SQL-Server including Operating System.
Starting with 11R2g Oracle now provides a Database Gateway for ODBC for 64-bit Windows operating systems, which can be used to connect to any third party database using a suitable third party 64-bit ODBC driver.

Please be aware:

- DG4ODBC is first ported to 64bit Windows platforms starting with 11.2 and it is NOT supported to use a 32bit DG4ODBC on a 64bit Windows operating system nor can you use a 32bit ODBC driver with a 64bit DG4ODBC.

The gateway is certified also for older Oracle releases 9.2.0.8, 10.1.0.5, or 10.2.0.3. But please be aware those pre-11g Oracle databases require a patch to work properly with V11 Gateways.

The patch can be found on My Oracle Support by performing a simple search under the 'Patches & Updates' tab at the top of the page. Choose 'Simple Search’, enter 5965763 in the block for the patch number, and select the appropriate platform from the Platform or Language list.

This compatibility patch is already included in the 10.2.0.4 patch-sets.

B-      Click Run Button for Installation.



C-      Installer is automatic checking UI Pre-req 


D-      Click Next Button 

E-      Click Browse... If you want to change the installation directory location if it is your need. Otherwise Click Next Button to Continue. 


F-      Before Checking Product-Specific Prerequisite Click Next Button


G-      Check In () Two Production for Database Gateways
1-      Oracle Database Gateway for Microsoft SQL Server 11.2.0.4.0
2-      Oracle Database Gateway for ODBC 11.2.0.4.0
Then Click Next Button


H-      Loading Java Development Kit for Installation


I-      You will write of your Microsoft Sql-Server 2008 information there like this.
1-      Sql Server Database Server Host Name: GTECHPC ( This is host name of Microsoft Sql Server)
2-      Sql Server Instance Name: ORCL (This is Microsoft SQL-Server Instance name you can get from Sql-Server)
3-      Sql Server Database Name: Northwind (This is your created database there you will store our business data as well
4-      All Information of Microsoft Sql Server Should be correct because it will create internal connectivity link with ODBC
Then Click Next Button

J-      Processing Precompiler Support Files…


K-      Click Install Button for Installation 


L-      Installation Continue…




M-      At the end we will be creating  LISTENER and TNS just for Name of Listener and tns because both has not certified for Oracle Gateways (HS) after creating we will delete all information in listener and tns because of some (HS) miss information has miss.


N-   I am Creating listener with the name of LISTENERDG4ODBC and TNS for DG4ODBC.




O-      Click Yes button for Finished Installation.


P-      After Installation we will check dg4odbc and dg4msql is available in Oracle Gateways ORACLE_HOME/Bin


Q-     Listener Service add in Services.msc Like below:



Create ODBC for Connectivity
Step – 2
A-      Click ODBC Data Sources (64-bit)


      B-   Click System DNS Tab and Click Add Button


C-   Click SQL Server Line and Click Finish Button


D-      You will write and select correct information for DNS Configuration
1-      Name: dg4odbc
2-      Description: dg4odbc
3-      Server: GTECHPC\ORCL
                Then Click Next 


E-      Go with default configuration and Click Next Button 


F-      Check In () Change the default database to: and Select Northwind Custom Database for Default and Business Data. Then Click Next Button


G-      Go with default configuration and Click Finish Button 


H-      Click Test Data Source Button for Testing of ODBC DSN


I-      Click OK Button 




J-      Click OK Button 


K-      Click OK for Final Close



Heterogenic Service Configuration on Oracle Gateways
Step – 3
A-      Create and Change init<SID>.ora File
1-      Create init<SID>.ora file
2-      Location “D:\product\11.2.0\tg_1\hs\admin “
3-      If your DSN-ODBC name is dg4odbc so you will create initdg4odbc.ora file in above location like:


4-      Change information in initialization initdg4odbc.ora file

D:\product\11.2.0\tg_1\hs\admin\ initdg4odbc.ora

# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
#
# HS init parameters
#
HS_FDS_CONNECT_INFO = <odbc data_source_name>
HS_FDS_TRACE_LEVEL = <trace_level>
#
# Environment variables required for the non-Oracle system
#
#set <envvar>=<value>

Change like this: first, copy both parameters, commend off then paste and change the values with save.

D:\product\11.2.0\tg_1\hs\admin\ initdg4odbc.ora

# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
#
# HS init parameters
#
#HS_FDS_CONNECT_INFO = <odbc data_source_name>
#HS_FDS_TRACE_LEVEL = <trace_level>

HS_FDS_CONNECT_INFO = dg4odbc
HS_FDS_TRACE_LEVEL = OFF
#
# Environment variables required for the non-Oracle system
#
#set <envvar>=<value>

B-      You will remove old Information in listener.ora and recreate the listener with new (PROGRAM) with services.msc name.

1-      Old Listener Values.
2-      Location: D:\product\11.2.0\tg_1\NETWORK\ADMIN\listener.ora

# This is a sample listener.ora that contains the NET8 parameters that are
# needed to connect to an HS Agent

LISTENER =
 (ADDRESS_LIST=
      (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
 )
SID_LIST_LISTENER=
  (SID_LIST=
      (SID_DESC=
         (SID_NAME=dg4odbc)
         (ORACLE_HOME=D:\product\11.2.0\tg_1)
         (PROGRAM=dg4odbc)
      )
  )
#CONNECT_TIMEOUT_LISTENER = 0

3-      You will have add new listener information as per Configuration Requirement like this: 
1-      As per services.msc Registration listener name : LISTENERDG4ODBC
2-      Add Hostname of Sql Server : GTECHPC.oracle.com
3-      Add Port for Oracle Database : 1521
4-      Add SID_NAME this is DSN-ODBC Name Here: dg4odbc
5-      Add PROGRAM which is you are used for Connectivity (It will same DSN-ODBC) : dg4odbc

# Listener.ora Network Configuration File: D:\product\11.2.0\tg_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

LISTENERDG4ODBC =
 (ADDRESS_LIST=
      (ADDRESS= (PROTOCOL=tcp) (HOST=GTECHPC.oracle.com) (PORT=1521))
 )

SID_LIST_LISTENERdg4odbc=
  (SID_LIST=
      (SID_DESC=
         (SID_NAME=dg4odbc)
         (ORACLE_HOME=D:\product\11.2.0\tg_1)
         (PROGRAM=dg4odbc)
      )
  )

#CONNECT_TIMEOUT_LISTENERdg4odbc = 0

C-      You will remove old Information in tnsnames.ora and recreate the TNS with new (HS) Prameter.

1-      Old tnsname.ora values:
2-      Location: D:\product\11.2.0\tg_1\NETWORK\ADMIN\ tnsnames.ora.

# tnsnames.ora Network Configuration File: D:\product\11.2.0\tg_1\network\admin

dg4msql =
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
    (CONNECT_DATA=(SID=dg4msql))
    (HS=OK)
  )

3-      You will have add new listener information as per Configuration Requirement like this: 
1-      Write of your tnsname which is DSN-ODBC Name Here: dg4odbc
2-      Add Hostname of Sql Server : GTECHPC.oracle.com
3-      Add Port for Oracle Database : 1521
4-      Add CONNECT_DATA this is DSN-ODBC Name Here: dg4odbc
5-      Add HS Parameter which is you are used for Connectivity: OK

# tnsnames.ora Network Configuration File: D:\product\11.2.0\tg_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

dg4odbc =
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=GTECHPC.oracle.com)(PORT=1521))
    (CONNECT_DATA=(SID=dg4odbc))
    (HS=OK)
  )

D-      You will start listener and check all Services that is depended on listener

#lsnrctl start LISTENERDG4ODBC


#lsnrctl Status LISTENERDG4ODBC


#tnsping dg4odbc



Oracle Database DB Link Configuration with Oracle Gateways (Heterogenic Service)
Step – 4

A-      Add Oracle Gateways tnsname service in Oracle Database where you want to create db link for accessing Microsoft SQL-Server.
B-      Source you Database environment

[oracle@dbsc ~]$ source /u02/oracle/db/tech_st/12.1.0/DUMM_dbsc.env


C-      Open your tnsname.ora and you will add there Oracle Gateways services for connectivity with Microsoft SQL Server and test tsnping is working fine.

[oracle@dbsc ~]$ cd $TNS_ADMIN
[oracle@dbsc DUMM_dbsc]$ vi tnsnames.ora

dg4odbc  =
                 (DESCRIPTION=
                   (ADDRESS=(PROTOCOL=tcp)(HOST=GTECHPC.oracle.com)(PORT=1521))
    (CONNECT_DATA=(SID=dg4odbc))
    (HS=OK)
  )
[oracle@dbsc ~]$ tnsping dg4odbc

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 26-SEP-2019 11:10:07

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:
/u02/oracle/db/tech_st/12.1.0/network/admin/DUMM_dbsc/sqlnet_ifile.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=GTECHPC.oracle.com)(PORT=1521)) (CONNECT_DATA=(SID=dg4odbc)) (HS=OK))
OK (10 msec)

[oracle@dbsc ~]$

D-      You will Connect with SYS AS SYSDBA for Creating DB Link and Create DB link with “sa” sysadmin user in SQL-Server and furqan is local user in SQL-Server

[oracle@dbsc DUMM_dbsc]$ sqlplus / as sysdba

SQL> Create public database link dg4odbc connect to "sa" identified by "Password123" using 'dg4odbc';

SQL> Create public database link furqan connect to "furqan" identified by "Oracle_12" using 'dg4odbc';


SQL> desc "dbo"."Employees"@dg4odbc;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EmployeeID                                NOT NULL NUMBER(10)
 LastName                                  NOT NULL NVARCHAR2(20)
 FirstName                                 NOT NULL NVARCHAR2(10)
 Title                                              NVARCHAR2(30)
 TitleOfCourtesy                                    NVARCHAR2(25)
 BirthDate                                          DATE
 HireDate                                           DATE
 Address                                            NVARCHAR2(60)
 City                                               NVARCHAR2(15)
 Region                                             NVARCHAR2(15)
 PostalCode                                         NVARCHAR2(10)
 Country                                            NVARCHAR2(15)
 HomePhone                                          NVARCHAR2(24)
 Extension                                          NVARCHAR2(4)
 Photo                                              LONG RAW
 ReportsTo                                          NUMBER(10)
 PhotoPath                                          NVARCHAR2(255)
 Salary                                             NUMBER(10)

SQL> select "EmployeeID","LastName","FirstName" from "dbo"."Employees"@dg4odbc;

EmployeeID LastName                                 FirstName
---------- ---------------------------------------- --------------------
         1 Davolio                                  Nancy
         2 Fuller                                   ali
         3 Leverling                                Janet
         4 Peacock                                  Margaret
         5 Buchanan                                 Steven
         6 Suyama                                   Michael
         7 King                                     Robert
         8 Callahan                                 Laura
         9 Dodsworth                                Anne
        12 Majid                                    Mansoor
        13 asif                                     khan
        21 rashif                                   ayaz
        22 ali raza                                 kashif
        23 khan                                     ali asif
        24 kashif                                   ali
        25 khan                                     ali asif
        26 ali jan                                  noman
        27 ali jan                                  noman
        30 qureshi                                  asif
        31 zafar                                    kashif
        32 ali                                      kashif
        33 erre                                     ali
        34 Khan                                     Ali

23 rows selected.

2092 rows selected.

SQL> select * from "sys"."all_objects"@dg4odbc

2092 rows selected.


SQL> col OWNER format a10
SQL> col DB_LINK format a30
SQL> col USERNAME  format a10
SQL> col HOST format a10
SQL> select OWNER,DB_LINK,USERNAME,HOST from dba_db_links where DB_LINK like ('%DG4ODBC%');

OWNER      DB_LINK                        USERNAME   HOST
---------- ------------------------------ ---------- ----------
PUBLIC     DG4ODBC.ORACLE.COM            sa         dg4odbc

SQL>

Source: SR/Internal Research