This is about getting Oracle XE running on a Linux laptop, specifically my laptop. running Xubuntu, a variation on Ubuntu, but not the kind of variation that would mess up a database. Back in 2009 I was comfortable with Oracle XE, fairly comfortable anyway. But it seems installing Oracle on Linux has moved on to something much, much harder. I did get it working, though it took a lot of swearing.
First take a look at this, then assume you’re taking the third way, ie use Docker. You will need to install Docker if you haven’t already.
I did try the first option (twice actually) and it failed the same way both times, near the end (I think) with no diagnostics.
The details of the Docker image you use are here: https://registry.hub.docker.com/u/alexeiled/docker-oracle-xe-11g/
It is a 300MB download, and it is trivial to start. I did not have any success with the apex stuff though. It kept asking me for the same password over and over. But that is likely an Oracle thing rather than a Docker thing. I didn’t need apex, though. All I wanted to do was get a database running and import a known good backup to it.
With the docker image you already have the first part, all that remains is the import.
First, copy your dump to somewhere you can map easily, I used /tmp.
Now you need to modify your docker run command to look like this:
sudo docker run -d -p 49160:22
-p 49161:1521 -p 49162:8080
-v /tmp:/tmp alexeiled/docker-oracle-xe-11g
That makes docker map the tmp file on your host system as tmp on your docker image.
sudo ssh root@localhost -p 49160
–you’re logged into root on the docker image.
cp /tmp/*.dmp /u01/app/oracle/admin/XE/dpdump/
chmod o+rw /u01/app/oracle/admin/XE/dpdump/*.dmp
next start sqlplus and do the following:
create user platinum identified by mypassword;
create tablespace PLATINUM_DATA DATAFILE ‘tbs_f2.dbf’ SIZE 10M online;
alter database datafile ‘tbs_f2.dbf’ autoextend on maxsize unlimited;
The dump user is platinum and the dump has a tablespace of platinum_data. The only way I know to find this out is to try it before creating the tablespace, note the errors and then create what you need.
impdp system/oracle dumpfile=D16-platinum-previous.dmp logfile=impschema.log full=y
There are dozens of more complex variations of the impdp command but that seems to be all you really need. Your dmp file will be different to mine, of course.
Finally you should change the system password or it will expire:
(change the password to something other than oracle ‘cos it will expire)
And that is all you need.
But I have to add that I really dislike doing anything with Oracle. To do anything they expect you to have a depth of knowledge that a DBA ought to have, not a software developer. Lots of options, lots of complications which I’m sure makes everything run very fast, but if you can’t get it running at all (and I gave up on this more than once) then it is no use.
In the end the import was not too hard but it took me half a day to wade through the complexities and rat holes some simple documentation would fix. The actual install remains appalling, so I’m thankful for Docker.
My next task is cleaning up the debris left over from the failed installs….
But one more thing. If you restart your Docker image all the data will be gone, including the changed password. This might be a good thing in some cases but I wanted it to remember my import. For that I needed to make a new Docker image from the running one. It is quite simple. Follow the instructions under ‘commit’ on this page.