Welcome! This repository provides a complete, portable environment for practicing SQL and PL/SQL using Oracle Database Express Edition (XE) on Docker. It is designed to work seamlessly with Visual Studio Code on Linux.
- Linux OS (Ubuntu, Fedora, Arch, etc.)
- Git
- Visual Studio Code
- Docker & Docker Compose
If you haven't installed Docker yet, run the command for your specific distribution.
sudo apt-get update
sudo apt-get install docker.io docker-compose -y
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USERsudo dnf install docker docker-compose -y
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USERsudo pacman -S docker docker-compose
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USERImportant: After running these commands, log out and log back in so your user permissions update.
-
Clone the Repository Open your terminal and download this project:
git clone https://github.com/LazzouziYoussefEtu/OracleMiniDataBaseOnDockerForRelationnalDatabasesPractice.git cd OracleMiniDataBaseOnDockerForRelationnalDatabasesPractice -
Start the Database We use
docker-composeto automate the startup and ensure your data is saved locally in theoracle-datafolder.docker-compose up -d
NB : keep in mind that the docker Container fetches the container image password from
docker-compose.yml, the propertyenvironement.ORACLE_PASSWORDWait about 1-2 minutes for the database to fully initialize.
-
Install Extensions Open VS Code (
code .) and install the following extensions from the Marketplace:- Oracle Developer Tools for VS Code (for connection and standard SQL).
- SQL Notebook (or a similar extension supporting
.sqlnbfor notebook practice).
-
Configure the Connection
- Click the Database Icon in the sidebar.
- Click the + (Plus) icon to add a connection.
- Enter the following details:
Field Value Connection Name OracleDockerUser Name SYSTEMPassword YourSecurePassword123(as defined in docker-compose)Role DefaultConnection Type BasicHost Name localhostPort 1521Service Name XE- Click Save and then Connect.
Use this method to initialize your database tables.
- Navigate to the
scripts/folder in the VS Code file explorer. - Open the
setup.sqlfile. Or change it to your liking (Optional). - Right-click anywhere in the editor and select Execute All.
- This will create your practice tables and insert your initial dummy data.
SQL Notebooks allow you to mix documentation (Markdown) with executable code blocks, which is perfect for learning PL/SQL logic.
-
Create a Notebook:
- Create a new file named
practice_plsql.sqlnb.
- Create a new file named
-
Add a Code Cell:
- Click + Code in the notebook interface.
- Select your
OracleDockerconnection from the dropdown menu on the cell.
-
Write PL/SQL: Paste a PL/SQL block into the cell:
DECLARE v_message VARCHAR2(50) := 'Hello from PL/SQL Notebook!'; BEGIN DBMS_OUTPUT.PUT_LINE(v_message); END; / -
Run the Cell:
- Click the Play button next to the cell.
- View the output directly below the code block.
To stop the database and free up resources:
docker-compose downTo restart it later (your data will still be there):
docker-compose up -d