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...