Search code examples
sqloracleinstallationoracle-sqldeveloper

Installing Oracle on M1 without VM?


Is there a way to install oracle 12c on MacOS? Because I am able to install SQL Developer, but I obviously can't use it if I can't install Oracle.

Btw I don't want to use a VM because of the low performance on the M1 and the ARM Architecture.

PS: I also have a windows PC. On this machine I installed Oracle and it works perfectly fine. If there is a way that I can connect to this "Server" please leave a stack overflow link below.

STATUS des LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Startdatum                25-DEZ-2020 23:09:33
Uptime                    0 Tage 1 Std. 29 Min. 12 Sek.
Traceebene               off
Sicherheit                ON: Local OS Authentication
SNMP                      OFF
Parameterdatei des Listener C:\Users\Ben\Desktop\db_home\network\admin\listener.ora
Logdatei des Listener    D:\benOracle\diag\tnslsnr\DESKTOP-FT8E4S1\listener\alert\log.xml
Zusammenfassung Listening-Endpunkte...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DESKTOP-FT8E4S1)(PORT=5500))(Security=(my_wallet_directory=D:\BENORACLE\admin\orcl\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services ▄bersicht...
Dienst "52448234712340b69f274bcc790ecfe0" hat 1 Instanzen.
  Instanz "orcl", Status READY, hat 1 Handler f³r diesen Dienst...
Dienst "CLRExtProc" hat 1 Instanzen.
  Instanz "CLRExtProc", Status UNKNOWN, hat 1 Handler f³r diesen Dienst...
Dienst "cfc353defce0494a8a440e7d1f817c2d" hat 1 Instanzen.
  Instanz "orcl", Status READY, hat 1 Handler f³r diesen Dienst...
Dienst "orcl" hat 1 Instanzen.
  Instanz "orcl", Status READY, hat 1 Handler f³r diesen Dienst...
Dienst "orclXDB" hat 1 Instanzen.
  Instanz "orcl", Status READY, hat 1 Handler f³r diesen Dienst...
Dienst "orclpdb" hat 1 Instanzen.
  Instanz "orcl", Status READY, hat 1 Handler f³r diesen Dienst...
Der Befehl wurde erfolgreich ausgef³hrt.
LSNRCTL>```

Solution

  • Apologies for the wall of text in advance.

    1.Section for the windows installation. See section-2 below for docker setup (Assuming relative paths to DB_HOME which is generally under $INSTALL_DIRECTORY\product$RELEASE_VERSION$DB_HOME_NAME, ie D:\Oracle\DB\12201\i0\product\12.2.0\dbhome_1 where INSTALL_DIRECTORY=D:\Oracle\DB\12201\i0, RELEASE_VERSION=12.2.0, DB_HOME_NAME=dbhome_1) You need to be checking your listener.ora and tnsnames.ora file under $DB_HOME\network\admin\listener.ora and $DB_HOME\network\admin\tnsnames.ora (The latter is for having a alias for any native ojdbc client but it is good checksum to do testing with the tnsping etc.)

    With 12c desktop-type installation, you get two listener definitions.

    For the listener and tnsnames files, one-key point is to have the address of the machine setup properly. Unless you have the luxury of a static-ip, it is better have hostname based definitions which you can setup and switch around through your hosts file (C:\Windows\System32\drivers\etc\hosts, if you are opening with notepad) such as:

    127.0.0.1   MY-AWESOME-MACHINE
    

    where the $HOSTNAME in the following files will be "MY-AWESOME-MACHINE". Obviously, this is an alias for your ipv4 loopback address but you can set it up to be what is available to your Mac host for your VM's IP Address. So the IP address can change but you can just update the assignment your hosts file and restart your tns-listener service (OracleOraDB1Home1TNSListener if you did not temper with it). As a rule of thumb, I try to keep my custom hostname definitin aligned with the Windows physical or virtual machine's "Device Name" which can be set in Settings/System/About -> "Rename this PC"

    See the following.

    listener.ora should have:

    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = **$DB_HOME**)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:**$DB_HOME**\bin\oraclr12.dll")
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = **$HOSTNAME**)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
      )
    

    tnsnames.ora should preferably have:

    ORACLR_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
        )
        (CONNECT_DATA =
          (SID = CLRExtProc)
          (PRESENTATION = RO)
        )
      )
    
    LOCALORCLPDB=
      (DESCRIPTION=
        (ADDRESS=
          (PROTOCOL=TCP)
          (HOST=**$HOSTNAME**)
          (PORT=1521)
        )
        (CONNECT_DATA=
          (SERVER = DEDICATED)
          (SERVICE_NAME = ORCLPDB)
        )
      )
    

    2.Docker-based Container setup For a docker-based (18.06-ce) installation on setup on an EL7/EL7 machine, I use the following for my setup. I never had the chance to try it with M1 or let alone an ARM-ISA based machine but if it can help you, I am leaving it below.

    In order to obtain the image (container-registry.oracle.com/database/enterprise:12.2.0.1-slim) you need to sign-up to oracle container registry which requires an oracle account (You can create a free one) with which you access the website for the following: Login-to: https://container-registry.oracle.com Go-to: Browse Containers/Database @Database-Repositries-Page: Select Language, click "continue" in right-most column for "enterprise" repository. Agree to the prompt for development-only use. @Database-Repositries-Page: Click the "enterprise" under "repository" column. @Oracle-Database-Enterprise-Edition: Down below in the tags portion you can see the available images In-your-command-line-running-docker-engine(1): execute "docker login container-registry.oracle.com" In-your-command-line-running-docker-engine(2): you will be prompted for your oracle account username (e-mail) and password. paste-enter in order. Pull-the-image: docker pull container-registry.oracle.com/database/enterprise:12.2.0.1-slim

    Create the configuration file directory

    mkdir $HOME/dkr-oradb-ecfg
    

    Create Docker Volume directories

    mkdir -p $HOME/shared/DockerVolumes/ORA-DB/DB-ORA-SLIM-0
    
    # Create the credential file, it might not be able to override values so this rather more for reference, DO NOT USE in PRODUCTION especially for an instance with public access
    sh -c 'cat << EOF > $HOME/dkr-oradb-ecfg/db-ora-slim-0.env.list
    ORACLE_SID=orclcdb
    ORACLE_PDB=orclpdb1
    ORACLE_PWD=Oradoc_db1
    EOF'
    
    # Run the container
    # As a rule-of-thumb I try to forward the ports exposed from a container as much as I can, so you can opt to run with the defaults. The catch is, the forwarded ports should be allowed in via firewall (in case a firewall is present)
    docker run -d --name db-ora-slim-0 -p 32200:1521 -p 32201:5500 -v $HOME/shared/DockerVolumes/ORA-DB/DB-ORA-SLIM-0:/opt/oracle/oradata --env-file $HOME/dkr-oradb-ecfg/db-ora-slim-0.env.list container-registry.oracle.com/database/enterprise:12.2.0.1-slim
    

    You should be able to connect to the CDB with SID (ip-address:32200:orclcdb) or PDB(ip-address:32200/orclpdb1) with service name.