Oracle 21c XE Usage Guide | Generated by AI
Question: How to use Oracle Database 21c Express Edition (XE)?
Answer:
Oracle XE 21c is a lightweight free Oracle database for development/testing. The typical workflow is:
Install XE
↓
Start database service
↓
Connect with SQL*Plus / SQL Developer
↓
Create user/schema
↓
Create tables
↓
Connect from Java/Python apps
Oracle XE 21c creates:
- Container database:
XE - Pluggable database:
XEPDB1 - Listener: default port
1521 - Enterprise Manager Express: usually
5500(Oracle Docs)
1. Install Oracle Database XE 21c
Windows
Download and run installer:
setup.exe
Run as Administrator. The installer creates database SID:
XE
and asks you to set passwords for:
SYS
SYSTEM
PDBADMIN
2. Check Oracle services
Windows:
Win + R
services.msc
Find:
OracleServiceXE
OracleOraDB21Home*TNSListener
Start them.
(Oracle)
3. Connect using SQL*Plus
Open terminal:
sqlplus / as sysdba
You should see:
SQL>
Check database:
select name from v$database;
Output:
XE
Check PDB:
show pdbs;
Example:
CON_ID CON_NAME OPEN MODE
2 XEPDB1 READ WRITE
4. Open PDB if needed
Oracle 21c uses multitenant architecture.
Login:
sqlplus / as sysdba
Run:
alter pluggable database XEPDB1 open;
Make it auto-open:
alter pluggable database XEPDB1 save state;
5. Create application user
Do not use SYSTEM for applications.
Switch to PDB:
alter session set container=XEPDB1;
Create user:
create user app identified by password123;
Grant permissions:
grant connect, resource to app;
For development:
grant unlimited tablespace to app;
6. Connect as your user
Connection string:
username: app
password: password123
host: localhost
port: 1521
service: XEPDB1
SQL*Plus:
sqlplus app/password123@localhost:1521/XEPDB1
7. Create tables
Example:
create table users (
id number generated by default as identity,
name varchar2(100),
email varchar2(200),
created_at timestamp default current_timestamp,
primary key(id)
);
Insert:
insert into users(name,email)
values('Alice','alice@test.com');
commit;
Query:
select * from users;
8. Use Oracle from Java Spring Boot
Maven:
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>23.8.0.25.04</version>
</dependency>
application.yml
spring:
datasource:
url: jdbc:oracle:thin:@localhost:1521/XEPDB1
username: app
password: password123
driver-class-name: oracle.jdbc.OracleDriver
jpa:
database-platform: org.hibernate.dialect.OracleDialect
Then:
@Entity
class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
String name;
}
9. Use Oracle SQL Developer
Install:
Oracle SQL Developer
Create connection:
Name:
XE Local
Username:
app
Password:
password123
Hostname:
localhost
Port:
1521
Service name:
XEPDB1
Test:
Success
10. Useful DBA commands
Show users
select username from dba_users;
Show tables
select table_name from user_tables;
Current user
show user;
Shutdown
shutdown immediate;
Startup
startup;
11. Docker option (often easier)
For development, Oracle XE in Docker is usually cleaner:
docker run \
-d \
--name oracle21c \
-p 1521:1521 \
-e ORACLE_PASSWORD=<PASSWORD> \
gvenzl/oracle-xe
Connect:
localhost:1521/XEPDB1
For a Java/Spring engineer, the learning path I would use:
SQL basics
↓
Oracle schema/user model
↓
PLSQL procedures
↓
Indexes + execution plans
↓
Spring Boot + Oracle JDBC
↓
Oracle RAC/Data Guard concepts
Oracle is still common in banking/enterprise systems, especially with Java stacks. (Oracle)
References:
- Oracle Database XE 21c Installation Guide (Oracle Docs)
- Oracle XE Quick Start (Oracle)
