In this post, I would show you how you can deploy Oracle 18c XE database in Oracle Cloud Infrastructure Gen 2, in just one command.
Login to your OCI compute node where you want to deploy the Oracle 18c XE, please make a note that you have created the compute VM with Oracle Linx 7, Oracle Linux 8 still, at time of writing this post, doesn't have OCI included image for the 18c XE.
Since we are on OEL7.7 and OCI image already includes the Oracle 18c XE database rpm in there so doing pre-check is optional and we can directly install it using below one line command, it would automatically find the dependencies and do that job for you.
Let's initiate the installation now as below.
[root@oci02 ~]# yum install oracle-database-xe-18c.x86_64
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-xe-18c.x86_64 0:1.0-1 will be installed
--> Processing Dependency: oracle-database-preinstall-18c for package: oracle-database-xe-18c-1.0-1.x86_64
--> Running transaction check
---> Package oracle-database-preinstall-18c.x86_64 0:1.0-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================
Installing:
oracle-database-xe-18c x86_64 1.0-1 ol7_oci_included 2.4 G
Installing for dependencies:
oracle-database-preinstall-18c x86_64 1.0-1.el7 ol7_latest 18 k
Transaction Summary
=============================================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 2.4 G
Installed size: 5.2 G
Is this ok [y/d/N]: y
Downloading packages:
(1/2): oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm | 18 kB 00:00:00
(2/2): oracle-database-xe-18c-1.0-1.x86_64.rpm | 2.4 GB 00:01:11
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 34 MB/s | 2.4 GB 00:01:11
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : oracle-database-preinstall-18c-1.0-1.el7.x86_64 1/2
Installing : oracle-database-xe-18c-1.0-1.x86_64 2/2
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-18c.conf' and then execute '/etc/init.d/oracle-xe-18c configure' as root.
Verifying : oracle-database-xe-18c-1.0-1.x86_64 1/2
Verifying : oracle-database-preinstall-18c-1.0-1.el7.x86_64 2/2
Installed:
oracle-database-xe-18c.x86_64 0:1.0-1
Dependency Installed:
oracle-database-preinstall-18c.x86_64 0:1.0-1.el7
Complete!
[root@oci02 ~]#
Above you see, it installed the 18c XE HOME and it points you to the configuration file that you can modify per your needs and run the /etc/init.d/oracle-xe-18c configure to create the XE container database for you, as below.
Default, sample configuration file that would be used to created the database.
[root@oci02 ~]# cat /etc/sysconfig/oracle-xe-18c.conf
#This is a configuration file to setup the Oracle Database.
#It is used when running '/etc/init.d/oracle-xe-18c configure'.
# LISTENER PORT used Database listener, Leave empty for automatic port assignment
LISTENER_PORT=
# EM_EXPRESS_PORT Oracle EM Express URL port
EM_EXPRESS_PORT=5500
# Character set of the database
CHARSET=AL32UTF8
# Database file directory
# If not specified, database files are stored under Oracle base/oradata
DBFILE_DEST=
# SKIP Validations, memory, space
SKIP_VALIDATIONS=false
[root@oci02 ~]#
Let's create the database as below. You need to provide a complex password that will be used for SYS, SYSTEM and PDBADMIN accounts commonly, later you may change it which is different to each other once database instance created successfully.
[root@oci02 ~]# /etc/init.d/oracle-xe-18c configure
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database XE.
Enter SYS user password:
********
Enter SYSTEM user password:
*******
Enter PDBADMIN User Password:
**********
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
31% complete
34% complete
38% complete
41% complete
43% complete
Completing Database Creation
47% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/XE.
Database Information:
Global Database Name:XE
System Identifier(SID):XE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/XE/XE.log" for further details.
Connect to Oracle Database using one of the connect strings:
Pluggable database: oci02/XEPDB1
Multitenant container database: oci02
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE
[root@oci02 ~]#
Once database instance gets configured, you are provided "Database Information" and connect string for the Pluggable database, dbca log file location that you can review and finally Enterprise Manager URL to use for the database monitoring purpose.
Finally you may spare few mins and validate the container database information.
[root@oci02 ~]# ps -ef | grep pmon
oracle 23387 1 0 19:00 ? 00:00:00 xe_pmon_XE
root 23902 11789 0 19:02 pts/0 00:00:00 grep --color=auto pmon
[root@oci02 ~]#
[root@oci02 ~]# su - oracle
Last login: Mon Oct 14 18:51:07 GMT 2019 on pts/0
[oracle@oci02 ~]$
[oracle@oci02 ~]$ . oraenv
ORACLE_SID = [oracle] ? XE
The Oracle base has been set to /opt/oracle
[oracle@oci02 ~]$
[oracle@oci02 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 18.0.0.0.0 - Production on Mon Oct 14 19:03:09 2019
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL>
SQL> select name, open_mode, database_role, cdb from v$database;
NAME OPEN_MODE DATABASE_ROLE CDB
--------- -------------------- ---------------- ---
XE READ WRITE PRIMARY YES
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 XEPDB1 READ WRITE NO
SQL>
Hope it helps, thanks for reading, please subscribe to this blog to stay tuned with latest news on Oracle Cloud Infrastructure and Oracle Autonomous Database Cloud Services and other new articles.
Twitter : https://twitter.com/rajsoft8899
Linkedin : https://www.linkedin.com/in/raj-kumar-kushwaha-5a289219/
Facebook : https://www.facebook.com/rkushawaha
I like the helpful information you provide for your articles.
ReplyDeleteI'll bookmark your blog and test once more here frequently.
I'm slightly sure I will learn lots of new stuff proper right here!
Good luck for the next!