A comprehensive hands-on laboratory for advanced database concepts using Oracle Database, SQL Developer, and Docker containerization.
- Overview
- Prerequisites
- Getting Started
- SQL Developer Configuration
- Database Schema
- Usage Examples
- Troubleshooting
This repository provides a complete Docker-based Oracle Database environment for learning and practicing advanced database management concepts. It includes:
- π³ Dockerized Oracle Database XE
- π₯ HR Schema with realistic relational data model
- π§ SQL Developer integration
- π Comprehensive examples and exercises
Before you begin, ensure you have the following installed:
- Docker Desktop
- Oracle SQL Developer (optional, for GUI access)
- Basic understanding of SQL and relational databases
Use this approach if you want to create your own custom schema from scratch.
docker exec -it advanced_dbms bashsqlplus sys/oracle@XE as sysdbaALTER SESSION SET CONTAINER = XEPDB1;
SHOW CON_NAME;
SHOW PDBS;CREATE USER sandesh_csit IDENTIFIED BY sandesh_csit ACCOUNT UNLOCK;
GRANT CONNECT, RESOURCE, DBA TO sandesh_csit;sqlplus sandesh_csit/sandesh_csit@XEPDB1Verify your connection:
SHOW USER;Use this approach to quickly set up the complete HR demonstration schema.
docker cp "<PATH_TO_HR_SCHEMA_FOLDER>" advanced_dbms:/home/hrschemaExample (Windows):
docker cp "D:\Github\Advanced-DBMS\HR Schema\human_resources" advanced_dbms:/home/hrschemaExample (macOS/Linux):
docker cp ~/projects/advanced-dbms/hr-schema advanced_dbms:/home/hrschemadocker exec -it advanced_dbms sqlplus sys/oracle@XE as sysdbaInside SQL*Plus, execute:
@/home/hrschema/hr_install.sqldocker exec -it advanced_dbms sqlplus hr/hr@XETest the schema:
SELECT employee_id, first_name, last_name, job_id
FROM employees
WHERE ROWNUM <= 10;Connect to your Oracle Database using SQL Developer with the following settings:
| Parameter | Value |
|---|---|
| Connection Name | HR_XE (or custom name) |
| Username | hr |
| Password | hr |
| Hostname | localhost |
| Port | 1521 |
| Service Name | XE |
| Role | Default |
π‘ Tip: Enable "Save Password" for convenience, then click Test to verify the connection.
The HR schema implements a realistic organizational structure with the following tables:
REGIONS
ββ COUNTRIES
ββ LOCATIONS
ββ DEPARTMENTS βββ
ββ EMPLOYEES β
ββ JOBS β
ββββββββββ
ββ JOB_HISTORY
| Table | Description |
|---|---|
| REGIONS | Geographic regions (e.g., Americas, Europe, Asia) |
| COUNTRIES | Countries associated with regions |
| LOCATIONS | Physical office locations |
| JOBS | Job titles with salary ranges |
| DEPARTMENTS | Organizational departments |
| EMPLOYEES | Employee records with hierarchical relationships |
| JOB_HISTORY | Historical job assignments and transfers |
- β Sequences for auto-incrementing primary keys
- β Foreign key constraints for referential integrity
- β Indexes on frequently queried columns
- β Check constraints for data validation
- β Self-referential relationships (manager hierarchy)
-- Find employees in a specific department
SELECT e.first_name, e.last_name, d.department_name, j.job_title
FROM employees e
JOIN departments d ON e.department_id = d.department_id
JOIN jobs j ON e.job_id = j.job_id
WHERE d.department_name = 'IT';-- Display organizational hierarchy
SELECT LEVEL, employee_id, first_name, last_name, manager_id
FROM employees
START WITH manager_id IS NULL
CONNECT BY PRIOR employee_id = manager_id
ORDER SIBLINGS BY last_name;-- Average salary by department
SELECT d.department_name,
COUNT(e.employee_id) as employee_count,
ROUND(AVG(e.salary), 2) as avg_salary
FROM departments d
LEFT JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name
ORDER BY avg_salary DESC;# Check if container is running
docker ps
# Start the container if stopped
docker start advanced_dbms
# View container logs
docker logs advanced_dbms# Verify Oracle listener is running
docker exec -it advanced_dbms lsnrctl status
# Check database status
docker exec -it advanced_dbms sqlplus / as sysdba
SQL> SELECT status FROM v$instance;If you encounter permission errors:
-- Grant additional privileges
GRANT CREATE SESSION, CREATE TABLE, CREATE VIEW, CREATE SEQUENCE TO <username>;.
βββ HR Schema/
β βββ human_resources/
β βββ hr_install.sql
β βββ hr_schema.sql
β βββ hr_data.sql
β βββ hr_indexes.sql
βββ examples/
β βββ queries/
β βββ exercises/
βββ docker-compose.yml
βββ README.md
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is intended for educational purposes.
Happy Learning! π