Oracle 12c docker setup on Apple M1 - oracle

I am trying to run Oracle db in docker on M1 Mac. I have tried images from both store/oracle/database-enterprise:12.2.0.1-slim and container-registry.oracle.com/database/enterprise:12.2.0.1-slim but getting the same error.
docker run -d -it --name oracle -v $(pwd)/db/oradata:/ORCL store/oracle/database-enterprise:12.2.0.1-slim
I also tried non-slim version and by providing the --platform linux/amd64 to the docker command. Result is same.
Here's the result of docker logs -f oracle
Setup Oracle Database
Oracle Database 12.2.0.1 Setup
Sat Jul 31 18:44:14 UTC 2021
Check parameters ......
log file is : /home/oracle/setup/log/paramChk.log
paramChk.sh is done at 1 sec
untar DB bits ......
log file is : /home/oracle/setup/log/untarDB.log
untarDB.sh is done at 29 sec
config DB ......
log file is : /home/oracle/setup/log/configDB.log
Sat Jul 31 18:44:42 UTC 2021
Start Docker DB configuration
Call configDBora.sh to configure database
Sat Jul 31 18:44:42 UTC 2021
Configure DB as oracle user
Setup Database directories ...
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 31 18:44:43 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][#<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][#<connect_identifier>]
Enter user-name: Enter password:
ERROR:
ORA-12547: TNS:lost contact
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
update password
Enter password for SYS:
create pdb : ORCLPDB1
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 31 18:44:43 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][#<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][#<connect_identifier>]
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][#<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][#<connect_identifier>]
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
Reset Database parameters
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 31 18:44:43 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][#<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][#<connect_identifier>]
Enter user-name: Enter password:
ERROR:
ORA-12547: TNS:lost contact
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 31-JUL-2021 18:44:44
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/989db909d8df/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 31-JUL-2021 18:44:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/989db909d8df/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
DONE!
Remove password info
Docker DB configuration is complete !
ERROR : config DB failed, please check log /home/oracle/setup/log/configDB.log for details!
OS process OFSD (ospid 188) idle for 30 seconds, exiting
2017-08-09T10:36:20.752530+00:00
ARCH: Archival disabled due to shutdown: 1090
Shutting down archive processes
Archiving is disabled
JIT: pid 563 requesting stop
2017-08-09T10:36:20.815635+00:00
Stopping background process VKTM
2017-08-09T10:36:26.581058+00:00
Instance shutdown complete (OS id: 563)
/usr/bin/tail: inotify cannot be used, reverting to polling: Function not implemented
Is it the issue with M1 or I my configuration

Oracle Database on M1 Mac
This is a doozy.. Oracle Database isn't supported on MacOS, however, with Docker virtualizing linux, it can be. Unfortunately, even though Docker supports M1 Mac ARM virtualization, Oracle Database relies heavily on some low level kernel calls that Docker and Rosetta 2 can't handle. This leads us to the only possible solution to run locally: Using full emulation (a virtual machine).
Install Lima with HomeBrew. Lima is a sort of unofficial "macOS subsystem for Linux" with support for running VMs with different architecture (like running an x86 OS on top of ARM MacOS):
brew install lima
Create a new Impish Ubuntu (default) Virtual Machine:
limactl start
Select Open an editor to override the configuration.
Using the default editor (vi) modify the arch field to the following (i to enter insert mode, make the change, ESC to enter command mode, :wq to exit and save).
arch: "x86_64"
Run the newly created default Lima VM, and change directories to the new VM's home directory. (All commands past this should be run in the newly started shell unless specified otherwise).
lima
cd ~
Install Docker for Ubuntu in the Lima VM.
Add your user to the docker group, and activate the changes to be able to run docker commands without root access:
sudo usermod -aG docker $USER
newgrp docker
Run Image from docker hub
docker login
docker run -d -p 1521:1521 --name oracle store/oracle/database-enterprise:12.2.0.1
Connect with default values
username/password#SID: sys/Oradoc_db1#ORCLCDB

If someone is still struggling with this one, I found a better and straight forward solution:
Install homebrew
https://brew.sh/
Install Colima
brew install colima
Install docker
brew install docker
Start Colima by setting up x86_64 architecture
colima start --memory 8 --arch x86_64
Test docker
docker run hello-world
Note: You should clean everything related to docker from your system along with docker desktop, with this you do not need docker desktop

After investing some time on it, here is what I tested and worked and didn't work for me.
Lima - For me it didn't work.
From what I got, Lima is a qemu wrapper. So in theory it should work, but I had same problems as the ones described on this open issue:
https://github.com/lima-vm/lima/issues/713#issuecomment-1064151675
Multipass - Didn't work.
Multipass is an Ubuntu's vm. The problem is that it does not support cross architecture for now. You will only be able to create vms for the same architecture (aarch64) and oracle won't run on it.
Qemu directly.
This is the only option that worked for me, if you are interested on the steps here it is:
brew install qemu utm
obs.: utm is a graphical tool to run qemu without having to know its complicated commands.
Download an amd64 linux iso of your preference.
In my case it was an ubuntu server (just make sure it is for amd64)
On utm create a new emulator and select the image you downloaded
I've selected for the machine architecture the first one available (label with 2009), there is one tagged with a (default) but it is too slow - avoid this one.
2 cores for cpu, 4G mem was enough for me.
For the shared folder, it is not a very straight forward the way to access it, so in the end scp was enough for file transfer between host/guest machines.
Once you have passed the installation process and have logged in, install docker:
https://docs.docker.com/engine/install/ubuntu/
extra: sudo apt-get install docker-compose
Load your oracle docker image and run it.
If you have any volume configured you need to remember to give access permission to it (chmod)
Enjoy :)

I used Colima on my m2 Macbook air and it works perfectly
brew install colima
brew install docker
colima start --memory 4 --arch x86_64
docker run -e ORACLE_PASSWORD=pass -p 1521:1521 -d gvenzl/oracle-xe

There are two issues here:
Oracle Database is not supported on ARM processors, only Intel. See here: https://github.com/oracle/docker-images/issues/1814
Oracle Database Docker images are only supported with Oracle Linux 7 or Red Hat Enterprise Linux 7 as the host OS. See here: https://github.com/oracle/docker-images/tree/main/OracleDatabase/SingleInstance
Oracle Database ... is supported for Oracle Linux 7 and Red Hat Enterprise Linux (RHEL) 7. For more details please see My Oracle Support note: Oracle Support for Database Running on Docker (Doc ID 2216342.1)
The referenced My Oracle Support Doc ID goes on to say that the database binaries in their Docker image are built specifically for Oracle Linux hosts, and will also work on Red Hat. That's it.
Because Docker provides process level virtualization it still pulls kernel and other OS libraries from the underlying host OS. A Docker image built for Oracle Linux needs an Oracle Linux host; it doesn't bring the Oracle Linux OS with it. Only Oracle Linux or Red Hat Linux are supported for any Oracle database Linux installation, with or without Docker. Ubuntu, Mac OS, Debian, or any other *NIX flavor will not provide predictable reliable results, even if it is hacked into working or the processes appear to work normally.

Here is worked for me:
You cannot change the CDB name
It is hardwired to use a domain name
The password must mixed-case 8 characters or more with a special character
docker run -d --name 12c \
--privileged \
--memory=4096M \
-p 1512:1521/tcp -p 5512:5500/tcp \
-e DB_SID=ORCLCDB \
-e DB_PDB=ORCLPDB \
-e DB_DOMAIN=localdomain \
-e DB_PASSWD=Password#2 \
-v ${HOME}/containers/storage/oracle/EE12201/u02/app/oracle:/ORCL/u02/app/oracle \
-v ${HOME}/containers/storage/oracle/EE12201/u03/app/oracle:/ORCL/u03/app/oracle \
-v ${HOME}/containers/storage/oracle/EE12201/u04/app/oracle:/ORCL/u04/app/oracle \
container-registry.oracle.com/database/enterprise:12.2.0.1

Related

Error when trying to run Memgraph under Ubuntu on WSL: "System has not been booted with systemd as init system (PID 1). Can't operate."

My setup is Windows 11 with WSL2 and Ubuntu 22.04.1 LTS (GNU/Linux 5.15.79.1-microsoft-standard-WSL2 x86_64). I'm following the instructions for installing Memgraph on Ubuntu
but I keep getting the error:
mike#wks1:~$ wget https://download.memgraph.com/memgraph/v2.5.1/ubuntu-22.04/memgraph_2.5.1-1_amd64.deb
--2023-01-27 09:26:51-- https://download.memgraph.com/memgraph/v2.5.1/ubuntu-22.04/memgraph_2.5.1-1_amd64.deb
Resolving download.memgraph.com (download.memgraph.com)... 172.67.130.22, 104.21.7.96, 2606:4700:3034::6815:760, ...
Connecting to download.memgraph.com (download.memgraph.com)|172.67.130.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17578738 (17M) [application/x-www-form-urlencoded]
Saving to: ‘memgraph_2.5.1-1_amd64.deb’
memgraph_2.5.1-1_amd64.deb 100%[=================================================>] 16.76M 18.3MB/s in 0.9s
2023-01-27 09:26:52 (18.3 MB/s) - ‘memgraph_2.5.1-1_amd64.deb’ saved [17578738/17578738]
mike#wks1:~$ sudo dpkg -i memgraph_2.5.1-1_amd64.deb
[sudo] password for mike:
Selecting previously unselected package memgraph.
(Reading database ... 24112 files and directories currently installed.)
Preparing to unpack memgraph_2.5.1-1_amd64.deb ...
Unpacking memgraph (2.5.1-1) ...
Setting up memgraph (2.5.1-1) ...
Don't forget to switch to the 'memgraph' user to use Memgraph
......+.....+.+........+......+...+...+.......+......+......+.........+.........+...+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*......+...+...+...+............+...+.......+...+...........+...+.+.........+...+...+...........+...+.......+...............+...+.....+......+.+...+......+..+...............+.............+..+....+...+.....+.+.....+.......+..............+.+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+.+........+......+.+........+............+.............+.............................+......+..........+......+......+........+......+...............+..........+...........+.........+...+.......+.....+...+................+.....+..........+......+....................+.+............+................................+...+.+..............+.+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
..............+..+......+....+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...+....+.....+.......+............+...+........+.......+........+.........+...+...+.+.....+.............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+..+..........+...+......+...........+....+...............+.....+...+.......+.....+...+..........+...+............+........+.......+.....+.+.........+..+...+.+.....+..........+..+.........+............................+..+.+.....+........................+.+................................+...+...+.+........+.......+.........+.....+.+...+...........+............+.......+..+.+..+................+.........+......+...........+.+..+.............+..+.+..+........................+....+..+.......+........+....+........+.......+......+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
Created symlink /etc/systemd/system/multi-user.target.wants/memgraph.service → /lib/systemd/system/memgraph.service.
mike#wks1:~$ sudo journalctl --unit memgraph
No journal files were found.
-- No entries --
mike#wks1:~$ sudo systemctl start memgraph
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
I've tried all of the tips that I got by Googling, but non of them didn't work. When I dual boot into Ubuntu, I have no problems. What am I going wrong?
The procedure for installing Memgrap using WSL and Ubuntu is different than installing Memgraph directly onto Ubuntu. There is a notice in your output that says Don't forget to switch to the 'memgraph' user to use Memgraph.
The command for running Memgraph under WSL is:
sudo runuser -l memgraph -c '/usr/lib/memgraph/memgraph'
Take a look at the documentation on how to install MemgraphDB on Windows with WSL.

how to resolve Error when loading database in MariaDB in MAC terminal?

I am trying to use XAMPP in my mac SOURCE database which I stored in my mac desktop. When I connect the xampp and open the terminal and try to use the SOURCE command i have following screen with an error massage........
Linux debian 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Aug 4 02:29:53 2021 from 192.168.64.1
root#debian:~# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 38
Server version: 10.4.20-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> USE dhtest
Database changed
MariaDB [dhtest]> SOURCE /Users/kamrulhasan/Desktop/Database/dh.sql;
ERROR: Failed to open file '/Users/kamrulhasan/Desktop/Database/dh.sql', error: 2
MariaDB [dhtest]>

Unable to execute cr9idata.pl

Oracle Database Home patches installed successfully
Executing cr9idata.pl
Executing: perl /u01/db/VIS/12.1.0/nls/data/old/cr9idata.pl
Unable to execute cr9idata.pl
RW-50010: Error: - script has returned an error: 2
RW-50004: Error code received when running external process. Check log file for details.
Running Database Install Driver for VIS instance
I executed command in terminal with root account:
[root#ntcs ~]# perl /u01/db/VIS/12.1.0/nls/data/old/cr9idata.pl
Directory /u01/db/VIS/12.1.0/nls/data/9idata already exist. Overwriting...
Copying files to /u01/db/VIS/12.1.0/nls/data/9idata...
Copy finished.
Please reset environment variable ORA_NLS10 to /u01/db/VIS/12.1.0/nls/data/9idata!
Thanks advanced for helping !
After serveral day debugging. I found the reason is my oracle user error.
I installed perl into /home/oracle/perl5...then make oracle user error.
I cannot su oracle from root user.
when i install perl for oracle user then .bashrc of oracle user auto add two routine line:
eval perl -I ~/perl5/lib/perl5 -Mlocal::lib
export MANPATH=$HOME/perl5/man:$MANPATH
I just remove above two lines above then i can su oracle from root user.
Conclusion:
When you install Oracle EBS 12.2.0 on CentOS 7.3. rapidwiz tool will su to oracle user automatically to install DB. But our oracle error cannot be su to so make error. But it show the symtom very strange so it is difficult to debug.
Now i install Oracle EBS 12.2 sucessfully !
I am very happy to share this to anyone meet this error.
I am installing EBS 12 at the moment.
Looking a bit deeper into the logs for the cr9idata.pl script, I saw that this error is caused by a missing Perl module. The Perl version that is installed with Oracle includes this library, so setting the path manually works in that case.
If you (like me) have installed Perl from YUM, install this module: perl-File-CheckTree

boot2docker vm forgets changes when restarted

Basically any changes I make while SSHed into the VM are lost at restart of the VM. I am assuming the problem is associated with the error when I stop the VM.
C:\Users\Tom>boot2docker stop
error in run: Failed to stop machine "boot2docker-vm": exit status 1
But, I may just be doing something dumb.
The sequence I followed is below (docker logo elided), you can see it losing the sample directory across the restart.
C:\Users\Tom>boot2docker up
Waiting for VM and Docker daemon to start.......................ooo
Started.
Writing C:\Users\Tom\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\Tom\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\Tom\.boot2docker\certs\boot2docker-vm\key.pem
Docker client does not run on Windows for now. Please use
"boot2docker" ssh
to SSH into the VM instead.
C:\Users\Tom>boot2docker ssh
Boot2Docker version 1.5.0, build master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015
Docker version 1.5.0, build a8a31ef
docker#boot2docker:~$ ls
boot2docker, please format-me
docker#boot2docker:~$ mkdir testdir
docker#boot2docker:~$ ls
boot2docker, please format-me testdir/
docker#boot2docker:~$ exit
C:\Users\Tom>boot2docker stop
error in run: Failed to stop machine "boot2docker-vm": exit status 1
C:\Users\Tom>boot2docker status
poweroff
C:\Users\Tom>boot2docker start
Waiting for VM and Docker daemon to start...
....................ooo
Started.
Writing C:\Users\Tom\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\Tom\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\Tom\.boot2docker\certs\boot2docker-vm\key.pem
Docker client does not run on Windows for now. Please use
"boot2docker" ssh
to SSH into the VM instead.
C:\Users\Tom>boot2docker ssh
Boot2Docker version 1.5.0, build master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015
Docker version 1.5.0, build a8a31ef
docker#boot2docker:~$ ls
boot2docker, please format-me
docker#boot2docker:~$
Running
Windows: 8.1
VirtualBox: 4.3.12 r93733
Boot2Docker version 1.5.0, build master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015
Docker version 1.5.0, build a8a31ef
That is what I explained in "Windows Boot2Docker behind corporate proxy": there is no persistence in the Tiny Core used by boot2docker as a Linux VM.
You need to make sure the VirtualBox has the Oracle_VM_VirtualBox_Extension_Pack downloaded and added in the Virtual Box / File / Settings / Extension / add the Oracle_VM_VirtualBox_Extension_Pack-4.x.yy-zzzzz.vbox-extpack file).
As documented in boot2docker, you will have access (from your Tiny Core ssh session) to /c/Users/<yourLogin> (ie the %USERPROFILE% is shared by Virtual Box)
What I do in my b2d.bat start script is copy the files I want to be restored (mainly docker profile or .ashrc, for http_proxy settings and favorite aliases), and keep all my other modifications in /c/Users/<yourLogin>.

Installing docker with devstack

I am trying to install devstack and docker (http://devstack.org/guides/single-machine.html) onto a VM containing Ubuntu 13.10 Server. devstack contains a docker installer script in tools/docker/install_docker.sh which it is recommended to run first before running the stack.sh installer script for devstack. I have patched the docker install script according to the bug report https://bugs.launchpad.net/devstack/+bug/1237581 however docker still reports a problem:
socat[NNNN] E connect(3, AF=1 "/var/run/docker.sock", 22): Connection refused
Does anyone know a fix for this problem?
Thanks,
David
If you get error messages regarding /var/run/docker.sock then either the docker daemon/service is not started or your user (devstack user) has no permissions.
Start docker:
service docker restart
Add your user (devstack user) to the docker group. Try to enumerate containers:
docker ps
If that still does not fix the problem then you might want to change the permission of /var/run/docker.sock directly:
sudo chown vagrant:vagrant /var/run/docker.sock
Check your kernel ( uname -a ) and make sure it is 3.8 or latest. Also, make sure you are on a 64bit Ubuntu ( X86_64 distribution ). The point is that the Docker daemon might not be starting (fails) because it is not supported on a 32 bit distribution.

Resources