Skip Headers
Oracle® Database Express Edition Getting Started Guide
11g Release 2 (11.2)

Part Number E18585-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

  PDF · Mobi · ePub

Oracle® Database Express Edition

Getting Started Guide

11g Release 2 (11.2)

E18585-04

July 2011

Welcome to Oracle Database Express Edition (Oracle Database XE). This guide gets you quickly up and running using Oracle Database XE by creating database objects and a simple application. It covers the following topics:

This guide assumes that you have installed Express Edition on your Windows or Linux system, as described in Oracle Database Express Edition Installation Guide for Microsoft Windows and Oracle Database Express Edition Installation Guide for Linux x86-64.

1 Exploring the Oracle Database XE User Interface

The user interface to Oracle Database XE includes the following:

1.1 System Menu Commands

To access the major features of Oracle Database XE, use the system menu as follows to get to the available specific commands:

  • On Windows, from the Start menu, select Programs (or All Programs), then Oracle Database 11g Express Edition.

  • On Linux, click the Application menu (on Gnome) or the K menu (on KDE), then point to Oracle Database 11g Express Edition.

Then select from the submenu items:

  • Get Help: Displays the following selections:

    • Go To Online Forum: Displays the online forum for discussions about Oracle Database XE.

    • Read Documentation: Displays the Oracle Database XE documentation library on the Internet.

    • Register For Online Forum: Allows you to register for the Oracle Database XE online forum.

  • Backup Database: In NOARCHIVELOG mode (the default), shuts down the database, backs it up, and then restarts it. In ARCHIVELOG mode, performs an online backup of the database. For more information on backups, see Oracle Database Express Edition 2 Day DBA.

  • Restore Database: Shuts down and then restores the database to the most recent backup. For more information on restoring a database, see Oracle Database Express Edition 2 Day DBA.

  • Run SQL Command Line: Starts the SQL Command Line utility for Oracle Database XE. To connect to the database, issue the connect command in the following format at the SQL prompt:

    connect username/password
    

    where username is the user name, such as system or another user account name, and password is the password that was assigned when Oracle Database XE was installed or when that user was created. To get help, you can enter the command help at the SQL prompt after you have connected to the database.

  • Start Database: Starts Oracle Database XE if it is currently stopped. By default, the database is started for you after installation and every time your computer is restarted. However, to reduce the overall performance load on the system, you can manually stop the database, and then manually restart it later.

    (If the database is not currently stopped, an informational message is displayed that the database is already started.)

    Note:

    To start or stop the database: On Windows, you must be logged in as the user who installed Oracle Database XE or as a Windows administrator; on Linux, you must be logged in as the user who installed Oracle Database XE or as a user who is a member of the dba user group (typically the user oracle).
  • Stop Database: Stops Oracle Database XE if it is currently started.

  • Get Started: Displays the Oracle Database XE Home Page in your default browser. See Section 1.2, "Database Home Page".

1.2 Database Home Page

The Database home page is a Web browser-based interface for performing various database administration operations, including the following:

  • Monitoring database storage

  • Monitoring database sessions

  • Viewing database initialization parameters

  • Getting started with Oracle Application Express

To access the database home page, follow these steps:

  1. Navigate the system menu as follows:

    • On Windows, from the Start menu, select Programs (or All Programs), then Oracle Database 11g Express Edition, and then Get Started.

    • On Linux, click the Application menu (on Gnome) or the K menu (on KDE), then point to Oracle Database 11g Express Edition, and then Get Started.

    The Oracle Database XE home page appears:

    Description of gs_admin_consl.jpg follows
    Description of the illustration gs_admin_consl.jpg

    For detailed information about these database-level operations, see Oracle Database Express Edition 2 Day DBA.

  2. Click the button or tab for any category you are interested in (for example, Storage).

    If you are prompted for login information, specify:

    • Username: Enter system for the user name.

    • Password: Enter the password that was specified when Oracle Database XE was installed.

2 Creating a Database User

You must create at least one database user that you will use to create database objects. A database user is a type of database object: a user is associated with a database schema, you connect to the database as a database user, and the database user is the owner of any database objects (tables and so on) that you create in the schema associated with the user.

For example, to create a database user named chris. Follow these steps, using the command line:

  1. Display the SQL command prompt window. For example, on Windows, click Start, then Programs (or All Programs), then Oracle Database 11g Express Edition, and then Run SQL Command Line.

  2. Connect as the SYSTEM user:

    • Type: connect

    • Enter user-name: system

    • Enter password: <password-for-system>

  3. Create the user. For example, enter a statement in the following form:

    SQL> create user chris identified by <password-for-chris>;
    
  4. Grant the user the necessary privileges. For example:

    SQL> grant connect, resource to chris;
    
  5. Optionally, exit SQL*Plus (which also closes the command window):

    SQL> exit
    

SQL Developer as an Alternative for Creating Database Users:

If you have experience with SQL Developer, you can use it instead of the command line to create a database user, as follows:
  1. Create a database connection for the SYSTEM user.

  2. Open that database connection for the SYSTEM user.

  3. Right-click the Other Users node in the Connections navigator under that connection.

  4. Select Create User, and specify the necessary information. (Under Roles, grant CONNECT and RESOURCE.)

3 Installing SQL Developer

You now want to be able to create and work with database objects (tables, views, procedures, functions, and so on) in the database that you installed. To do this, you can use Oracle SQL Developer and Oracle Application Express (also referred to as Oracle Application Express):

To install and start SQL Developer:

Step 1: Go to the Oracle Technology Network page for SQL Developer at

http://www.oracle.com/technetwork/developer-tools/sql-developer/

Step 2: Click the Downloads tab (next to Overview).

Step 3: Read and accept the license agreement.

Step 4: Follow the instructions for downloading and installing SQL Developer.

Tip:

Windows users may find it convenient to download the kit that includes a JDK (Java Development Kit). The kit size is larger, but it does not require you to have a JDK on your PC. (In addition, you aren't required to know if you have a JDK, or if the one you have is an acceptable version).

The installation itself is simple. For example, on a Windows PC you can unzip the downloaded file into C:\Program Files.

To start SQL Developer, go to the sqldeveloper directory under the SQL Developer installation directory (for example, on a Windows system this might be C:\Program Files\sqldeveloper), and do one of the following:

If you are asked to enter the full pathname for java.exe, click Browse and find java.exe. For example, on a Windows system the path might have a name similar to C:\Program Files\Java\jdk1.6.0_21\bin\java.exe.

4 Getting Started Using SQL Developer

To start using SQL Developer to create and work with objects and schemas in your XE database, follow these major steps:

  1. Install and start SQL Developer, as explained in Section 3.

  2. Create some database connections, as explained in Section 4.1.

  3. Connect to the database and work with database objects, such as by doing the tutorial described in the online help, as explained in Section 4.2.

SQL Developer comes with a tutorial and demos to help you learn to use its features.

4.1 Creating Database Connections

To work with your Express Edition database in SQL Developer, you must create some database connections, so that you can view and work with database objects, use the SQL Worksheet, and use other features.

To create database connections, you can use one or more of the following approaches:

4.1.1 Autogenerate Local Connections

You can automatically create a database connection for each unlocked user account on the local system by right-click the Connections node and selecting Create Local Connections. The connections are placed in a folder named Auto-Generated Local Connections, as shown in Figure 1.

Figure 1 Autogenerated Connections in SQL Developer Window

Description of Figure 1 follows
Description of "Figure 1 Autogenerated Connections in SQL Developer Window"

For autogenerated connections, you will always be prompted for the password when you connect, and you cannot edit the user name or password in the connection properties dialog box. To be able avoid the password prompt by selecting the Save Password option for a connection, you must create the connection manually.

4.1.2 Create Connections Manually

You can manually create database connections to the local Express Edition database and to Oracle Database instances on other systems. If you create a connection manually, you can specify the Save Password option to avoid having to enter the password each time you connect, and you can edit the user name and password associated with then connection.

To create a new database connection:

  1. In the Connections navigator, right-click the Connections node and select New Database Connection.

  2. Use the dialog box to specify information about the connection. Figure 2 shows the information to create a connection for a database user named CHRIS.

    Figure 2 Creating a Database Connection

    Description of Figure 2 follows
    Description of "Figure 2 Creating a Database Connection"

    In the connection definition in Figure 2:

    • Connection Name: An alias for a connection to the database using the information that you enter. Example: XE_CHRIS

    • Username: Name of the database user for the connection. This user must have sufficient privileges to perform the tasks that you want to perform while connected to the database. Example: chris

    • Password: Password associated with the specified database user.

    • Save Password: Specify this option if you want the password is saved with the connection information; you will not be prompted for the password on subsequent attempts to connect using this connection.

    • Hostname: Host system for the Oracle database. For your Express Edition database, the hostname is localhost.

    • Port: Listener port. The default is 1521.

    • SID: Database name. The default for Express Edition is xe.

  3. Click Test to check if you have entered the correct information for the connection.

    If the test is not successful, correct information as needed and click Test again.

  4. When the test is successful, click Save to save the connection.

  5. To open the connection after saving it, you can click Connect. (You can also open the connection using the Connections navigator.)

4.2 Working with Database Objects

To get started quickly working with database objects, do the short tutorial in the SQL Developer online help (also available in Oracle SQL Developer User's Guide). This tutorial creates three tables, a sequence, a view, and a PL/SQL procedure for a small library database, and inserts some sample data into the tables. You can create these objects using a database connection to a user that you created (such as one to CHRIS if you used that example).

To access this tutorial in the help:

  1. Click Help, then Table of Contents.

  2. In the Contents navigator, double-click the topic Tutorial: Creating Objects for a Small Database.

  3. Follow the instructions for the major steps in the tutorial.

In addition to or instead of doing this tutorial, you can unlock the supplied sample HR user account (see Section 5), and then use a database connection to the HR user to view tables, procedures, and other objects. (You can modify data in the tables owned by HR, but you probably do not want to because many documents show examples that assume the supplied data.)

You can also check the many tutorials, demos, courses, and other resources mentioned on the SQL Developer Start Page and on the Oracle Technology Network.

5 Unlocking the Sample User Account

To view any objects owned by the supplied sample database user named HR, or to create the form-based application as described in Section 6, "Creating an Application Using Application Express", you must first unlock the HR sample account.

Oracle Database XE comes with a sample database user named HR. This user owns several database tables in a sample schema for a fictional Human Resources department. However, for security reasons, this user's account is locked. You need to unlock this account before you can view the HR objects or build any applications that use these objects. You can use either of the following approaches to unlock the account:

5.1 Unlock HR Using SQL Developer

To unlock the sample user account using SQL Developer:

  1. Open a database connection for the SYSTEM user. For example, with the connections shown in Figure 1, "Autogenerated Connections in SQL Developer Window" in Section 4.1.1, open the connection named SYSTEM.

  2. In the Connection navigator under the connection for the SYSTEM user, expand the Other Users node.

  3. Under Other Users, right-click the node for the HR user and select Edit User.

  4. In the Create/Edit User dialog box, uncheck (deselect) the option Account is Locked.

    1. For New Password and Confirm Password, enter the password that you want for the HR user.

    2. Uncheck (deselect) Password expired (User must change next login).

    3. Uncheck (deselect) Account is Locked.

  5. Click Apply to alter the HR user so that the account is unlocked and not expired.

  6. Click Close to close the dialog box.

5.2 Unlock HR Using the SQL Command Line

To unlock the sample user account using the SQL command line:

  1. Display the SQL command prompt window. For example, on Windows, click Start, then Programs (or All Programs), then Oracle Database 11g Express Edition, and then Run SQL Command Line.

  2. Connect as the SYSTEM user:

    • Type: connect

    • Enter user-name: system

    • Enter password: <password-for-system>

  3. Enter the following statement to unlock the HR account:

    SQL> ALTER USER hr ACCOUNT UNLOCK;
    
  4. Enter a statement in the following form to specify the password that you want for the HR user:

    SQL> ALTER USER hr IDENTIFIED BY <hr-password>;
    
  5. Optionally, exit SQL*Plus (which also closes the command window):

    SQL> exit
    

6 Creating an Application Using Application Express

You can use Oracle Application Express to create applications with forms linked to tables and data in the database. This section guides you through creating such an application using the supplied HR account, and it contains the following sections:

6.1 Getting Started with Application Express

To use Application Express, you must create at least one Application Express workspace. For this exercise, you will create a workspace for the HR user, so that you can develop the sample application using the HR database account. (After you perform the steps in this section, you do not need to repeat them for creating and modifying Application Express applications in this workspace.)

To create the Application Express workspace:

  1. From the system menu, navigate to Oracle Database 11g Express Edition and select Get Started.

  2. On the Database home page, click Application Express.

  3. On the Login page, log in with the user name and password for the SYSTEM account.

  4. On the Oracle Application Express page, create a workspace for the existing database user HR, as shown in Figure 3.

    Figure 3 Creating an Application Express Workspace

    Description of Figure 3 follows
    Description of "Figure 3 Creating an Application Express Workspace"

    Database User: Specify Use Existing to create the workspace for the existing database user named HR.

    Application Express Username: Enter a desired name for the Application Express workspace to be created. Example: hr_apex

    Password and Confirm Password: Enter the password to be used for the Application Express workspace.

  5. Click Create Workspace.

  6. On the next page, click the click here link to log in to the workspace.

The first time you attempt to access the workspace, you will be prompted to reset the password for the workspace. (You can specify the same password or a different one.)

6.2 Logging in to the Workspace for the Sample Account

To create the application, you must log in to the workspace that you created in Section 6.1, "Getting Started with Application Express".

To log in to the workspace:

  1. From the system menu, navigate to Oracle Database 11g Express Edition and select Get Started.

  2. On the Database home page, click Application Express.

  3. On the Login page, click the button Already have an account? Login Here.

  4. Log in to the Application Express workspace.

Now you are ready to create your first application using Application Express.

6.3 Creating a Simple Application

Creating an application is an easy way to view and edit your database data. You create this application based on the EMPLOYEES table, which is part of the HR schema.

To create an application based on the EMPLOYEES table:

  1. On the Application Express page for the workspace, click Application Builder.

  2. Click the Create button.

  3. Under Create Application, for Application Type select Database and click Next.

  4. Under Create Application:

    1. Name: Enter MyApp.

    2. Application: (Accept the default.)

    3. Create Application: From Scratch

    4. Schema: HR

    5. Click Next.

    Next, add pages to your application.

  5. Under Add Page:

    1. Page Type: Report and Form.

      Notice that Action describes the type of page you are adding.

    2. Table Name: Click the up arrow, and then select EMPLOYEES.

    3. Implementation: Interactive

      Report and Form icon
      Description of the illustration gs_report_and_form.jpg

    4. Click Add Page.

      Two new pages are listed at the top of the page, under Create Application.

      Description of gs_two_new_pages.jpg follows
      Description of the illustration gs_two_new_pages.jpg

    5. Click Next.

  6. On the Tabs panel, accept the default (One Level of Tabs) and click Next.

  7. On the Shared Components panel, accept the default (No) and click Next.

    This option enables you to import shared components from another application. Shared components are common elements that can display or be applied on any page within an application.

  8. On the Attributes panel, for Authentication Scheme select the default (Application Express) and all remaining defaults, and click Next.

  9. On the User Interface panel, select Theme 2 click Next.

    Themes are collections of templates that you can use to define the layout and style of an entire application.

  10. On the Confirm panel, confirm your selections. To return to a previous wizard page, click Previous. To accept your selections, click Create.

    After you click Create, the following message displays at the top of the page:

    Application created successfully.
    

6.4 Running Your New Application

To run your application:

  1. Click the Run Application icon.

    Run Application icon
    Description of the illustration gs_run_ico.jpg

  2. In the log in page, enter hr for both the User Name and Password.

    Your application appears, showing the EMPLOYEES table.

  3. Explore your application.

    You can query the EMPLOYEES table, if you want. To manage the application, use the Developer toolbar at the bottom on the page.

    Developer toolbar
    Description of the illustration gs_d_toolbar.jpg

    The Developer toolbar offers a quick way to edit the current page, create a new page, control, or component, view session state, or toggle debugging or edit links on and off.

  4. To exit your application and return to Application Builder, click Edit Page 1 on the Developer toolbar.

  5. To return to the Database Home Page, select the Home breadcrumb at the top of the page.

    Description of gs_bread_myapp.jpg follows
    Description of the illustration gs_bread_myapp.jpg

    Congratulations! You have just created and run your first application using Application Express with Oracle Database XE.

7 Learning More About Oracle Database XE

To learn more about using Oracle Database XE, you can use the Oracle Database XE Documentation Library, which is available from the system menu or the administrative console.

Be sure to review these documents, in particular:

Title Content
Oracle Database Express Edition 2 Day DBA Discusses common day-to-day administrative tasks.
Oracle Database Express Edition 2 Day Developer's Guide Explains how to take advantage of the Oracle Database Express Edition development environment.
Oracle Database Express Edition 2 Day + Application Express Developer's Guide Offers a series of tutorials that describe how to build database-centric Web applications using the Oracle Application Express client.
Oracle Database Express Edition 2 Day + PHP Developer's Guide Provides a tutorial that shows you how to download and install Apache and the Zend Core PHP drivers, and then how to use PHP to connect to Oracle Database XE, and demonstrates how to use PHP to develop a simple application that accesses and modifies data.
Oracle Database Express Edition 2 Day Plus Java Developer Guide Provides a tutorial that shows you how to use Java and JDBC to connect to Oracle Database XE, and demonstrates how to develop a simple Java application that accesses and modifies data.
Oracle Database Express Edition 2 Day Plus .NET Developer Guide Describes the key features of Oracle Data Provider for .NET and Oracle Developer Tools for Visual Studio .NET. It leads you through installation and configuration, shows how to build basic applications using Oracle Data Provider for .NET and Oracle Developer Tools for Visual Studio .NET, and how to create and use both PL/SQL and .NET stored procedures.

8 Major Changes for Release 11.2

This section summarizes the major changes between Oracle Database XE Release 11.2 and the previous release (10.2).

The most obvious difference is in the user interface, specifically the Database Home Page, as explained in Section 8.1.

The resource limitations are the same as for Release 10.2, except that you can now store up to 11 GB of user data (not including Express Edition system data), as opposed to 4 GB in Release 10.2.

Oracle Database XE Release 11.2 contains a vast set of Oracle Database features that have been introduced since Release 10.2. In general, Oracle Database XE Release 11.2 contains the features of Oracle Database Standard Edition Release 11.2, except as qualified in Oracle Database Express Edition Licensing Information. See that manual for detailed information about features that are and are not included in Oracle Database XE.

8.1 User Interface Changes

In Oracle Database XE Release 11.2, you can use the Database Home Page to perform various database administration tasks, including monitoring database storage, monitoring database sessions, and viewing database initialization parameters. To access Oracle Application Express, click the Application Express button on the Database Home Page and follow the instructions. Once you create a workspace, username, and password, you can access Oracle Application Express directly from your Web browser as described in Oracle Database Express Edition 2 Day + Application Express Developer's Guide.

9 Documentation Accessibility

For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.

Access to Oracle Support

Oracle customers have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.


Oracle Database Express Edition Getting Started Guide, 11g Release 2 (11.2)

E18585-04

Copyright © 2006, 2011, Oracle and/or its affiliates. All rights reserved.

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.