Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Tuesday, December 2, 2025

Why and How to install Grid 19c on RHEL 8?

 Why ?

Simply we will be requested to install Oracle Grid RAC DB on Redhat RHEL 8, below is my note for this installation.

How ?

1-  OS installed + asm disks by servers admin

Done By OS and VM team
Ensure: secure boot not working for grid


# mokutil --sb-state

2- Install packages:

3- setup ASMLIB:

## linux disks for redhat :

https://access.redhat.com/solutions/315643

https://labmice.in/oraclerac/RHEL8.10/Prerequsites_OS_Oracle_RAC_RHEL8.10/

OL8/RHEL8: ASMLib: root.sh is failing with CRS-1705: Found 0 Configured Voting Files But 1 Voting Files Are Required (Doc ID 2789052.1)

 

yum install kmod-oracleasm

yum localinstall libbpf-0.6.0-6.el8.x86_64.rpm

yum localinstall oracleasmlib-2.0.12-1.el7.x86_64.rpm

yum localinstall oracleasm-support-2.1.11-2.el7.x86_64.rpm

 

https://docs.oracle.com/en/operating-systems/oracle-linux/asmlib/asmlib-ConfiguringASMLib.html#querying_asm_disk_information

 

lsblk

parted /dev/sde --script mklabel gpt mkpart primary 0% 100%

sudo oracleasm configure -i

sudo systemctl enable --now oracleasm

sudo oracleasm createdisk data1 /dev/sde1

sudo oracleasm scandisks

oracleasm listdisks

4- setup DNS records

**3 IPs for scan

** 2 IPs for vir ( added to hosts )

** hosts in DNS

5- creat directories and user for Grid

create user/groups

  groupadd -g 54321 oinstall

  groupadd -g 54329 asmadmin

  groupadd -g 54327 asmdba

  groupadd -g 54328 asmoper

  groupadd -g 54322 dba

  groupadd -g 54323 oper

  groupadd -g 54324 backupdba

  groupadd -g 54325 dgdba

  groupadd -g 54326 kmdba

  groupadd -g 54330 racdba

useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,racdba grid

useradd -u 54331 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,asmadmin,asmoper,oper oracle

echo "oracle123" | passwd --stdin oracle

echo "grid123" | passwd --stdin grid

 

## create directories

mkdir -p /u01/app/19.0.0/grid

mkdir -p /u01/app/grid

chown -R grid:oinstall /u01

chmod -R 775 /u01/

 

## etc hosts on both nodes

#Virtual IPs:

x.x.x.x  <hostname1>-vip   <hostname1>-vip.<domain>

x.x.x.x  <hostname2>-vip   <hostname2>-vip.<domain>

6- unzip home and apply patch during the instllation:

## patch GRID_HOME with latest page during the installation ** make sure to update OPatch version

./gridSetup.sh -applyRU /u01/patches/34762026

/u01/app/19.0.0/grid/gridSetup.sh -applyRU /u01/files/34762026 (GI Patch)

 


Tuesday, September 16, 2025

Why and How to know and compress Table as Hybrid Columnar Compression (HCC)?

Why ?

To get the most compress advance feature on the Oracle Exadata machine you may use the Hybrid Columnar Compression(HCC), however , there is a limitation on it where you have to use it for a certain object type, moreover, the way to apply this is online and offline , below I will simply mention the query to identified these objects and the option of doing this.

How ?

Below is a query that will identify and create executable scripts for the offline way where table will be locked, and indices will be unusable after doing this.

1- Identify and generate offline script for HCC:

select  -

'ALTER TABLE '||table_owner||'.'||table_name||' move PARTITION '||PARTITION_NAME||' compress for query high ;' Result

from dba_TAB_PARTITIONS

where (COMPRESS_FOR<> 'QUERY HIGH' or COMPRESS_FOR is null)

and table_name not in (select table_name from dba_tab_columns

where data_type in ('CLOB','LOB','LONG', 'BLOB', 'LONG RAW'))

and table_name not in(select TABLE_NAME from dba_indexes

where index_type in ('BITMAP')

)and TABLE_NAME not in(select OBJECT_NAME from dba_recyclebin dr where dr.OWNER=TABLE_OWNER)

--and TABLE_OWNER NOT IN ('SYS','SYSTEM')

ORDER BY TABLE_OWNER,TABLE_NAME,PARTITION_NAME ;

2- Using DBMS_REDEFINITION.REDEF_TABLE for the online HCC implementation:

BEGIN

  DBMS_REDEFINITION.REDEF_TABLE (

    uName                      => '<table_owner>'

   ,tName                      => '<table_name>'

   ,table_compression_type     => 'COLUMN STORE COMPRESS FOR QUERY HIGH');

END;

/

 

Wednesday, June 11, 2025

Create a new Server DB using Existing ASM disks - DB Disk replication ASM

Why?

In an assumption that computing DB server got crashed and only ASM disks which are in storage appliance are available or in a case of data replication using ASM disk storage replication which not a recommended approach but I am here just elaborate how you will achieve this in case of needed.

How?

In my case the original DB is RAC two nodes and I will create a new single node to using that ASM disks and start the DB using these disks in a new computing node with version 19c.

1- Install both Grid and DB as software only using same version and patch level of the orginal one:

2- Start using "root" the HAS for oracle restart:

. oraenv

/u01/app/19.0.0/grid/perl/bin/perl -I/u01/app/19.0.0/grid/perl/lib/ -I/u01/app/19.0.0/grid/crs/install/ /u01/app/19.0.0/grid/crs/install/roothas.pl

 

3- using grid start the other service as below.

crsctl start res ora.cssd -init

 

4- From old  nodes:

 get the asm parameter file and change what is needs to be changed,

get oracle parameter file and change what is needs to be changed (cluster=no):

check the crs status and check diskgroups :

crsctl stat res –t

ASMCMD> lsdg

start ASM whether using sqlplus / as sysasm

or 

using after add the resource:

srvctl start asm

 

5- start DB using pfile:

#sqlplus / as sysdba

SQL> startup nomount pfile='initorcla.ora' ;

SQL> alter database mount;

SQL> alter database open;

 

6- add needed resources in the SRVCTL to be part of Grid:

srvctl add listener -l LISTENER -p "TCP:1541" -o $ORACLE_HOME

srvctl add asm -l LISTENER -p $ORACLE_HOME/dbs/init+ASM.ora

srvctl add database -d <dbname> -o $ORACLE_HOME -p /export/home/oracle/pfile_<dbname>.ora -pwfile +DATA/ICM/PASSWORD/pwd<dbname>.257.1132500007

crsctl stat res -t

 

below references may help with troubleshooting and other details :

https://eleoracle.wordpress.com/2015/01/23/move-asm-diskgroups-between-server/

https://www.br8dba.com/cssd-wont-start-automatically/

Saturday, July 20, 2024

Rename the Database

Why?

One of the common change for database for the Data Guard implementation is to match the DB name and have a different DB unique name, it is article I will list my own steps to keep achieve this along with other changes to avoid any issue post to this change. In my below steps I have match the oracle name and oracle SID to follow the same pattern of default installation values.

How?

With reference to the blog https://oracle-base.com/articles/9i/dbnewid , I did my below steps.

1- Check the current value for the SID and database name:

SQL> show parameter name ;

SQL> select instance from v$thread;

SQL> select name from v$database;

 

2- stop the DB and started on mount stat:

SQL> SHUTDOWN IMMEDIATE

SQL> STARTUP MOUNT

 

3- rename the DB using “nid” utility, setname parameter to only change the name and keep the DB id, shutdown it and started on mount to change parameter file , error will appeared but ignore it.

$ nid TARGET=sys/sys@<current_service_name> DBNAME='<new_name>' SETNAME=YES

SQL> SHUTDOWN IMMEDIATE

SQL> STARTUP MOUNT

SQL> ALTER SYSTEM SET DB_NAME='<new_name>' SCOPE=SPFILE;

SQL> SHUTDOWN IMMEDIATE

 

4- change the password file and spfile name to match the new name:

$ orapwd file=orapw$ORACLE_SID password=sys force=y

Export ORACLE_SID=<new_DBNAME>;

SQL> STARTUP MOUNT

--*Rename the SPFILE to match the new DBNAME

$ cd $ORACLE_HOME/dbs

$ cp spfile<old_dbname>.ora spfile$ORACLE_SID.ora

$ lsnrctl reload

SQL> STARTUP MOUNT ;

SQL> show parameter name ;

SQL> alter database open ;

 

Tuesday, September 12, 2023

Why and How to install RAC DB 19c on Solaris 11.4 ?

 Why ?

RAC DB is the most powerful RDBMS DB for high performance and high availability. It is an expected task for any Oracle DBA to do RAC installation and here I am sharing my quick reference while do this task along with some details related to disks and OS configuration to achieve this.

How ?

 

Below are steps that I follow to do this installation where I have the below:

Download GI+DB binary for Solaris Sparc64

Download the latest GI patch that will include both GI and DB and make sure you have opatch latest one as well :

1- OS pre configuration:

## check NTP

svcs -xv ntp

svcs /network/ntp:default

svcs -l /network/ntp:default

ntpq -p

https://docs.oracle.com/cd/E26502_01/html/E28996/time-20.html

 

#TO setup the slew

svccfg -s svc:/network/ntp:default setprop config/slew_always = true

svcadm refresh svc:/network/ntp:default

#To check it :

svcprop -p config/slew_always svc:/network/ntp:default

svccfg -s svc:/network/ntp:default listprop | /bin/grep slew

## check DNS

nslookup

## install packages

root@node1:~# pkg list entire

NAME (PUBLISHER)                                  VERSION                    IFO

entire                                            11.4-11.4.52.0.1.132.2     i--

root@node1:~# pkg install oracle-database-preinstall-19c

2- Users/group setup:

## create user/groups

  groupadd -g 54321 oinstall

  groupadd -g 54329 asmadmin

  groupadd -g 54327 asmdba

  groupadd -g 54328 asmoper

  groupadd -g 54322 dba

  groupadd -g 54323 oper

  groupadd -g 54324 backupdba

  groupadd -g 54325 dgdba

  groupadd -g 54326 kmdba

  groupadd -g 54330 racdba

 

useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,racdba -d "/export/home/oracle" -m oracle

useradd -u 54331 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,asmadmin,asmoper -d "/export/home/grid" -m grid

3-User project in OS:

# to check current configured project

cat /etc/project

 

## using project to create users:

projadd -p 100 -G dba -c "Oracle Project" -K "project.max-shm-memory=(privileged,10G,deny)" group.dba

projmod -sK "project.max-sem-ids=(privileged,100,deny)" group.dba

 projmod -sK "project.max-shm-ids=(privileged,100,deny)" group.dba

  projmod -sK "project.max-sem-nsems=(privileged,256,deny)" group.dba

projmod -sK"process.max-stack-size=(basic,10485760,deny)" group.dba

 

useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,racdba -d "/export/home/oracle" -m -K project=group.dba oracle

useradd -u 54331 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,asmadmin,asmoper -d "/export/home/grid" -m -K project=group.dba grid

 

## to create a project and then add the user use the below :

 

projadd -G dba -c "Oracle dba Group for CRS and RDBMS" group.dba

projmod -sK "project.max-shm-memory=(priv,32G,deny)" group.dba

projmod -sK "project.max-sem-ids=(priv,256,deny)" group.dba

projmod -sK "process.max-sem-nsems=(priv,256,deny)" group.dba

projmod -sK "process.max-file-descriptor=(priv,65536,deny)" group.dba

projmod -sK "process.max-file-descriptor=(basic,65536,deny)" group.dba

projmod -sK "process.max-stack-size=(basic,10485760,deny)" group.dba

usermod -K project=group.dba grid

usermod -K project=group.dba oracle

4- Create directories:

## create directories

mkdir -p /u01/app/19.0.0/grid

mkdir -p /u01/app/grid

chown -R grid:oinstall /u01

chmod -R 775 /u01/

 

5- Create directories:

## create directories

mkdir -p /u01/app/19.0.0/grid

mkdir -p /u01/app/grid

chown -R grid:oinstall /u01

chmod -R 775 /u01/

 

6- prepare ASM disks:

## Some references for the disk setup :

 

AFD Storage Disks Not Appearing Under "CREATE ASM DISK GROUP" In 19c Grid Installation (Doc ID 2878933.1)

Configuring Disk Devices for Oracle ASM on Oracle Solaris

https://support.oracle.com/epmos/faces/CommunityDisplay?resultUrl=https%3A%2F%2Fcommunity.oracle.com%2Fmosc%2Fdiscussion%2Fcomment%2F14658232&_afrLoop=72302341112795&resultTitle=Re%3A+ASMFD+%3A+before+installing+GRID+use+of+asmfd_label+seems+to+do+nothing.+AFD_STATE+showing+nothing.&commId=&displayIndex=1&_afrWindowMode=0&_adf.ctrl-state=wiy4fphbq_634#Comment_14658232

 

You have to get the list of shared disk from OS Admin include the cylinder to be used, below I will show samples only :

 

you may use command “format” to see all disks details, below is a sample of initiate and label the disks.

 

After unzip the GI home by following the below link, start the labeling.

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwsol/installing-oracle-standalone-cluster.html#GUID-7BAE8D62-4D26-424C-BBB4-B993F248C163

 

chown grid:asmadmin /dev/rdsk/c0t60000970000297801140533030303344d0s0

chown -h grid:asmadmin /dev/rdsk/c0t60000970000297801140533030303344d0s0

chmod g+w /devices/scsi_vhci/disk@g60000970000297801140533030303344:a,raw

ls -ltrh /dev/rdsk/c0t60000970000297801140533030303344d0s0

ls -ltrh /devices/scsi_vhci/disk@g60000970000297801140533030303344:a,raw

 

DATA Disk Group

As root user :

export ORACLE_HOME=/u01/app/19.0.0/grid

export ORACLE_BASE=/u01/app/grid

cd /u01/app/19.0.0/grid/bin

 

./asmcmd afd_label MGMT1 /dev/rdsk/c0t60000970000297801140533030303344d0s0 –init

./asmcmd afd_lslbl /dev/rdsk/c0t60000970000297801140533030303344d0s0

 

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=368998006909019&parent=EXTERNAL_SEARCH&sourceId=PROBLEM&id=2355039.1&_afrWindowMode=0&_adf.ctrl-state=168weusfr1_4

 

 

In case you do a deinstall, below will help you to wipe and clean up the disks :

 

dd if=/dev/zero of=/dev/rdsk/c0t60000970000297801140533030303344d0s0 bs=1024 count=100

./asmcmd afd_unlabel /dev/rdsk/c0t60000970000297801140533030303344d0s0 –init

 

 

7- start GI instllation:

## To avoid any issue and bugs ,I do prefer to patch the GI during the installation with the latest RU .

## to avoid GI installation issue , chwon to grid after setup the disks using root ,some logs will be owned by root and this will affect the GI installation:

 chown -R grid:oinstall /u01/app/19.0.0/grid/log

 

You may run cluvy as well prior to installation or you may depned on GUI cluvy during the installation.

## Cluvy command , you have to install clufy separately

cluvfy stage -pre crsinst -n node1,node2 -fixup -verbose

 

 

## patch GRID_HOME with latest page during the installation ** make sure to update OPatch version

 

## run installer from Grid user home

/u01/app/19.0.0/grid/gridSetup.sh -applyRU /u01/files/34762026

 

Follow the wizard till the scripts step by step.

 

8- DB instllation:

mkdir -p /u02/app/oracle

mkdir -p /u02/app/oracle/product/19.0.0/dbhome_1

cd /u02/app/oracle/product/19.0.0/dbhome_1

unzip -q /export/home/sal3570/oracle_files/DB_19c_instllation.zip

#update opatch and prepare DB, OCW patches to be applied during installation

./runInstaller -applyRU /u02/patches/34762026/34765931 -applyOneOffs /u02/patches/34762026/34768559

 

Follow the wizard till the scripts step by step.

 

9- GI wizard sample :




















 

10- DB wizard sample :











## Then DBCA 









## this should be confirmed with the Application requirement 



Why and How to install Grid 19c on RHEL 8?

  Why ? Simply we will be requested to install Oracle Grid RAC DB on Redhat RHEL 8, below is my note for this installation . How ? 1-  OS in...