Tuesday, April 3, 2012

Mount Remote Windows Folder with RHEL 5 Linux

Login into linux using root user

Create the required mount point in linux
#mkdir -p /mnt/win_folder   
mount the remote folder
#mount -t cifs //windows_machine_ip_or_name//shared_folder -o username=test,password=test123 /mnt/win_folder

-t cifs - file system type to be mount
-o : are options passed to mount command, here i have passed 2 options username and password
//windows_machine_ip_or_name//shared_folder - windows/shared folder
 /mnt/win_folder - linux mount point

Configure the system to automount while starting

add entry into /etc/fstab
Open file /etc/fstab using vi text editor:# vi /etc/fstabAppend line
//windows_machine_ip_or_name//shared_folder /mnt/win_folder cifs username=test,password=test123 0 0

How to Create Oracle Worflow Business Events

How to Create Oracle Worflow Business Events

Purpose: Below I am going to show you how we can use a business event to execute custom plsql function.

Go to system Administrator Responsiblity => Worflow Administrator
Select Business Events Tab

Click Create Event Button



    Enter the required values.
    Click Apply
Create Event Subscription by clicking Event Subscription
       
Click on Create Subscription button



System will be the name of your enviroment instance , selection available
Action type custom
Click Next

Create a PL/SQL function  that will be execute when the event is raised

Function ts_cancel_event(p_subscription_guid In RAW
,p_event In Out NoCopy Wf_Event_t
)
Return Varchar2
Is
l_doc_id Number;
Begin
l_doc_id := p_event.getValueForParameter('XXPM_DOC_ID');
-- your own logic example like inserting data to table or some action
----
----
 RETURN 'SUCCESS';
End ts_cancel_event;

getValueForParameter is used to retrieve parameter value from event.
Attach the procedure to Event Action window



Enter all required values and Click Apply

Next step is how to raise the event:

Sample code is below
Procedure raise_approval_cancel_event(p_doc_id In Number)

Is
l_event_param_list wf_parameter_list_t;
l_param_table wf_parameter_t;
l_index Number;
Begin
l_event_param_list := wf_parameter_list_t();
-- lets add the value to event parameters
l_param_table := wf_parameter_t(Null,Null);
l_event_param_list.Extend;
l_param_table .setName('XXPM_DOC_ID');
l_param_table .setValue(p_doc_id);
l_index := coalesce(l_index ,0) + 1;
l_event_param_list (l_index ) := l_param_table ;
wf_event.RAISE(p_event_name => 'sat.oracle.apps.xxpm.ts.cancelApprovalProcess'
,p_event_key => 'XXPMSTS'||to_char(p_doc_id)
,p_parameters => l_event_param_list
 );
ENd raise_approval_cancel_event;



Monday, May 9, 2011

HR: Bulk Deletion/ending of element entries

HR: Bulk Deletion/ending of element entries
Declare
-- select all active opening balances
Cursor op_end_cur Is
Select pee.element_entry_id
From pay_element_types_f petf
    ,pay_element_entries pee
    ,pay_element_links_f pelf
    ,per_all_assignments_f paaf
Where petf.element_type_id = pee.element_type_id
And pelf.element_type_id = petf.element_type_id
And pelf.element_type_id = pee.element_type_id
And pelf.element_link_id = pee.element_link_id
And petf.element_name = <>
And paaf.assignment_id = pee.assignment_id
And <> between paaf.effective_start_date and paaf.effective_end_date;
l_v number := null;
l_s_date date;
l_e_date date;
l_w boolean;
Begin
pay_db_pay_setup.set_session_date(<>);
-- ending opening balance cursor
For op_end In op_end_cur
Loop
 hr_entry_api.delete_element_entry(p_dt_delete_mode => 'DELETE',
                                   p_session_date => <>,
                                   p_element_entry_id => op_end.element_entry_id);
commit;
End Loop;
End;

Single responsibility assign to bulk of users

How to assign a responsiblity to bulk users

Declare
  v_responsibility_id fnd_responsibility.responsibility_id%type;
  v_application_id    fnd_responsibility.application_id%type;
  v_resp_key  fnd_responsibility.responsibility_key%type;
  Cursor c_fnd_Cur Is
         Select a.user_id
         From fnd_user a
             ,per_all_people_f b
             ,per_all_assignments_f c
         Where a.employee_id = b.person_id
         And sysdate between b.effective_start_date and b.effective_end_date
         And sysdate between c.effective_start_date and c.effective_end_date;
  Type v_fnd_rec Is Table Of c_fnd_Cur%Rowtype;
  v_fnd_table v_fnd_rec;
  v_found               boolean := false;
Begin
  Open c_fnd_Cur;
  Fetch c_fnd_Cur Bulk Collect Into v_fnd_table;
  Close c_fnd_Cur;
  For idx In v_fnd_table.first..v_fnd_table.last
  Loop
     -- get responsiblity details
     v_resp_key := 'XXHR_EMPLOYEE_SELF_SERVICE';
     fnd_oid_subscriptions.get_resp_app_id(p_resp_key => v_resp_key
                                         ,x_responsibility_id=> v_responsibility_id
                                         ,x_application_id=> v_application_id      );
     -- verify assignments existing with user or not
     v_found := fnd_user_resp_groups_api.assignment_exists( user_id => v_fnd_table(idx).user_id
                                                          , responsibility_id   => v_responsibility_id
                                                          , responsibility_application_id => v_application_id
                                                          , security_group_id             => null);
     if (not v_found)  then
            fnd_user_resp_groups_api.insert_assignment( user_id  => v_fnd_table(idx).user_id
                                                      , responsibility_id => v_responsibility_id
                                                      , responsibility_application_id => v_application_id
                                                      , security_group_id  => null
                                                      , start_date  => sysdate
                                                      , end_date    => null
                                                      , description   => 'Employee Self Service'    );
     end if;
  End Loop;
  commit;
End;

Friday, September 17, 2010

ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [

Error:
SQL> startup


ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 71304572 bytes
Database Buffers 88080384 bytes
Redo Buffers 7139328 bytes
Database mounted.
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],

Solution:
startup mount;

recover database;
alter system open;