This chapter describes the installation of Oracle Database Extensions for .NET, system requirements, and file locations.
This chapter contains these topics:
Oracle Database Extensions for .NET requires the following:
Windows operating system
32-bit: Windows Vista (Business, Enterprise, and Ultimate Editions), Windows Server 2003, Windows Server 2003 R2, Windows 2000 or Windows XP Professional Edition.
64 bit: Windows Vista x64 (Business, Enterprise, and Ultimate Editions), Windows Server 2003 x64, Windows Server 2003 R2 x64, or Windows XP x64.
Microsoft .NET Framework 1.1 or later.
For .NET Framework 2.0-specific features, ODP.NET 10.2.0.2.20 or later is required
64-bit Windows platforms support only 64-bit .NET Framework for version 2.0 and later. Thus, 64-bit ODE only supports 64-bit .NET Framework 2.0 or later. The first 64-bit ODE version is 10.2.0.3.02 on both Windows x64 and Itanium.
Oracle Database 11g release 1 (11.1) or later.
Oracle Client release 10g Release 2 (10.2) or later is required for .NET stored procedure development and deployment.
Oracle Developer Tools for Visual Studio .NET is required for .NET stored procedure development and deployment.
Oracle Developer Tools for Visual Studio .NET is not released with Oracle Database. It can be obtained from the Oracle .NET Developer Center at OTN.
A .NET stored procedure or function must meet the following requirements:
Be declared a public static method.
Not be a constructor or a destructor.
Use parameter types that are compatible with the Oracle native database types.
OraClr11.dll
is installed in the ORACLE_BASE\ORACLE_HOME
\bin
directory.The readme file, readme.html
, is installed in the ORACLE_BASE\ORACLE_HOME
\ODE.NET\DOC
directory.
.NET assemblies deployed by developers are copied into the ORACLE_BASE
\
ORACLE_HOME
\
bin\CLR
directory (or its subdirectory) by the Oracle Deployment Wizard for .NET.
Oracle Database Extensions for .NET is installed as part of a custom Oracle Database installation using the Oracle Universal Installer. From the Oracle Universal Installer Welcome screen, you must chose Advanced Installation, then from the Select Installation Type screen, choose Custom. When the Available Product Components list is displayed, go to Enterprise Edition Options, and select Oracle Database Extensions for .NET.
Oracle Database Extensions for .NET is configured using the Database Configuration Assistant.
As part of Oracle Database Extensions for .NET installation, a Windows service is installed. The service is called OraClrAgnt
and can be accessed through the Service Control Panel, as Oracle
ORACLE_HOME
ClrAgent
, where ORACLE_HOME
represents your Oracle home.
This service is used for the startup, configuration, and shutdown of the extproc
agent.
The parameters which can be configured using this service are listed in Table 2-1, "OraClrAgnt Service Parameters".
These parameter values can be specified as part of the Start Parameters in the properties window of the Control Panel Service. In this case, the parameter values are not saved and the values must be supplied again if the service is restarted later.
To persist the parameter values, you can change the Windows registry entry for this service and provide the parameter values as command line parameters to OraClrAgnt.exe
. To do this, set the Windows registry key, ImagePath
, located at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Oracle
OracleHome
ClrAgent
The value should be something similar to the following:
ORACLE_BASE\ORACLE_HOME
\bin\OraClrAgnt.exe agent_sid=CLRExtProc
max_dispatchers=2 tcp_dispatchers=0 max_task_threads=6 max_sessions=25
ENVS="EXTPROC_DLLS=ONLY:
ORACLE_BASE\ORACLE_HOME
\bin\oraclr11.dll"
If the service cannot be started or stopped, the error messages are logged in the Application Log of the Event Viewer, with the service name as the event source name.
Table 2-1 lists the parameters which can be configured using this service.
Table 2-1 OraClrAgnt Service Parameters
Parameters | Descriptions |
---|---|
|
This represents the |
|
Variable that specifies the This is similar to setting environment variables to external procedures using Refer to "Table 13–5 External Procedures Settings in listener.ora" in Oracle Net Services Administrator's Guide for more information. |
|
Address on which the listener is listening. This is an optional parameter. If it is not specified, then this is set to the default value. |
|
Number of maximum dispatchers in the |
|
Number of maximum sessions in the |
|
Number of maximum task threads in the |
|
Address on which the agent should listen for shutdown messages from |
|
Number of TCP dispatchers in the |
Note:
By default, this service is created and run in the Local System Account; however, it can be changed to work with a logged-on user account through the service control panel.See Also:
Oracle Database Heterogeneous Connectivity Administrator's Guide, Table 5-2, for further information about configuration parameters and default valuesYou should tune the OraClrAgnt
to match the expected load on your system.
Excessive extproc.exe
processes being spawned is a sign that you have set the configuration values too low.
Start with the following values and increase as you test your system for performance:
OraClrAgnt Parameter | Initial Value |
---|---|
max_sessions |
25 |
max_task_threads |
6 |
max_dispatchers |
2 |
You can migrate .NET stored procedures from Oracle Database release 10.2 to release 11.1 as follows:
Select the libraries that are used by .NET stored procedures from the Oracle Database 10g release 2 (10.2) database. For example,
SELECT library_name, file_spec FROM ALL_LIBRARIES WHERE OWNER='SYS'
and FILE_SPEC LIKE '$ORACLE_HOME\bin\clr\%';
library_name
is usually in the format dll_name_DLL
. For example, the library_name
for Project1.dll
would be PROJECT1_DLL
.
Create a SQL file manually (for example, DotNetSP_Grant.sql
) with the following SQL statements:
CREATE LIBRARY "SYS"."library_name" AS 'file_spec' GRANT EXECUTE ON "SYS"."library_name" TO "schema_name" GRANT EXECUTE ON "SYS"."DBMS_CLR" TO "schema_name" GRANT EXECUTE ON "SYS"."DBMS_CLRTYPE" TO "schema_name" GRANT EXECUTE ON "SYS"."DBMS_CLRPARAMTABLE" TO "schema_name"
Run Oracle Data Pump Export utility for the Oracle Database 10g release 2 (10.2).
Expdp system schemas="schema_name" directory=ORACLECLRDIR dumpfile=DotNetSP.dmp include=PROCEDURE,FUNCTION
Copy .NET stored procedure assemblies from Oracle Database 10g release 2 (10.2) ORACLE_BASE\ORACLE_HOME
\bin\clr
folder and its subfolders to the same directory structure in Oracle Database 11g release 1 (11.1).
Run DotNetSP_Grant.sql
as SYSDBA
against the Oracle Database 11g release 1 (11.1) database.
Run Oracle Data Pump Import utility for the Oracle Database 11g release 1 (11.1) database.
impdp system schemas="schema_name" directory=ORACLECLRDIR dumpfile=DotNetSP.dmp
You can add functionality to Oracle Database Extensions for .NET using Windows registry entries that are located at
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_
ORACLE_HOME
\ODE
Table 2-2 lists registry keys that add functionality to Oracle Database Extensions for .NET and the sections where the keys are discussed.
Registry Key | Section |
---|---|
. |
|
|
"Backward Compatibility for Nullable ODP.NET Connected Types" |
|
|
|
|
|
|
|
With release 11.1.0.6.20, you can unload .NET assemblies when .NET stored procedure execution completes. This makes it easier to repeatedly test your code during development. If this registry key is not enabled, the exproc.exe
process must be stopped and started with each redeployment.
This feature should not be used during performance testing or for production, as it has a negative effect on performance.
To define assembly loading behavior, set the registry value RecreateAppDomain
of type REG_SZ
under this registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_
ORACLE_HOME
\ODE
The valid values for RecreateAppDomain
are:
0
= .NET Assembly remains loaded when the .NET stored procedure execution completes.
1
= .NET Assembly is unloaded when the .NET stored procedure execution completes.
ODP.NET for .NET 2.0 supports a static Null
property in ODP.NET Connected Types, in addition to the existing support for disconnected types such as OracleDecimal
. It also supports a public property, IsNull
, for each of these types to check whether or not objects of these types have been assigned a value.
See Also:
Oracle Data Provider for .NET Developer's Guide for more information on nullable typesThis enables Null
objects of ODP.NET Connected Types to be propagated to and from a .NET stored procedure. The list of these connected types follows:
OracleBlob
OracleClob
OracleBFile
OracleXmlType
Previous versions of .NET stored procedures expected ODP.NET connected type parameters to be passed as NULL
rather than a Type.Null
object. In order to support backward compatibility, the registry string ProviderNull
can be used to retain the old behavior.
To determine how Oracle Database Extensions for .NET handles passing a NULL
value to an ODP.NET connected type parameter in a .NET stored procedure, set the registry string ProviderNull
under this registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_
ORACLE_HOME
\ODE
The valid values for ProviderNull
are:
0
= ODP.NET connected-type parameters are passed as NULL
rather than Type.Null
object.
1
= Oracle Database Extensions for .NET passes a Type.Null
object to the .NET stored procedure in the case of a null value.
If multiple .NET run time versions are installed on the database computer, then Oracle Database Extensions for .NET defaults to the latest .NET run time available. However, you can configure Oracle Database Extensions for .NET to load a particular .NET run time by setting a registry value.
To specify .NET run time version, set the registry value, .NETFramework
under this registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_
ORACLE_HOME
\ODE
Set the registry value to the appropriate .NET run time version, for example, v2.0.50727.
For example, if the server has .NET framework version 1.1 and 2.0 and the .NET stored procedures are built with .NET framework 1.1, then this registry value may be set to v1.1.4322 to instruct Oracle Database Extensions for .NET to load .NET framework version 1.1.4322.
The following are typical .NET runtime version values for various .NET versions:
1.0 : v1.0.3705
1.1 : v1.1.4322
2.0 : v2.0.50727"
Oracle Database Extensions for .NET provides debug tracing support, which allows logging of all the Oracle Database Extensions for .NET activities into a trace file. Different levels of tracing are available.
The following registry settings should be configured under
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_
ORACLE_HOME
\ODE
TraceOption
specifies whether to log trace information in single or multiple files for different threads. If a single trace file is specified, the filename specified in TraceFileName
is used. If the multiple trace files option is requested, a Thread ID is appended to the file name provided to create a trace file for each thread.
The valid values for TraceOption
are:
0
= Single trace file
1
= Multiple trace files
Note: You can use Oracle Data Provider for .NET tracing mechanism to troubleshoot ODP.NET specific issues.
TraceFileName
specifies the file name that is to be used for logging trace information. If TraceOption
is set to 0
, the name is used as is. However, if TraceOption
is 1
, the Thread ID is appended to the file name provided.
The valid values for TraceFileName
are: any valid path name and file name.
TraceLevel
specifies the level of tracing in Oracle Database Extensions for .NET.
The valid values for TraceLevel
are:
0
= None
1
= Entry and exit information
See Also:
Debug Tracing section in Oracle Data Provider for .NET Developer's Guide.NET stored procedures are hosted inside the external procedure agent extproc.exe
. .NET run time version 2.0 allows most unhandled exceptions in threads to proceed, which might cause an unhandled exception to terminate extproc.exe
. This behavior is different from .NET run time versions 1.0 and 1.1, which provide a backstop for many unhandled exceptions.
Oracle Database Extensions for .NET installs extproc.exe.config
file in the ORACLE_BASE\ORACLE_HOME
\Bin
directory to force .NET run time version 2.0 to use the behavior of .NET run time version 1.1. If the Garbage Collector or a thread created inside the .NET stored procedures throws an exception, and if this exception is not handled by the .NET stored procedure, then the tracing mechanism reports the exception.
The following is an example extproc.exe.config
file:
<configuration> <runtime> <legacyUnhandledExceptionPolicy enabled="1"/> </runtime> </configuration>
You can change this file to revert back to .NET 2.0 behavior by modifying the extproc.exe.config
file as follows:
<configuration> <runtime> <legacyUnhandledExceptionPolicy enabled="0"/> </runtime> </configuration>