Anda di halaman 1dari 15

jThomas Enterprises LLC

Installing Oracle 11g Express


on Windows 7 with
SQL*Developer 4.0

Oracle 11g Express & SQL*Developer 4.0


on Windows 7

This guide will assist in configuring a suitable development environment that will per-

mit you to experiment with SQL and PL/SQL using an Oracle 11g Express Edition Database.

In particular, these instructions require that specific software packages are installed

and configured with some non-default settings. No worries, everything can be setup with
a minimum level of knowledge and without cost.
Hardware and Operating System

The software used with this guide was deployed and tested on Windows 7 (32 bit) us-

ing a basic laptop with an Intel i5 processor and 2 GB of RAM. You should not have to
make any changes to the operating system, as a basic installation will work perfectly. You
will, however, need administrator privileges on the system to install the software.
Software

Two main pieces of free software will be installed and configured. They are:
Oracle Database 11g Express Edition (the database for our data)
Oracle SQL*Developer 4.0 (the tool we will write our code in)

All of the software can be downloaded from Oracles website (www.oracle.com) for

absolutely no cost. You will have to register as a developer with the Oracle Technology
Network (which is also free) in order to execute the download for the Oracle 11g Express
Edition and SQL*Developer 4.0

Downloading Oracle 11g Express Edition (XE)


After you navigate to the Oracle website, follow the links to the download section for

the 11g Express Database (the exact navigation is not given here since Oracle changes it
from time to time - you could also use a search engine to find it). The page should look
similar to the screen shot here:

The download link becomes active after you have accepted the license agreement. The
compressed file is around 327 MB and download times will vary depending on your connection speed.
Extracting Oracle 11g Express Edition

After the download completes, you will have a single file that should be named

OracleXE112_Win32.zip.

Right click and extract the file contents to a folder of your choos-

ing (this is not where the database will be installed, it is simply a staging area for the installation process.) In the example, we extract the file into the default folder which is named
c:\OracleXE112_Win32:

Viewing the c:\OracleXE112_Win32 after the extract, there will be a single folder

named DISK1. Open the DISK1 folder and there should be the following contents:

Installing Oracle 11g Express Edition


1. Double-click the setup application to launch

the 11g Express installer. If you receive a warning


popup window, click the Run button to permit Windows to execute the application.

2. It may take some time for the application to start but it will eventually begin a series

of wizard pages that will step you through the installation. After accepting the license
agreements, allow the installer to use the default location for the database which is
c:\oraclexe:

3. On the page that asks you to Specify Database Passwords for the system accounts,
use the password admin1. You can, of course choose anything you like but this guide assumes that the password for the SYS and SYSTEM accounts is admin1.

After completing the Install Wizard pages,


a progress screen will display so you can
monitor the installation. Installation will
take less than 5 minutes.

4. Once the installer completes, it will display a completed page and you can exit
the installer by clicking Finish.

Post Installation Tasks - Checking changes made to Windows 7


It is always a good idea to see what a piece of installed software had done to your

computer. Oracle 11g Express Edition gets installed as a series of OS files and Windows
Services that allow you to start, stop, connect, and administer the database. The source
files for the database are all installed under the c:\oraclexe folder. The overall folder
hierarchy is fairly deep but it is all-inclusive for the product. There is no need to modify
these files at this time.

The Windows Services that are started are shown here (these can be viewed using

the Services Control panel):

The two main services (OracleServiceXE and OracleXETNSListener) should already be


started (and they will be set to auto-start at system boot). If these services are ever not running, the database will not be available.

The Windows Start Menu should have a new entry that encompasses all of the menu

options for Oracle 11g Express Edition.

The Start Database and Stop Database are nothing more than scripts that execute to
turn on and o the Oracle 11g Express instance. Backup and Restore Database perform
simple backups and restorations from a point in time.
NOTE: The backup and Restore options require addition information to be made clear. Refer to the Oracle 11g Express documentation for the details. The online documentation can
be accessed if you have an Internet connection by using the Get Help menu option.

The Get Started option will open your local web browser and navigate to an Oracle

Application Express (APEX) application that provides you some summary information
about your locally running 11g Express instance:

Post Installation Tasks - Testing your Oracle Connection


Using the Windows Start Menu, click on the Run SQL Command Line option.

A window will display that looks like a Windows Command Prompt. This is actually an
Oracle tool called SQL*Plus that has been around for a long time. This is generally, the
lowest level way to connect and interact with an Oracle Database (any version).

To test our newly installed Oracle 11g Express database, try to establish a connection as
the default Database Administrator account, SYSTEM. To do this, type the connect command at the SQL> prompt (supply the password used during the installation):

If you correctly entered the password and all of the database services are running, you will
see the word Connected followed by a new SQL> prompt. Type exit and the prompt
and the command line tool will close.

Congratulations! You now have a working Oracle 11g Express Edition database.
NOTE: At this point, if there are any errors (other than a mistyped password), you are

better o re-installing the entire database product. Simply re-run the installer and choose
the Remove option. When that is complete, reboot your computer and perform the installation again.
Downloading & Installing SQL*Developer

The tool that this guide chooses for interacting with the database is SQL*Developer

4.0. This is a free Integrated Development Environment (IDE) provided by Oracle largely
centered around executing SQL and PL/SQL commands. The IDE is a Java Application
and, as such, can run in any operating major system that can use Java. To help simplify
the installation, Oracle has a version of SQL*Developer that includes the Java Development Kit (JDK) but only if you are running the 64-bit version of Windows. If you are on
32-bit Windows, you will have to download and install Java 7 (recommended) prior to installing SQL*Developer.

The SQL*Developer download is in


the same basic area of Oracles website as the database. The actual
download page is shown here:

here is no installation process for SQL*Developer. As a Java application, you simply

download the file, extract the content to a folder, and launch the application. In the following example, SQL*Developer was downloaded and placed into the folder
c:\sqldeveloper (of course you can place it anywhere you like). The screen shot
shows a partial listing of the files in the folder that comprise SQL*Developer:

To start the IDE, use the sqldeveloper application that has the

icon to it. A startup

screen should display as shown here:

Once the startup has finished, the complete IDE will display and we can proceed with the
configuration steps. If a welcome page is displayed, you can close it.

10

NOTE: If you had to install Java manually, SQL*Developer may request that you identify the
path of where your JDK is installed. This will be one-time configuration step.
Post Installation: Create a database connection

SQL Developer requires that we tell it about any databases that we need to work

with. This is done by creating database connections in the tool. We will create our first
connection as the default database administrator, SYSTEM. Follow the steps below to accomplish this:

Click on the green plus (+) in the Connec-

1.

tions window on the left side of the IDE.

2.

A popup window will display where you can fill out all the required information to create the connection. Type in the data exactly as shown in the screenshot below:

Connection Name: system-xe


Username: system
Password: admin1
Save Password: checked

11

NOTE: Leave the hostname, port, and SID all to their defaults (since the database was installed on the same system using all defaults). If your machine has a proper hostname or a
known IP address, you may use that value instead of localhost.
2.

Click the Test button and if all is well, you will see a message that says

Status: Success in the lower lefthand corner of the window just above the Help button.

3. Click Connect and you will be returned to the main IDE screen and you are now connected to the 11g Express Database as the SYSTEM user. A default SQL Worksheet
opens under a tab that indicates the username of current connection. A pulldown list
on the right side of the Worksheet also indicates the current connection.

4. In the Connections window, right click the system-xe connection and choose
Disconnect. This disconnects you form the Oracle 11g Database running on your machine. You will notice that the SQL Worksheet remains open but the pull down list on

12

the right no longer indicates a connection.You will also notice that the connection icon
in the Connections window no longer has the plug on it. As we can have more than
one connection defined, this is a handy way of determining which connections are currently open.

You can now close SQL*Developer using the File menu: File->Exit
Post Installation: Creating a Shortcut to SQL*Developer

Having a quick shortcut to launch SQL*Developer is

very useful so let us create that now. Open the folder


where you installed SQL*Developer and right click on the
sqldeveloper icon. Choose the Create shortcut from
the menu.

Drag the newly created shortcut to the Windows

Task Bar (usually on the bottom of the screen).


Test out your new shortcut to make sure everything is working properly.

13

Optional Configuration Items: Unlocking the HR User


Oracle 11g Express Edition has some demo database users loaded into the default in-

stall. Once of these users is named HR and has several tables related to employees, salaries, etc.. Oracle uses this schema is many of their online tutorials and it is referenced in a
great many articles written by other developers. This user is locked by default during the
installation of the database. To unlock the HR user so you can experiment with it, do the
following:
1.

Open SQL*Developer and open the connection for system-xe that we created in
the last section.

2.

After the SQL Worksheet displays, unlock the HR schema by typing the code below
in the worksheet window and executing it using the Run Statement

3.

button:

The HR user is now available for use. The default password is HR. To simply the
HR user and its objects, create a SQL*Developer connection for it in the same way
you created one for the SYSTEM user in the previous section.

14