Sunday, January 18, 2015

Adding Swap to a Linux VM



Find a device on which you want to put the swap

for our purposes we will put it as a file on the boot device.

[root@ebscloud ~]# mkdir /swap
[root@ebscloud ~]# cd /swap
[root@ebscloud swap]# dd if=/dev/zero of=swapfile1 bs=1048576 count=500
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 0.709267 s, 739 MB/s
[root@ebscloud swap]# ls -lrt
total 512000
-rw-r--r-- 1 root root 524288000 Jan 18 11:40 swapfile1
[root@ebscloud swap]#
[root@ebscloud swap]# mkswap ./swapfile1
Setting up swapspace version 1, size = 511996 KiB
no label, UUID=47543a04-0a4b-4b36-a257-2eb5f4aceb7a
[root@ebscloud swap]#
[root@ebscloud swap]# swapon ./swapfile1
[root@ebscloud swap]#

Don't forget to add the entry into fstab to make it persistent at reboot ( left as exercise for reader ! )

( NB :  If you are following the above is slightly incorrect as we need 600 not 500 but the theory is the same ) 

Saturday, January 17, 2015

Downloading And Applying our patches to Cloud Control ( Part 4 - Agent Patches )




OK  so let's log on to CLoud Control and thus to the Site Map


Click into patching and provisioning/patches and updates at the bottom left
This brings us to this window


Enter 20109357  ( we get this patch ID from the 1900943.1 note  it is the master note for this ) 


Once the patch appears in the list, open it, and click on Add to Plan/Add to New 
Pick the Server you want and give the plan a name - such as AGENT_PATCHPLAN_1 above 
then create plan.  Click into the plan and scroll down to Validation, then ANALYZE 




this takes a couple of minutes but 
Click into Review and Deploy on the left, and down on the right click DEPLOY

Now click Submit 
On the page it changes to Deploy in Progress.  Click into Show Details Results 

After about 5 minutes it should show OK and patch completed after stopping and restarting the agent










Downloading And Applying our patches to Cloud Control ( Part 3 - Plugin Patches )



Now we have an uptodate OMS lets get the plugins updated

At the moment this is patch 20188140: enterprise manager for oms plugins 12.1.0.4.

Download the patch to the server using the wget method I showed earlier

This is a big patch approx 400MB so it will take a bit 

unzip it to a patch directory and lets run opatch analyze 

[oracle@ebscloud 20188140]$ /u01/oracle/oms12104/oms/OPatch/opatchauto apply -analyze -property_file /home/oracle/patches/wlsprops.txt
OPatch Automation Tool
Copyright (c) 2014, Oracle Corporation.  All rights reserved.


OPatchauto version : 11.1.0.12.3
OUI version        : 11.1.0.12.0
Running from       : /u01/oracle/oms12104/oms
Log file location  : /u01/oracle/oms12104/oms/cfgtoollogs/opatch/opatch2015-01-17_08-17-50AM_1.log

OPatchauto log file: /u01/oracle/oms12104/oms/cfgtoollogs/opatchauto/20188140/opatch_oms_2015-01-17_08-17-53AM_analyze.log


WARNING: Sub-patch "19051557" skipped for incompatibility with components installed in the OMS system.
WARNING: Sub-patch "19282500" skipped for incompatibility with components installed in the OMS system.
WARNING: Sub-patch "19513319" skipped for incompatibility with components installed in the OMS system.
WARNING: Sub-patch "20109340" skipped for incompatibility with components installed in the OMS system.

Configuration Validation: Success


SKIPPED...

Complete Summary
================


All log file names referenced below can be accessed from the directory "/u01/oracle/oms12104/oms/cfgtoollogs/opatch/2015-01-17_08-17-50AM_SystemPatch_20188140_1"

Prerequisites analysis summary:
-------------------------------

The following sub-patch(es) are applicable:

      Oracle Home Name   Sub-patches                                          Log file
      ----------------   -----------                                          --------
    oracle_sysman_xa21      19907892   19907892_ApplyPrereq2015-01-17_08-18-23AM_2.log
  oracle_sysman_emas21      20109345   20109345_ApplyPrereq2015-01-17_08-18-08AM_2.log
    oracle_sysman_db21      20109326   20109326_ApplyPrereq2015-01-17_08-18-18AM_2.log
   oracle_sysman_ssa21      20109312   20109312_ApplyPrereq2015-01-17_08-18-31AM_2.log
  oracle_sysman_emct21      19163444   19163444_ApplyPrereq2015-01-17_08-18-15AM_2.log
    oracle_sysman_vt21      19060193   19060193_ApplyPrereq2015-01-17_08-18-26AM_2.log
   oracle_sysman_mos21      19051548   19051548_ApplyPrereq2015-01-17_08-18-28AM_2.log


The following sub-patches are incompatible with components installed in the OMS system:
19051557,19282500,19513319,20109340



--------------------------------------------------------------------------------
The following warnings have occurred during OPatchauto execution:
1)  Sub-patch "19051557" skipped for incompatibility with components installed in the OMS system.
2)  Sub-patch "19282500" skipped for incompatibility with components installed in the OMS system.
3)  Sub-patch "19513319" skipped for incompatibility with components installed in the OMS system.
4)  Sub-patch "20109340" skipped for incompatibility with components installed in the OMS system.
--------------------------------------------------------------------------------
OPatchauto Session completed with warnings.
Log file location: /u01/oracle/oms12104/oms/cfgtoollogs/opatchauto/20188140/opatch_oms_2015-01-17_08-17-53AM_analyze.log

OPatchauto completed with warnings.
[oracle@ebscloud 20188140]$


so now emctl stop oms 

and run the apply 

[Jan 17, 2015 8:20:27 AM]    Collect Patch Data: In Progress...
[Jan 17, 2015 8:20:33 AM]    Collect Patch Data: Completed.
[Jan 17, 2015 8:20:33 AM]    Collect Target Data: In Progress...
[Jan 17, 2015 8:20:33 AM]    Collect Target Data: Completed.
[Jan 17, 2015 8:20:33 AM]    --------------------------------------------------------------------------------------------------------------------------------------------

                             Enterprise Manager with single primary OMS instance only, not a Multi-OMS environment, and no HA configuration;
                             Primary OMS instance(s):


                            Platform Oracle home:
                             /u01/oracle/oms12104/oms
                             List of Plugin Oracle homes:
                             oracle_sysman_cfw21 : /u01/oracle/oms12104/plugins/oracle.sysman.cfw.oms.plugin_12.1.0.1.0
                             oracle_sysman_db21 : /u01/oracle/oms12104/plugins/oracle.sysman.db.oms.plugin_12.1.0.6.0
                             oracle_sysman_xa21 : /u01/oracle/oms12104/plugins/oracle.sysman.xa.oms.plugin_12.1.0.6.0
                             oracle_sysman_emas21 : /u01/oracle/oms12104/plugins/oracle.sysman.emas.oms.plugin_12.1.0.6.0
                             oracle_sysman_mos21 : /u01/oracle/oms12104/plugins/oracle.sysman.mos.oms.plugin_12.1.0.6.0
                             oracle_sysman_ssa21 : /u01/oracle/oms12104/plugins/oracle.sysman.ssa.oms.plugin_12.1.0.8.0
                             oracle_sysman_emct21 : /u01/oracle/oms12104/plugins/oracle.sysman.emct.oms.plugin_12.1.0.6.0
                             oracle_apps_ebs21 : /u01/oracle/oms12104/plugins/oracle.apps.ebs.oms.plugin_12.1.0.2.0
                             oracle_sysman_vt21 : /u01/oracle/oms12104/plugins/oracle.sysman.vt.oms.plugin_12.1.0.6.0
                             --------------------------------------------------------------------------------------------------------------------------------------------
[Jan 17, 2015 8:20:33 AM]    Validate Configuration: In Progress...
[Jan 17, 2015 8:20:33 AM]    Checking the status of weblogic admin server for OMS instance domain...
[Jan 17, 2015 8:20:34 AM]    State of the weblogic admin server "EMGC_ADMINSERVER" for OMS instance domain is : RUNNING
[Jan 17, 2015 8:20:34 AM]    AdminServer status check: [PASSED]
[Jan 17, 2015 8:20:34 AM]    Checking the status of OMS repository...
[Jan 17, 2015 8:20:34 AM]    Status of the OMS repository is : UP
[Jan 17, 2015 8:20:34 AM]    OMS repository status check: [PASSED]
[Jan 17, 2015 8:20:34 AM]    Checking whether software library is configured....
[Jan 17, 2015 8:20:34 AM]    Software library is correctly configured.
[Jan 17, 2015 8:20:34 AM]    Checking whether software library is configured....Software library configuration check: [PASSED]
[Jan 17, 2015 8:20:34 AM]    Validate Configuration: Completed.
[Jan 17, 2015 8:20:34 AM]    Running apply prerequisite checks for sub-patch(es) "20109345" and Oracle Home "/u01/oracle/oms12104/plugins/oracle.sysman.emas.oms.plugin_12.1.0.6.0"...
[Jan 17, 2015 8:20:36 AM]    Sub-patch(es) "20109345" are successfully analyzed for Oracle Home "/u01/oracle/oms12104/plugins/oracle.sysman.emas.oms.plugin_12.1.0.6.0"
[Jan 17, 2015 8:20:36 AM]    Running apply prerequisite checks for sub-patch(es) "19163444" and Oracle Home "/u01/oracle/oms12104/plugins/oracle.sysman.emct.oms.plugin_12.1.0.6.0"...
[Jan 17, 2015 8:20:39 AM]    Sub-patch(es) "19163444" are successfully analyzed for Oracle Home "/u01/oracle/oms12104/plugins/oracle.sysman.emct.oms.plugin_12.1.0.6.0"
[Jan 17, 2015 8:20:39 AM]    Running apply prerequisite checks for sub-patch(es) "20109326" and Oracle Home "/u01/oracle/oms12104/plugins/oracle.sysman.db.oms.plugin_12.1.0.6.0"...
[Jan 17, 2015 8:20:42 AM]    Sub-patch(es) "20109326" are successfully analyzed for Oracle Home "/u01/oracle/oms1

..SKIPPED...

[Jan 17, 2015 8:38:51 AM]    Patching summary:
                             -----------------
                             Binaries of the following sub-patch(es) have been applied successfully:
                             oracle_sysman_xa21:19907892
                             oracle_sysman_emas21:20109345
                             oracle_sysman_db21:20109326
                             oracle_sysman_ssa21:20109312
                             oracle_sysman_emct21:19163444
                             oracle_sysman_vt21:19060193
                             oracle_sysman_mos21:19051548


                             The following sub-patches are incompatible with components installed in the OMS system:
                             19051557,19282500,19513319,20109340

                             Deployment summary:
                             -------------------


So that is ALL OK 

We are patched. 


emctl start oms and we are done. 

Downloading And Applying our patches to Cloud Control ( Part 2 - PSU )



Using the WGET method download and unzip patch 19218456

Unzip it and run the analyze phase, with the credential key file we have created :
[oracle@ebscloud 19218456]$ /u01/oracle/oms12104/oms/OPatch/opatchauto apply -analyze -property_file /home/oracle/patches/wlsprops.txt
OPatch Automation Tool
Copyright (c) 2014, Oracle Corporation.  All rights reserved.


OPatchauto version : 11.1.0.12.3
OUI version        : 11.1.0.12.0
Running from       : /u01/oracle/oms12104/oms
Log file location  : /u01/oracle/oms12104/oms/cfgtoollogs/opatch/opatch2015-01-14_07-18-43AM_1.log

OPatchauto log file: /u01/oracle/oms12104/oms/cfgtoollogs/opatchauto/19218456/opatch_oms_2015-01-14_07-18-45AM_analyze.log



Configuration Validation: Success


Running apply prerequisite checks for sub-patch(es) "19218456" and Oracle Home "/u01/oracle/oms12104/oms"...
Please monitor OPatch log file: /u01/oracle/oms12104/oms/cfgtoollogs/opatch/19218456_Jan_14_2015_07_18_43/ApplyPrereq2015-01-14_07-19-00AM_2.log
Sub-patch(es) "19218456" are successfully analyzed for Oracle Home "/u01/oracle/oms12104/oms"


Complete Summary
================


All log file names referenced below can be accessed from the directory "/u01/oracle/oms12104/oms/cfgtoollogs/opatch/2015-01-14_07-18-43AM_SystemPatch_19218456_1"

Prerequisites analysis summary:
-------------------------------

The following sub-patch(es) are applicable:

  Oracle Home Name   Sub-patches                                          Log file
  ----------------   -----------                                          --------
           oms12c2      19218456   19218456_ApplyPrereq2015-01-14_07-19-00AM_2.log



Log file location: /u01/oracle/oms12104/oms/cfgtoollogs/opatchauto/19218456/opatch_oms_2015-01-14_07-18-45AM_analyze.log

OPatchauto succeeded.


So now we have validated our patchset, it is now time to apply it per the notes : 

emctl stop oms

Oracle Enterprise Manager Cloud Control 12c Release 4
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Oracle Management Server Successfully Stopped
Oracle Management Server is Down
[oracle@ebscloud 19218456]$
[oracle@ebscloud 19218456]$ /u01/oracle/oms12104/oms/OPatch/opatchauto apply -property_file /home/oracle/patches/wlsprops.txt
OPatch Automation Tool
Copyright (c) 2014, Oracle Corporation.  All rights reserved.


OPatchauto version : 11.1.0.12.3
OUI version        : 11.1.0.12.0
Running from       : /u01/oracle/oms12104/oms
Log file location  : /u01/oracle/oms12104/oms/cfgtoollogs/opatch/opatch2015-01-17_07-56-03AM_1.log

OPatchauto log file: /u01/oracle/oms12104/oms/cfgtoollogs/opatchauto/19218456/opatch_oms_2015-01-17_07-56-06AM_deploy.log



Configuration Validation: Success


Running apply prerequisite checks for sub-patch(es) "19218456" and Oracle Home "/u01/oracle/oms12104/oms"...
Please monitor OPatch log file: /u01/oracle/oms12104/oms/cfgtoollogs/opatch/19218456_Jan_17_2015_07_56_03/ApplyPrereq2015-01-17_07-56-18AM_2.log
Sub-patch(es) "19218456" are successfully analyzed for Oracle Home "/u01/oracle/oms12104/oms"

To continue, OPatchauto will do the following:
[Patch and deploy artifacts]   : Apply sub-patch(es) [ 19218456 ] to Oracle Home "/u01/oracle/oms12104/oms";
                                 Apply RCU artifact with patch "/u01/oracle/oms12104/oms/.patch_storage/19218456_Oct_14_2014_03_22_39/original_patch"


Do you want to proceed? [y|n]
y
User Responded with: Y

Applying sub-patch "19218456" to Oracle Home "/u01/oracle/oms12104/oms"...
Please monitor OPatch log file: /u01/oracle/oms12104/oms/cfgtoollogs/opatch/19218456_Jan_17_2015_07_56_03/apply2015-01-17_07-56-30AM_4.log

Updating repository with RCU reference file "/u01/oracle/oms12104/oms/.patch_storage/19218456_Oct_14_2014_03_22_39/original_patch"

Complete Summary
================


All log file names referenced below can be accessed from the directory "/u01/oracle/oms12104/oms/cfgtoollogs/opatch/2015-01-17_07-56-03AM_SystemPatch_19218456_1"

Patching summary:
-----------------

Binaries of the following sub-patch(es) have been applied successfully:

  Oracle Home Name   Sub-patches                                    Log file
  ----------------   -----------                                    --------
           oms12c2      19218456   19218456_apply2015-01-17_07-56-30AM_4.log

Deployment summary:
-------------------

The following artifact(s) have been successfully deployed:

  Artifacts                                                  Log file
  ---------                                                  --------
        SQL   rcu_applypatch_original_patch_2015-01-17_07-58-05AM.log


Log file location: /u01/oracle/oms12104/oms/cfgtoollogs/opatchauto/19218456/opatch_oms_2015-01-17_07-56-06AM_deploy.log

OPatchauto succeeded.

And there we are.... 12.1.0.4 PSU applied ! 

Now start it up again with emctl start oms ( don't also forget to do emcli sync on your emcli installs ). 




Wednesday, January 14, 2015

Setting up opatchauto credential files



In order to have to avoid setting in passwords every time we do opatchauto we can build a credential file :

[oracle@ebscloud patches]$ /u01/oracle/oms12104/oms/OPatch/wlskeys/createkeys.sh -h $ORACLE_HOME -location .
Please enter weblogic admin server username: weblogic
Please enter weblogic admin server password:
Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Creating new key...

Trying to get configuration and key files for the given inputs...
This operation will take some time. Please wait for updates...
User configuration file created: /home/oracle/patches/config
User key file created: /home/oracle/patches/key
'createKeys' succeeded.

Now create the small file needed the property file to point at these, lets call it wlsprops
You need the admin server URL for the first one, you can get this from emctl status oms -details and replace https with t3s 


AdminServerURL=t3s://ebscloud.bcs.com:7103
AdminConfigFile=/home/oracle/patches/config
AdminKeyFile=/home/oracle/patches/key

So this can now be used with our Enterprise Manager patching




Friday, January 9, 2015

Updating to latest opatch

In previous post we showed how to get latest opatch,  now we show how to install it


OPATCH before

[oracle@ebscloud ~]$ /u01/oracle/oms12104/oms/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.1.0.10.4
Copyright (c) 2015, Oracle Corporation.  All rights reserved.



OPatch is just unzip the 688 zip file straight over the Oracle Home :

set ORACLE_HOME correctly  and

[oracle@ebscloud patches]$ unzip -d $ORACLE_HOME p6880880_111000_Linux-x86-64.zip
Archive:  p6880880_111000_Linux-x86-64.zip
  inflating: /u01/oracle/oms12104/oms/OPatch/wlskeys/README.txt
replace /u01/oracle/oms12104/oms/OPatch/wlskeys/createkeys.cmd? [y]es, [n]o, [A]ll, [N]one, [r]ename:

just press A and ENTER 

....
  creating: /u01/oracle/oms12104/oms/OPatch/ocm/bin/
  inflating: /u01/oracle/oms12104/oms/OPatch/ocm/bin/emocmrsp
  inflating: /u01/oracle/oms12104/oms/OPatch/opatch.bat
  inflating: /u01/oracle/oms12104/oms/OPatch/operr.bat
  inflating: /u01/oracle/oms12104/oms/OPatch/opatchauto.bat

all done.   

OPATCH after 

[oracle@ebscloud patches]$ /u01/oracle/oms12104/oms/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.1.0.12.3
Copyright (c) 2015, Oracle Corporation.  All rights reserved.


Using Wget to get Oracle Patches

A little known metalink feature is using wget to download patches.

This can help tremendously in reducing the amount of crud you have to move around from desktop to server as patches can be very big, and people's desktop connections very slow indeed.

The usual patch download process is to find the patch in metalink, then download to the PC, then FTP or SFTP to the server to be patched.

Using Wget lets us download the file direct from metalink to the server in question.

So how to do this wget step ?


Let's assume we start both from the same point :


Here we are downloading opatch, a fairly common patching tool

If I click on the link we will have the patch downloaded to my PC.

But in the bottom we can see WGET options.  Let's look at that :


It tells us we will download a little script that will actually get the files for us, rather than the large download.  This sounds nice.  Let's do that so press the button. 

What we're seeing is windows 8.1 downloading the file to the desktop and asking if we want to open or save it. Notepad is not good with shell scripts cos it doesn't do CRLFs very well so we will save it instead ! 

When we open that file with a proper editor we see



Ok so what do we do with this.   On the database server or host which you want to patch, open a vi editor



Now copy the contents of the script into the vi editor :  ctrl-A to select all , paste into the terminal emulator




OK - can we use this :  We still have to edit it to change it for the correct userid and password so go up to the top of the file
Edit the lines SSO_USERNAME and SSO_PASSWORD to be whatever you use for Metalink like :

SSO_USERNAME=dingo@xyz.com
SSO_PASSWORD=swordfish

NOW we can use this ! 

Exit to the shell and chmod +x the script, and execute it.

You may run into the problem or two with wget, which is the mechanism for getting the patch  not working.   When you try and check this you will see what wget cannot connect to updates.oracle.com  .    Deep checking shows that this is because the SSL server cannot seem to handle TLS V1.2  - this is not a client side issue, even recompiling to the latest version of wget will not solve it.   The only way of doing this is to tell the wget client to downgrade its SSL protocol to TLSV1 only  - you can do that by adding --secure-protocol=TLSV1 and then it all works.

[oracle@ebscloud patches]$ sh dl.sh
[oracle@ebscloud patches]$ ls -lrt
total 53400
-rw-r--r-- 1 oracle oinstall 54484029 Nov 28 14:18 p6880880_111000_Linux-x86-64.zip
-rwxr-xr-x 1 oracle oinstall     1964 Jan  9 08:00 dl.sh
-rw-r--r-- 1 oracle oinstall     3329 Jan  9 08:00 download

[oracle@ebscloud patches]$

And now it has downloaded our patch !