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=







Thursday, July 21, 2016

Upgrade OEM 12c to OEM 13c Cloud control

8:23 AM Posted by Dilli Raj Maharjan 1 comment
OEM(Oracle Enterprise Manager) is pictorial representation of system, its status, downtime impact with lot of features to enhance the usability of Database. OEM 13c maximize support integration for Oracle Engineered Machine Exadata. OEM makes daily jobs easier and faster.
If we have Enterprise Manager Cloud Control 12c Release 5 (12.1.0.5), 12c Release 4 (12.1.0.4) or 12c Release 3 (12.1.0.3) then Oracle recommends that you upgrade it to 13c Release 1 to benefit from all the new features.

Supported environment for upgrading to OEM 13c Cloud control:

  1. 12c Release 5 (12.1.0.5)
  2. 12c Release 4 (12.1.0.4)
  3. 12c Release 3 (12.1.0.3) without BI Publisher. If BI publisher is configured then we need to upgrade to 12c Release 4 or 5

Supported OMR database version

  1. Oracle 12.1.0.2.0

Supported Managed Targets

  1. Oracle 12.1.0.2.0
  2. Oracle 12.1.0.1.0
  3. Oracle 11.2.0.4.0
  4. Oracle 11.2.0.3.0
  5. Oracle 11.2.0.2.0
  6. Oracle 11.2.0.1.0
  7. Oracle 11.1.0.7.0
  8. Oracle 10.2.0.5.0
  9. Oracle 10.2.0.4.0
  10. Oracle 10.2.0.5.0
  11. Oracle 10.2.0.4.0
  12. Oracle 10.1.0.5.0

Supported Agent version

  1. Agent 13.1.0.0.0
  2. Agent 12.1.0.5.0
  3. Agent 12.1.0.4.0
  4. Agent 12.1.0.3.0

Restriction

  1. Pre-installed JDK or Oracle Weblogic is not supported from 13c Release 1 onward.
  2. Dedicated Oracle Weblogic Server 12c Release 1 is required.
  3. The central agent (in other words, the Management Agent installed with the OMS) is not upgraded by default. You must upgrade it using the Agent Upgrade Console available in the Enterprise Manager Cloud Control Console after upgrading the OMS.
  4. After upgrading the OMS, you must upgrade the Management Agent separately using the Agent Upgrade Console. Agent Upgrade Console is a GUI console that you see in the Enterprise Manager Cloud Control Console after you upgrade the OMS.
  5. To access the Agent Upgrade Console, from the Setup menu, click Manage Cloud Control, then select Upgrade Agents.

Upgrading OMR note

Ensure that you stop the OMS instances of the earlier release that are connected to the database
emctl stop oms -all

Ensure that you do not have any login or logoff triggers set in the Oracle Database that houses the Oracle Management Repository
SELECT COUNT (trigger_name) FROM sys.dba_triggers WHERE TRIGGERING_EVENT LIKE 'LOGIN%' AND status='ENABLED';
SELECT COUNT (trigger_name) FROM sys.dba_triggers WHERE TRIGGERING_EVENT LIKE 'LOGOFF%' AND status='ENABLED';

Disable if logon or logoff triggers exists
alter trigger disable;
alter trigger enable;

Upgrade the database to 12.1.0.2

Disable the optimizer adaptive feature by setting the optimizer_adaptive_features to false and set compatible to 12.1.0.2.0

alter system set optimizer_adaptive_features=false scope=both;

















ALTER SYSTEM SET COMPATIBLE='12.1.0.2.0' SCOPE=SPFILE;











Restart the OMR database.

Copy emkey

$/bin/emctl config emkey -copy_to_repos [-sysman_pwd ]








Verify with the following command

$/bin/emctl status emkey







If the emkey is copied, then you will see the following message:

The EMKey  is configured properly, but is not secure.
Secure the EMKey by running "emctl config emkey -remove_from_repos".


Restart OMS service.

$/bin/emctl stop oms -all
$/bin/emctl start oms





















Create new Middleware home and BI Config and cluster directory should be outside of the Middleware home.

mkdir -p /ssd/oracle/Middleware_1
mkdir -p /ssd/oracle/bi_config
mkdir -p /ssd/oracle/bi_cluster
chown -R oracle:oinstall /ssd/oracle/Middleware_1
chown -R oracle:oinstall /ssd/oracle/bi_config
chown -R oracle:oinstall /ssd/oracle/bi_cluster











To run em pre-requisite check before performing upgrade. Execute following command

./em13100_linux64.bin EMPREREQ_KIT=true EMPREREQKIT_PROPERTY_FILE=


Sample property file
installerMode=emprereqkit
connectString=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=core.localdomain)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=testoem)))
dbPassword=dill1o@
dbRole=sysdba
dbUser=SYS
executionType=install
logLoc=/u01/software/em13c/prerequisiteResults/log
prereqResultLoc=/u01/software/em13c/prerequisiteResults
reposUser=SYSMAN
runPrerequisites=true


Stop the JVMD and ADP engines explicitly:

$/bin/emctl extended oms jvmd stop -all
$/bin/emctl extended oms adp stop –all












Shutdown OMS

$/bin/emctl stop oms -all













Management Agent Shutdown requirement

$/gc_inst/bin/emctl stop agent










For error emkey has not been copied

/bin/emctl config emkey -copy_to_repos_from_file -repos_host -repos_port -repos_sid -repos_user SYSMAN [-repos_pwd ] [-admin_pwd ] -emkey_file /sysman/config/emkey.ora








TMP directory required at least 10G space, if we do not have sufficient space we can create new temp directory for installation.

mkdir -p /data/tmp/
chown -R oracle:oinstall /data/tmp/






If you are using redhat-6.8 or centos 6.8 modify the parameter to 6.7 because 6.8 is not certified yet.

You may encounter the error below:
Expected result: One of enterprise-6.7,enterprise-6.6,enterprise-6.5,enterprise-6.4,enterprise-6.3,enterprise-6.2,enterprise-6.1,enterprise-6.0,oracle-7.1,oracle-7,redhat-7.1,redhat-7,oracle-8,redhat-6.7,redhat-6.6,redhat-6.5,redhat-6.4,redhat-6.3,redhat-6.2,redhat-6.1,redhat-6.0,SuSE-11,SuSE-12
Actual Result: redhat-6.8










Make source file executable

chown 755 em13100_linux64.bin







Execute em13100_linux64.bin with the command below. Note in my case I have used new temp directory due to un sufficient space on /tmp

./em13100_linux64.bin -J-Djava.io.tmpdir=/data/tmp






























Once you execute the em13100_linux64.bin binary this is the landing page.





























Uncheck "I wish to receive security updates via My Oracle Support". Click on Next to continue.












Warning message will be displayed. Click on Yes to continue.





























Select Skip and Click on Next to continue.






























All Prerequisite checks should be succeeded before beginning the installation. Click on Next to continue.






























Select Upgrade and existing Enterprise Manager system Click on Next to continue.






























Select new Middleware home Click on Next to continue.






























Provide the Repository database details. Select Confirm that you have backed up Management Repository and Disable DDMP jobs Click on Next to continue.












Repository database related prerequisite checks in progress.


















Patch related information will be displayed. Click on OK once you applied minimal patches required for repository database.





















If Management agent is not closed then this message will pop up. Stop the agent and click on OK to continue.

Some fixable configuration requirements error will be displayed. Click on Yes to fix it automatically.




















Few warning message regarding the requirements. Click on OK to fix it and continue.































Plugin details will be displayed. Click on Next to continue.






























We can choose additional plugins in the case we required. Click on Next to continue.

Type extended weblog server domain Click on Next to continue.






























Type BI Publisher Config Volume and Cluster Volume. Click on Next to continue.






























BI Publisher port details will be displayed Click on Next to continue.






























Summary will be displayed Click on Upgrade to begin upgrade.






























Upgrade on progress ##########.






























Upgrade on progress ####################.






























Upgrade on progress ##############################.






























Upgrade on progress ########################################.












Execute listed allroot.sh script file as user root. Once execution completes Click on OK to continue.






























Information regarding OEM upgrade complete will be displayed. Click on Close to complete upgrade.

























Now we can login OEM 13c with the same details as of OEM 12c. Same URL and same user credentials.





















Click I accept on the License Agreement. 














OEM 13c is ready to use.