Skip to content

Configuration

Oracle user accounts

Relational databases are designed to be used by many users, and so each user will need an account which is protected by a username and password. For each schema in an Oracle database, there is a special user called the schema owner, and it is this account that maintains the tables and other objects that comprise the schema. Towards the end of the module, we will look at how the schema can be shared with other users.

By default, every Oracle database has two administrative accounts whose usernames are SYS and SYSTEM. The distinctions between them are beyond the scope of this module, and you can think of them as equivalent.

If you installed the software on your own laptop, you will have been prompted for a password for these accounts during the installation process. If you are using a virtual PC, the password for both accounts is manager. Please note that Oracle passwords are case-sensitive.

Unlock the example user account

Oracle 11g also comes with an example user caller HR which owns a set of tables. The user and the tables are referred to throughout the Oracle help documentation, and we will also be using them in this module. Immediately after installation, the example account is locked and you need to unlock it before it can be used. The simplest way to do this is to use the SQL*Plus command line interface. Start SQL*Plus (labelled 1 in the graphic below) using the Oracle group on the Windows start menu.

Oracle group

When it first starts up, SQL*Plus is not connected to a database, and you have to make a connection explicitly. This is useful when you are connecting to the same database as different users (eg SYSTEM and HR).

Use the following command to connect to the database - bear in mind that you need to press RETURN to terminate all SQL*Plus commands:

1
    connect system/manager

If you leave out the password, SQL*Plus will prompt you for it.

Command line

Because the SQL*Plus window is an extension of the Windows command line, it is subject to the same restrictions. In particular, the standard cut/copy/paste operations do not work in the same way as in standard applications. To improve the interface slightly, right-click on the title bar and choose Properties from the pop-up menu. Check Quick Edit Mode and Insert Mode as shown in the graphic below and click OK. This will allow you to highlight text in the SQL*Plus window and copy it by right-clicking. A second right-click will paste the copied text into the window. These settings will be remembered next time you start SQL*Plus.

Properties

To unlock the HR account, type in the following command including the final semicolon and press RETURN:

1
    alter user hr identified by hr account unlock;

The phrase "identified by hr" resets the account password to hr.

The HR account is now ready for access. You can leave SQL*Plus by closing the window or by typing the command exit followed by RETURN.