Sunday, August 16, 2020

olsnodes command in oracle rac

 olsnodes command in oracle rac


Olsnodes,oifcfg,cluvfy,


Introduction


olsnodes command provides the list of nodes and other information of all the nodes particapating in the cluster.


crsctl tool

will verify health check of cluster services


from one node, can verify of all nodes.



#cd /u01/app/11.2.0/grid/bin

#./crsctl check cluster -all


crs

css

evm - upper stack

ohasd - lower stack -

Only specific node - service status of that particular node.


./crsctl check cluster


Note: On server boot, the cluster services get started on its own.

----------------------------------------------------

To stop the clusterware services


#./crsctl stop cluster -all ( includes all the nodes)

But make sure to stop lower stack manually of every node.

./crsctl stop crs (execute on every node)

-------------------------------------------


To start .. the service if manually then


just start crs

both lower and upper get started.

./crsctl start crs

Monitor ./crsctl check cluster -all

------------------------------------------


 Verify Unix logs and clusterware logs.


For every service, we have a log in grid home.

Where does the clusterware logs locate?

cd $GRID_HOME/log  path


eg: /u01/app/11.2.0/grid/log/rac1

For node2

/u01/app/11.2.0/grid/log/rac2


Will find

folders

crsd

cssd

evmd


How to read the log file ?

# tail -100f crsd.log


also

# tail -1000f crsd.log | more




Using diagcollection script

diagcollection.pl


Steps: #

# ./diagcollection.pl --collect


once the zip files generated , will use winscp/ftp to pull in to desktop and then upload to metalink/support.


If oracle support needs , to collect diagnostic information from cluster logs to identify the issue. Will need to provide logs using diagcollection script





Diagnostic files - Retention policy - housekeeping

----------------------------------

$GRID_HOME/log/rac1

crsd.log

cssd.log

ohasd.log

read by tail command


Retention Policy for these logs.


# Rotation / retention Policy

  10x10 rules as part of automatic rotation/retention policy

and governed automatically.


10 copies of cssd.log files with 50M retained and rotated

subsequently

ohasd,evmd,crsd etc logs also retain 10 copies with 10m size.


The policy doesnt applies to the alerthostname.log file.


If the file got removed , need to stop,start service.



Changing parameter file :

--------------------------

 Use sid to apply on nodes in a cluster.


sql>alter system set undo_retention=2600 scope=both sid='*';


------------------------------------

About -

    Olsnodes,oifcfg,cluvfy



olsnodes


    On a cluster - to list active nodes

# cd /u01/app/11.2.0/grid/bin/

#./olsnodes


# ./olsnodes -i


# ./olsnodes -n

rac1    1

rac2    2

rac3    3


# ./olsnodes -s

rac1    Active

rac2    Active

rac3    Inactive

---------------------------------------------------------


Oracle Interface Configuration Tool (OIFCFG)

        to adminstrate the network interfaces.


    # oifcfg iflist (For listing interfaces)


   

# ./oifcfg iflist

eth0  192.169.2.0

eth1  10.10.10.0


# ./oifcfg getif ( verify - list of public/private interfaces)

eth0  192.169.2.0  global  public

eth1  10.10.10.0  global  cluster_interconnect



#./oifcfg setif xxxxxx private


Verify - scan configuration

---------------------------

su - oracle

. grid_env

$ srvctl config scan



Cluster Verification Utility – Environment Integrity Check tool

--------------------------------------------------------------

Before installation , how to ensure the cluster integrity ...

    how we verify cluster configuration

        using cluvfy tool....

        comes with in grid software as well. in installed binaries.

   

    two Stages

    pre

    post - failed - no DNS Server - cluvfy failed.


    cd /u01/app/11.2.0/grid/bin

    ls –ltr cluvfy*

    cluvfy

   

    to be ran with oracle user *


    Verifying shared storage accessibility

   

    $cluvfy comp ssa -n all -verbose



    Cluster Verification Utility Connectivity Verifications    


    $cluvfy comp nodereach -n rac1,rac2,rac3 -verbose

    $cluvfy comp nodecon -n all -verbose


    Post - stage

    cluvfy stage -post crsinst -n rac1,rac2 -verbose


    Cluster integrity

     ./cluvfy comp clu




Crsctl to manage grid services

srvctl to manage/monitor resources - db,listener,scan,vip.


Check the Status of the RAC

---------------------------

$ srvctl config database -d prod

$ srvctl status database -d prod


SQL> SELECT inst_id,inst_name FROM v$active_instances;


Verify instances status using views in grid.

--------------------------------------------

SQL> select inst_id,instance_name,status,thread# from gv$instance;


$srvctl status instance -d prod -i prod1,prod2

$srvctl status instance -d prod -n rac1



Note : Info on olsnodes it may be differ from your environment prod,dev,test,naming conventions and directories etc


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME




Oracle oratab file

 Oracle oratab file

Introduction

oratab:


oratab file is created by the root.sh script during oracle database installation ,and it is updated by the database configuration assistant DBCA when creating or deleting  a database ,the oratab file entry is also created automatically by the database agent 


When does oratab file created?

What are the contents of oratab file?

how to read oratab file?

How do we verify number of databases on server? (from oratab file)

How to locate the binaries installed on a server for a database?



oratab file get created when root.sh script executed while install.

Will read using more command

eg: $more /etc/oratab


The contents are

SID:$ORACLE_HOME:Y/N


Note: SID - database name, System identifier

The path of oracle binaries located using ORACLE_HOME parameter


eg: /u01/app/oracle/product/12.1.0/dbhome_1


Can have multiple homes for multiple database , can find from oratab.


prod:/u01/app/oracle/product/12.1.0/dbhome_1:Y

dev:/u01/app/oracle/product/11.2.0/dbhome_1:N


Here N/Y represents, to start on server boot..

----------------

Y - Yes , to start

N - No, Will not start on boot.


To login to a database , verify the SID value from ORACLE_SID using echo command.

----------------------

$echo $ORACLE_SID

If the value is prod

the database connected to prod


IF its dev

the db is dev

If not dev,then how to connect/set


using export command can set the environment variable...to login to aparticular db.

---------------------

$export ORACLE_SID=dev

then verify

$echo $ORACLE_SID


Which location to verify , the db installed ?

using variable ORACLE_HOME

how to verify ?

$echo $ORACLE_HOME


Conclusion:


Number of databases on a server

.bash_profile

root scripts while install

Binaries path

/etc/oratab

export - to set environment variable

echo - to verify the variable

$ORACLE_SID

$ORACLE_HOME


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME

Oracle Database Post Installation Root scripts

 

Oracle Database Post Installation Root scripts 


Introduction:


 when we install oracle Database standalone and RAC environment part of post installtion steps we execute two Root scripts oracle also suggest to backup the 'orainstroot.sh' and 'root.sh',these two scripts are executed as a root user in linux and it displays after the,oracle software installation complete 


Two scripts root.sh,orainstroot.sh


What is oratab file?

What are the contents of oratab file?

When the oratab file got created?


While installation, will execute two root scripts.

1. orainstroot.sh

will remove the permissions on inventory files from world(public).

Will change permissions to oinstall OS group.


 Importance of orainstroot.sh


 The first script that we run is  "orainstroot.sh" which is located in 


$ORACLE_BASE/oraInventory(/u01/app/oracle/orainventory)path we execute "orainstroot.sh " script for following purpose


 1)it creates the inventory pointer file(/etc/oraInst.loc) this file shows the inventory location and group is linked to 


 2)it changes the groupname of the oraInventory directory to oinstall group


 

2. root.sh

will create oratab file while installation using root script.


/etc/oratab

will read using

$more /etc/oratab


The contents are oratab file are the database entries.


Importance of root.sh


The second script that we run is "root.sh"  script which is located  in $ORACLE_HOME(/u01/app/oracle/product/11.2.0/db_1)path  we execute "root.sh" for the following purpose


1)it will creates /etc/oratab file.This is the file which we use to make automatic database shutdown and startup it is very important file


2)it sets the Oracle base and Home environments


3)it sets an appropriate permission to the OCR base directory


4) creates the OCR backup and network socket directories


5)modifies the ownership to "root" user on the Oracle base and Cluster home file systems


6)it configures the OCR and Voting disk (only on the first node )


7)starts the Clusterware daemons


8)it adds Clusterware daemons to the inittab file


9)It verifies the whether the Clusterware is up on all nodes


10)it verifies the super user priveliges


First Field | Second | third

ORACLE_SID : ORACLE_HOME : Y/N

prod : /u01/app/oracle/product/12.1.0/dbhome_1 : Y


Here ORACLE_SID is the db name

Y/N - represents - to start the db on server boot.



eg:

prod : /u01/app/oracle/product/12.1.0/dbhome_1 : Y

dev : /u01/app/oracle/product/11.1.0/dbhome_1 : N


In this case, How many databases are there?

Two Databases - prod,dev


Which will get start on boot ? prod

will not ?  dev



how many products are there on server?

12c

11g


-----------------------------------------------------------------------

How do we login to database?



Using tool sqlplus with sys user as sys admin with sysdba role


eg:

su - oracle ( using - will read bash_profile to locate the binary files)

$sqlplus '/as sysdba'


Here / represents sys user

or

$sqlplus sys/sys123 as sysdba

or

$sqlplus sys as sysdba

Paswd : sys123


SQL> select name,open_mode from v$database;



sql> is database prompt

# is root unix prompt




What is .bash_profile ?


is a hidden file for every unix user with dot as prefix.

To list the hidden file using

#ls -ltra


If its root user - /

If its for oracle user :- /home/oracle


Will configure variables to locate the binaries installed


eg:

ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

ORACLE_SID=prod

Here the default database was set to prod to login.



Will execute the .bash_profile to set the environment variables for that session.


Can also use manually with export command

eg:

$export ORACLE_SID=dev

Now can verify using echo

$echo $ORACLE_SID



Note : Info on Post Installation root scripts it may be differ from your environment like prod,dev,test,and naming conventions ,directories etc


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME



Oracle Database Startup and Shutdown Procedure

 Oracle Database Startup and Shutdown Procedure


Introduction:


when the database before started there are four modes of startup and shutdown modes to open a database


Nomount State:


In Nomount state when the controlfile  is to ready to open,Redologfiles and database files are closed and are not accessebile ,the oracle instance is available but some of the v$ views (dynamic performance views)are available during this Nomount state  

Database may be brought to this state to perform some operation like


Creating Database


Recreating control file


eg: v$session,v$database,v$instance etc


Mount State:


In Mount state after the control file is opened and existence of all the database files and redolog files is to be verified to start up the database open 

Database may be brought to this state to perform operations like 


Backup

Recovery of the system crash or undo datafiles

change the database to archive log mode  (when you query  select name ,open_mode from v$database we will get the database is mounted)


Four Modes - -->shutdown Instance


1. shutdown normal

2. shutdown transactional

3. shutdown immediate

4. shutdown abort




1. shutdown normal


No new connections can be established

Will wait till users disconnect.

Changes are written to disk

No recovery required.

BG processes terminates and memory freed.


sql>shutdown


2. Shutdown transactional


sql>shutdown transaction


No new connections

will wait till users complete the transaction.

Changes writes in to datafiles.

no recovery is required

BG processes terminates and memory freed.


3. Shutdown immediate ( best Practice)


sql>shutdown immediate

sql>shut immediate


no new connections

Will not wait users disconnect/complete transaction

Changes written in to datafiles

uncommitted changes are rollbacked.

bg terminated and memory freed

no recovery required


4. shutdown abort

sql>shutdown abort


If database not responds then will do abort.


committed Changes will not write in to datafiles

Does need instance recovery by smon while instance startup.



THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME

Oracle ASMCMD commands

 

Oracle ASMCMD commands


Introduction


Oracle ASMCMD commands used in linux in command line utility


$export ORACLE_SID=+ASM

$cd $ORACLE_HOME/bin

$asmcmd

ASMCMD>exit


The asmcmd utility "-p" option used in it will display the current path 


$asmcmd -p

ASMCMD[+]>cd FLASH

ASMCMD[+FLASH]>



cd command is used to changes to a specific directory


ASMCMD [+diskgroup2/crm] >cd+diskgroup1/hrms

ASMCMD[+diskgroup1/hrms]> cd DATAFILE

ASMCMD[+diskgroup1/hrms/DATAFILE]>cd..

ASMCMD[+]>cd +diskgroup1/sample/C*



pwd command is used for absolute path for current directory


ASMCMD>pwd


help command is used to display all the lists of the ASMCMD commands and general information on ASCMD utility


ASMCMD>help

ASMCMD>help lsct

ASMCMD>?

ASMCMD> ? mkgrp


du command is used to display the total space in the files and directories 


ASMCMD[+diskgroup1/prod]>du

Used_MB   Mirror_Used_MB

1300                3200



Find Command is used to display the absolute path of all occurances of the specified name pattern  wild cards can also be used in specified directories and its subdirectories


ASMCMD>find +diskgroup1 undo *

+diskgroup1/crm/DATAFILE/UNDOTBS1.347.4444421853

+diskgroup1/crm/DATAFILE/UNDOTBS1.361.4461812843


ASMCMD>find -t CONTROLFILE +diskgroup_data/hrms *

+diskgroup_data/hrms/CONTROLFILE/Current.150.44421274

+diskgroup_data/hrms/CONTROLFILE/Current.151.44421764


ASMCMD[+]>find--type CONTROLFILE +data/devdb *

+data/devdb/CONTROLFILE/Current.150.582466152



ls commands is used to display the list of contents of an ASM directory


ASMCMD[+diskgroup1/sample/DATAFILE]>ls

SYSAUX .346.666621122

SYSTEM.345.666621122

UNDOTBS1.347.66621123

UNDOTBS1.365.666211239

USERS.369.66621123

EXAMPLE.349.66662


how many databases are using an ASM instance 


ASMCMD[+DG1_FRA]>lsct

DB_NAME Status Software_version Compatible_version  instance_Name

DEV CONNECTED  10.2.0.1.0         10.2.0.1.0                                      DEV

TEST CONNECTED 10.2.0.1.0          10.2.0.1.0                                      TEST



mkdir is used to create the ASM directories under current Directory


ASMCMD[+diskgroup1]> mkdir subd1 subd2



rm command used to delete the specified ASM files and directories


ASMCMD[+diskgroup1/sample/DATAFILE]>rm alias382.f

ASMCMD>rm -rf +dg/orcl/DATAFILE

ASMCMD>rm -rf fradg/*


chown command is used changes the owner of a file or list of files


ASMCMD[+fra/orcl/archivelog/flashback]>chown asmdba1:asm_fra log_8.153.576541269

ASMCMD>chown oracle1:asm_users+data/hrms/controlfile/current.164.543781436


mount command will used to mount the specific diskgroups one or more diskgroups


ASMCMD[+]> mount -f data

ASMCMD[+]> mount --restrict data

ASMCMD[+]>mount -a


unmount command will be used dismount the specified diskgroup


dismounted all the diskgroups mounted in the oracle ASM instance

ASMCMD[+] unmount -a


force the dismount of the data in diskgroup

ASMCMD[+] unmount -f data


SQL equivalent for unmount command as

sql>ALTER DISKGROUP  diskgroup_name DISMOUNT;



ASMCMD> lsdg

ASMCMD>lsdg -g

ASMCMD>lsct

ASMCMD>lsattr -G DATA

ASMCMD>lsattr -G DATA -1

exit

sqlplus /as sysasm

sql> alter diskgroup



Note: Info on OracleASMCMD commands it may differ from your environment like production,testing,dev,and naming conventions directories


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME 


 





ITIL Process

ITIL Process Introduction In this Blog i am going to explain  ITIL Process, ITIL stands for Information Technology Infrastructure Library ...