Got Oracle XE 21c running on TrueNAS Scale in <5 minutes. Here's how

I’m not a huge Oracle user or fan, but for kicks, I thought I’d see how long it would take me to bring the Oracle XE 21c docker image up on TrueNAS scale.

Answer: only a few minutes to get the basics, but several hours to figure out how to work around the ORA-00821 bug.

Here are the tricks to create the Custom app:

  1. Home page for the docker image is found by typing “express” in the search box. Then click express in the search result to get the info page. Oracle creates a dynamic link for this page.
  2. Image repo:
  3. Image tag: latest
  4. Map port 1521 to 9000 (it won’t let you map to a lower port number)
  5. Map /opt/oracle/oradata to the zfs dataset you created to hold the oracle data. Make sure owner and group are 54321 (oracle). Using credential manager, create an oinstall group (54321), then create the oracle user (54321) with oinstall as the primary group.
  6. Use the pod shell and run the setPassword script with the password to set it to so you can connect and create your user(s). You only have to do this once. Once your user is created, login with that user.
  7. Wait until it is running (it has to set everything up which takes 10 to 15 minutes)
  8. You can then login as SYS (role SYSDBA) using that password you set. I used VS Code with the SQL Developer extension:
  9. Create a new user(s) and passwords.

Your startup WILL FAIL if you have too many CPU cores on your system. You cannot simply set CPUs to 2 in the config file. See this bug.: ORA-00821: Specified value of sga_target is too small. This bug has existed for 4 years now.

I couldn’t figure out how to modify the CPU_COUNT parameter in the image and since truenas uses k3s, it’s not like you can modify an existing container and restart it since k3s always will create a fresh container.

THE FIX: So what I ended up doing (that worked) is I mapped my oracle dataset to /truenas rather than /opt/oracle/oradata so it would start without the error. Then in the pod shell, I did a recursive cp of everything in the oradata directory (including the .XE.created file) to /truenas.

Then I reconfigured the chart to map my now initialized dataset to /opt/oracle/oradata and it worked! So if the database is already initialized, it skips the CPU check!

A fresh Oracle system uses only around 500MB of RAM.

I hope the hours I spent figuring this workaround will help the next person. You’ll only encounter the problem if you have more than around 24 cores (I have 48).

1 Like