Powered By Blogger

Thursday, October 16, 2014

Checking password expiration on Solaris using Script

# Copy /etc/shadown to temp directory (I am copying to /home/ramkumar and delete   #after) 
#!/usr/bin/bash
if [ $# -eq 0 ]
   then
    echo "You need to pass user as argument"
    exit 1
fi
COUNT=`grep $1 /home/ramkumar/shadow|wc -l`
if [ $COUNT != 1 ]
  then
  echo "User is not valid"
  exit 1;
fi

CURRENT_CH=`grep $1 /home/ramkumar/shadow | cut -d: -f3`
HOST=`uname -n`

LAST_CHA=`/bin/perl -e 'print int(time/(60*60*24))'`
# Compute the age of the user's password

AGE=`echo $LAST_CHA - $CURRENT_CH | /usr/bin/bc`
echo "last Changed" $AGE " days ago"

# Password expiration

EXPIRE=`echo 90 - $AGE | /usr/bin/bc`
if [ $EXPIRE -lt 0 ]
  then
   EXP=`echo $EXPIRE|sed 's/-//g'`
    echo "$1 password on $HOST expired  $EXP days ago"
  else
    echo "$1 password on $HOST expires in $EXPIRE days"
fi

ASM on Solaris and ASMLib on Linux


  • ASM Setup on Solaris (Make sure multipathing is enabled)
(Verify all partition is s6)
Format < c*t*d0>
Format > volname
Volname> “ORC ASM”
Label it > yes
Format > quit

# chown oragrid:asmadmin /dev/rdsk/c*t*d*s6
# chmod 660 /dev/rdsk/c*t*d*s6

 ASM on Linux using using ASMLib

As per  Metalink Document 1089399.1 ( Oracle is not supporting ASMLib  on RHEL 6) 



For Red Hat Enterprise Linux 6 (beginning with 6.4) the kernel driver package 'kmod-oracleasm' is available directly from Red Hat, and can be installed from the "RHEL Server Supplementary (v. 6 64-bit x86_64)" channel on Red Hat Network (RHN).  Updates and support for this module will be provided by Red Hat.  Please check with your Red Hat advisor for questions concerning use of the kernel driver package.  The 'oracleasmlib' and 'oracleasm-support' packages are maintained by Oracle; they are required in order to use kmod-oracleasm.  These are available for download from the Oracle Technology Network.


# yum install kmod-oracleasm
  • oracleasm-support-2.1.8-1.el6.x86_64.rpm 
  • oracleasmlib-2.0.4-1.el6.x86_64.rpm 
       #  yum install oracleasmlib-2.0.4-1.el6.x86_64.rpm
      #  yum install oracleasm-support-2.1.8-1.el6.x86_64.rpm
After installing 


# /usr/sbin/oracleasm configure –i

Default user to own the driver interface []: oragrid 
Default group to own the driver interface []: asmadmin 
Start Oracle ASM library driver on boot (y/n) [ n ]: y
 Fix permissions of Oracle ASM disks on boot (y/n) [ y ]: y


Set the ORACLEASM_SCANORDER parameter in /etc/sysconfig/oracleasm
NOTE: When setting the ORACELASM_SCANORDER to a value, specify a common string associated with your device mapper pseudo device name. For example, if all the device mapper device had a Deploying Oracle RAC 11g R2 Database on RHEL 6.x / Oracle Linux 6.x
19
prefix string of the word "asm", (/dev/mapper/asm-ocr1,/dev/mapper/asm-ocr2), populate the ORACLEASM_SCANORDER parameter as:ORACLEASM_SCANORDER="dm". This would ensure that oracleasm will scan these disks first.

Set the ORACLEASM_SCANEXCLUDE parameter in /etc/sysconfig/oracleasm to exclude non-multipath devices.
For example: ORACLEASM_SCANEXCLUDE=
NOTE: If we wanted to ensure to exclude our single path disks within /dev/ such as sda and sdb, our ORACLEASM_SCANEXCLUDE string would look like: ORACLEASM_SCANEXCLUDE="sda sdb"

# /usr/sbin/oracleasm createdisk  DISKNAME  /dev/mapper/diskpartition
NOTE: The fields DISKNAME and /dev/mapper/diskpartition should be substituted with the appropriate names for your environment respectively.
NOTE: It is highly recommended to have all of your Oracle related disks to be within Oracle ASM. This includes your OCR disks, voting disks, database disks, and flashback recovery disks.

# /usr/sbin/oracleasm listdisks 

(T0 verify disks)

On the other node:


# /usr/sbin/oracleasm scandisks.
Welcome to the UNIX world