Files
ROMFASTSQL/proxmox/lxc108-oracle/roa-windows-setup/docs/00-INSTALL-ORACLE-XE.md
Claude Agent 6410339196 feat(clienti): add Oracle XE PDB recreare scripts and audit cleanup
- Complete PDB export/import workflow (16 scripts in clienti/oracle-xe-21c/import/)
- Recreare PDB script with step-by-step guide (recreare_pdb.sql)
- Universal audit cleanup script for Oracle XE 11g-21c (cleanup_audit.sql)
- Troubleshooting guide with all lessons learned (depanare-ora-12954-spatiu.md)
- Fixed: DIRECTORY grant syntax, DBMS_LOCK grant, remap_tablespace USERS:ROA,
  impdp quoted AS SYSDBA for Windows, AWR retention 8 days, datafile full path
- Updated roa-windows-setup docs with XE prevention steps and gotchas table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:31:17 +00:00

8.8 KiB

Installing Oracle 21c Express Edition on Windows

Overview

Oracle 21c Express Edition (XE) is free to use with the following limitations:

  • 2 CPU threads
  • 2 GB RAM for database
  • 12 GB user data

For ROA installations with up to 50 companies, XE is sufficient.


Download

  1. Go to Oracle XE Downloads: https://www.oracle.com/database/technologies/xe-downloads.html

  2. Download OracleXE213_Win64.zip (~1.5 GB)

    • Requires Oracle account (free registration)
  3. Verify download integrity (optional):

    Get-FileHash OracleXE213_Win64.zip -Algorithm SHA256
    

System Requirements

Requirement Minimum Recommended
OS Windows 10/11, Server 2016+ Windows Server 2019+
RAM 4 GB 8 GB
Disk 15 GB 50 GB
CPU 2 cores 4 cores

Installation

Step 1: Extract ZIP

Expand-Archive OracleXE213_Win64.zip -DestinationPath C:\OracleXE_Install

Step 2: Run Installer

  1. Open Command Prompt or PowerShell as Administrator

  2. Navigate to extracted folder:

    cd C:\OracleXE_Install\Disk1
    
  3. Run setup:

    .\setup.exe
    

Step 3: Installation Wizard

  1. Welcome Screen - Click Next

  2. License Agreement - Accept and click Next

  3. Oracle Home Location

    • Default: C:\app\oracle\product\21c\dbhomeXE
    • Keep default unless disk space is an issue
  4. Database Passwords

    • Enter password for SYS and SYSTEM: romfastsoft
    • Confirm password
    • Important: Remember this password!
  5. Summary - Review and click Install

  6. Installation Progress - Wait (~10-20 minutes)

  7. Finish - Note the connection information:


Post-Installation Configuration

Verify Services Running

Open Services (services.msc) and verify:

Service Status Startup Type
OracleServiceXE Running Automatic
OracleOraDB21Home1TNSListener Running Automatic

Or via PowerShell:

Get-Service Oracle* | Format-Table Name, Status, StartType

Test Connection

# Set Oracle environment
$env:ORACLE_HOME = "C:\app\oracle\product\21c\dbhomeXE"
$env:PATH = "$env:ORACLE_HOME\bin;$env:PATH"

# Test connection to CDB
sqlplus system/romfastsoft@localhost:1521/XE

# Test connection to PDB (for applications)
sqlplus system/romfastsoft@localhost:1521/XEPDB1

Expected output:

Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL>

CDB/PDB Architecture

Oracle XE uses Container Database (CDB) architecture:

+---------------------------------------------+
|              CDB: XE                        |
|  +---------------------------------------+  |
|  |  CDB$ROOT - System, SYS objects       |  |
|  +---------------------------------------+  |
|  +---------------------------------------+  |
|  |  PDB$SEED - Template (read-only)      |  |
|  +---------------------------------------+  |
|  +---------------------------------------+  |
|  |  XEPDB1 - Application Data (ROA)      |  |
|  +---------------------------------------+  |
+---------------------------------------------+
Container Purpose Connect To
XE (CDB$ROOT) Administration, SYS Admin only
XEPDB1 Application data ROA applications

Important: Always connect to XEPDB1 for ROA operations, not XE!


Verify PDB Status

-- Connect as SYSDBA
sqlplus sys/romfastsoft@localhost:1521/XE as sysdba

-- Check PDB status
SELECT name, open_mode FROM v$pdbs;

-- Expected output:
-- NAME      OPEN_MODE
-- --------- ----------
-- PDB$SEED  READ ONLY
-- XEPDB1    READ WRITE

If XEPDB1 is MOUNTED (not READ WRITE):

ALTER PLUGGABLE DATABASE XEPDB1 OPEN;
ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE;

Ce NU trebuie făcut manual

Următoarele sunt create automat de scriptul 01-setup-database.ps1:

Component Script
Tablespace ROA 01-setup-database.ps1
DMPDIR directory 01-setup-database.ps1
Password profile (UNLIMITED) 01-setup-database.ps1
User CONTAFIN_ORACLE 01-setup-database.ps1
sqlnet.ora (client vechi) 01-setup-database.ps1

NU rula manual comenzile SQL pentru acestea - scripturile le fac automat!


Enterprise Manager Express

Access EM Express web interface:

https://localhost:5500/em/

Login:

  • Username: system
  • Password: romfastsoft
  • Container: XEPDB1 (or leave empty for CDB)

Memory Configuration

Check current memory settings:

SHOW PARAMETER memory;
SHOW PARAMETER sga;
SHOW PARAMETER pga;

XE defaults (cannot exceed due to license):

  • SGA: 2 GB max
  • PGA: 2 GB max

For better performance within limits:

-- Automatic memory management
ALTER SYSTEM SET MEMORY_TARGET = 2G SCOPE = SPFILE;
ALTER SYSTEM SET MEMORY_MAX_TARGET = 2G SCOPE = SPFILE;

Troubleshooting

OracleServiceXE Not Starting

  1. Check Windows Event Viewer for errors
  2. Verify disk space (need 15+ GB free)
  3. Check Oracle alert log:
    Get-Content C:\app\oracle\diag\rdbms\xe\XE\trace\alert_XE.log -Tail 50
    

Cannot Connect to XEPDB1

-- Connect to CDB
sqlplus sys/romfastsoft@localhost:1521/XE as sysdba

-- Check PDB status
SELECT name, open_mode FROM v$pdbs;

-- Open if mounted
ALTER PLUGGABLE DATABASE XEPDB1 OPEN;
ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE;

ORA-12514: TNS listener does not know of service

# Check listener status
lsnrctl status
lsnrctl services

# Restart listener
lsnrctl stop
lsnrctl start

Uninstall Oracle XE

If needed, run the universal installer in deinstall mode:

C:\app\oracle\product\21c\dbhomeXE\deinstall\deinstall.bat

Or via Control Panel > Programs and Features.


Post-Installation: Preventie ORA-12954 (OBLIGATORIU!)

Oracle XE are limita de 12 GB. Fara aceste setari, SYSAUX creste automat pana la limita (SQL Tuning Sets, audit trail).

Conecteaza-te la PDB-ul XEPDB1 ca SYS si ruleaza:

sqlplus sys/romfastsoft@localhost:1521/XEPDB1 as sysdba

-- 1. Dezactiveaza auto tasks care umfla SYSAUX
EXEC DBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'sql tuning advisor', operation => NULL, window_name => NULL);
EXEC DBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'auto space advisor', operation => NULL, window_name => NULL);

-- 2. Dezactiveaza audit policies (umfla AUDSYS)
NOAUDIT POLICY ORA_SECURECONFIG;
NOAUDIT POLICY ORA_LOGON_FAILURES;

-- 3. AWR retention minim (8 zile - limita moving window baseline)
EXEC DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(retention => 8*24*60, interval => 60);
EXEC DBMS_STATS.ALTER_STATS_HISTORY_RETENTION(7);

-- 4. Grant DBMS_LOCK (necesar pentru PACK_UTILS_FILE)
GRANT EXECUTE ON SYS.DBMS_LOCK TO CONTAFIN_ORACLE;

-- 5. Verificare
SELECT client_name, status FROM dba_autotask_client;
SELECT policy_name, enabled_option FROM audit_unified_enabled_policies;

IMPORTANT: Fara acesti pasi, baza de date va atinge limita de 12 GB in cateva luni! Vezi clienti/oracle-xe-21c/depanare-ora-12954-spatiu.md pentru ghid complet de depanare.


Gotchas Oracle XE 21c (Windows)

Problema Solutie
ORA-02236: invalid file name la CREATE TABLESPACE Specifica path complet: DATAFILE 'C:\...\ROA01.DBF'
ORA-00959: tablespace 'USERS' does not exist la impdp Adauga remap_tablespace=USERS:ROA
ORA-00942 la GRANT pe DIRECTORY Foloseste GRANT READ, WRITE ON DIRECTORY dir_name nu ON SYS.dir_name
PLS-00201: DBMS_LOCK must be declared GRANT EXECUTE ON SYS.DBMS_LOCK TO CONTAFIN_ORACLE
ORA-65066 la ALTER USER SYSTEM pe PDB SYSTEM e common user, modifica din CDB$ROOT
ORA-28000: account is locked la impdp cu SYSTEM Foloseste SYS AS SYSDBA: impdp "sys/pass@XEPDB1 AS SYSDBA"
impdp AS SYSDBA nu functioneaza pe Windows Pune in ghilimele: impdp "sys/pass@XEPDB1 AS SYSDBA"
ORA-13541 la AWR retention Retention trebuie >= 8 zile (moving window baseline)

Next Steps

After Oracle XE installation:

  1. Copy config.example.ps1 to config.ps1
  2. Edit config.ps1 with your settings
  3. Run 01-setup-database.ps1
  4. Run the post-installation prevention steps above!

See main README.md for complete workflow.


Last Updated: 2026-03-24 Project: ROMFASTSQL - Oracle XE Installation Guide