Thursday, December 1, 2022

Useful Oracle DBA Scripts

 

Useful DBA Scripts

Script – Check RMAN Backup Status

Scripts to check backup status and timings of database backups –

This script will be run in the database, not the catalog.

Login as sysdba –

This script will report on all backups – full, incremental and archivelog backups –

col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;

This script will report all on full and incremental backups, not archivelog backups –

col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
where input_type='DB INCR'
order by session_key;

Script – Sessions with high physical reads

 set linesize 120
col os_user format a10
col username format a15

col pid format 9999999999
PROMPT SESSIONS SORTED BY PHYSICAL READS
PROMPT
select
  OSUSER os_user,username,
    PROCESS pid,
    ses.SID sid,
    SERIAL#,
    PHYSICAL_READS,
     BLOCK_CHANGES
 from       v$session ses,
   v$sess_io sio
  where      ses.SID = sio.SID
and username is not null
and status='ACTIVE'
 order      by PHYSICAL_READS;

Script – Database structure and file location

set pagesize 500
set linesize 130
Prompt
Prompt Control Files Location >>>>
col name  format a60 heading "Control Files"

select name
from   sys.v_$controlfile
/

Prompt
Prompt Redo Log File Locations >>>>
Prompt

col Grp    format 9999
col member format a50 heading "Online REDO Logs"
col File#  format 9999
col name   format a50 heading "Online REDO Logs"
break on Grp
select group#,member
from   sys.v_$logfile
/


Prompt Data Files Locations >>>>

col Tspace    format a25
col status    format a3  heading Sta
col Id        format 9999
col Mbyte     format 999999999
col name      format a50 heading "Database Data Files"
col Reads     format 99,999,999
col Writes    format 99,999,999

break on report
compute sum label 'Total(MB)'  of Mbyte  on report

select F.file_id Id,
       F.file_name name,
       F.bytes/(1024*1024) Mbyte,
       decode(F.status,'AVAILABLE','OK',F.status) status,
       F.tablespace_name Tspace
from   sys.dba_data_files F
order by tablespace_name;




Control Files Location >>>>

Control Files
------------------------------------------------------------
/u03/oradata/rcatp/control01.ctl
/u05/oradata/rcatp/control02.ctl


Redo Log File Locations >>>>


    GROUP# Online REDO Logs
---------- --------------------------------------------------
         1 /u03/oradata/rcatp/redo01.log
         2 /u05/oradata/rcatp/redo02.log
         3 /u03/oradata/rcatp/redo03.log
         3 /u05/oradata/rcatp/redo03b.log
         1 /u05/oradata/rcatp/redo01b.log
         2 /u03/oradata/rcatp/redo02b.log

6 rows selected.

Data Files Locations >>>>

   ID Database Data Files                                     MBYTE Sta TSPACE
----- -------------------------------------------------- ---------- --- -------------------------
    9 /u03/oradata/rcatp/patrol01.dbf                            20 OK  PATROL
    7 /u03/oradata/rcatp/rman10p01.dbf                          466 OK  RMAN10P
    5 /u03/oradata/rcatp/rman11p01.dbf                          200 OK  RMAN11P
    8 /u03/oradata/rcatp/rman9p01.dbf                           106 OK  RMAN9P
    3 /u03/oradata/rcatp/sysaux01.dbf                           540 OK  SYSAUX
    1 /u03/oradata/rcatp/system01.dbf                           700 OK  SYSTEM
    2 /u03/oradata/rcatp/undotbs01.dbf                          220 OK  UNDOTBS1
    4 /u03/oradata/rcatp/users01.dbf                              6 OK  USERS
                                                         ----------
sum                                                            2258

8 rows selected.

ASH and AWR Performance Tuning Scripts

Listed below are some SQL queries which I find particularly useful for performance tuning. These are based on the Active Session History V$ View to get a current perspective of performance and the DBA_HIST_* AWR history tables for obtaining performance data pertaining to a period of time in the past.

Top Recent Wait Events

col EVENT format a60 

select * from (
select active_session_history.event,
sum(active_session_history.wait_time +
active_session_history.time_waited) ttl_wait_time
from v$active_session_history active_session_history
where active_session_history.event is not null
group by active_session_history.event
order by 2 desc)
where rownum < 6
/

Top Wait Events Since Instance Startup

col event format a60

select event, total_waits, time_waited
from v$system_event e, v$event_name n
where n.event_id = e.event_id
and n.wait_class !='Idle'
and n.wait_class = (select wait_class from v$session_wait_class
 where wait_class !='Idle'
 group by wait_class having
sum(time_waited) = (select max(sum(time_waited)) from v$session_wait_class
where wait_class !='Idle'
group by (wait_class)))
order by 3;

List Of Users Currently Waiting

col username format a12
col sid format 9999
col state format a15
col event format a50
col wait_time format 99999999
set pagesize 100
set linesize 120

select s.sid, s.username, se.event, se.state, se.wait_time
from v$session s, v$session_wait se
where s.sid=se.sid
and se.event not like 'SQL*Net%'
and se.event not like '%rdbms%'
and s.username is not null
order by se.wait_time;

Find The Main Database Wait Events In A Particular Time Interval

First determine the snapshot id values for the period in question.

In this example we need to find the SNAP_ID for the period 10 PM to 11 PM on the 14th of November, 2012.

select snap_id,begin_interval_time,end_interval_time
from dba_hist_snapshot
where to_char(begin_interval_time,'DD-MON-YYYY')='14-NOV-2012'
and EXTRACT(HOUR FROM begin_interval_time) between 22 and 23;

set verify off
select * from (
select active_session_history.event,
sum(active_session_history.wait_time +
active_session_history.time_waited) ttl_wait_time
from dba_hist_active_sess_history active_session_history
where event is not null
and SNAP_ID between &ssnapid and &esnapid
group by active_session_history.event
order by 2 desc)
where rownum

Top CPU Consuming SQL During A Certain Time Period

Note – in this case we are finding the Top 5 CPU intensive SQL statements executed between 9.00 AM and 11.00 AM

select * from (
select
SQL_ID,
 sum(CPU_TIME_DELTA),
sum(DISK_READS_DELTA),
count(*)
from
DBA_HIST_SQLSTAT a, dba_hist_snapshot s
where
s.snap_id = a.snap_id
and s.begin_interval_time > sysdate -1
and EXTRACT(HOUR FROM S.END_INTERVAL_TIME) between 9 and 11
group by
SQL_ID
order by
sum(CPU_TIME_DELTA) desc)
where rownum

Which Database Objects Experienced the Most Number of Waits in the Past One Hour

set linesize 120
col event format a40
col object_name format a40

select * from 
(
  select dba_objects.object_name,
 dba_objects.object_type,
active_session_history.event,
 sum(active_session_history.wait_time +
  active_session_history.time_waited) ttl_wait_time
from v$active_session_history active_session_history,
    dba_objects
 where 
active_session_history.sample_time between sysdate - 1/24 and sysdate
and active_session_history.current_obj# = dba_objects.object_id
 group by dba_objects.object_name, dba_objects.object_type, active_session_history.event
 order by 4 desc)
where rownum < 6;

Top Segments ordered by Physical Reads

col segment_name format a20
col owner format a10 
select segment_name,object_type,total_physical_reads
 from ( select owner||'.'||object_name as segment_name,object_type,
value as total_physical_reads
from v$segment_statistics
 where statistic_name in ('physical reads')
 order by total_physical_reads desc)
 where rownum

Top 5 SQL statements in the past one hour

select * from (
select active_session_history.sql_id,
 dba_users.username,
 sqlarea.sql_text,
sum(active_session_history.wait_time +
active_session_history.time_waited) ttl_wait_time
from v$active_session_history active_session_history,
v$sqlarea sqlarea,
 dba_users
where 
active_session_history.sample_time between sysdate -  1/24  and sysdate
  and active_session_history.sql_id = sqlarea.sql_id
and active_session_history.user_id = dba_users.user_id
 group by active_session_history.sql_id,sqlarea.sql_text, dba_users.username
 order by 4 desc )
where rownum

SQL with the highest I/O in the past one day

select * from 
(
SELECT /*+LEADING(x h) USE_NL(h)*/ 
       h.sql_id
,      SUM(10) ash_secs
FROM   dba_hist_snapshot x
,      dba_hist_active_sess_history h
WHERE   x.begin_interval_time > sysdate -1
AND    h.SNAP_id = X.SNAP_id
AND    h.dbid = x.dbid
AND    h.instance_number = x.instance_number
AND    h.event in  ('db file sequential read','db file scattered read')
GROUP BY h.sql_id
ORDER BY ash_secs desc )
where rownum

Top CPU consuming queries since past one day

select * from (
select 
	SQL_ID, 
	sum(CPU_TIME_DELTA), 
	sum(DISK_READS_DELTA),
	count(*)
from 
	DBA_HIST_SQLSTAT a, dba_hist_snapshot s
where
 s.snap_id = a.snap_id
 and s.begin_interval_time > sysdate -1
	group by 
	SQL_ID
order by 
	sum(CPU_TIME_DELTA) desc)
where rownum

Find what the top SQL was at a particular reported time of day

First determine the snapshot id values for the period in question.

In thos example we need to find the SNAP_ID for the period 10 PM to 11 PM on the 14th of November, 2012.

select snap_id,begin_interval_time,end_interval_time
from dba_hist_snapshot
where to_char(begin_interval_time,'DD-MON-YYYY')='14-NOV-2012'
and EXTRACT(HOUR FROM begin_interval_time) between 22 and 23;
select * from
 (
select
 sql.sql_id c1,
sql.buffer_gets_delta c2,
sql.disk_reads_delta c3,
sql.iowait_delta c4
 from
dba_hist_sqlstat sql,
dba_hist_snapshot s
 where
 s.snap_id = sql.snap_id
and
 s.snap_id= &snapid
 order by
 c3 desc)
 where rownum < 6 
/
select
 s.snap_id,
 to_char(s.begin_interval_time,'HH24:MI') c1,
 sql.executions_delta c2,
 sql.buffer_gets_delta c3,
 sql.disk_reads_delta c4,
 sql.iowait_delta c5,
sql.cpu_time_delta c6,
 sql.elapsed_time_delta c7
 from
 dba_hist_sqlstat sql,
 dba_hist_snapshot s
 where
 s.snap_id = sql.snap_id
 and s.begin_interval_time > sysdate -1
 and
sql.sql_id='&sqlid'
 order by c7
 /

Do we have multiple plan hash values for the same SQL ID – in that case may be changed plan is causing bad performance

select 
  SQL_ID 
, PLAN_HASH_VALUE 
, sum(EXECUTIONS_DELTA) EXECUTIONS
, sum(ROWS_PROCESSED_DELTA) CROWS
, trunc(sum(CPU_TIME_DELTA)/1000000/60) CPU_MINS
, trunc(sum(ELAPSED_TIME_DELTA)/1000000/60)  ELA_MINS
from DBA_HIST_SQLSTAT 
where SQL_ID in (
'&sqlid') 
group by SQL_ID , PLAN_HASH_VALUE
order by SQL_ID, CPU_MINS;

Top 5 Queries for past week based on ADDM recommendations

/*
Top 10 SQL_ID's for the last 7 days as identified by ADDM
from DBA_ADVISOR_RECOMMENDATIONS and dba_advisor_log
*/

col SQL_ID form a16
col Benefit form 9999999999999
select * from (
select b.ATTR1 as SQL_ID, max(a.BENEFIT) as "Benefit" 
from DBA_ADVISOR_RECOMMENDATIONS a, DBA_ADVISOR_OBJECTS b 
where a.REC_ID = b.OBJECT_ID
and a.TASK_ID = b.TASK_ID
and a.TASK_ID in (select distinct b.task_id
from dba_hist_snapshot a, dba_advisor_tasks b, dba_advisor_log l
where a.begin_interval_time > sysdate - 7 
and  a.dbid = (select dbid from v$database) 
and a.INSTANCE_NUMBER = (select INSTANCE_NUMBER from v$instance) 
and to_char(a.begin_interval_time, 'yyyymmddHH24') = to_char(b.created, 'yyyymmddHH24') 
and b.advisor_name = 'ADDM' 
and b.task_id = l.task_id 
and l.status = 'COMPLETED') 
and length(b.ATTR4) > 1 group by b.ATTR1
order by max(a.BENEFIT) desc) where rownum < 6;

Monday, November 7, 2022

Reasons to Upgrade Oracle EBS to latest version 12.2.11

Upgrade Oracle EBS from 11i & 12.1 to 12.2

Organizations currently operating Oracle E-Business Suite (EBS) 11i or 12.1 versions must have heard about Oracle have ceased support for these versions in December 2021. It is time to focus on upgrading to EBS12.2 or migrate to Oracle Fusion Cloud. 

There is Market Driven Support MDS still available for 12.1.3 version only for customers who pay for this MDS extension support service but even this is available only until December 2023. So all the customers across the globe have only 1 years left to upgrade to the latest 12.2.11 version available in market. 

In this blog, we showcase the reasons to upgrade and challenges/setbacks in sustaining support.

Support Stages Offered by Oracle


Premier Support

The initial support stage spans five years from the Oracle EBS product’s general availability. This includes general support, such as critical patch updates, security alerts, and technical support, to name a few.

Extended Support

An optional, secondary support stage wherein customers can pay a fee to experience ‘Premier-like’ support for three additional years beyond the end of Premier Support.

Sustaining Support

The last stage of support, after Premier has ended and Extended has either expired or is no longer offered; offers technical support, access to content (e.g. critical patch updates) produced during the Premier stage, and other limited support features intended to help maintain or “sustain” a platform.

Challenges

End of Support
  • It means there is no support for the current system and providing updates for an outdated product.
  • Flaws will continue to remain and exposes the business to unnecessary risk.
Productivity & Efficiency
  • Using the out-of-date application will restrict you to discover the new features & functionalities.
  • It adversely affects productivity and efficiency in business operations.
Challenges in Sustaining Support

Sustaining support does not include,

  • Critical Patch Updates.
  • New updates, fixes & security alerts.
  • New tax & regulatory updates.
  • Certifications with new third-party products, which affect integration.
Productivity & Efficiency
  • Lifetime support policy
  • Latest technology enhancements
  • Online Patching
  • Built on Fusion Middleware – Web logic Platform
  • In-Memory enhancements to Applications
  • Future innovations

The continuous Innovation release model

Oracle planned and separated the technology stack updates from application code updates. It allows customers to retain their application code level, while they are upgrading the tech stack. Customers reap the benefits of new application functionalities without disturbing their existing tech stack to the latest level. There will not be EBS release 12.3, instead, 12.2.x will have the release in a continuous innovation model.

  • Technology Stack Updates - Migration to new architecture like from application server to fusion middleware
  • Applications Updates - It is nothing but an up-gradation of the application version
12.2 Patching Cycle – Online Patching

  • Online Patching cycle includes 5 phases
  • Application is only offline during the "Cutover" phase
  • Online Patching is used to apply all patches in 12.2


Benefits of upgrading to 12.2

Intuitive Look, Feel, and Experience

  • Users can click on an icon to receive a summary of recent notifications
  • Use new widgets designed to improve productivity
Business Value Increased Through Enhancements
  • E-Business Suite 12.2 offers hundreds of cross-industry capabilities, with numerous areas enhanced from previous versions
Downtime Greatly Reduced Through Online Patching
  • This means that you can apply patches to your system while it is still running and fully operational, and while users are still online
Technical Improvements
  • This technology takes E-Business Suite data through the metadata dictionary. It then makes the constructed HTML page available to end-users through Apache (Listener) technology

Sunday, October 9, 2022

Setup Oracle Database 21c on Oracle Linux 7

 Oracle has released the On-Premise version of Oracle Database 21c ( only on Linux for now ), last week. You can download it from either MOS or Oracle edelivery:

This release is an “Innovation Release”, which means it comes with only 2 years of Premier Support and no extended support, as opposed to a “Long Term Release” which comes with 5 years of Premier Support followed by 3 years of Extended Support. Tim Hall has explained in details why you shouldn’t jump onto upgrading to Oracle Database 21c in this post. So has Connor McDonald in this hilarious video. However, if you are looking to install and explore the new features in Oracle Database 21c, which are anyways going to be included in the upcoming Long Term Support Release, then this post should hopefully help.

In this post, I will show a step-by-step process of installing and setting up an Oracle Database 21c on Oracle Linux 7. I have configured Linux 7 on Oracle Virtual Box. I won’t go through the steps to setup OL7 in this post. You can refer to this link to go through the detailed steps of installing Linux 7 (OL7). The software I used are:

Prerequisites

Once you have downloaded and setup OL7, there are some prerequisite setups that needs to be performed before kicking of the installation. These steps are shown below.

Get the IP Address using ‘ifconfig’ or ‘ip addr’ command. For example:

[root@oracledb21col7 ~]# ifconfig

Get the hostname.

[root@oracledb21col7 ~]# hostname
oracledb21col7.rishoradev.com

Amend the IP address and hostname to “/etc/hosts” file to resolve the hostname. You can use the vi editor for this.

[ Note: This can also be done with DNS ].

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.XX.X oracledb21col7.rishoradev.com

Next, download “oracle-database-preinstall-21c” package. This package will perform all the setups that are necessary to install 21c. Check the available packages using ‘yum list’ command.

[root@oracledb21col7 ~]# yum list oracle-database-preinstall-21c
Loaded plugins: langpacks, ulninfo
Available Packages
oracle-database-preinstall-21c.x86_64               1.0-1.el7                ol7_latest

Use ‘yum install’ to install the “oracle-database-preinstall-21c” package. Once this is done, you should see a ‘Complete!’ message.

[root@oracledb21col7 ~]# yum install oracle-database-preinstall-21c.x86_64
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-21c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: ksh for package: oracle-database-preinstall-21c-1.0-1.el7.x86_64
--> Running transaction check
---> Package ksh.x86_64 0:20120801-142.0.1.el7 will be installed
--> Finished Dependency Resolution

....

....
Installed:
  oracle-database-preinstall-21c.x86_64 0:1.0-1.el7                                                                                                                                                                

Dependency Installed:
  ksh.x86_64 0:20120801-142.0.1.el7                                                                                                                                                                                

Complete!

Issue the ‘yum list’ command again to confirm that the package was successfully installed.

[root@oracledb21col7 ~]#  yum list oracle-database-preinstall-21c
Loaded plugins: langpacks, ulninfo
Installed Packages
oracle-database-preinstall-21c.x86_64            1.0-1.el7              @ol7_latest

The next step is not mandatory. But I ran the ‘yum update’ because I wanted to make sure I had also the latest OS packages. It might take a while for all the packages to be installed.

[root@oracledb21col7 ~]# yum update -y --skip-broken

Edit “/etc/selinux/config” file and set “SELINUX=permissive“. It is recommended that you restart the server after this.

[root@oracledb21col7 ~]# vi /etc/selinux/config

Disable firewall.

[root@oracledb21col7 ~]# systemctl stop firewalld
[root@oracledb21col7 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

Create the directory structure for Oracle 21c to be installed and grant privileges.

[root@oracledb21col7 ~]# mkdir -p /u01/app/oracle/product/21c/dbhome_1
[root@oracledb21col7 ~]# mkdir -p /u02/oradata
[root@oracledb21col7 ~]# chown -R oracle:oinstall /u01 /u02
[root@oracledb21col7 ~]# chmod -R 777 /u01 /u02

Create a directory for hosting the scripts and navigate to the directory.

[root@oracledb21col7 ~]# mkdir /home/oracle/scripts

Create an environment file called “setEnv.sh” using the script below.

[root@oracledb21col7 ~]# cat > /home/oracle/scripts/setEnv.sh <<EOF
> # Oracle Settings
> export TMP=/tmp
> export TMPDIR=\$TMP
>
> export ORACLE_HOSTNAME=oracledb21col7.rishoradev.com
> export ORACLE_UNQNAME=cdb1
> export ORACLE_BASE=/u01/app/oracle
> export ORACLE_HOME=\$ORACLE_BASE/product/21c/dbhome_1
> export ORA_INVENTORY=/u01/app/oraInventory
> export ORACLE_SID=cdb1
> export PDB_NAME=pdb1
> export DATA_DIR=/u02/oradata
>
> export PATH=/usr/sbin:/usr/local/bin:\$PATH
> export PATH=\$ORACLE_HOME/bin:\$PATH
>
> export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
> export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
> EOF

Issue the following command to add the reference of the environment file created above in the “/home/oracle/.bash_profile”.

[root@oracledb21col7 ~]# echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Copy the Oracle software that you have downloaded to a directory. I have copied it under dbhome1.

[root@oracledb21col7 Downloads]# cp LINUX.X64_213000_db_home.zip /u01/app/oracle/product/21c/dbhome_1/.

Change the password of “oracle” user.

[root@oracledb21col7 ~]# passwd oracle

Login using “oracle” user.

[root@oracledb21col7 ~]# su - oracle

Unzip the Oracle software in ‘/u01/app/oracle/product/21c/dbhome_1’ directory, using the ‘unzip’ command as shown below. We’ll set this path as the ORACLE_HOME later on during the installation.

[oracle@oracledb21col7 dbhome_1]$ unzip -q LINUX.X64_213000_db_home.zip
[oracle@oracledb21col7 dbhome_1]$ ls
addnode     crs  data       diagnostics  hs             javavm  ldap                          mgw      olap    oracore  oui    precomp  racg      runInstaller   sqldeveloper  srvm      utl
assistants  css  dbs        dv           install        jdbc    lib                           network  oml4py  ord      owm    python   rdbms     schagent.conf  sqlj          suptools  xdk
bin         ctx  deinstall  env.ora      instantclient  jdk     LINUX.X64_213000_db_home.zip  nls      OPatch  ords     perl   QOpatch  relnotes  sdk            sqlpatch      ucp
clone       cv   demo       has          inventory      jlib    md                            odbc     opmn    oss      plsql  R        root.sh   slax           sqlplus       usm

This completes all the prerequite steps and now we are all set to kick off the installation.

Installation

For installing Oracle, I used MobaXterm, to launch the Installer. Download MobaXterm on the Host machine, open a console and connect to your Linux machine using ‘ssh’ and IP address of the Linux machine with oracle user, as shown in the screenshot below. [ I want to thank Jason Shannon for recommending MobaXterm]

Navigate to the folder where you have unzipped the Oracle using MobaXterm console and execute ‘runInstaller’.

[oracle@oracledb21col7 ~]$ cd /u01/app/oracle/product/21c/dbhome_1/
[oracle@oracledb21col7 dbhome_1]$ ./runInstaller
Launching Oracle Database Setup Wizard...

This will open up the GUI as shown below. Click on ‘Set Up Software Only’ and click ‘Next’.

Provide the basic configuration details as shown below. Also set the Global DB Password. When you are done, click Next.

Select Single instance database installation and click Next.

Choose the preferred edition. I chose the Enterprise Edition. Click Next.

Set Oracle Base path and click Next.

Set the Inventory Directory and click Next.

Set the Privileged Operating System groups. I chose dba for all the groups.

Leave the Root script execution configuration with the default settings. In the final step of the installation, the system will prompt to connect to another terminal using the “root” user and run the scripts – orainstRoot.sh and root.sh.

System will perform the system checks. Once it is completed, click Next.

Save the Response File, if you want to reuse this for performing a Silent install in future.

Click Install to kick off the installation process.

You will be prompted to execute the scripts – orainstRoot.sh and root.sh using “root” user.

Open another terminal window and execute the scripts as shown below. Once completed, come back to the installation screen and click OK.

[root@oracledb21col7 CVU_21.0.0.0.0_oracle]# cd /u01/app/oraInventory/
[root@oracledb21col7 oraInventory]# ls
ContentsXML  logs  oraInst.loc  orainstRoot.sh
[root@oracledb21col7 oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oracledb21col7 oraInventory]# cd /u01/app/oracle/product/21c/dbhome_1/
[root@oracledb21col7 dbhome_1]# ./root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/21c/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin/
   Copying dbhome to /usr/local/bin/ ...
   Copying oraenv to /usr/local/bin/ ...
   Copying coraenv to /usr/local/bin/ ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

That should complete the installation process. The next stage will be to create the database.

Create Database

Before we create the database, the first thing we need to do is to start the listener services, using “lsnrctl start”.

[oracle@oracledb21col7 ~]$ lsnrctl start

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 18-AUG-2021 23:33:29

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/21c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oracledb21col7/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb21col7.rishoradev.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date                18-AUG-2021 23:33:29
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracledb21col7/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb21col7.rishoradev.com)(PORT=1521)))
The listener supports no services
The command completed successfully

Once the listener is up and running, you need to create the database using the Database Configuration Assistant (DBCA). This can be done using the interactive mode by issuing the dbca command, through MobaXterm. Once you execute the dbca command, the GUI should pop up .

OR, you can opt the Silent mode, as I have done below. To learn more about Silent mode, click here.

dbca -silent -createDatabase                                                   \
     -templateName General_Purpose.dbc                                         \
     -gdbname ${ORACLE_SID} -sid  ${ORACLE_SID} -responseFile NO_VALUE         \
     -characterSet AL32UTF8                                                    \
     -sysPassword Welcome1                                                     \
     -systemPassword Welcome1                                                  \
     -createAsContainerDatabase true                                           \
     -numberOfPDBs 1                                                           \
     -pdbName ${PDB_NAME}                                                      \
     -pdbAdminPassword PdbPassword1                                            \
     -databaseType MULTIPURPOSE                                                \
     -memoryMgmtType auto_sga                                                  \
     -totalMemory 2000                                                         \
     -storageType FS                                                           \
     -datafileDestination "${DATA_DIR}"                                        \
     -redoLogFileSize 50                                                       \
     -emConfiguration NONE                                                     \
     -ignorePreReqs

This would create the database for you. Now you have successfully installed Oracle Database 21c. Happy exploring!!!

[oracle@oracledb21col7 ~]$ sqlplus / as sysdba
....
....
SQL> Select BANNER_FULL from v$version;

BANNER_FULL
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0