Sunday, 4 July 2021

Oracle EBS R12.X - cpadmin.sh Concurrent Processing Command-Line Utility

The command-line utility cpadmin consolidates various existing utilities for concurrent processing into a single menu-based utility 


This adadmin-style utility can be used for multiple tasks, including:

1.Manager Status

2.Clean CP Tables

3.Set Manager Diagnostics

4.Manager Control

5.Rebuild Manager Views

6.Move Request Files

7.Analyze Request


Running the cpadmin utility:

Complete the steps below to run the command-line utility and its maintenance tasks.

  1. Set the environment.

  2. From any directory, start cpadmin with this command:
    $ cpadmin.sh

  3. Respond to prompts. 
  4. Choose one of the tasks listed above.
  5. Exit the cpadmin utility.

For more information , one can refer the MOS Doc id : 2319585.1

Oracle EBS R12.2 - Integrated with OAM and OID - Check the sequence of HTTP requests

Confirm that APPS_AUTH_AGENT is properly redirecting to WebGate

Confirm that the mod_weblogic plugin on your WebGate installation is correctly proxying to Oracle WebLogic Server

Confirm that Oracle E-Business Suite AccessGate is running, and processing the OAM headers

Oracle EBS R12.2 - Oracle E-Business Suite AccessGate Version

Change to the directory where fndauth.war exists, and run the command 

$ java -jar fndauth.war

  Ebusiness AccessGate 1.1.0.1 Fri Mar 4 16:49:04 EST 2011





Oracle EBS R12.2 - Inventory report (Technology stack) to collect a list of patches applied

Run  the below command on application tier of EBS R12.2

$ADPERLPRG $FND_TOP/patch/115/bin/TXKScript.pl -script=$FND_TOP/patch/115/bin/txkInventory.pl -txktop=$APPLTMP -contextfile=$CONTEXT_FILE -appspass=<appspassword> -outfile=$APPLTMP/Report_App_Inventory.html

Oracle EBS R12.2 - Enable debug for opmn

To enable debug for opmn, edit 

$IAS_ORACLE_HOME/instances/<instance>/config/OPMN/opmn/opmn.xml

Change the following line

        <debug comp="" rotation-size="1500000"/>
        to
        <debug comp="ons[all];pm[all]" rotation-size="1500000"/>

Oracle EBS R12.2 - Gather the Apache, WLS and Apps log files which have been modified in the last 1 day

#### Start of script
###################################################################################
(
# pick up files which have been modified in the last 1 day only
HowManyDaysOld=1
echo "Picking up files which have been modified in the last ${HowManyDaysOld} days"
set -x
find $LOG_HOME -type f -mtime -${HowManyDaysOld} > m.tmp
find $FMW_HOME/webtier/instances/*/diagnostics/logs -type f -mtime -${HowManyDaysOld} >> m.tmp
find $FMW_HOME/wlserver_10.3/common/nodemanager/nmHome*/*.log -type f -mtime -${HowManyDaysOld} >> m.tmp
## Get log files for only the WLS servers needed. Valid server names are one or more of:
## AdminServer forms-c4ws_server forms_server oacore_server oaea_server oafm_server
for SERVERNAME in AdminServer oacore_server forms_server oafm_server
do
find $EBS_DOMAIN_HOME/servers/${SERVERNAME}*/logs -type f -mtime -${HowManyDaysOld} >> m.tmp
find $EBS_DOMAIN_HOME/servers/${SERVERNAME}*/adr/diag/ofm/EBS_domain_*/${SERVERNAME}*/incident -type f -mtime -${HowManyDaysOld} >> m.tmp
done
zip -r mzAppsLogFiles_`hostname`_`date '+%m%d%y'`.zip -@ < m.tmp
rm m.tmp
) 2>&1 | tee mzLogZip.out
###################################################################################
#### End of script
=========================================================================

Oracle EBS R12.2 - Collect AccessGate LogFiles

Create a file call logging.properties in 
$FMW_HOME/Oracle_EBS-app1/deployment_plans/accessgate with below information

           # Use this file as the LOG_CONFIG_FILE during deployment.
           #
           #
           #---------------------------------------------
           #  Global properties
           #---------------------------------------------
           handlers=java.util.logging.FileHandler
           #---------------------------------------------
           # Default global logging level.
           .level= ALL
           #---------------------------------------------
           # Handler specific properties.
           #---------------------------------------------
           java.util.logging.FileHandler.pattern = /tmp/fndauth%u.log
           java.util.logging.FileHandler.limit = 100000
           java.util.logging.FileHandler.count = 1
           java.util.logging.FileHandler.level = FINE
           java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

           #Ebusiness AccessGate modules
           oracle.apps.fnd.ext.common.level=FINE
           oracle.apps.fnd.ext.common.server.level=FINE

 Take a backup of  $INST_TOP/appl/admin/oaea_wls.properties 

 Make below change

 From

      LOG_CONFIG_FILE=
 To
      LOG_CONFIG_FILE=<Absolute path to logging.properties>

 Restart oaea_server1 manage server

        $ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh stop oaea_server1
        $ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh start oaea_server1

  OR
    Restart EBS Accessgate Manage server .
            Login to WLS console 

            Login as weblogic user  
                        > Environment under Domain Structure
                                 > Servers 
                                        >  control
                                                > Select EBS accessgate manage server
            shutdown and start .

Collect  Following logfiles for review:

We can collect log file from two path depend on the patch applied

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

First Path

$IAS_ORACLE_HOME/instances/EBS_web_<InstanceName>_OHS1/diagnostics/logs/OHS/EBS_web_<Instance Name>/

access_log
console~OHS~1.log
oblog.log

Second Path
if Patch 27294892: CONSOLIDATED PATCH ON TOP OF TXK DELTA 10 or higher applied path will be $IAS_ORACLE_HOME/instances/EBS_web_OHS1/diagnostics/logs/OHS/EBS_web_ohs1)

access_log
console~OHS~1.log
oblog.log

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

From $EBS_DOMAIN_HOME/servers/oaea_server1/logs
oaea_server1.log
oaea_server1.out
access.log
----------------------------------------------------------------------------------------------------------------------
From $EBS_DOMAIN_HOME/ or /tmp
fndauth.log 


Sunday, 27 June 2021

Oracle EBS Script to calculate number of requests run per week

SELECT COUNT(*) Total, 
sum(decode(greatest(0,ceil (sysdate - actual_completion_date)),
least(7,ceil(sysdate-actual_completion_date) ),1,0)) Week4, 
sum(decode(greatest(8,ceil (sysdate - actual_completion_date)), 
least(14,ceil(sysdate-actual_completion_date) ),1,0)) Week3,
sum(decode(greatest(15,ceil (sysdate - actual_completion_date)), 
least(21,ceil(sysdate-actual_completion_date) ),1,0)) Week2,
sum(decode(greatest(22,ceil (sysdate - actual_completion_date)), 
least(28,ceil(sysdate-actual_completion_date) ),1,0)) Week1
FROM FND_CONCURRENT_REQUESTS
WHERE ACTUAL_COMPLETION_DATE is not null;

Saturday, 26 June 2021

Implement Password Policy in Oracle Database

Script to implement password policy in Oracle database

CREATE OR REPLACE FUNCTION VERIFY_FUNCTION_11G (username varchar2, password varchar2, old_password varchar2)

  RETURN boolean IS
     
     m                    integer;
     differ               integer;
     isdigit              boolean;
     islowerchar          boolean;
     isupperchar          boolean;
     ispunct              boolean;
     db_name              varchar2(40);
     digitarray           varchar2(20);
     punctarray           varchar2(25);
     lowerchararray       varchar2(30);
     upperchararray       varchar2(30);
     i_char               varchar2(10);
     simple_password      varchar2(10);
     reverse_user         varchar2(32);
     lv_count             number;

BEGIN
   digitarray     := '0123456789';
   lowerchararray := 'abcdefghijklmnopqrstuvwxyz'; 
   upperchararray := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
   punctarray     := '!"#$%&()''*+,-/:;<=>?_';
   lv_count       := 0;

   -- Check for the minimum length of the password
   IF length(password) < 8 THEN
      raise_application_error(-20001, 'Password length less than 8');
   END IF;

   -- Check if the password is same as the username or username(1-100)
   IF NLS_LOWER(password) = NLS_LOWER(username) THEN
     raise_application_error(-20002, 'Password same as or similar to user');
   END IF;
   
   FOR i IN 1..100 LOOP
      i_char := to_char(i);
      if NLS_LOWER(username)|| i_char = NLS_LOWER(password) THEN
        raise_application_error(-20005, 'Password same as or similar to user name ');
      END IF;
   END LOOP;
   -- Check if the password is same as the username reversed
   FOR i in REVERSE 1..length(username) LOOP
     reverse_user := reverse_user || substr(username, i, 1);
   END LOOP;
   
   IF NLS_LOWER(password) = NLS_LOWER(reverse_user) THEN
     raise_application_error(-20003, 'Password same as username reversed');
   END IF;
   -- Check if the password is the same as server name and or servername(1-100)
   select name into db_name from sys.v$database;
   
   IF NLS_LOWER(db_name) = NLS_LOWER(password) THEN
      raise_application_error(-20004, 'Password same as or similar to server name');
   END IF;
   
   FOR i IN 1..100 LOOP
      i_char := to_char(i);
      if NLS_LOWER(db_name)|| i_char = NLS_LOWER(password) THEN
        raise_application_error(-20005, 'Password same as or similar to server name ');
      END IF;
   END LOOP;

   -- Check if the password is too simple. A dictionary of words may be
   -- maintained and a check may be made so as not to allow the words
   -- that are too simple for the password.
   IF NLS_LOWER(password) IN ('welcome1', 'database1', 'account1', 'user1234', 'password1', 'oracle123', 'computer1', 'abcdefg1', 'change_on_install') THEN
      raise_application_error(-20006, 'Password too simple');
   END IF;
   -- Check if the password is the same as oracle (1-100)
    simple_password := 'oracle';
    FOR i IN 1..100 LOOP
      i_char := to_char(i);
      IF simple_password || i_char = NLS_LOWER(password) THEN
        raise_application_error(-20007, 'Password too simple ');
      END IF;
    END LOOP;
   -- Check if the password contains at least one letter, one digit
   -- 1. Check for the digit
   isdigit:=FALSE;
   m := length(password);
   FOR i IN 1..10 LOOP
      FOR j IN 1..m LOOP
         IF substr(password,j,1) = substr(digitarray,i,1) THEN
             isdigit:=TRUE;
             EXIT;  -- Exit from Loop
         END IF;
      END LOOP;
   END LOOP;
   IF isdigit = TRUE THEN
     lv_count := lv_count + 1;
   END IF;
   
   -- 2. Check for the lower case character
   islowerchar:=FALSE;
   FOR i IN 1..length(lowerchararray) LOOP
      FOR j IN 1..m LOOP
         IF substr(password,j,1) = substr(lowerchararray,i,1) THEN
            islowerchar:=TRUE;
            EXIT;  -- Exit from Loop
         END IF;
      END LOOP;
   END LOOP;
   
   IF islowerchar = TRUE THEN
      lv_count := lv_count + 1;
   END IF;
   -- 3. Check for the upper case character
   isupperchar:=FALSE;
   FOR i IN 1..length(upperchararray) LOOP
      FOR j IN 1..m LOOP
         IF substr(password,j,1) = substr(upperchararray,i,1) THEN
              isupperchar:=TRUE;
              EXIT;  -- Exit from Loop
         END IF;
      END LOOP;
   END LOOP;
   
   IF isupperchar = TRUE THEN
      lv_count := lv_count + 1;
   END IF;
      
   -- 4. Check for the Special character
   ispunct:=FALSE;
   FOR i IN 1..length(punctarray) LOOP
      FOR j IN 1..m LOOP
         IF substr(password,j,1) = substr(punctarray,i,1) THEN
              ispunct:=TRUE;
              EXIT;  -- Exit from Loop
         END IF;
      END LOOP;
   END LOOP;
   
   IF ispunct = TRUE THEN
      lv_count := lv_count + 1;
   END IF;
   
   IF lv_count < 3 THEN
      raise_application_error(-20008, 'Password must contain one Upper case , one Lower case , one digit and one special character (Any three of four)');
   END IF;
   -- Check if the password differs from the previous password by at least
   -- 3 letters
   IF old_password IS NOT NULL THEN
     differ := length(old_password) - length(password);
     differ := abs(differ);
     IF differ < 3 THEN
       IF length(password) < length(old_password) THEN
         m := length(password);
       ELSE
         m := length(old_password);
       END IF;
       FOR i IN 1..m LOOP
         IF substr(password,i,1) != substr(old_password,i,1) THEN
           differ := differ + 1;
         END IF;
       END LOOP;
       IF differ < 3 THEN
         raise_application_error(-20011, 'Password should differ from the old password by at least 3 characters');
       END IF;
     END IF;
   END IF;
   
   -- Everything is fine; return TRUE ;
   RETURN(TRUE);
END;

Enable flashback in Oracle standby database

Oracle Flashback Database enables point-in-time-recovery of the entire database without requiring a restore and recovery operation.

It rewinds the entire database to a specified point in time in the past by undoing all the changes that were made since that time

Follow below steps on Standby database to enable flashback

SQL> alter system set db_recovery_file_dest_size=16g scope=both;

SQL> alter system set db_recovery_file_dest='/u01/oracle/flash_recovery_area' scope=both;

SQL> alter system set db_flashback_retention_target=1440 scope=both;

SQL> alter database recover managed standby database cancel;

SQL> alter database flashback on;

SQL> alter database recover managed standby database using current logfile disconnect;

SQL> alter database recover managed standby database cancel;

SQL> Create restore point standby_26062021 guarantee flashback database;


Activate physical standby database to open mode

SQL> alter database activate standby database;

SQL> startup mount force;

SQL> alter database set standby database to maximize performance;

SQL> alter database open;







Enable Audit in Oracle Database

 To enable audit in Oracle database, follow the below steps

Database Steps:

      ·        Check parameter file is pfile or spfile

·        Note down the audit parameters before change

·        Create pfile from spfile and make the below audit parameter changes

·        Shutdown the database

·        Change the audit parameters in pfile.

a.      audit_file_dest =   <provide audit path on O/S>

b.      audit_trail  = os

c.      audit_sys_operations=true

       ·    Create spfile from pfile

       ·     Enable audit on the required users  using the below command.

                audit all by <user name>  by access 

Saturday, 12 June 2021

Provisioning Profile Log File Location

In 10g Releases (10.1.4.x)

Oracle Directory Integration Platform server log file : $ORACLE_HOME/ldap/log directory

Individual logs for each profile : $ORACLE_HOME/ldap/odi/log/ directory

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

In 11g Release 1 (11.1.1)

Log files: $MW_HOME/user_projects/domains/DOMAIN_NAME/servers/NAME_OF_MANAGED_SERVER/logs/NAME_OF_MANAGED_SERVER.log

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

DIP log file is located in the $ORACLE_HOME/ldap/log/odisrv<instance number>.log 

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

The provisioning profile logs : $ORACLE_HOME/ldap/odi/log directory. 
Each log file name is of the form: <ApplicationName>_<RealmName>_[I/E].[trc/aud].
Where:
I = INBOUND provisioning event (from Oracle E-Business Suite to Oracle Directory Services)
E = OUTBOUND provisioning event (from Oracle Directory Services to Oracle E-Business Suite)
-----------------------------------------------------------------------------------------------------------

Audit Log Location

In 10g Releases (10.1.4.x):
ORACLE_HOME/ldap/odi/log/PROFILE_NAME.aud

In 11g Release 1 (11.1.1):
DOMAIN_HOME/servers/wls_ods1/logs/auditlogs/DIP/
-----------------------------------------------------------------------------------------------------------
     

How to manage Oracle Internet Directory (OID) using OIDCTL command

On OID server  , make sure the below variables are set

$export ORACLE_INSTANCE=/d01/fmw/oid/ldap
$export INSTANCE_NAME=oid1 
$export COMPONENT_NAME=oid1
$export TNS_ADMIN=$DOMAIN_HOME/config/fmwconfig/ components/OID/config/componentName

View the Status
$ORACLE_HOME/bin/oidctl connect=oiddb status 

Stop the OID
$ORACLE_HOME/bin/oidctl connect=oiddb server=oidldapd instance=1 stop 

Start the OID
$ORACLE_HOME/bin/oidctl connect=oiddb server=oidldapd instance=1 start

Run adop cutover in EBS R12.2 without starting the Application Tier

Run the below command at the time of cutover 

adop phase=cutover mtrestart=no

Login R12.2 WebLogic Console denied from Client Machine

1.Log in to the primary node of the Oracle E-Business Suite instance.
2.Start the Oracle WebLogic Admin Server from the run file system, if it is not already running.
3.Take a backup of the run file system context file.
4.Edit the run file system context file to set the value for the
 s_wls_admin_console_access_nodes context variable to the list of trusted hosts that are allowed to access the Admin Server. 
<s_wls_admin_console_access_nodes oa_var="s_wls_admin_console_access_nodes">ws1.myco.com,ws2.myco.com</s_wls_admin_console_access_nodes>
5.Run AutoConfig.
6.Stop and restart the Oracle WebLogic Admin Server.

If you need to make changes without having access to the Oracle WebLogic Server Administration Console, you can update or remove the connection filter rules by editing the $DOMAIN_HOME/config/config.xml file. However, changes added this way will be overwritten by the next AutoConfig run.

Script to Diagnose adop and Other AD-TXK Issues in Oracle E-Business Suite R12.2

Execute the diagnostic script shipped  as per Note 1901242.1 on all application nodes

To use the script:
1. Unzip the patch to a new folder
2. Confirm the following files are present after unzipping.
        adzddbdetails.sql
        adzddiagnostic.pl
        adzdedndetails.sql

3. Source the Apps Tier run environment file
4. Run the master perl script adzddiagnostic.pl with the command "perl adzddiagnostic.pl"
5. Supply the apps database user password the script prompts for.
6. The script creates a file "diagnostic_info_<hostname>.tar" in the working directory.


Find TXK, AD patch level in R12.2

Run the below sql . Login as apps user

sqlplus apps/*****

SQL> SELECT codelevel 
           FROM AD_TRACKABLE_ENTITIES 
           WHERE abbreviation in ('txk','ad')

CODELEVEL
ad     C.7
txk    C.7

ADOP Analyzer in EBS R12.2

 Refer DOC ID 2379656.1 for ICM ADOP Application Tier Analyzer output

ORA-06598: insufficient INHERIT PRIVILEGES

While running adop phase=abort. Got below error

declare 
*
ERROR at line 1:
ORA-06598: insufficient INHERIT PRIVILEGES privilege
ORA-06512: at "APPS.AD_ZD_LOG", line 52
ORA-06512: at line 14

Solution :

       SQL>GRANT INHERIT ANY PRIVILEGES TO APPS;
       After this grant, run the abort and got completed
       
adop phase=abort

       The problem got resolved and started the patch cycle 

Saturday, 5 June 2021

Start admin Server from Patch File System in EBS R12.2

Run  EBSapps.env to set the patch file system environment

$cd $ADMIN_SCRIPTS_HOME

$ sh adadminsrvctl.sh start forcepatchfs

Ansible Script - Start an OCI ( Oracle Cloud Infrastructure) instance

 

Playbook file (instance_mgmt_start.yaml)

- name: instance lifecycle mgmt

  hosts: localhost

  collections:

    - oracle.oci

  tasks:

    - name: start instance

      oci_compute_instance_actions:

        instance_id:                                   

        action: start

      register: output

    - name: Print namespace name

      debug:

        msg: "{{ output }}"

 

Run ansbile-playbook as:

 

$ ansible-playbook  /home/a_prashant/.ansible/instance_mgmt_start.yaml

 

PLAY [Get namespace name] *****************************************************************************

 

TASK [Gathering Facts] *****************************************************************************

ok: [localhost]

 

TASK [Get namespace name1] *****************************************************************************

changed: [localhost]

 

TASK [Print namespace name] ************************************************************ok: [localhost] => {

    "msg": {

        "changed": true,

        "failed": false,

        "instance": {

            "agent_config": {

                "is_management_disabled": false,

                "is_monitoring_disabled": false

            },

            "availability_config": {

                "recovery_action": "RESTORE_INSTANCE"

            },

            "availability_domain": "RJkC:AP-MUMBAI-1-AD-1",

            "compartment_id": "                         ",

            "dedicated_vm_host_id": null,

            "defined_tags": {

                "Operations": {

                    "CostCenter": "56"

                },

                "Oracle-Tags": {                   "CreatedBy":"oracleidentitycloudservice/prashant",

                    "CreatedOn": "2021-02-12T05:12:02.350Z"

                }

            },

            "display_name": "TF_TERRAFORM_NEW",

            "extended_metadata": {},

            "fault_domain": "FAULT-DOMAIN-1",

            "freeform_tags": {},

            "id": "           ",

            "image_id": "         ",

            "instance_options": {

                "are_legacy_imds_endpoints_disabled": false

            },

            "ipxe_script": null,

            "launch_mode": "PARAVIRTUALIZED",

            "launch_options": {

                "boot_volume_type": "PARAVIRTUALIZED",

                "firmware": "UEFI_64",

                "is_consistent_volume_naming_enabled": true,

                "is_pv_encryption_in_transit_enabled": false,

                "network_type": "PARAVIRTUALIZED",

                "remote_data_volume_type": "PARAVIRTUALIZED"

            },

            "lifecycle_state": "RUNNING",

            "metadata": {

                "ssh_authorized_keys": "        \n"

            },

            "region": "ap-mumbai-1",

            "shape": "VM.Standard.E2.1.Micro",

            "shape_config": {

                "gpu_description": null,

                "gpus": 0,

                "local_disk_description": null,

                "local_disks": 0,

                "local_disks_total_size_in_gbs": null,

                "max_vnic_attachments": 1,

                "memory_in_gbs": 1.0,

                "networking_bandwidth_in_gbps": 0.48,

                "ocpus": 1.0,

                "processor_description": "2.0 GHz AMD EPYC™ 7551 (Naples)"

            },

            "source_details": {

                "boot_volume_size_in_gbs": null,

                "image_id": "                 ",

                "kms_key_id": null,

                "source_type": "image"

            },

            "system_tags": {

                "orcl-cloud": {

                    "free-tier-retained": "true"

                }

            },

            "time_created": "2021-02-12T05:12:02.923000+00:00",

            "time_maintenance_reboot_due": null

        }

    }

}

 

PLAY RECAP *****************************************************************************

localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0  ignored=0 

Register OID with EBS R12.2 during SSO setup

 $FND_TOP/bin/txkrun.pl -script=SetSSOReg -registeroid=yes -appname=R12AHPRODE_AHAPPS01 -svcname=R12AHPRODE_AHAPPS01


You are registering this instance with LDAP Server.

Enter LDAP Host name? AHAPPRODS.myorg.com
Enter the LDAP Port on Oracle Directory server? 3060
Enter the LDAP Directory Administrator (orcladmin) Bind password? oracle321
Enter the instance password that you would like to register this application instance with?  oracle321
Enter Oracle E-Business apps database user password ?


*** Log File = ../logs/appl/rgf/TXK/txkSetSSOReg_Wed_Apr_14_21_21_24_2021.xml


Beginning input parameter validation for LDAP Directory registration.
Input parameters validation for LDAP Directory registration completed.


BEGIN LDAP DIRECTORY REGISTRATION:
Beginning to register Application and Service containers if necessary.
Application and Service containers were created successfully if necessary.
Beginning to register application in the LDAP Directory.
Registration of application in LDAP Directory completed successfully.
[info] -> LOADING:  ../fs2/EBSapps/appl/fnd/12.0.0/admin/template/AppsOIDRegistration.tmp
Apr 14, 2021 9:34:59 PM oracle.ldap.util.LDIFLoader loadOneLdifFile
INFO: -> LOADING:  ../fs2/EBSapps/appl/fnd/12.0.0/admin/template/AppsOIDRegistration.tmp
Beginning to register provisioning profile in the LDAP Directory.
Registration of provisioning profile in the LDAP Directory completed successfully.
Application is now registered successfully with provisioning in the LDAP Directory.

End of ../fs2/EBSapps/appl/fnd/12.0.0/patch/115/bin/txkSetSSOReg.pl : No Errors encountered

EBS R12.2 - Check available Managed Server in Run and Patch filesystem

 In my case application servee is running on two nodes

Patch File System Managed Server on both nodes

SQL> set heading off
SQL> set pagesize 300;

SQL> SELECT
extractValue(XMLType(TEXT),'//oa_service_name[@oa_var="s_adminservername"]'),
extractValue(XMLType(TEXT),'//oacore_server_ports'),
extractValue(XMLType(TEXT),'//forms_server_ports'),
extractValue(XMLType(TEXT),'//oafm_server_ports'),
extractValue(XMLType(TEXT),'//forms-c4ws_server_ports'),
extractValue(XMLType(TEXT),'//oaea_server_ports')
from fnd_oam_context_files
where name not in ('TEMPLATE','METADATA')
and (status is null or status !='H')
and EXTRACTVALUE(XMLType(TEXT),'//file_edition_type')='patch'
and CTX_TYPE = 'A'; 

 Node 1

AdminServer
oacore_server2:7201
forms_server2:7401
oafm_server2:7601
forms-c4ws_server2:7801

Node 2

AdminServer
oacore_server1:7201
forms_server1:7401
oafm_server1:7601
forms-c4ws_server1:7801


Run File System Managed Server on both nodes

SQL>  SELECT
extractValue(XMLType(TEXT),'//oa_service_name[@oa_var="s_adminservername"]'),
extractValue(XMLType(TEXT),'//oacore_server_ports'),
extractValue(XMLType(TEXT),'//forms_server_ports'),
extractValue(XMLType(TEXT),'//oafm_server_ports'),
extractValue(XMLType(TEXT),'//forms-c4ws_server_ports'),
extractValue(XMLType(TEXT),'//oaea_server_ports')
from fnd_oam_context_files
where name not in ('TEMPLATE','METADATA')
and (status is null or status !='H')
and EXTRACTVALUE(XMLType(TEXT),'//file_edition_type')=' run';

Node 1

 AdminServer
oacore_server1:7202,oacore_server3:7204
forms_server1:7402
oafm_server1:7602
forms-c4ws_server1:7802

 Node2

AdminServer
oacore_server2:7202,oacore_server3:7204
forms_server2:7402
oafm_server2:7602
forms-c4ws_server2:7802

Saturday, 29 May 2021

Sync file system from one server to another using rsync command

#Create a script file with below contents. 
#Before running the script, implement ssh between source and destination server

# replace user and ip with correct value

src1=/a02/fmwprod/
src2=/etc/oraInventory/
des1=/a02/fmwprod/
des2=/etc/oraInventory/
user=xxxxx
ip=xx.xx.xx.xx


echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"

echo "Starting to execute the 'rsync' utility...."


/usr/bin/rsync -av $src1 $user@$ip:$des1
/usr/bin/rsync -av $src2 $user@$ip:$des2

echo "The execution has ended. Please check log created in tmp directory"

echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"

 #Schedule using crontab 

25 14 * * *  sh /home/rsyncFMW.sh 2>/tmp/rsync_sourceTOdest.err 1>/tmp/rsync_sourceTOdest.log


Create Instances in OCI using Terraform


Create the below environment file before running the terraform commands


env.sh
compute.tf
provider.tf
variable.tf

 

$ cat provider.tf

provider "oci" {
  tenancy_ocid = var.tenancy_ocid
  region = var.region
  disable_auto_retries = true

}

$cat compute.tf

resource "oci_core_instance" "test_instance" {

          availability_domain = var.instance_availability_domain

          compartment_id = var.compartment_id

          shape = var.instance_shape

          agent_config {

                 is_management_disabled = var.instance_agent_config_is_management_disabled

                 is_monitoring_disabled = var.instance_agent_config_is_monitoring_disabled

                   }

                availability_config {

                   recovery_action = var.instance_availability_config_recovery_action

                                    }

                metadata = {

                   ssh_authorized_keys = file("/home/a_prashant/.ssh/id_rsa.pub")

                           }

                display_name = var.instance_display_name

                source_details {

                      #Required

                        source_id = var.instance_image_id

                        source_type = "image"

                        }

 

                create_vnic_details {

                        assign_public_ip = true

                        subnet_id = "               "

                        }

                }

 

 

$ cat env.sh

export TF_VAR_tenancy_ocid=                                                

export TF_VAR_region=                        

export TF_VAR_instance_availability_domain=                        

export TF_VAR_compartment_id=                        

export TF_VAR_compartment_description=                        

export TF_VAR_compartment_name=                        

export TF_VAR_enable_delete=                        

export TF_VAR_vcn_cidr_block=                        

export TF_VAR_vcn_display_name=                        

export TF_VAR_vcn_dns_label=                        

export TF_VAR_instance_agent_config_is_monitoring_disabled=                        

export TF_VAR_instance_availability_config_recovery_action=                        

export TF_VAR_instance_image_id=                        

export TF_VAR_instance_display_name="TF_TERRAFORM_NEW"

 

 

$ cat variable.tf

variable "tenancy_ocid" {}

variable "user_ocid" {}

variable "fingerprint" {}

variable "private_key_path" {}

variable "private_key_password" {}

variable "region" {}

variable "compartment_id" {}

variable "instance_display_name" {}

#For VCN

variable "vcn_cidr_block" {}

variable "vcn_display_name" {}

variable "vcn_dns_label" {}

#For Instance

variable "instance_availability_domain" {}

variable "instance_shape" {}

variable "instance_agent_config_is_management_disabled" {}

variable "instance_agent_config_is_monitoring_disabled" {}

variable "instance_availability_config_recovery_action" {}

variable "instance_image_id" {}

  

$ terraform init

 

Initializing the backend...

 

Initializing provider plugins...

- Using previously-installed hashicorp/oci v4.13.0

 

The following providers do not have any version constraints in configuration,

so the latest version was installed.

 

To prevent automatic upgrades to new major versions that may contain breaking

changes, we recommend adding version constraints in a required_providers block

in your configuration, with the constraint strings suggested below.

 

* hashicorp/oci: version = "~> 4.13.0"

 

Terraform has been successfully initialized!

 

You may now begin working with Terraform. Try running "terraform plan" to see

any changes that are required for your infrastructure. All Terraform commands

should now work.

 

If you ever set or change modules or backend configuration for Terraform,

rerun this command to reinitialize your working directory. If you forget, other

commands will detect it and remind you to do so if necessary.

 

$ terraform plan

var.fingerprint

  Enter a value:                        

 

var.private_key_password

  Enter a value:                        

 

var.private_key_path

  Enter a value:                                

 

var.user_ocid

  Enter a value:                         

 

Refreshing Terraform state in-memory prior to plan...

The refreshed state will be used to calculate this plan, but will not be

persisted to local or remote state storage.

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

 

An execution plan has been generated and is shown below.

Resource actions are indicated with the following symbols:

  + create

 

Terraform will perform the following actions:

 

  # oci_core_instance.test_instance will be created

  + resource "oci_core_instance" "test_instance" {

      + availability_domain                 = "RJkC:AP-MUMBAI-1-AD-1"

      + boot_volume_id                      = (known after apply)

      + compartment_id                      = "                        "

      + dedicated_vm_host_id                = (known after apply)

      + defined_tags                        = (known after apply)

      + display_name                        = "TF_TERRAFORM_NEW"

      + fault_domain                        = (known after apply)

      + freeform_tags                       = (known after apply)

      + hostname_label                      = (known after apply)

      + id                                  = (known after apply)

      + image                               = (known after apply)

      + ipxe_script                         = (known after apply)

      + is_pv_encryption_in_transit_enabled = (known after apply)

      + launch_mode                         = (known after apply)

      + metadata                            = {

          + "ssh_authorized_keys" = <<~EOT

                ssh-rsa                         

            EOT

        }

      + private_ip                          = (known after apply)

      + public_ip                           = (known after apply)

      + region                              = (known after apply)

      + shape                               = "VM.Standard.E2.1.Micro"

      + state                               = (known after apply)

      + subnet_id                           = (known after apply)

      + system_tags                         = (known after apply)

      + time_created                        = (known after apply)

      + time_maintenance_reboot_due         = (known after apply)

 

      + agent_config {

          + are_all_plugins_disabled = (known after apply)

          + is_management_disabled   = false

          + is_monitoring_disabled   = false

 

          + plugins_config {

              + desired_state = (known after apply)

              + name          = (known after apply)

            }

        }

 

      + availability_config {

          + recovery_action = "RESTORE_INSTANCE"

        }

 

      + create_vnic_details {

          + assign_public_ip       = "true"

          + defined_tags           = (known after apply)

          + display_name           = (known after apply)

          + freeform_tags          = (known after apply)

          + hostname_label         = (known after apply)

          + private_ip             = (known after apply)

          + skip_source_dest_check = (known after apply)

          + subnet_id              = "                        "

          + vlan_id                = (known after apply)

        }

 

      + instance_options {

          + are_legacy_imds_endpoints_disabled = (known after apply)

        }

 

      + launch_options {

          + boot_volume_type                    = (known after apply)

          + firmware                            = (known after apply)

          + is_consistent_volume_naming_enabled = (known after apply)

          + is_pv_encryption_in_transit_enabled = (known after apply)

          + network_type                        = (known after apply)

          + remote_data_volume_type             = (known after apply)

        }

 

      + shape_config {

          + gpu_description               = (known after apply)

          + gpus                          = (known after apply)

          + local_disk_description        = (known after apply)

          + local_disks                   = (known after apply)

          + local_disks_total_size_in_gbs = (known after apply)

          + max_vnic_attachments          = (known after apply)

          + memory_in_gbs                 = (known after apply)

          + networking_bandwidth_in_gbps  = (known after apply)

          + ocpus                         = (known after apply)

          + processor_description         = (known after apply)

        }

 

      + source_details {

          + boot_volume_size_in_gbs = (known after apply)

          + kms_key_id              = (known after apply)

          + source_id               = "                        "

          + source_type             = "image"

        }

    }

 

Plan: 1 to add, 0 to change, 0 to destroy.

 

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

 

Note: You didn't specify an "-out" parameter to save this plan, so Terraform

can't guarantee that exactly these actions will be performed if

"terraform apply" is subsequently run.

 

$ terraform apply

var.fingerprint

  Enter a value:                                                     

 

var.private_key_password

  Enter a value:                         

 

var.private_key_path

  Enter a value:                         

 

var.user_ocid

  Enter a value:                         

 

 

An execution plan has been generated and is shown below.

Resource actions are indicated with the following symbols:

  + create

 

Terraform will perform the following actions:

 

  # oci_core_instance.test_instance will be created

  + resource "oci_core_instance" "test_instance" {

      + availability_domain                 = "RJkC:AP-MUMBAI-1-AD-1"

      + boot_volume_id                      = (known after apply)

      + compartment_id                      = "                        "

      + dedicated_vm_host_id                = (known after apply)

      + defined_tags                        = (known after apply)

      + display_name                        = "TF_TERRAFORM_NEW"

      + fault_domain                        = (known after apply)

      + freeform_tags                       = (known after apply)

      + hostname_label                      = (known after apply)

      + id                                  = (known after apply)

      + image                               = (known after apply)

      + ipxe_script                         = (known after apply)

      + is_pv_encryption_in_transit_enabled = (known after apply)

      + launch_mode                         = (known after apply)

      + metadata                            = {

          + "ssh_authorized_keys" = <<~EOT

                ssh-rsa                         

            EOT

        }

      + private_ip                          = (known after apply)

      + public_ip                           = (known after apply)

      + region                              = (known after apply)

      + shape                               = "VM.Standard.E2.1.Micro"

      + state                               = (known after apply)

      + subnet_id                           = (known after apply)

      + system_tags                         = (known after apply)

      + time_created                        = (known after apply)

      + time_maintenance_reboot_due         = (known after apply)

 

      + agent_config {

          + are_all_plugins_disabled = (known after apply)

          + is_management_disabled   = false

          + is_monitoring_disabled   = false

 

          + plugins_config {

              + desired_state = (known after apply)

              + name          = (known after apply)

            }

        }

 

      + availability_config {

          + recovery_action = "RESTORE_INSTANCE"

        }

 

      + create_vnic_details {

          + assign_public_ip       = "true"

          + defined_tags           = (known after apply)

          + display_name           = (known after apply)

          + freeform_tags          = (known after apply)

          + hostname_label         = (known after apply)

          + private_ip             = (known after apply)

          + skip_source_dest_check = (known after apply)

          + subnet_id              = "                        "

          + vlan_id                = (known after apply)

        }

 

      + instance_options {

          + are_legacy_imds_endpoints_disabled = (known after apply)

        }

 

      + launch_options {

          + boot_volume_type                    = (known after apply)

          + firmware                            = (known after apply)

          + is_consistent_volume_naming_enabled = (known after apply)

          + is_pv_encryption_in_transit_enabled = (known after apply)

          + network_type                        = (known after apply)

          + remote_data_volume_type             = (known after apply)

        }

 

      + shape_config {

          + gpu_description               = (known after apply)

          + gpus                          = (known after apply)

          + local_disk_description        = (known after apply)

          + local_disks                   = (known after apply)

          + local_disks_total_size_in_gbs = (known after apply)

          + max_vnic_attachments          = (known after apply)

          + memory_in_gbs                 = (known after apply)

          + networking_bandwidth_in_gbps  = (known after apply)

          + ocpus                         = (known after apply)

          + processor_description         = (known after apply)

        }

 

      + source_details {

          + boot_volume_size_in_gbs = (known after apply)

          + kms_key_id              = (known after apply)

          + source_id               = "                        "

          + source_type             = "image"

        }

    }

 

Plan: 1 to add, 0 to change, 0 to destroy.

 

Do you want to perform these actions?

  Terraform will perform the actions described above.

  Only 'yes' will be accepted to approve.

 

  Enter a value: yes

 

oci_core_instance.test_instance: Creating...

oci_core_instance.test_instance: Still creating... [10s elapsed]

oci_core_instance.test_instance: Still creating... [20s elapsed]

oci_core_instance.test_instance: Still creating... [30s elapsed]

oci_core_instance.test_instance: Still creating... [40s elapsed]

oci_core_instance.test_instance: Still creating... [50s elapsed]

oci_core_instance.test_instance: Still creating... [1m0s elapsed]

oci_core_instance.test_instance: Still creating... [1m10s elapsed]

oci_core_instance.test_instance: Creation complete after 1m18s [id=                        ]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.