{"id":880,"date":"2024-03-10T16:17:36","date_gmt":"2024-03-10T15:17:36","guid":{"rendered":"https:\/\/anjo.pt\/keyword-oracle\/?p=880"},"modified":"2025-10-13T20:03:48","modified_gmt":"2025-10-13T18:03:48","slug":"install-oracle-linux-9-and-oracle-database-19c-on-windows-wsl","status":"publish","type":"post","link":"https:\/\/anjo.pt\/keyword-oracle\/2024\/03\/10\/install-oracle-linux-9-and-oracle-database-19c-on-windows-wsl\/","title":{"rendered":"Install Oracle Linux 9 and Oracle Database 19c on Windows WSL"},"content":{"rendered":"\n<p>Since a few days I&#8217;ve a Oracle Database 19c running on my laptop (4 year old i5 processor with 16GB memory) under the Windows Subsystem for Linux with the latest Oracle Linux 9.3. It is working great for testing functionalities. It survives without problem sleep and restart without first shutting down correctly the database.<\/p>\n\n\n\n<p>While there are no snapshot possibility like with Virtualbox, it is possible to export the running image and re-import later. <\/p>\n\n\n\n<p>Below I describe the main steps to quickly install the system.<\/p>\n\n\n\n<!--more-->\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Download the <a href=\"https:\/\/apps.microsoft.com\/detail\/9n5mgj01cvxc?hl=en-US&amp;gl=US\">Oracle Linux 9.3 from Microsoft Store<\/a> <\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2024\/03\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"661\" height=\"236\" src=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2024\/03\/image.png\" alt=\"\" class=\"wp-image-881\" srcset=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2024\/03\/image.png 661w, https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2024\/03\/image-300x107.png 300w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><\/a><\/figure>\n\n\n\n<p><strong>2. Activate the systemd system and service mananger<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo su -\n\necho -e &quot;&#x5B;boot]\\nsystemd=true&quot; &gt;&gt; \/etc\/wsl.conf\n\nshutdown\n<\/pre><\/div>\n\n\n<p>Wait 30 seconds (<a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/wsl\/wsl-config\">Microsoft says 8 are enough<\/a>) and connect again to the WSL<\/p>\n\n\n\n<p><strong>3. Install necessary packages <\/strong><\/p>\n\n\n\n<p>These will configure Oracle user and groups and and provide the required tools to install and run the database<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo su -\n\ndnf install -y oracle-database-preinstall-19c\ndnf install -y gcc gcc-c++ libxcrypt-compat oracle-epel-release-el9 rlwrap hostname\n<\/pre><\/div>\n\n\n<p><strong>4. Make necessary and useful preparations for the Oracle database installation<\/strong><\/p>\n\n\n\n<p>This includes giving sudo access to the Oracle user and creating the base directories.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# As root user\necho &quot;oracle    ALL=(ALL)    NOPASSWD: ALL&quot; &gt; \/etc\/sudoers.d\/oracle\nmkdir \/u01\nmkdir \/u02\nchown oracle:oinstall \/u01\nchown oracle:oinstall \/u02\n\n# As Oracle user\nsu - oracle\n\n# Add info to Bash profile\necho &quot;export ORACLE_BASE=\/u01\/app\/oracle\nexport ORACLE_HOME=\\${ORACLE_BASE}\/product\/19.0.0\/dbhome_1\nexport TNS_ADMIN=\\${ORACLE_HOME}\/network\/admin\nexport PATH=\\${PATH}:\\${ORACLE_HOME}\/bin\nexport ORACLE_SID=mycdb1&quot; &gt;&gt; \/home\/oracle\/.bash_profile\n\n. .bash_profile\n<\/pre><\/div>\n\n\n<p><strong>5. Download the Oracle Database software and patches<\/strong><\/p>\n\n\n\n<p>You need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Oracle Database 19c for Linux x86-64 ZIP (LINUX.X64_193000_db_home.zip) from <a href=\"https:\/\/www.oracle.com\/database\/technologies\/oracle-database-software-downloads.html\">Oracle Software Downloads site<\/a><\/li>\n\n\n\n<li>Oracle Latest OPatch for DB 19.0.0.0.0 on Linux x86-64 from <a href=\"http:\/\/updates.oracle.com\/download\/6880880.html\">Oracle Updates site<\/a><\/li>\n\n\n\n<li>Oracle latest Release Updates: Oracle Database 19.22 RU (patch 35943157) and OCW 19.22 RU (patch 35967489). The easiest way it to download the <a href=\"https:\/\/updates.oracle.com\/Orion\/Services\/download\/p35940989_190000_Linux-x86-64.zip?aru=25527403&amp;patch_file=p35940989_190000_Linux-x86-64.zip\">patch 35940989 from Oracle Support site<\/a> (GI 19.22 RU) which contains both patches above. <\/li>\n<\/ul>\n\n\n\n<p>Unzip ONLY the patch p35940989_190000_Linux-x86-64.zip file. This will generate several directories. From those, you need to keep the directories named 35943157 and 35967489. Move those two to the same level as the other zip files. You can delete the rest.<\/p>\n\n\n\n<p>More information about the <a href=\"https:\/\/support.oracle.com\/knowledge\/Oracle%20Cloud\/2982833_1.html\">requirements to install Oracle 19c on Oracle Linux 9 on Oracle Support site<\/a>.<\/p>\n\n\n\n<p><strong>6. Patch Oracle 19c image with latest patches<\/strong><\/p>\n\n\n\n<p>This step is required to be able to install correctly on Oracle Linux 9.3. In the commands below I expect the two zip files and two directories to be available under \/mnt\/c\/Users\/USERNAME\/Downloads\/ .<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# As Oracle user\n\nSTAGING_AREA=\/mnt\/c\/Users\/user\/Downloads\n\nmkdir -p $ORACLE_HOME\n\n# Unzip Base Oracle 19c image\nunzip -q $STAGING_AREA\/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME\/\n\n# Update OPatch\nrm -rf $ORACLE_HOME\/OPatch\nunzip -q $STAGING_AREA\/p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME\/\n\n# Patch Oracle Home with 19.22\ncd $ORACLE_HOME\n.\/runInstaller -applyRU ${STAGING_AREA}\/35943157 -applyOneOffs ${STAGING_AREA}\/35967489\n<\/pre><\/div>\n\n\n<p><strong>7. Install Oracle 19c (19.22)<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# As Oracle user\n\nORA_INVENTORY=\/u01\/app\/oraInventory\n\ncd $ORACLE_HOME\n.\/runInstaller -ignorePrereq -waitforcompletion -silent   \\\n    -responseFile ${ORACLE_HOME}\/install\/response\/db_install.rsp  \\\n    oracle.install.option=INSTALL_DB_SWONLY                       \\\n    ORACLE_HOSTNAME=$(hostname -f)                                \\\n    UNIX_GROUP_NAME=oinstall                                      \\\n    INVENTORY_LOCATION=${ORA_INVENTORY}                           \\\n    SELECTED_LANGUAGES=en,en_GB                                   \\\n    ORACLE_HOME=${ORACLE_HOME}                                    \\\n    ORACLE_BASE=${ORACLE_BASE}                                    \\\n    oracle.install.db.InstallEdition=EE                           \\\n    oracle.install.db.OSDBA_GROUP=dba                             \\\n    oracle.install.db.OSBACKUPDBA_GROUP=backupdba                 \\\n    oracle.install.db.OSDGDBA_GROUP=dgdba                         \\\n    oracle.install.db.OSKMDBA_GROUP=kmdba                         \\\n    oracle.install.db.OSRACDBA_GROUP=racdba                       \\\n    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                    \\\n    DECLINE_SECURITY_UPDATES=true\n\n# Call required scripts as root\nsudo \/u01\/app\/oraInventory\/orainstRoot.sh\nsudo \/u01\/app\/oracle\/product\/19.0.0\/dbhome_1\/root.sh\n\n# Activate Unified auditing mode\ncd $ORACLE_HOME\/rdbms\/lib\nmake -f ins_rdbms.mk uniaud_on ioracle\n<\/pre><\/div>\n\n\n<p><strong>8. Configure Listener<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# As Oracle user\n\necho &quot;# listener.ora \nLISTENER =\n  (DESCRIPTION_LIST =\n    (DESCRIPTION =\n      (ADDRESS = (PROTOCOL = TCP)(HOST = ${HOSTNAME})(PORT = 1521))\n    )\n  )&quot; &gt; $ORACLE_HOME\/network\/admin\/listener.ora\n\necho &quot;# sqlnet.ora\nNAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)\n\n# Network encryption required\nSQLNET.ENCRYPTION_SERVER = REQUIRED\nSQLNET.ENCRYPTION_TYPES_SERVER = (AES256)\nSQLNET.CRYPTO_CHECKSUM_SERVER = REQUIRED\nSQLNET.CRYPTO_CHECKSUM_TYPES_SERVER = (SHA512)&quot; &gt; $ORACLE_HOME\/network\/admin\/sqlnet.ora\n\ncd $ORACLE_HOME\/network\/admin\nsed -i &quot;s\/VM_NAME\/$(hostname)\/g&quot; listener.ora\n\n$ORACLE_HOME\/bin\/lsnrctl start\n$ORACLE_HOME\/bin\/lsnrctl status\n<\/pre><\/div>\n\n\n<p><strong>9. Create Database Container and Pluggable database<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# as Oracle user\n\nORACLE_SID=mycdb1\n\ndbca -silent -createDatabase                            \\\n     -templateName General_Purpose.dbc                  \\\n     -gdbname ${ORACLE_SID} -sid  ${ORACLE_SID}         \\\n\t -dbOptions JSERVER:false,DV:false,ORACLE_TEXT:false,IMEDIA:false,CWMLITE:false,SPATIAL:false,OMS:false,APEX:false \\\n     -sysPassword Welcome_1                             \\\n     -systemPassword Welcome_1                          \\\n     -createAsContainerDatabase true                    \\\n     -numberOfPDBs 1                                    \\\n     -pdbName orapdb1                                   \\\n     -pdbAdminPassword Welcome_1                        \\\n     -totalMemory 2048                                  \\\n     -memoryMgmtType AUTO_SGA\t                        \\\n     -storageType FS                                    \\\n     -datafileDestination \/u02\/app\/oracle\/oradata       \\\n\t -recoveryAreaDestination \/u02\/app\/oracle\/fast_recovery_area \\\n\t -recoveryAreaSize 4096                             \\\n     -emConfiguration NONE                              \\\n     -ignorePreReqs -sampleSchema true\n<\/pre><\/div>\n\n\n<p>You can follow the creation on another window under the directory (took about 40 minutes on my laptop):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nls -l \/u01\/app\/oracle\/cfgtoollogs\/dbca\/mycdb1\n<\/pre><\/div>\n\n\n<p>The output is the following<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;WARNING] &#x5B;DBT-06801] Specified Fast Recovery Area size (4,096 MB) is less than the recommended value.\n   CAUSE: Fast Recovery Area size should at least be three times the database size (3,603 MB).\n   ACTION: Specify Fast Recovery Area Size to be at least three times the database size.\nPrepare for db operation\n8% complete\nCopying database files\n31% complete\nCreating and starting Oracle instance\n32% complete\n36% complete\n40% complete\n43% complete\n46% complete\nCompleting Database Creation\n51% complete\n53% complete\n54% complete\nCreating Pluggable Databases\n58% complete\n77% complete\nExecuting Post Configuration Actions\n100% complete\nDatabase creation complete. For details check the logfiles at:\n \/u01\/app\/oracle\/cfgtoollogs\/dbca\/mycdb1.\nDatabase Information:\nGlobal Database Name:mycdb1\nSystem Identifier(SID):mycdb1\nLook at the log file &quot;\/u01\/app\/oracle\/cfgtoollogs\/dbca\/mycdb1\/mycdb1.log&quot; for further details.\n<\/pre><\/div>\n\n\n<p>At the end is the CDB created and running:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexport ORACLE_SID=mycdb1\n\n$ sqlplus \/ as sysdba\n\nSQL*Plus: Release 19.0.0.0.0 - Production on Sun Mar 10 15:42:07 2024\nVersion 19.22.0.0.0\n\nCopyright (c) 1982, 2022, Oracle.  All rights reserved.\n\nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.22.0.0.0\n\nSQL&gt; show pdbs\n\n    CON_ID CON_NAME                       OPEN MODE  RESTRICTED\n---------- ------------------------------ ---------- ----------\n         2 PDB$SEED                       READ ONLY  NO\n         3 ORAPDB1                        READ WRITE NO\n<\/pre><\/div>\n\n\n<p><strong>10. (optional) Create systemd service to automatic start database<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# As root\n\necho &quot;&#x5B;Unit]\nDescription=Oracle Database Service\nAfter=syslog.target network.target \n\n&#x5B;Service]\n#set any limits here\nLimitMEMLOCK=infinity\nLimitNOFILE=65535\n\nType=idle\nRemainAfterExit=yes\nUser=oracle\nGroup=oinstall\nRestart=no\nEnvironment=ORACLE_HOME=\/u01\/app\/oracle\/product\/19.0.0\/dbhome_1\nExecStart=\/bin\/bash -c &#039;${ORACLE_HOME}\/bin\/dbstart $ORACLE_HOME&#039;\nExecStop=\/bin\/bash -c &#039;${ORACLE_HOME}\/bin\/dbshut $ORACLE_HOME&#039;\n\n&#x5B;Install]\nWantedBy=multi-user.target&quot; &gt; \/usr\/lib\/systemd\/system\/oracle-db.service\n\nsystemctl daemon-reload\nsystemctl enable oracle-db.service\n<\/pre><\/div>\n\n\n<p><strong>11. Export and save a backup of the WSL image <\/strong><\/p>\n\n\n\n<p>From a Powershell window (it will stop\/kill the WSL instance):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir C:\\Users\\USERNAME\\Backup\\WSL\\\n\nwsl --list\nwsl --export OracleLinux_9_3 C:\\Users\\USERNAME\\Backup\\WSL\\OracleLinux_OracleDB1922.tar\nwsl gzip OracleLinux_OracleDB1922.tar\n<\/pre><\/div>\n\n\n<p>The Zip file is about 6GB in my case. <\/p>\n\n\n\n<p><strong>12. Import backup of WSL image<\/strong><\/p>\n\n\n\n<p>After unzipping the image from backup, open a Powershell window and run:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n wsl --import OracleLinux9_Oracle1922 C:\\Users\\USERNAME\\WSL\\ C:\\Users\\USERNAME\\Backup\\WSL\\OracleLinux_OracleDB1922.tar\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Since a few days I&#8217;ve a Oracle Database 19c running on my laptop (4 year old i5 processor with 16GB memory) under the Windows Subsystem for Linux with the latest Oracle Linux 9.3. It is working great for testing functionalities. It survives without problem sleep and restart without first shutting down correctly the database. While [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,65,6,39],"tags":[],"class_list":{"0":"post-880","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-linux","7":"category-multitenant","8":"category-oracle","9":"category-oracle-19c","10":"czr-hentry"},"_links":{"self":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/comments?post=880"}],"version-history":[{"count":10,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/880\/revisions"}],"predecessor-version":[{"id":1064,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/880\/revisions\/1064"}],"wp:attachment":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/media?parent=880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/categories?post=880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/tags?post=880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}