<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ayan Dhara</title>
    <description>The latest articles on DEV Community by Ayan Dhara (@ayandhara).</description>
    <link>https://dev.to/ayandhara</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F589225%2F75130e58-7755-4a57-ae04-fdf984226ab0.png</url>
      <title>DEV Community: Ayan Dhara</title>
      <link>https://dev.to/ayandhara</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ayandhara"/>
    <language>en</language>
    <item>
      <title>Installing Oracle DB 11g on linux using Docker</title>
      <dc:creator>Ayan Dhara</dc:creator>
      <pubDate>Mon, 28 Mar 2022 15:33:21 +0000</pubDate>
      <link>https://dev.to/ayandhara/installing-oracle-db-11g-on-docker-2n94</link>
      <guid>https://dev.to/ayandhara/installing-oracle-db-11g-on-docker-2n94</guid>
      <description>&lt;p&gt;Oracle DB is one of the most popular Database Software&lt;/p&gt;

&lt;p&gt;Here I am going to show how to install Oracle DB 11g an older but easy to use version on linux in a docker container.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Setup Docker
&lt;/h3&gt;

&lt;p&gt;So first let's install docker:-&lt;/p&gt;

&lt;p&gt;debian based systems&lt;br&gt;
&lt;code&gt;sudo apt install docker.io&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;arch based systems:-&lt;br&gt;
&lt;code&gt;sudo pacman -S docker&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now it's time to start with it&lt;/p&gt;

&lt;p&gt;You need add current user to docker group&lt;br&gt;
&lt;code&gt;sudo usermod -aG docker $USER&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then reboot or relogin your mechine or run&lt;br&gt;
&lt;code&gt;newgrp docker&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Add swap space
&lt;/h3&gt;

&lt;p&gt;now you need to have enough swap space for installing oracle DB.&lt;br&gt;
Minimum 2GiB is required.&lt;br&gt;
But it will be better to add swap space equel to total ram of the mechine.&lt;br&gt;
(&lt;em&gt;If you already have swap space added you can skip to Oracle Linux Installation&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;create a swap file&lt;br&gt;
&lt;code&gt;sudo fallocate -l 4G /swapfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;set permissions &lt;br&gt;
&lt;code&gt;sudo chmod 600 /swapfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;set swap area and activate&lt;br&gt;
&lt;code&gt;sudo mkswap /swapfile&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sudo swapon /swapfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;swap space will be deactivate on reboot.&lt;br&gt;
to actvate automatically on reboot add&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;/swapfile swap swap defaults 0 0&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;this line to &lt;code&gt;/etc/fstab&lt;/code&gt;&lt;br&gt;
using editor or by&lt;br&gt;
&lt;code&gt;sudo nano /etc/fstab&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;now to verify swap added successfully run&lt;br&gt;
&lt;code&gt;sudo swapon --show&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Install or add oracle db to docker
&lt;/h3&gt;

&lt;p&gt;To pull oracle db image from docker repo and run it &lt;br&gt;
&lt;code&gt;docker run -d oracleinanutshell/oracle-xe-11g&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But you need to expose necessary ports.&lt;br&gt;
Default port for Express WebApp is &lt;code&gt;8080&lt;/code&gt; and Database will run on &lt;code&gt;1521&lt;/code&gt; (&lt;em&gt;you can change it while installing&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;so now stop and delete the docker container using&lt;br&gt;
&lt;code&gt;docker stop &amp;lt;container-id&amp;gt;&lt;/code&gt; then&lt;br&gt;
&lt;code&gt;docker rm &amp;lt;container-id&amp;gt;&lt;/code&gt;&lt;br&gt;
(container id will be printed on terminal while running docker)&lt;/p&gt;

&lt;p&gt;so final command with open port will be&lt;br&gt;
&lt;code&gt;docker run -d -p 1521:1521 -p 8080:8080 oracleinanutshell/oracle-xe-11g&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;now if you want to restart the server (docker container on restart) then instead of above command you need to run&lt;br&gt;
&lt;code&gt;docker run -d --restart unless-stopped -p 1521:1521 -p 8080:8080 oracleinanutshell/oracle-xe-11g&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and to manually start the container run&lt;br&gt;
&lt;code&gt;docker start &amp;lt;container-id&amp;gt;&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
