|
| 1 | +@ECHO OFF |
| 2 | +REM |
| 3 | +REM configure.bat |
| 4 | +REM |
| 5 | +REM This .bat file configures ODP.NET, Managed Driver |
| 6 | +REM |
| 7 | + |
| 8 | +if /i {%1} == {-h} goto :Usage |
| 9 | +if /i {%1} == {-help} goto :Usage |
| 10 | + |
| 11 | +REM determine if the configuration is on a 32-bit or 64-bit OS |
| 12 | +set ODAC_CFG_PREFIX=Wow6432Node\ |
| 13 | +if (%PROCESSOR_ARCHITECTURE%) == (x86) if (%PROCESSOR_ARCHITEW6432%) == () set ODAC_CFG_PREFIX= |
| 14 | + |
| 15 | +REM configure machine wide or not - default is true |
| 16 | +set MACHINE_WIDE_CONFIGURATION=true |
| 17 | +if /i {%1} == {false} set MACHINE_WIDE_CONFIGURATION=false |
| 18 | + |
| 19 | +if {%MACHINE_WIDE_CONFIGURATION%} == {true} ( |
| 20 | + |
| 21 | +REM Configure machine.config for ODP.NET, Managed Driver's configuration file section handler and client factory |
| 22 | +echo. |
| 23 | +echo OraProvCfg /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" /set:settings\TNS_ADMIN:"%~dp0..\..\..\network\admin" |
| 24 | +OraProvCfg /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" /set:settings\TNS_ADMIN:"%~dp0..\..\..\network\admin" |
| 25 | + |
| 26 | +REM Place the ODP.NET, Managed Driver assemblies into the GAC |
| 27 | +echo. |
| 28 | +echo OraProvCfg /action:gac /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" |
| 29 | +OraProvCfg /action:gac /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" |
| 30 | + |
| 31 | +REM Place the ODP.NET, Managed Policy assembly into the GAC |
| 32 | +echo. |
| 33 | +echo OraProvCfg /action:gac /providerpath:"%~dp0..\PublisherPolicy\4\Policy.4.121.Oracle.ManagedDataAccess.dll" |
| 34 | +OraProvCfg /action:gac /providerpath:"%~dp0..\PublisherPolicy\4\Policy.4.121.Oracle.ManagedDataAccess.dll" |
| 35 | + |
| 36 | +) else ( |
| 37 | + |
| 38 | +REM For local installs, unconfig odpm |
| 39 | +REM Unconfigure machine.config for ODP.NET, Managed Driver's configuration file section handler and client factory |
| 40 | +echo. |
| 41 | +echo OraProvCfg /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" |
| 42 | +OraProvCfg /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" |
| 43 | + |
| 44 | +REM Remove the ODP.NET, Managed Driver assemblies from the GAC |
| 45 | +echo. |
| 46 | +echo OraProvCfg /action:ungac /providerpath:"Oracle.ManagedDataAccess, Version=4.121.2.0" |
| 47 | +OraProvCfg /action:ungac /providerpath:"Oracle.ManagedDataAccess, Version=4.121.2.0" |
| 48 | + |
| 49 | +REM Remove the ODP.NET, Managed Policy assembly from the GAC |
| 50 | +echo. |
| 51 | +echo OraProvCfg /action:ungac /providerpath:"Policy.4.121.Oracle.ManagedDataAccess, Version=4.121.2.0" |
| 52 | +OraProvCfg /action:ungac /providerpath:"Policy.4.121.Oracle.ManagedDataAccess, Version=4.121.2.0" |
| 53 | + |
| 54 | +REM Remove the ODP.NET, Managed DTC assembly from the GAC |
| 55 | +echo. |
| 56 | +echo OraProvCfg /action:ungac /providerpath:"Oracle.ManagedDataAccessDTC, Version=4.121.2.0" |
| 57 | +OraProvCfg /action:ungac /providerpath:"Oracle.ManagedDataAccessDTC, Version=4.121.2.0" |
| 58 | +) |
| 59 | + |
| 60 | +REM Add a registry entry for enabling event logs |
| 61 | +echo. |
| 62 | +echo reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Data Provider for .NET, Managed Driver" /v EventMessageFile /t REG_EXPAND_SZ /d %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\EventLogMessages.dll /f |
| 63 | +reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Data Provider for .NET, Managed Driver" /v EventMessageFile /t REG_EXPAND_SZ /d %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\EventLogMessages.dll /f |
| 64 | + |
| 65 | +REM Delete the old registry entry to add managed assembly in the Add Reference Dialog box in VS.NET |
| 66 | +echo. |
| 67 | +echo reg query HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed\ |
| 68 | +reg query HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed\ 1>NUL 2>NUL |
| 69 | +if %ERRORLEVEL% EQU 0 ( |
| 70 | +echo reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed" /f |
| 71 | +reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed" /f 1>NUL 2>NUL |
| 72 | +) |
| 73 | + |
| 74 | + |
| 75 | +REM Create a registry entry to add managed assembly in the Add Reference Dialog box in VS.NET |
| 76 | +echo. |
| 77 | +echo reg add "HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess" /ve /t REG_SZ /d %~dp0..\common /f |
| 78 | +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess" /ve /t REG_SZ /d %~dp0..\common /f |
| 79 | +echo. |
| 80 | +echo reg add "HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6" /ve /t REG_SZ /d %~dp0..\common\EF6 /f |
| 81 | +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\%ODAC_CFG_PREFIX%Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6" /ve /t REG_SZ /d %~dp0..\common\EF6 /f |
| 82 | + |
| 83 | +goto :EOF |
| 84 | + |
| 85 | +:Usage |
| 86 | +echo. |
| 87 | +echo Usage: |
| 88 | +echo configure.bat [machine_wide_configuration] |
| 89 | +echo. |
| 90 | +echo Example: |
| 91 | +echo configure.bat (configure ODP.NET, Managed Driver at a machine wide level) |
| 92 | +echo configure.bat false (do not configure ODP.NET, Managed Driver at a machine wide level) |
| 93 | +echo. |
| 94 | +echo NOTE: By default, machine_wide_configuration=true. |
| 95 | +goto :EOF |
0 commit comments