Srikanth Technologies

Unlocking HR account in Oracle Database 18c Express Edition (XE)

When you install Oracle Database 18c XE (Express Edition), you get two databases - XE and XEPDB1.

When you connect without mentioning any database then you are connected to XE database.

However, HR account is not present in XE database, it is present in XEPDB1 database. So, to access HR account and its tables, we need to connect to XEPDB1 database explicitly.

For security reasons, HR account is locked and its password is expired. So, we need to connect to SYSTEM account and unlock HR account and change its password using the following commands from command prompt:

  1. Connect to system account with its password (oracle in my case) using sqlplus. Name localhost means Oracle is running on the current system, 1521 is port number and XEPDB1 is database name. All these are default and should work in your systems unless you configure Oracle differently.

    >sqlplus system/oracle@localhost:1521/XEPDB1
    SQL*Plus: Release - Production on Wed Mar 17 15:16:55 2021
    Copyright (c) 1982, 2018, Oracle.  All rights reserved.
    Last Successful login time: Wed Mar 17 2021 15:16:05 +05:30
    Connected to:
    Oracle Database 18c Express Edition Release - Production
  2. Once you are connected, unlock HR account and change its password as follows:

    SQL> alter user hr account unlock;
    User altered.
    SQL> alter user hr identified by hr;
    User altered.
  3. Now you can connect to HR account as follows:

    SQL> connect hr/hr@localhost:1521/XEPDB1
    SQL> select tname from tab;
    8 rows selected.

That's all you have to do to unlock and connect to HR account. Use the same connection string to connect from Oracle SQL Developer and other tools.