February 2012 - Posts

Install Oracle Database 10g on Win7 x64

Actually, Oracle Database 10g (64-bit version) cannot be installed on either Windows 7 x64 or Windows Server 2008R2, but we can “hack” the installer configuration to allow this installation scenario. However, Oracle said they didn’t recommend this “hacking” story. They said we have to use Oracle Database 11g instead. But, one of my big customer still use Oracle Database 10g, they don’t have license for 11g, and I have to install 10g in my development machine.

  1. First of all, copy the installation files to hard disk, let’s say we copy those files to c:\oracle10g
  2. Open folder install, open oraparam.ini using notepad, go to line 32, we will find this line:

    #Windows=5.0,5.1,5.2

    Change that line to:

    #Windows=5.0,5.1,5.2,6.0.6.1

    As you may know Windows 5.1 is well known as Windows XP, 5.2 is Windows Server 2003, 6.0 is Windows Vista/Windows Server 2008, and 6.1 is Windows 7/Windows Server 2008R2.
  3. Save oraparam.ini
  4. Open folder stage\prereq\db, open refhost.xml, at line 30, add this line:

    <OPERATING_SYSTEM>
          <VERSION VALUE="6.1"/>
    </OPERATING_SYSTEM>

  5. Save refhost.xml
  6. Back to the root folder, run setup.exe, Oracle Universal Installer should said that your operating system is passed the requirement.
  7. Install the Oracle Database as usual

While installing, we will be notified that Database Control (Enterprise Manager) service cannot be started. Don’t worry, we do not need this in our development machine. We still can use command line based, sqlplus, to control the database.

OK, so far so good, let’s try to build the database application using Visual Studio.

In my experiment, I used Visual Studio 2008, I tried to create simple ASP.NET 3.5 Web Site, and add reference to Microsoft Oracle Client library. This .NET library is bundled with .NET Framework (Version 2.0 or 4.0), you can find System.Data.OracleClient in GAC. Write this code:

var conn = new System.Data.OracleClient.OracleConnection();
conn.ConnectionString = "user id=hr;password=hr;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))";
conn.Open();

As you see, we have to use “long version” of data source value. It seems we can’t use only TNS name.

Then, I ran the web site…..and BOOM!!! ASP.NET threw an exception with message that Oracle Client 8.1.3 or higher is required.

It seems .NET Framework Oracle Client cannot use Oracle Database 10g x64 library we already installed.

Then….I tried to download and install Oracle Client 10g, the installer will add it’s bin folder to PATH environment variable. We have to move this folder to the last order of the PATH variable:

  1. Open up System Properties from Control Panel, go to Advanced tab, open Environment Variables window.
  2. At System Variables, find PATH variable, move Oracle Client’s bin folder to the last order of the PATH values.
  3. Click OK to save changes.
  4. Restart Windows to ensure our changes would be applied.

Re-open and re-run our ASP.NET Web Site code, the error message we saw before should be vanished and the connection object can be opened successfully.

You may have question, why do I not use ODP.NET instead?

Yes, I have tried it also. I have tried to use ODP.NET DLL, Oracle.DataAccess.dll (64 bit version), but I still can’t connect to the database from my .NET code. If you have any suggestion how to use ODP.NET 10g in .NET application, please let me know.

Share this post: | | | |
Posted by paulus with 1 comment(s)
Filed under: , , ,