Wednesday, April 22, 2026

Oracle Database Architecture & Instance Details & Memory & BG Process & Database & Backend Storage File Structure

oraclelab1 - DEVDB (Running in OS file system)
oraclelab2 - TESTDB (Running in OS ASM file system)

Oracle Architecture:
===================================
Instance + Database 

Instance = Logical structure (Memory + BG Process)
Database = Physical Structure (Datafiles)(OS FS / ASM FS)

Instance: Logical structure (Memory + BG Process)
=========
Memory + BG Process

Memory = SGA + PGA 
BG Process = Mandatory BG Process + Non-Mandatory BG Process

Memory = SGA + PGA 
====================================
SGA
====
System / Shared Global Area 
Shared Pool, Large Pool, Stream Pool, JAVA Pool, Data Buffer Cache, Log buffer cache 
SGA_TARGET=3GB 

PGA
=====
Program / Private Global Area 
stack space, Cursor Area, sort Area, temp Area, bitmap/bittree Area, UGA 
PGA_AGGREGATE_LIMIT=2GB


./dbca
- DEVDB
- TESTDB 

Memory management:
AMM
+++++
MEMORY_TARGET=10G
- dynamically SGA & PAG memory component will be assigned 

SGA=8G/6G
PGA=2G/4G


ASMM (Default) 
+++++
SGA_TARGET=3GB 
- dynamically all memory component will be assigned 

PGA_AGGREGATE_LIMIT=2GB
- dynamically all memory component will be assigned 


BG Process = Mandatory BG Process + Non-Mandatory BG Process
==========================================================
Mandatory BG Process
SMOM
PMON
DBWR
LGWR
CKPT

Non-Mandatory BG Process
Arch 
Reco (Distributed Tx, In-doubt transaction)  
Jq
MMON (AMM, ASMM) 
MMNL (AWR)
etc....


clint C1:
=====================
select * from EMP; 

1 min - Query exaction took 
Parsing - 30 sec 
Execution - 30 sec 

Parsing: - query running slow 
- syntax check 
- symmetic check 
- permission check 

This query converted as SQLID
select * from EMP; -> 1a1a1a

Why query went for parsing?
- Query executed for first time 

Hard Parsing:
select * from EMP; 
- Oracle will create SQL ID (1a1a1a) for these SQL queries 

Memory > SGA > Shared Pool 
- Library cache 
- Will holds SQL ID  
- Data dictionary cache 
- Will hold metadata or table (EMP) structure information 

Cache miss?
- User requested data is not in the database buffer cache 
- Then SP will go to datafile and get the EMP data and put into buffer cache 


clint C2:
=====================
15 sec - Query exaction took 
Soft parsing - making use of already generated SQL ID 
Cache Hit: Data is already available on BC 



LGWR - log writer 
- writes data from Log buffer cache to redo log file 
- 1/3 full of log buffer cache
- every 3 sec 
- commit happens

DBWR - DB writer 
- writes data from DB buffer cache to datafiles  
- 1/3 full of DB buffer cache
- whenever checkpoint happens 

Dirty Buffer - New data or modified block in the buffer cache 

SMON - System monitor 
- recovering incase of instance crash 
- roll forward committed Tx by reading redo logs 
- rollback uncommitted Tx by reading redo logs  

PMON - Process monitor 
- Keep a track of all user session whenever any user session broke due to network issue 
- Any user session reached ideal session timeout (ideal session timeout = 2hours) 
- PMON will cleanup all resource help by those user session like any lock or any metadata  

CKPT - ckeckpoint 
- Maintain database consistency state for recovery 
- Main job of CKPT is to update latest SCN number into Datafiles and Controfliles header 
- SCN number - system change number 
- every transaction in my database is will generate these SCNs 

SCN - system change number 


Instance = Logical structure (Memory + BG Process)

BG Process = Mandatory BG Process + Non-Mandatory BG Process
==========================================================
Mandatory BG Process
SMOM
PMON
DBWR
LGWR
CKPT

Non-Mandatory BG Process
Arch 
Reco (Distributed Tx, In-doubt transaction)  
Jq
MMON (AMM, ASMM) 
MMNL (AWR)
etc....


Database = Physical Structure (Datafiles)(OS FS / ASM FS)


How select query works?
- for the first time
- second time 

How select insert works?
How select update works?
How select delete works?


Instance = Logical structure (Memory + BG Process)
Database = Physical Structure (Datafiles)(OS FS / ASM FS)

Database = Physical Structure (Datafiles/storage files) (OS FS/ ASM FS)
DEVDB - OS FS 
TESTDB - ASM FS 

- SYSTEM Datafile - Stores all data dictionary and Dynamic perf view or base table / metadata 
- SYSAUX Datafile - Database Stats 
- UNDO Datafile - Old values / Old records / Previous value (undo_rentention=15min)
- TEMP Datafile - Temp operation 
- USERS Datafile - Actual End user data 


select name from v$datafile;
select file_name from dba_data_files;

select NAME from v$tempfile;
select FILE_NAME from dba_temp_files;


Instance + Database 
====================
Instance = Memory + BG Process 
Memory= SGA+PGA 
BG Process=mandatory+Non-Mandatory 
Database=datafile 

1. Instance will start 
- Along with memory and BG process will get started 
2. That instance will be mapped to database 


pfile / spfile:
======================
- This is the fixt file will be used to start my database instance
- Instance structure  

pfile - parameter file 
spfile - server parameter file 

pfile - txt file 
spfile - binary file 

- Database instance properties we are going to define in spfile/pfile 
- Its key value pair 

database_name=DEVDB
instance_name=DEVDB
SGA=3G
PGA=2G
controlfiles
 
many parameter we defined 

supported 450+ parameter 

spfile / pfile is a key value pair file which has 
variable and value assigned to it 
database_name=DEVDB
instance_name=DEVDB
SGA=3G
PGA=2G

./dbca 
TESTDB
DEVDB 

how to check spfile?
How to check whether DB is running with pfile / spfile?

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/19.0.0
                                                 .0/dbhome_1/dbs/spfileDEVDB.or
                                                 a
SQL>

/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileDEVDB.ora
/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora

You can create pfile from Spfile 
You can create Spfile from pfile

v$parameter 

Oracle recommends to run database / database instance using Spfile 
Why? 
- We can make use of dynamic parameters
- Wd can change these dynamic parameter without bouncing or restart database 
 
When we start DB 
-> It will look for Spfile 
-> if not found it will look for pfile 
-> if not found database instance will not start 


controlfile:
========================
- binary file 
- end with .ctl 

[oracle@oraclelab1 dbs]$ cat initDEVDB.ora
*.control_files=
'/u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_ntwl2o59_.ctl',
'/u01/app/oracle/fast_recovery_area/DEVDB/controlfil

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_ntwl2o59_.ctl
/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_ntwl2o6o_.ctl

multiplexing of CF - duplicate copies of CF 

We call it has heart of your database.....
Controlfile is binary file 

Why we call it has heart of my database?
Because CF knows everything about my database 
- DB name 
- Instance name 
- when db created 
- Oracle home 
- SCN number 
- DB ID 
- archive log information 
- How many archives are generated 
- Where are my datafile 
- Where my redo logs 
everything.....


Datafiles:
==================================
- binary file 
- ends with .dbf 

How your instance/database know where are datafile/redo log?
- Controlfile will give those information 

1. End user data will be stored in these datafile
2. Core based tables or metadata tables will be stored on few datafiles 

- SYSTEM Datafile - Stores all data dictionary and Dynamic perf view or base table / metadata 
- SYSAUX Datafile - Database Stats 
- UNDO Datafile - Old values / Old records / Previous value 
- TEMP Datafile - Temp operation 
- USERS Datafile - Actual End user data 

select name from v$datafile;
select name from v$tempfile;

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf
/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf
/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf
/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf

SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_temp_ntwl2w50_.tmp


Redo log:
===========
- binary file 
- ends with .log 

How your instance/database know where are redo log file?
- Controlfile will give those information 

- Transaction information 
- end user transaction information which was written into redo buffer cache, These transaction from redo buffer cache will be written these redo log with help LGWR BG process 

select member from v$logfile;

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_3_ntwl2qf6_.log
/u01/app/oracle/fast_recovery_area/DEVDB/onlinelog/o1_mf_3_ntwl2r8g_.log
/u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_2_ntwl2qdm_.log
/u01/app/oracle/fast_recovery_area/DEVDB/onlinelog/o1_mf_2_ntwl2qsq_.log
/u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_1_ntwl2qct_.log
/u01/app/oracle/fast_recovery_area/DEVDB/onlinelog/o1_mf_1_ntwl2ql5_.log

Multiplexing of Redo log: - duplicate copy of redo logs 


Archive logs:
==============
- Binary file 
- Ends with .arc 

- These are copy of your redo logs 
- Arch background process will generates these arch logs 

How to find whether DB is in archive log mode or not?
archive log list
show parameter recovery

How to enable to disable archive log mode?
Enable:
=============
1. shutdown DB 
SQL> shut immediate;

2. start in mount mode
SQL> startup mount;

3. enable archive log mode 
SQL> alter database archivelog;

4. open database
SQL> alter database open;

disable:
=================
1. shutdown DB 
SQL> shut immediate;

2. start in mount mode
SQL> startup mount;

3. disable archive log mode 
SQL> alter database noarchivelog;

4. open database
SQL> alter database open;



diagnostic file 
======================
DBA maintenance or administration or health check 
- alert log (regular used) 
- trace file 
- trm file 
- incident file 
- core dump file 
- audit file 

alert log:
+++++++++++++++
[oracle@oraclelab1 dbs]$ locate alert_DEVDB.log
/u01/app/oracle/diag/rdbms/devdb/DEVDB/trace/alert_DEVDB.log

v$diag_info
select NAME,VALUE from v$diag_info;

Diag Trace = /u01/app/oracle/diag/rdbms/devdb/DEVDB/trace
locate alert_DEVDB.log

tail -f /u01/app/oracle/diag/rdbms/devdb/DEVDB/trace/alert_DEVDB.log
2026-03-16T10:51:47.022511+05:30
PMON (ospid: ): terminating the instance due to ORA error
2026-03-16T10:51:47.022662+05:30
Cause - 'Instance is being terminated due to fatal process death (pid: 24, ospid: 11922, SMON)'
2026-03-16T10:51:47.024035+05:30
System state dump requested by (instance=1, osid=11877 (PMON)), summary=[abnormal instance termination].
System State dumped to trace file /u01/app/oracle/diag/rdbms/devdb/DEVDB/trace/DEVDB_diag_11897.trc
2026-03-16T10:51:47.383565+05:30
Dumping diagnostic data in directory=[cdmp_20260316105147], requested by (instance=1, osid=11877 (PMON)), summary=[abnormal instance termination].
2026-03-16T10:51:48.525835+05:30
Instance terminated by PMON, pid = 11877


trace file & trm file:
+++++++++++++++++++++++
trace - xml 
trm - binary 

Diag Trace = /u01/app/oracle/diag/rdbms/devdb/DEVDB/trace


Password File:
==============
Binary file

location of password file:
Oracle_Home/dbs/orapwDEVDB
/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/orapwDEVDB

Why password file?
- sysdba remote login authentication 
- DR/Standby database sync with prod

sqlplus / as sysdba >>>>>>>>>>>>>>>>>>>>> OS authentication 
sqlplus sys/Mallik123@DEVDB as sysdba >>>>>>>>> Password file authentication 
sqlplus mallik/mallik@DEVDB >>>>>>>>> Database authentication 

In case password file missing or corrupted?
orapwd file=orapwDEVDB


1. Spfile / pfile missing or corrupted?
- No impact on my database 
- We will not be able to start DB next time 

2. CF missing or corrupted?
- DB will crash 

3. datafile missing or corrupted?
- DB may or may not crash 

- SYSTEM Datafile - Stores all data dictionary and Dynamic perf view or base table / metadata 
- SYSAUX Datafile - Database Stats 
- UNDO Datafile - Old values / Old records / Previous value (undo_rentention=15min)

- TEMP Datafile - Temp operation 
- USERS Datafile - Actual End user data 

4. Redo missing or corrupted?
- DB may or may not crash 

5. Archive missing or corrupted?
- No impact on my database 

6. diagnostic file missing or corrupted?
DBA maintenance or administration or health check 
- alert log (regular used) 
- trace file 
- trm file 
- incident file 
- core dump file 
- audit file 

- No impact on my database 

7. password file missing or corrupted?
- No impact on my database 

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com

Tuesday, April 21, 2026

2 Node RAC | GI Installation & Configuration | 2 Node RAC Oracle Home & DB Installation

Setting up Labs: 
==================================
2 node RAC setup 

node1 - +ASM1 (DEVDB1) - oraclelab1.localdomain.com
node2 - +ASM2 (DEVDB2) - oraclelab2.localdomain.com

DEVDB (DEVDB1 & DEVDB2)

RAC Setup or Cluster setup:
=============================
Step 1: Setup node1 and node2 (Linux server setup and IP configuration) - This is done by Linux and network admins 
Step 2: Download 19c GI/ASM/Clusterware software and Installation GI/ASM/Clusterware home 
- ./gridSetup.sh (+ASM1 & +ASM2)
Step 3: Download 19c DB software and Installation Oracle home (RAC Oracle Home)
- ./runInstaller 
Step 4: Create Database 
- ./dbca (DEVDB - DEVDB1 & DEVDB2)


Step 1: Setup node1 and node2:
=======
- Setup oraclelab1 & oraclelab2 - VM/Physical Linux server (Done by Linux admin in Realtime)

laptop / Desktop:
Hardware: 20GB RAM & 150GB SSD Hard disk 
node1 - oraclelab1 - 8GB RAM - 50GB SSD 
node2 - oraclelab2 - 8GB RAM - 50GB SSD 
remaining - 4GB RAM for your laptop / Desktop operation 
remaining - 50Gb SSD we will create some ASM disks (3GB, 20GB, 10GB)

- Install Oracle Virtual box to setup these labs (Hyper wiser)
- Oracle Virtual box you can download and install from Link #2 (Other Tools for DBAs) or from Google 
- https://drive.google.com/drive/folders/1T9lZJZBy-LHy-OWXUCf1nsyad6ZJoZ2n

- Download oraclelab1.rar and oraclelab2.rar VMs from Link #1 (Ready_VMs_RAC) and unzip using winrar software 
- https://drive.google.com/drive/folders/1o_IqopNgyQdqM3C9BKSXWfpTNi1SzQzg

- Download and install winrar software from link #2 (Other Tools for DBAs)
- https://drive.google.com/drive/folders/1T9lZJZBy-LHy-OWXUCf1nsyad6ZJoZ2n
- Add oraclelab1 and oraclelab2 into Oracle Virtual Box 

(20 GB RAM & 150GB SSD Hard disk)
oraclelab1 - 8GB (50GB)
oraclelab2 - 8GB (50GB) 
4GB for laptop / desktop operation
50GB - ASM disks 

IP and Networking for oraclelab1 and oraclelab2:
Get your laptop IP address -----------------192.168.0.101
Get your laptop subnet range----------------255.255.255.0
Get your laptop gateway IP address ---------192.168.0.1
Get your laptop DNS IP address -------------192.168.0.1

cmd> ipconfig 
cmd> ipconfig /all

oraclelab1: oraclelab2:
interface 1 - enp0s3 interface 1 - enp0s3
==================== =====================
Public: 192.168.0.151 Public: 192.168.0.152 
255.255.255.0 255.255.255.0
192.168.0.1 192.168.0.1
192.168.0.1 192.168.0.1

interface 2 - enp0s8 interface 2 - enp0s8
==================== =====================
Private: 192.168.1.151 Private: 192.168.1.152
255.255.255.0 255.255.255.0


- You can access these labs (oraclelab1 and oraclelab2) from putty or mobaxterm 
- You can download and install putty or mobaxterm  from Link #2 (Other Tools for DBAs)
https://drive.google.com/drive/folders/1T9lZJZBy-LHy-OWXUCf1nsyad6ZJoZ2n


vi /etc/hosts - oraclelab1 & oraclelab2

#Public
192.168.0.151 oraclelab1.localdomain.com oraclelab1
192.168.0.152   oraclelab2.localdomain.com oraclelab2

#Private
192.168.1.151 oraclelab1-priv.localdomain.com  oraclelab1-priv
192.168.1.152 oraclelab2-priv.localdomain.com  oraclelab2-priv

#VIP
192.168.0.153  oraclelab1-vip.localdomain.com   oraclelab1-vip
192.168.0.154  oraclelab2-vip.localdomain.com   oraclelab2-vip

#SCAN IP/VIP
192.168.0.155 scan.localdomain.com        scan
192.168.0.156 scan.localdomain.com        scan
192.168.0.157 scan.localdomain.com        scan


vi /etc/hosts - oraclelab1 & oraclelab2

#Public
10.26.6.161      oraclelab1.localdomain.com      oraclelab1
10.26.6.162      oraclelab2.localdomain.com      oraclelab2

#Private
10.23.6.161      oraclelab1-priv.localdomain.com  oraclelab1-priv
10.23.6.162      oraclelab2-priv.localdomain.com  oraclelab2-priv

#VIP
10.26.6.163  oraclelab1-vip.localdomain.com   oraclelab1-vip
10.26.6.164  oraclelab2-vip.localdomain.com   oraclelab2-vip

#SCAN IP/VIP
10.26.6.165      scan.localdomain.com        scan
10.26.6.166      scan.localdomain.com        scan
10.26.6.167      scan.localdomain.com        scan

Step 2: Download 19c GI/ASM/Clusterware software and Installation GI/ASM/Clusterware home 
- ./gridSetup.sh (+ASM1 & +ASM2)

a) - Manual Users & Groups creation
groupadd oinstall 
groupadd dba 
useradd oracle 
usermod -g oinstall -G oinstall,dba oracle 

- Automatic Users & Groups creation (and also installation of pre-requisite rpms)
yum install oracle* --skip-broken 
- users and groups will be created 
- all pre-req rpms will be installed 
- all the kernel parameter and shared memory parameter will be set 

yum install oracle-database-preinstall-19c --skip-broken 
yum install oracle-database-preinstall-21c --skip-broken 

b) - Directory creation

mkdir -p /u01/app/19.0.0.0/grid
mkdir -p /u01/app/oracle/product/19.0.0.0/dbhome_1

chown -R oracle:oinstall /u01
chmod -R 755 /u01

c) - DNS server setup and name resolution - We are making use of oraclelab1 (node1) itself as a DNS server
nslookup oraclelab1.localdomain.com
-> 192.168.0.151

nslookup oraclelab2.localdomain.com
-> 192.168.0.152

nslookup 192.168.0.151
-> oraclelab1.localdomain.com

nslookup 192.168.0.152
-> oraclelab2.localdomain.com

yum install bind* (oraclelab1 & oraclelab2)

vi /etc/named.conf
- define node1 and DNS server 

options {
        listen-on port 53 { 127.0.0.1; 192.168.0.151; };
        allow-query     { localhost; 192.168.0.0/24; };


forward zoon: (Hostname -> get IP)
zone "localdomain.com" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};

reverse zoon: (IP -> get Hostname)
zone "0.168.192.in-addr.arpa." IN {
type master;
file "0.168.192.in-addr.arpa";
allow-update { none; };
};

vi /var/named/localdomain.zone
$TTL 86400
@ IN SOA oraclelab1.localdomain.com. root.localdomain.com. (
2014051001 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ; minimum
)
@ IN NS oraclelab1.localdomain.
localhost IN A 127.0.0.1
oraclelab1 IN A 192.168.0.151
oraclelab2 IN A 192.168.0.152
oraclelab1-priv IN A 192.168.1.151
oraclelab2-priv IN A 192.168.1.152
oraclelab1-vip IN A 192.168.0.153
oraclelab2-vip IN A 192.168.0.154
scan IN A 192.168.0.155
scan IN A 192.168.0.156
scan IN A 192.168.0.157




vi /var/named/0.168.192.in-addr.arpa
$TTL 86400
@ IN SOA oraclelab1.localdomain.com. root.localdomain.com. (
2
3H
1H
1W
1H )
@ IN NS oraclelab1.localdomain.com.
@ IN PTR localdomain.com.
oraclelab1 IN A 192.168.0.151
oraclelab2 IN A 192.168.0.152
scan IN A 192.168.0.155
scan IN A 192.168.0.156
scan IN A 192.168.0.157
151 IN PTR oraclelab1.localdomain.com.
152 IN PTR oraclelab2.localdomain.com.
155 IN PTR scan.localdomain.
156 IN PTR scan.localdomain.
157 IN PTR scan.localdomain.


vi /etc/named.conf
options {
        listen-on port 53 { 127.0.0.1; 10.26.6.161; };
        allow-query     { localhost; 10.26.0.0/21; };

forward zoon: (Hostname -> get IP) >>>>>>>>>>>>
zone "localdomain.com" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};

vi /var/named/localdomain.zone
$TTL 86400
@ IN SOA oraclelab1.localdomain.com. root.localdomain.com. (
2014051001 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ; minimum
)
@ IN NS oraclelab1.localdomain.
localhost IN A 127.0.0.1
oraclelab1 IN A 10.26.6.161
oraclelab2 IN A 10.26.6.162
oraclelab1-priv IN A 10.23.6.161
oraclelab2-priv IN A 10.23.6.162
oraclelab1-vip IN A 10.26.6.163
oraclelab2-vip IN A 10.26.6.164
scan IN A 10.26.6.165
scan IN A 10.26.6.166
scan IN A 10.26.6.167


reverse zoon: (IP -> get Hostname) >>>>>>>>>>>>>>
zone "51.1.10.in-addr.arpa." IN {
type master;
file "6.26.10.in-addr.arpa";
allow-update { none; };
};


vi /var/named/6.26.10.in-addr.arpa
$TTL 86400
@ IN SOA oraclelab1.localdomain.com. root.localdomain.com. (
2
3H
1H
1W
1H )
@ IN NS oraclelab1.localdomain.com.
@ IN PTR localdomain.com.
oraclelab1 IN A 10.26.6.161
oraclelab2 IN A 10.26.6.162
scan IN A 10.26.6.165
scan IN A 10.26.6.165
scan IN A 10.26.6.165
161 IN PTR oraclelab1.localdomain.com.
262 IN PTR oraclelab2.localdomain.com.
165 IN PTR scan.localdomain.
166 IN PTR scan.localdomain.
167 IN PTR scan.localdomain.


setup resolv.conf 

vi /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver oraclelab1.localdomain.com
options timeout:1
options attempts:5

service named restart

cp /etc/hosts /etc/hosts_backup
cp /etc/named.conf /etc/named.conf_backup
cp /var/named/localdomain.zone /var/named/localdomain.zone_backup
cp /var/named/6.26.10.in-addr.arpa /var/named/6.26.10.in-addr.arpa_backup
cp /etc/resolv.conf /etc/resolv.conf_backup

scp /etc/hosts* root@10.26.6.162:/etc/
scp /etc/named.conf* root@10.26.6.162:/etc/.
scp /var/named/localdomain.zone* root@10.26.6.162:/var/named/.
scp /var/named/6.26.10.in-addr.arpa* root@10.26.6.162:/var/named/.
scp /etc/resolv.conf* root@10.26.6.162:/etc/.

service named restart

d) - disable firewall on both the nodes 
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld

e) Create shared disks for ASM 
Create ASM/GI 
- ASM/GI can be created or ASM/GI can only understand Physical disks / raw disks / block devices 
- ASM/GI can not understand virtual disks 

We have lab1 and lab2 - These are virtual machines 
- Then we can create only virtual disks 

First go ahead and add 3 virtual disks to both the VMs>>>>>
add 3 disks - virtual disks 
3GB  - ASM - /dev/sdb (sharable)
20GB - DB  - /dev/sdc (sharable)
10GB - DB  - /dev/sdd (sharable) 

I can make my ASM/GI fool
- I can tell ASM/GI that these virtual disks are raw disks
- By making use of ASM library I can convert or by label these virtual disks as raw disks

Second go ahead and convert or by label these virtual disks as raw disks (on only 1 nodes)
fdisk /dev/sdb -> /dev/sdb1
fdisk /dev/sdc -> /dev/sdc1
fdisk /dev/sdd -> /dev/sdd1

Command (m for help): n
Command (m for help): w

 3G - /dev/sdb - fdisk - /dev/sdb1 - asmlibrary - ASMDISK1 ----- ASM installation 
20G - /dev/sdc - fdisk - /dev/sdc1 - asmlibrary - ASMDISK2 ----- Database 
10G - /dev/sdd - fdisk - /dev/sdd1 - asmlibrary - ASMDISK3 ----- Database 

setup asm-library setup on both the nodes
oracleasm configure -i
oracleasm init

- Perform only on node1
oracleasm createdisk ASMDISK1 /dev/sdb1    - OCR
oracleasm createdisk ASMDISK2 /dev/sdc1    - DATA
oracleasm createdisk ASMDISK3 /dev/sdd1    - RECO

- Perform only on node2
oracleasm scandisks
oracleasm listdisks

f) - GI Installation (ASM Home or GI Home or clusterware home or ASM Software or GI Software or clusterware software)

ASM Home - Automatic Storage management home
GI Home - Grid Infrastructure home
Clusterware Home 

- Download GI Software - oracle edelivery (https://edelivery.oracle.com/osdc/faces/SoftwareDelivery)
- Or Download from link #2 (Oracle Software and Patches -> 19c Software)
- unzip into /u01/app/19.0.0.0/grid (only on node1)
WINSCP:
$cd /u01/patches
$unzip V982068-01.zip -d /u01/app/19.0.0.0/grid

SHARED FOLDER 
# cd /media/sf_Software/Grid_19c_Software/
#unzip V982068-01.zip -d /u01/app/19.0.0.0/grid
#cd /u01/app/19.0.0.0
#chown -R oracle:oinstall grid

passwd oracle 
>>> Give password 

- cd /u01/app/19.0.0.0/grid
- ./runcluvfy.sh stage -pre crsinst -n oraclelab1,oraclelab2 -verbose (as oracle/grid user only on node1)
- ./gridSetup.sh (directly login as oracle user - on GUI)


Step 3: Download 19c DB software and Installation Oracle home (RAC Oracle Home)
- ./runInstaller 
- Download DB Software - oracle edelivery (https://edelivery.oracle.com/osdc/faces/SoftwareDelivery)
- Download from link #2 
- unzip into /u01/app/oracle/product/19.0.0.0/dbhome_1 (only on node1)

WINSCP:
#cd /u01/patches/
#unzip V982063-01.zip -d /u01/app/oracle/product/19.0.0.0/dbhome_1
#cd /u01/app/oracle/product/19.0.0.0
#chown -R oracle:oinstall dbhome_1

SHARED FOLDER 
#cd /media/sf_Software/DB_19c_Software/
#unzip V982063-01.zip -d /u01/app/oracle/product/19.0.0.0/dbhome_1
#cd /u01/app/oracle/product/19.0.0.0
#chown -R oracle:oinstall dbhome_1
$cd /u01/app/oracle/product/19.0.0.0/dbhome_1
$./runInstaller  (directly login as oracle user - on GUI)


Step 4: Create Database 

- Diskgroup creation +DATA & +RECO - ASM Storage

$cd /u01/app/19.0.0.0/grid/bin
$./asmca (+DATA-20G, +RECO-10G)

- cd /u01/app/oracle/product/19.0.0.0/dbhome_1/bin
- ./dbca (DEVDB - DEVDB1 & DEVDB2) (directly login as oracle user - on GUI)

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com

Interview_Questions_6 | Oracle RAC Installation, Cluster Services & Administration

1. Tool used for Cluster Installation prechecks?
./runcluvfy.sh (/u01/app/19.0.0.0/grid)

2. Tool used to install GI/ASM/Clusterware Home?
./gridSetup.sh (/u01/app/19.0.0.0/grid)

3. Tool used to install Oracle Home / Database Home / DB Home?
./runInstaller (/u01/app/oracle/product/19.0.0.0/dbhome_1)

4. Tool used to create DiskGroup / ASM Storage (+OCR/+DATA/+RECO)
./asmca (/u01/app/19.0.0.0/grid/bin)

5. Tool used to create database? -> DEVDB 
./dbca (/u01/app/oracle/product/19.0.0.0/dbhome_1/bin)

6. Log location of GI/ASM/Clusterware installation
GI/ASM/Clusterware Installation log location:
- /tmp/GridSetupActions2025-07-17_11-19-39AM
After Installation log will move to
- tail -f /u01/app/oraInventory/logs/GridSetupActions2025-07-17_11-19-39AM/gridSetupActions2025-07-17_11-19-39AM.log

root.sh script execution log location:
node1 -> tail -f /u01/app/oracle/crsdata/oraclelab1/crsconfig/rootcrs_oraclelab1_2025-07-17_11-37-47AM.log
node2 -> tail -f /u01/app/oracle/crsdata/oraclelab2/crsconfig/rootcrs_oraclelab2_2025-07-17_11-46-00AM.log

node1 -> /u01/app/19.0.0.0/grid/root.sh
node2 -> /u01/app/19.0.0.0/grid/root.sh
- configure cluster 
- configure OLR/OCR/Votedisks
- starts cluster daemons
- Set ASM instance 
- Set ASM storage 
- many more  

7. orainventory root scripts 

node1 -> /u01/app/oraInventory/orainstRoot.sh
node2 -> /u01/app/oraInventory/orainstRoot.sh
- set permission (read / write ) on /u01/app/oraInventory
- set ownership/group ownership on /u01/app/oraInventory

8. oracle root script execution 

node1 -> /u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh
node2 -> /u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh
- create and grant permission on /etc/oratab 
- set env variable 

9. Log location of Oracle Home / Database Home / DB Home installation
tail -f /u01/app/oraInventory/logs/InstallActions2025-07-18_08-59-12AM/installActions2025-07-18_08-59-12AM.log

10. Log location of database creation  
tail -f /u01/app/oracle/cfgtoollogs/dbca/DEVDB/trace.log_2025-07-18_09-16-06AM

11. Tool used to create ASMDISKS using virtual disks(ASMDISK1/ASMDISK2/ASMDISK3)?
oracleasm library 
oracleasm createdisk ASMDISK1 /dev/sdb1
oracleasm createdisk ASMDISK2 /dev/sdc1
oracleasm createdisk ASMDISK3 /dev/sdd1

Because ASM can not understand virtual disks / partitioned disks 
ASM can only understand RAW disks / Physical disks / Block devices 
We fooled ASM by converting or labelling there Virtual Disks -> Partitioned Disks -> ASM disks 

12. How to install/setup oracleasm library 
oracleasm init
oracleasm configure -i

13. Where to download GI / ASM / Clusterware software? 
- oracle edelivery (free) 
- OTN (free)
- support.oracle.com (license) 

14. Where to download Oracle Home / Database Home / DB Home software? 
- oracle edelivery (free) 
- OTN (free)
- support.oracle.com (license) 

15. check ASM and DB instance are running or not?
ps -ef|grep smon

16. check ASM and DB instance owner?
ps -ef|grep smon

+ASM1/+ASM2 -> oracle 
DEVDB1/DEVDB2 -> oracle 

+ASM1/+ASM2 -> grid 
DEVDB1/DEVDB2 -> oracle 

+ASM1/+ASM2 -> grid 
DEVDB1/DEVDB2 -> oraprod  

17. How to connect to ASM instance?
ps -ef|grep smon
su - oracle
. oraenv -> +ASM1/+ASM2
env |grep ORA
sqlplus / as sysasm 

vi /etc/oratab
+ASM1:/u01/app/19.0.0.0/grid:Y

vi /etc/oratab
+ASM2:/u01/app/19.0.0.0/grid:Y


vi /home/oracle/.bash_profile

export ORACLE_SID=+ASM1
export ORACLE_HOME=/u01/app/19.0.0.0/grid
export ORACLE_BASE=/u01/app/oracle
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$PATH:$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$PATH:$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

vi /home/oracle/.bash_profile

export ORACLE_SID=+ASM2
export ORACLE_HOME=/u01/app/19.0.0.0/grid
export ORACLE_BASE=/u01/app/oracle
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$PATH:$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$PATH:$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

18. How to connect to DB instance?
ps -ef|grep smon
su - oracle
. oraenv -> DEVDB1/DEVDB2
env |grep ORA
sqlplus / as sysdba

vi /etc/oratab
DEVDB1:/u01/app/oracle/product/19.0.0.0/dbhome_1:Y

vi /etc/oratab
DEVDB2:/u01/app/oracle/product/19.0.0.0/dbhome_1:Y


vi /home/oracle/.bash_profile

export ORACLE_SID=DEVDB1
export ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$PATH:$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$PATH:$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

vi /home/oracle/.bash_profile

export ORACLE_SID=DEVDB2
export ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$PATH:$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$PATH:$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib


+ASM1  - node1 -> grid ->  /home/grid/.bash_profile
DEVDB1 - node1 -> oracle ->  /home/oracle/.bash_profile
su - grid
su - oracle

+ASM2  - node2 -> grid ->  /home/grid/.bash_profile
DEVDB2 - node2 -> oracle ->  /home/oracle/.bash_profile
su - grid
su - oracle

+ASM1 & DEVDB1 - node1 -> oracle ->  /home/oracle/.bash_profile
+ASM2 & DEVDB2 - node2 -> oracle ->  /home/oracle/.bash_profile
We can set only 1 evn variable in .bash_profile 

19. How to connect to ASM storage / ASM diskgroups?
OCR, DATA, RECO

ps -ef|grep smon
su - oracle
. oraenv -> +ASM1/+ASM2
env |grep ORA
asmcmd -p
ASMCMD [+] > lsdg

20. Check cluster status and cluster resource and OS daemons:
ps -ef|grep smon
su - oracle
. oraenv -> +ASM1/+ASM2
env |grep ORA

crsctl --- Tool

crsctl stat res -t -init ------ cluster resource for a single node 
crsctl stat res -t  ----- cluster resource for all node
ps -ef|grep d.bin ------- OS daemons

21. What all softwares are installed on my server 
node1: 19C GI & 19C DB 
node2: 19C GI & 19C DB

- looking at inventory file
cat /u01/app/oraInventory/ContentsXML/inventory.xml

node1: 19C GI & 19C DB + 12c DB + 19C DB 
node2: 19C GI & 19C DB + 12c DB + 19C DB  

node1
/u01/app/19.0.0.0/grid - +ASM1
/u01/app/oracle/product/19.0.0.0/dbhome_1 - DEVDB1
/u01/app/oracle/product/12.0.0.0/dbhome_1 - TESTDB1
/u01/app/oracle/product/19.0.0.0/dbhome_2 - UATDB1

node2
/u01/app/19.0.0.0/grid - +ASM2
/u01/app/oracle/product/19.0.0.0/dbhome_1 - DEVDB2
/u01/app/oracle/product/12.0.0.0/dbhome_1 - TESTDB2
/u01/app/oracle/product/19.0.0.0/dbhome_2 - UATDB2

22.  How to get inventory location?
cat /etc/oraInst.loc

23. check database status and database Instance status:

ps -ef|grep smon
su - oracle
. oraenv -> DEVDB1/DEVDB2
env |grep ORA
sqlplus / as sysdba
select instance_name, status from v$instance;
select name, open_mode from v$database;

select instance_name, status from gv$instance;
select name, open_mode from gv$database;

srvctl --- Tool 

srvctl status database -d DEVDB
srvctl status instance -i DEVDB1 -d DEVDB
srvctl status instance -i DEVDB2 -d DEVDB

24. How many database are create on a server? 
cat /etc/oratab
crsctl stat res -t (set environmental variable to ASM/GI owner ) 

25.  How many instance are running on a server? 
ps -ef|grep smon
crsctl stat res -t

26. How to find how many RAC node or cluster nodes? 
ps -ef|grep smon
su - oracle
. oraenv -> +ASM1/+ASM2
env |grep ORA

[oracle@oraclelab1 ~]$ olsnodes
oraclelab1
oraclelab2

27. How to verify whether it RAC database or standalone?
srvctl config database -d DEVDB

sqlplus / as sysdba
show parameter cluster 
select instance_name, status from gv$instance;

28. Oracle Home / Database Home / DB Home
GI Home / grid Home / ASM Home / Clusterware Home 

DB: -> /u01/app/oracle/product/19.0.0.0/dbhome_1
===
Oracle Software 
Database software 
DB Software 
Oracle Home 
Database Home 
DB home 

GI / ASM / Clusterware : -> /u01/app/19.0.0.0/grid
====
GI Home (Grid Infrastructure Home) 
ASM Home (Automatic Storage Management Home) 
Grid Home
Clusterware Home  
Clusterware Software
ASM Software 
GI Software 

29.  Root script 
/u01/app/oraInventory/orainstRoot.sh
- set inventory permission and ownership 
- group ownership 

/u01/app/19.0.0.0/grid/root.sh
- Configure and start Cluster resource, OS daemons and create ASM Instance 

/u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh
- created /etc/oratab file and set permission and env

30. GUI mode installation Vs silent mode 
- GUI - Demo - directly login to server / VM and installed GI & DB

- In case if we don't have direct login to server
- vnc server 
- tiger vnc 
- vnc viewer
- xming or many more

xming
https://mallik034.blogspot.com/2020/04/srchttpsdrive.html

vnc viewer 
https://mallik034.blogspot.com/2025/05/install-oracle-using-vnc.html

- Even some customer will not allow these GUI screens 
- command line (silent/Manual method)
- create response file and then install it (Oracle doc ID)

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com

Sunday, April 19, 2026

Interview_Questions_5 | Oracle ASM Architecture, Internals, Disk Groups & Redundancy

1. change diskgroup redundancy? 
TESTDB -> +DATA (External Redundancy)
Change redundancy of DATA diskgroup to NORMAL / HIGH? 
- Not possible 

2. change AU size of a diskgroup? 
TESTDB -> +DATA (AU=4MB)
Change AU size of DATA diskgroup to 1M/8MB?
- Not possible 

db_block_szie=8K 
AU=1MB/4MB 
-> bigger the AU/db_block_size better for OLAP/Datawarehouse database 

3. change diskgroup name? 
TESTDB -> +DATA groups
Change name of DATA diskgroup DATAC? 
- Possible (This need downtime for TESTDB)
DATA -> DATAC 

4. How to map asm disks to diskgroup?
/dev/oracleasm/disks/ASMDISK1 - OCR
/dev/oracleasm/disks/ASMDISK2 - DATA
/dev/oracleasm/disks/ASMDISK3 - RECO

select GROUP_NUMBER,NAME,FAILGROUP,PATH from V$ASM_DISK order by GROUP_NUMBER;
select GROUP_NUMBER,NAME from V$ASM_DISKGROUP order by GROUP_NUMBER;

ASMCMD [+] > lsdsk -G OCR
Path
/dev/oracleasm/disks/ASMDISK1
ASMCMD [+] > lsdsk -G DATA
Path
/dev/oracleasm/disks/ASMDISK2
ASMCMD [+] > lsdsk -G RECO
Path
/dev/oracleasm/disks/ASMDISK3

5. How to map asm disks to OS disks?
/dev/oracleasm/disks/ASMDISK1 - /dev/sdb1
/dev/oracleasm/disks/ASMDISK2 - /dev/sdc1
/dev/oracleasm/disks/ASMDISK3 - /dev/sdd1

oracleasm querydisk -d ASMDISK1
oracleasm querydisk -d ASMDISK2
oracleasm querydisk -d ASMDISK3

[root@oraclelab2 dev]# oracleasm querydisk -d ASMDISK1
Disk "ASMDISK1" is a valid ASM disk on device [8,17]
[root@oraclelab2 dev]# oracleasm querydisk -d ASMDISK2
Disk "ASMDISK2" is a valid ASM disk on device [8,33]
[root@oraclelab2 dev]# oracleasm querydisk -d ASMDISK3
Disk "ASMDISK3" is a valid ASM disk on device [8,49]

6. smallest unit of DB and smallest unit of ASM storage 

db_block_szie=8K 
AU=1MB/4MB 

-> bigger the AU/db_block_size better for OLAP/Datawarehouse database 

7. ASM Instance:
- instance only 

8. SPFILE (80+)
- SPFILE in diskgroup 
- create pfile from spfile 

9. ASM specific memory & ASM specific BG process 

10. connecting to DB, ASM, ASM storage 

11.  ASM storage structure / ASM logical structure  
AU, ASM Extents, ASM file, ASM disks, ASM diskgroup 

12. DB_BLOCK_SIZE Vs AU 

13. Redundancy (External, Normal, High) 

14. Why ASM? or advantages of ASM 
- Redundancy (External, Normal, High) 
- Fail Group 
- Striping 
- High speed read and write (Multiple parallel IO)
- Autorestart feature 

15. DB start-up sequence and ASM startup sequence 

16. ASM diskgroup administration 
create / alter / drop 

17. v$ Vs dba_ 
v$asm_diskgroup 
v$asm_disk
v$asm_operation
v$instance 

18. How to speed up this rebalance operation?
-> by using asm_power_limit parameter 
ASM_POWER_LIMIT - speed up rebalance 

19. How to estimate or get the rebalance time 
-> v$asm_operation

20. ASM, DB maintenance - Bounce
HAS (os process / os daemon) -> ASM -> DB 

crsctl check has
crsctl stop has
crsctl start has

srvctl status asm 
srvctl stop asm 
srvctl start asm 

srvctl status database -d TESTDB 
srvctl stop database -d TESTDB 
srvctl start database -d TESTDB 

21. diskgrup creation 
Creation DG - using command line 
Creation DG - using command GUI (./asmca) 

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com

Interview Question 3 - Physical_Vs_Logical_Structure_Of_Database_&_Datablocks_Extensts_Segments_Tablespaces_Datafile_&_Fragmentation_&_Row_Chaining_&_Row_Migration

1. How Many TS inside database?
1024
v$tablespace

SQL> select NAME from v$tablespace;
NAME
------------------------------
SYSAUX
SYSTEM
UNDOTBS1
USERS
TEMP

2. How many datafiles inside single TS?
1024
v$datafile

SQL> select TABLESPACE_NAME,FILE_NAME from dba_data_files;
TABLESPACE_NAME                FILE_NAME
------------------------------ ----------------------------
USERS                          /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf
UNDOTBS1                       /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf
SYSTEM                         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf
SYSAUX                         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf

3. How to map each TS and associated datafile? 
dba_data_files;

SQL> select TABLESPACE_NAME,FILE_NAME from dba_data_files;
TABLESPACE_NAME                FILE_NAME
------------------------------ ----------------------------
USERS                          /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf
UNDOTBS1                       /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf
SYSTEM                         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf
SYSAUX                         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf

4. max size of datafile 
- 32GB (8k)

5. Tablespace is full?
- check all datafiles and are all datafiles reached 32GB
- Yes then add new datafile 

6. fragmentation (select query taking more time) - 10%
Cause: caused by lots delete operation then HWM is reached block header and we can not use deleted space within a block  
Solution: Table move, Table shrink, Export & Import of a table 

7. HWM? 
logical indicator of used data in a block 
- Inserts will always goes about HWM
- Read or select queries will always goes below HWM 

8. What data block(8k)

9. Extents 

10. Segments 

11. Tablesapce 

12. datafiles 

tablespaces (datafiles) -> segments -> extents -> data block(8k)

13. row piece 

14. How to find tablespace utilization 

set pages 1000 lines 1000
col tablespace_name format a16;
col file_name format a80;
SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 "In MB"
FROM DBA_DATA_FILES;

SQL> set pages 1000 lines 1000
col tablespace_name format a16;
col file_name format a80;
SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 "In MB"
FROM DBA_DATA_FILES;SQL> SQL> SQL>   2

TABLESPACE_NAME  FILE_NAME                                                                             In MB
---------------- -------------------------------------------------------------------------------- ----------
USERS            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf                          5
UNDOTBS1         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf                     340
SYSTEM           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf                       900
SYSAUX           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf                       540

Mallik -> USERS -> user.dbf 
user.dbf - 5MB used - 32GB free 

Mallik user is trying to add data but he is getting Tablespace USER is full.
- strange 
- engage DBA to add new datafile into USER TS 


set pages 1000 lines 1000
col tablespace_name format a16;
col file_name format a80;
SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 "In MB",AUTOEXTENSIBLE
FROM DBA_DATA_FILES;

15. AUTOEXTENSIBLE
default any datafile is created which will create with 100MB size when this 100MB is full then it will increase by 200MB

16. OMF - oracle managed files 
create tablespace TEST1; (OMF) 
- default name is given for datafile 
- default initial size is defined for datafile - 100MB 
- once this 100MB is full automatically oracle can assign 100MB/200MB each 
- autoextetion 

set pages 1000 lines 1000
col tablespace_name format a16;
col file_name format a80;
SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 "In MB",AUTOEXTENSIBLE
FROM DBA_DATA_FILES;SQL> SQL> SQL>   2

TABLESPACE_NAME  FILE_NAME                                                                             In MB AUT
---------------- -------------------------------------------------------------------------------- ---------- ---
USERS            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf                          5 YES
UNDOTBS1         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf                     340 YES
SYSTEM           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf                       900 YES
SYSAUX           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf                       540 YES
TEST1            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_test1_nvkom8j3_.dbf                        100 YES

17. noautoextention or Non-OMF 
create tablespace TEST2 
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test2.dbf'
size 200M;

SQL> set pages 1000 lines 1000
col tablespace_name format a16;
col file_name format a80;
SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 "In MB",AUTOEXTENSIBLE
FROM DBA_DATA_FILES;SQL> SQL> SQL>   2

TABLESPACE_NAME  FILE_NAME                                                                             In MB AUT
---------------- -------------------------------------------------------------------------------- ---------- ---
USERS            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf                          5 YES
UNDOTBS1         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf                     340 YES
SYSTEM           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf                       900 YES
SYSAUX           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf                       540 YES
TEST1            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_test1_nvkom8j3_.dbf                        100 YES
TEST2            /u01/app/oracle/oradata/DEVDB/datafile/test2.dbf                                        200 NO

user1 -> TEST1 TS
- create table TABLE1 
- insert data of 100MB 
- further user1 can insert data of 1G 

user2 -> TEST2 TS 
- create table TABLE2
- insert data of 100MB 
- further user2 can try to insert data of 1G - which will fail 

user2 will engage DBA 
- As a DBA I will check whether datafile is AUTOEXTENSIBLE ON/OFF 
- I can increate the datafile size 

alter database
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test2.dbf'
resize 1G;

alter database
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test2.dbf'
resize 32G;

alter database
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test2.dbf'
AUTOEXTEND ON;

- As a DBA I will check whether datafile is reached 32GB or not  
- I can add new datafile 

ORA-01686 max #file 10

17. OMF / Non-OMF 

create tablespace TEST1; (OMF) 

create tablespace TEST2 
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test2.dbf'
size 200M;

SQL> show parameter db_create_file_dest
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string      /u01/app/oracle/oradata

alter system set db_create_file_dest='';
create tablespace TEST3;

create tablespace TEST3 datafile '/u01/app/oracle/oradata/DEVDB/datafile/test3.dbf' size 100M;

alter system set db_create_file_dest='/u01/app/oracle/oradata';

18. Row chaining and row migration:

row migration:
===============
Cause: Future update is unable to keep the row piece within the same block and we end up with moving the row piece into new block 
Solution: pct free 20% or 30% 

ALTER TABLE EMP PCTFREE 20;

row chaining:
===============
Cause: Row piece size (16K) is bigger than data block size (8k)  
Solution: By creating bigger block size tablespace and move those tables 

TEST TS (8k) -> Mallik -> EMP (row piece 16k) 

- create TEST2 TS with 16K size 
- move EMP table from TEST TS to TEST2 TS 

19. Big file tablespace 
my database OLTP - banking - DML - best / default block size is 8k

Because of this 8k block size -> datafile size is 32GB 
- is there way can i create bigger datafile even though block size is 8k

create tablespace TEST1; -> test1.dbf 
8k -> DF size 32GB 

create bigfile tablespace TEST3; -> test3.dbf
8k -> DF size 32TB 


8K -> small file 32GB -> big file 32TB
16K -> small file 64GB -> big file 64TB
32K -> small file 128GB -> big file 128TB

create tablespace TEST5 
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test5.dbf'
size 33G;

create bigfile tablespace TEST5 
datafile '/u01/app/oracle/oradata/DEVDB/datafile/test5.dbf'
size 33G;

OLTP - (banking, retail, finance many more) 
OLAP - Datawarehouse - select or reporting query (100TB / 500TB) 

small file
++++++++++++++++++
OLAP - 200TB - 2,04,800 GB  
How many datafiles? 
- 6,400

OLAP - 400TB - 4,09,600 GB  
How many datafiles? 
- 12,800


Big file
++++++++++++++++++++
OLAP - 200TB - 2,04,800 GB  
How many datafiles? 
- 7

OLAP - 400TB - 4,09,600 GB  
How many datafiles? 
- 13


20. How to identify bigfile or small file?
We can create a tablespace with bigfile as a key-word 

SQL> SQL> set pages 1000 lines 1000
col tablespace_name format a16;
col file_name format a80;
SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 "In MB",AUTOEXTENSIBLE
FROM DBA_DATA_FILES;SQL> SQL> SQL>   2

TABLESPACE_NAME  FILE_NAME                                                                             In MB AUT
---------------- -------------------------------------------------------------------------------- ---------- ---
USERS            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_ntwl11pb_.dbf                          5 YES
UNDOTBS1         /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_ntwl10n5_.dbf                     340 YES
SYSTEM           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_ntwkz4g1_.dbf                       900 YES
SYSAUX           /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_ntwl07kk_.dbf                       540 YES
TEST1            /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_test1_nvkom8j3_.dbf                        100 YES
TEST2            /u01/app/oracle/oradata/DEVDB/datafile/test2.dbf                                       1024 YES
TEST5            /u01/app/oracle/oradata/DEVDB/datafile/test5.dbf                                      33792 NO

SQL> select NAME, BIGFILE from v$tablespace;
NAME                           BIG
------------------------------ ---
SYSAUX                         NO
SYSTEM                         NO
UNDOTBS1                       NO
USERS                          NO
TEMP                           NO
TEST1                          NO
TEST2                          NO
TEST5                          YES

8k:
++++++
small file ts -> we can add multiple datafile up to 1024 
32GB X 1024 datafile = 32,768 GB = 32TB 

big file -> only single datafile 
32TB X 1 datafile = 32TB 

block size = 8k 
create tablespace TEST1 - small file (32GB) - OLTP 
- create tablespace TEST1; 
- We can add 32GB * 1024 datafiles = 32TB 

create bigfile tablespace TEST2 - big file (32TB) - OLAP 
- create bigfile tablespace TEST2
- Big file tablespace supports only singe datafile inside tablespace 
- We can add 32TB * 1 datafiles = 32TB 

create tablespace TEST1;
create bigfile tablespace TEST2;

8k -> DF size 32GB  DF size 32TB
16k -> DF size 64GB  DF size 64TB
32k -> DF size 128GB DF size 128TB

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com

Oracle Patching Interview Questions 🚀 | GI, Oracle Home & Database

Lab1: OH
=============
1. Patch Oracle Home - OPatch Tool ------------------- done 
2. Patch Database DEVDB - datapatch tool ------------------- done 

Lab2: GI/ASM & OH 
==================
1. Patch GI Home - OPatch Tool ----------------------- done 
2. Patch Oracle Home - OPatch Tool ------------------- done 
3. Patch Database TESTDB - datapatch tool ------------------- done 
 

1. datapatch taking more time? or datapatch is hang?
- dba_registry (Invalid) 
- dba_object (Invalid) 
- lots of user session or Tx

2. OPatch Vs OPatchauto 
opatch ---- manual patching 
opathauto --- automatic patching 

GI:
/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local -silent /u01/patches/19.17/34416665/34419443
/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local -silent /u01/patches/19.17/34416665/34444834
/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local -silent /u01/patches/19.17/34416665/34428761
/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local -silent /u01/patches/19.17/34416665/34580338
/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local -silent /u01/patches/19.17/34416665/33575402

/u01/app/19.0.0.0/grid/OPatch/opatchauto apply /u01/patches/19.17/34416665 -oh /u01/app/19.0.0.0/grid

DB:
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch apply -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -local -silent /u01/patches/19.17/34416665/34419443
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch apply -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -local -silent /u01/patches/19.17/34416665/34444834

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatchauto apply /u01/patches/19.17/34416665 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1

GI + DB 
/u01/app/19.0.0.0/grid/OPatch/opatchauto apply /u01/patches/19.17/34416665


Conflict pre checks:
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34419443 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34444834 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34428761 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34580338 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/33575402 -oh /u01/app/19.0.0.0/grid

system space prechk:
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34419443 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34444834 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34428761 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34580338 -oh /u01/app/19.0.0.0/grid
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/33575402 -oh /u01/app/19.0.0.0/grid


Conflict pre checks:
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34419443 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34444834 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1

system space prechk:
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34419443 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34444834 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1


/u01/app/19.0.0.0/grid/OPatch/opatchauto apply /u01/patches/19.17/34416665 -analyse 


3. How to minimise downtime?
- Out of place patching 

Lab1: OH
=============
1. Patch Oracle Home - OPatch Tool ------------------- done (Downtime) 
2. Patch Database DEVDB - datapatch tool ------------------- done (Online)

Lab2: GI/ASM & OH 
==================
1. Patch GI Home - OPatch Tool ----------------------- done (Downtime) 
2. Patch Oracle Home - OPatch Tool ------------------- done (Downtime)  
3. Patch Database TESTDB - datapatch tool ------------------- done (Online)

OH - /u01/app/oracle/product/19.0.0.0/dbhome_1
DB - DEVDB 

a. copy dbhome_1 as dbhome_2
b. clone OH dbhome_2 using clone.pl 
- https://mallik034.blogspot.com/2020/02/cloning-oracle-home.html
c. apply patches on dbhome_2 using opatch
d. stop DB - DEVDB/TESTDB on dbhome_1 and start from dbhome_2 --- minimum downtime 
e. run datapatch for DB - DEVDB/TESTDB - online 


4. CDB and PDB patching 

DEVCDB >>>> PDB1, PDB2, PDB3 (PDB1 - closed) 
. oraenv >>> DEVCDB 
./datapatch -verbose 

later we have option to patch only PDB 
. oraenv >>> DEVCDB 
./datapatch -PDBS PDB1 -verbose 


5. Standby or DR 
+++++++++++++++++++++++++++++++++++++
1. Apply patch on OH at DR 
- We don't do database patching at DR 

2. Apply patch on OH at PROD
3. Patch PROD database using datapatch 
- When log shipping happens from PROD to DR then DR database will get patched 


1. Apply patch on GI at DR 
2. Apply patch on OH at DR 
- We don't do database patching at DR 

3. Apply patch on GI at PROD 
4. Apply patch on OH at PROD
5. Patch PROD database using datapatch 
- When log shipping happens from PROD to DR then DR database will get patched 


6. Rollback 
++++++++++++++++

lab1: rollback
=============== 
19.3 -> 19.17 >>>> Apply / patch 
19.17 -> 19.3 >>>> Rollback 

[oracle@oraclelab1 OPatch]$ /u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches
34419443;Database Release Update : 19.17.0.0.221018 (34419443)
34444834;OCW RELEASE UPDATE 19.17.0.0.0 (34444834)

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch rollback -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -local -silent -id 34444834
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch rollback -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -local -silent -id 34419443

19.3 -> 19.17 >>>> Apply / patch 
19.3 - become inactive but will not be removed 
19.17 - active 
when you rollback 19.17 then whatever old patch (19.3) will become active again 

Where these patches are stored either old inactive or active?

7. Patch Storage
====================
Where are these patches stored?
/u01/app/19.0.0.0/grid/.patch_storage/
/u01/app/oracle/product/19.0.0.0/dbhome_1/.patch_storage/

8. Central Inventory & Local Inventory:
Central Inventory (/u01/app/oraInventory) 
- Software Information or what all softwares are installed on a server like GI, 12c OH or 19c OH 

cat /etc/oraInst.loc 
cat /u01/app/oraInventory/ContentsXML/inventory.xml

Local Inventory
- Patch Information applied on that GI home or Oracle Home 
- each GI home and OH will be having its own local inventory 

lab1:
/u01/app/oracle/product/19.0.0.0/dbhome_1/inventory/ContentsXML/comps.xml 

lab2:
/u01/app/19.0.0.0/grid/inventory/ContentsXML/comps.xml 
/u01/app/oracle/product/19.0.0.0/dbhome_1/inventory/ContentsXML/comps.xml 

9. Can we run the opath or opatchauto parallelly 
- No 

10. Can we run multiple datapatch 
- Yes

12. Can I run opath/opatchauto online 
- No 

13. Can I run datapatch online 
- Yes (Its always online)  

14. Can I patch DR first or PROD first 
- Any order (Best practice is always patch DR first)

15. On lab2 Can I patch DB home first or ASM home first 
- Any order (Best practice is always patch ASM Home first)

16. What are different patches?
- Many 

ONEOFF patch 
merge patch 
RU patch 
CPU patch 
quarterly patch 
intrem patch 
overlay patch 
JAVA patch 
perl patch 
JDBC patch 
HOT patch 
online patch 

17. In case any inventory corruption - what happens?
- Patching will fail 
- Work with oracle support and rebuild inventory 

18. What are possible patching failure 
- active process 
- lower OPatch version 
- Space issue 
- network issue 
- process got killed 
- patching failed with relink issue 
- patching may fail due to permission issue 


- in any failure read the patching and fix the issue 
- re-run the patch command again 


19. Opatch is slow 
- Patch Storage is issue 
- there are lot of inactive patches 
- Opatch remove inactive patches (DoID/steps) 

19.3 -> 19.17 -> 19.20 -> 19.23 -> 19.25 -> 19.29 -> 19.30 

$ $ORACLE_HOME/OPatch/opatch util listorderedinactivepatches
$ $ORACLE_HOME/OPatch/opatch util deleteinactivepatches

20. Manual way of relinking oracle home 
- relink 
/u01/app/oracle/product/19.0.0.0/dbhome_1/bin/relink all  

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com

Oracle Database Architecture & Instance Details & Memory & BG Process & Database & Backend Storage File Structure

oraclelab1 - DEVDB (Running in OS file system) oraclelab2 - TESTDB (Running in OS ASM file system) Oracle Architecture: ====================...