Thursday, 26 December 2019

Backup of all Oracle Database objects on Server with Procedure



----Backup With Procedure

---Create Directory
CREATE OR REPLACE DIRECTORY PS_DIR AS '/u01/oracle/PROD/fs2/EBSapps/appl/au/12.0.0/forms/BackUp';


---Create Procedure
  
   CREATE OR REPLACE PROCEDURE    EXPORT_DDL
AS
    V_DDL_CLOB  CLOB;
    VPATH VARCHAR2(255);
BEGIN
    FOR C IN (SELECT OBJECT_NAME, OBJECT_TYPE
             FROM USER_OBJECTS
             WHERE OBJECT_TYPE IN ('TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','PACKAGE_BODY')
             and OBJECT_NAME like '%TGC%')
    LOOP
        V_DDL_CLOB := DBMS_METADATA.GET_DDL(C.OBJECT_TYPE, C.OBJECT_NAME);
        DBMS_XSLPROCESSOR.CLOB2FILE(V_DDL_CLOB, 'PS_DIR', C.OBJECT_TYPE || '_' || C.OBJECT_NAME||'.SQL');
    END LOOP;
END;



--- Call procedure

Exec EXPORT_DDL;

Tuesday, 17 December 2019

Compile Oracle form scripts

For single form

frmcmp_batch userid=apps/apps module=/opt/oracle/fs1/EBSapps/appl/au/12.0.0/forms/US/Form.fmb output_file=/opt/oracle/fs1/EBSapps/appl/fnd/12.0.0/forms/US/Form.fmx module_type=form batch=no compile_all=yes



For all forms/Lib

Copy following code and paste in notepad and save as Compile.cmd

@ECHO OFF 
cls 
Echo compiling libraries 10g .... 
for %%f IN (*.pll) do frmcmp userid=User_name/pass@orcl module=%%f batch=yes module_type=library compile_all=yes window_state=minimize 
ECHO libraries compilation complete
ECHO ----------------------------------
Echo compiling menus 10g .... 
for %%f IN (*.mmb) do frmcmp userid=User_name/pass@orcl module=%%f batch=yes module_type=menu compile_all=yes window_state=minimize 
ECHO menus compilation complete
ECHO ----------------------------------
Echo compiling forms 10g .... 
for %%f IN (*.fmb) do frmcmp userid=User_name/pass@orcl module=%%f batch=yes module_type=form compile_all=yes window_state=minimize 
ECHO form compilation complete
ECHO ----------------------------------
ECHO Form Compilation complete

Monday, 16 December 2019

Get the Password of a User In EBS

CREATE OR REPLACE PACKAGE get_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2;
END get_pwd;
/
--Package Body
CREATE OR REPLACE PACKAGE BODY get_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2
   AS
      LANGUAGE JAVA
      NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
END get_pwd;
/
--Query to execute
SELECT usr.user_name,
       get_pwd.decrypt
          ((SELECT (SELECT get_pwd.decrypt
                              (fnd_web_sec.get_guest_username_pwd,
                               usertable.encrypted_foundation_password
                              )
                      FROM DUAL) AS apps_password
              FROM fnd_user usertable
             WHERE usertable.user_name =
                      (SELECT SUBSTR
                                  (fnd_web_sec.get_guest_username_pwd,
                                   1,
                                     INSTR
                                          (fnd_web_sec.get_guest_username_pwd,
                                           '/'
                                          )
                                   - 1
                                  )
                         FROM DUAL)),
           usr.encrypted_user_password
          ) PASSWORD
  FROM fnd_user usr
 WHERE usr.user_name = '&USER_NAME';

Tuesday, 10 December 2019

Internal Concurrent Manager status could not be determined.

To resolve this, do the following steps.

1. Make sure that there are no concurrent processes still running. ps -ef | grep FNDLIBR
2. Use sqlplus, login as APPLSYS
3. delete  from fnd_concurrent_processes;
   Don't panic if it deletes a lot of rows this table holds a lot of useless history information and should be cleaned up every so often.
4. update fnd_concurrent_queues set running_processes=0;

Now restart your concurrent managers, which should start up without any errors in the log file at all.
Then see if the requests go through OK.

Tuesday, 3 December 2019

OAF Page to Upload Files into Server from local Machine

1. Create a New Workspace and Project
File > New > General > Workspace Configured for Oracle Applications

File Name – PrajkumarFileUploadDemo

Automatically a new OA Project will also be created

Project Name -- FileUploadDemo
Default Package -- prajkumar.oracle.apps.fnd.fileuploaddemo

2. Create a New Application Module (AM)
Right Click on FileUploadDemo > New > ADF Business Components > Application Module
Name -- FileUploadAM
Package -- prajkumar.oracle.apps.fnd.fileuploaddemo.server
Check Application Module Class: FileUploadAMImpl Generate JavaFile(s)

3. Create a New Page
Right click on FileUploadDemo > New > Web Tier > OA Components > Page
Name -- FileUploadPG
Package -- prajkumar.oracle.apps.fnd.fileuploaddemo.webui

4. Select the FileUploadPG and go to the strcuture pane where a default region has been created

5. Select region1 and set the following properties --
   
Attribute
Property
ID
PageLayoutRN
AM Definition
prajkumar.oracle.apps.fnd.fileuploaddemo.server.FileUploadAM
Window Title
Uploading File into Server from Local Machine Demo Window
Title
Uploading File into Server from Local Machine Demo
   
6. Create messageComponentLayout Region Under Page Layout Region
Right click PageLayoutRN > New > Region

Attribute
Property
ID
MainRN
Item Style
messageComponentLayout

7. Create a New Item messageFileUpload Bean under MainRN
Right click on MainRN > New > messageFileUpload
Set Following Properties for New Item --

Attribute
Property
ID
MessageFileUpload
Item Style
messageFileUpload

8. Create a New Item Submit Button Bean under MainRN
Right click on MainRN > New > messageLayout
Set Following Properties for messageLayout --

Attribute
Property
ID
ButtonLayout

Right Click on ButtonLayout > New > Item

Attribute
Property
ID
Submit
Item Style
submitButton
Attribute Set
/oracle/apps/fnd/attributesets/Buttons/Go

9. Create Controller for page FileUploadPG
Right Click on PageLayoutRN > Set New Controller
Package Name: prajkumar.oracle.apps.fnd.fileuploaddemo.webui
Class Name: FileUploadCO

Write Following Code in FileUploadCO processFormRequest
import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import oracle.apps.fnd.framework.OAException;
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{ super.processFormRequest(pageContext, webBean);  
 if(pageContext.getParameter("Submit")!=null)
 {
  upLoadFile(pageContext,webBean);    
 }
}

CODE #1 -- If Page has not deployed at instance, testing at Local Machine, use following Code
public void upLoadFile(OAPageContext pageContext,OAWebBean webBean)
{ String filePath = "D:\\PRajkumar";
 System.out.println("Default File Path---->"+filePath);
 String fileUrl = null;
 try
 {
  DataObject fileUploadData =  pageContext.getNamedDataObject("MessageFileUpload");
//FileUploading is my MessageFileUpload Bean Id
  if(fileUploadData!=null)
  {
   String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME"); 

   String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");  
   System.out.println("User File Name---->"+uFileName);
   FileOutputStream output = null;
   InputStream input = null;
   BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, uFileName);
   System.out.println("uploadedByteStream---->"+uploadedByteStream);
                          
   File file = new File("D:\\PRajkumar", uFileName);  
   System.out.println("File output---->"+file);
   output = new FileOutputStream(file);
   System.out.println("output----->"+output);
   input = uploadedByteStream.getInputStream();
   System.out.println("input---->"+input);
   byte abyte0[] = new byte[0x19000];
   int i;
    
   while((i = input.read(abyte0)) > 0)
   output.write(abyte0, 0, i);
   output.close();
   input.close();
  }
 }
 catch(Exception ex)
 {
  throw new OAException(ex.getMessage(), OAException.ERROR);
 }    
}

CODE #2 -- If Page has been Deployed at Instance, Use Following Code 
public void upLoadFile(OAPageContext pageContext,OAWebBean webBean)
{ String filePath = "/u01/app/apnac03r12/PRajkumar/";
 System.out.println("Default File Path---->"+filePath);
 String fileUrl = null;
 try
 {
  DataObject fileUploadData =  pageContext.getNamedDataObject("MessageFileUpload");
//FileUploading is my MessageFileUpload Bean Id
  if(fileUploadData!=null)
  {
   String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");  
   String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");  
   System.out.println("User File Name---->"+uFileName);
   FileOutputStream output = null;
   InputStream input = null;
   BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, uFileName);
   System.out.println("uploadedByteStream---->"+uploadedByteStream);
                          
   File file = new File("/u01/app/apnac03r12/PRajkumar", uFileName);  
   System.out.println("File output---->"+file);
   output = new FileOutputStream(file);
   System.out.println("output----->"+output);
   input = uploadedByteStream.getInputStream();
   System.out.println("input---->"+input);
   byte abyte0[] = new byte[0x19000];
   int i;
    
   while((i = input.read(abyte0)) > 0)
   output.write(abyte0, 0, i);
   output.close();
   input.close();
  }
 }
 catch(Exception ex)
 {
  throw new OAException(ex.getMessage(), OAException.ERROR);
 }    
}

10. Congratulation you have successfully finished. Run Your page and Test Your Work




 Page has deployed and Used CODE #2

Before Upload the File


After Upload the File
   

 Page has not been deployed and Used CODE #1

Before Upload the File


After Upload the File



OADBTransactionImpl in Oracle Application Framework (OAF)

OADBTransactionImpl is a class in Oracle Application Framework (OAF), which is a framework for building Oracle E-Business Suite applications...