Thursday, August 25, 2016

Configure hugepage

12:21 PM Posted by Dilli Raj Maharjan No comments
HugePages is a linux kernel feature that is integrated into the linux kernel >= 2.6. Enabling HugePages makes it possible for the operating system to support memory pages greater than default size that is 4KB. It is useful for both 32bit and 64bit architecture. It improves system performance by allocating bigger size of Pages and reducing the amount of system resources to access them. Size of hugepage vary from 2MB to 256 MB. It depends on the kernel version and hardware architecture. Hugepage enable single page size from default 4K to 2M resulting least number of Pages to access. In addition to that the HugePages can not be swapped which force the SGA to stay on Physical memory rather than virtual.

Configure hugepages


Verify existing hugepage setting 

grep -i huge /proc/meminfo










Create a file hugepage.sh with following contents

#!/bin/bash

# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`

# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`

# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1

# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk {'print $5'} | grep "[0-9][0-9]*"`
do
   MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
   if [ $MIN_PG -gt 0 ]; then
      NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
   fi
done

# Finish with results
case $KERN in
   '2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
          echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
   '2.6' | '3.8' | '3.10' | '4.1' ) echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    *) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End





























Make the script file executable

chmod 755  hugepage.sh






Execute the script file

./hugepage.sh







Configure kernel parameter vm.nr_hugepages in sysctl.conf file. In this case will be increase huge page values by 1 or 2

vi /etc/sysctl.conf
vm.nr_hugepages=886





Execute following command to take the kernel paramenter into effect.

sysctl -p

























Verify change with command below

grep -i huge /proc/meminfo










Modify memlock setting on /etc/security/limits.conf, the setting should be greater than or equal to the size of hugepage * number of hugepages

In our case 886 * 2048=1814528

* soft memlock 1814528
* hard memlock 1814528







Now force oracle to use hugepages only with oracle database parameter use_large_pages to only.

show parameter use_large_pages;
if the use_large_pages parameter is not set to true then alter it to true and restart the database.
alter system set use_large_pages=TRUE scope=spfile;
shutdown immediate;
startup





Monday, August 15, 2016

Change sysman password Oracle Enterprise Manager

9:26 PM Posted by Dilli Raj Maharjan No comments

Change directory to OMS_HOME/bin

cd /ssd/oracle/Middleware_1/bin

Stop OMS service

./emctl stop oms












Change sysman password with emctl command

./emctl config oms -change_repos_pwd -use_sys_pwd -new_pwd
./emctl config oms -change_repos_pwd -use_sys_pwd

if we do not provide sys password and new password option then password will be prompted as below.



Stop oms services and start OMS

./emctl stop oms -all














./emctl start oms



Now we can login with new password.


Sunday, August 14, 2016

Recover weblogic Admin password.

9:58 PM Posted by Dilli Raj Maharjan No comments

Go to OEM instance home. In my case /ssd/oracle/gc_inst is instance home.

cd /ssd/oracle/gc_inst1/

Change directory to user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/security/
and open file boot.properties.


[root@core gc_inst]# cd user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/security/
[root@core security]# cat boot.properties 
# Generated by Configuration Wizard on Thu Jun 23 11:59:29 NPT 2016
username={AES}gSDr8lmhI2OXWEXXXXXXXXXXX+ZOmnyOkOtaRUZmJo8=

password={AES}fUCumT2yS3YBWvXXXXXXXXXXXx0NkHtdaBytrg1fBE=









[oracle@core servers]$ pwd
/ssd/oracle/gc_inst/user_projects/domains/GCDomain/servers
[oracle@core servers]$

Note the username data value and password data value.

Create a java file that will decrypt the encrypted form of the password. I have created java file with name recoverpwd.java with content below.


[root@core security]# cat > /tmp/recoverpwd.java
public class recoverpwd {
 public static void main(String[] args)
 {
  System.out.println(
  new weblogic.security.internal.encryption.ClearOrEncryptedService(
  weblogic.security.internal.SerializedSystemIni.getEncryptionService(args[0]
   )).decrypt(args[1]));
  }
}













Compile java with following command


javac /tmp/recoverpwd.java 

ls /tmp/recoverpwd.class






Export oracle environment with following command


 . /ssd/oracle/gc_inst1/user_projects/domains/GCDomain/bin/setDomainEnv.sh 

Verify environment variables are set properly

echo $DOMAIN_HOME








Decrypt password with the java and the encrypted password.

cd /tmp/
java -cp $CLASSPATH:. recoverpwd \
$DOMAIN_HOME {AES}gSDr8lmhI2OXWEMpOmMLy3UkN+ZOmnyOkOtaRUZmJo8=