For Any queries, please mail us at support@funoracleapps.com

SED Command Basic Tutorial in Linux

No comments

SED Command Tutorial in Linux



Introduction:

SED command is very powerful tool in Linux and can be used vastly in shell scripting. It is called as stream editor.
It can perform lot of function on a file like replacing,finding,insertion and deletion.It is capable of solving complex text processing tasks with few lines of code.


Syntax:



sed OPTIONS... [SCRIPT] [INPUTFILE...] 




Examples:

Lets create a sample file with some context.

cat DEMO.txt


Example 1) Replace a pattern in a file. It will replace all occurrence of the pattern.
I the demo file I am going to replace the word "We" with "I". Please note it don't save the changes it is just show on the screen.

himanshu@himanshu-ThinkPad-T430 ~ $ sed 's/We/I/g' DEMO.txt 
I are an IT Services and Training provider. I are the believers in quality services and support.
I develop, support and maintenance services across the globe. 
I have been dealing with customers across the globe and deliver quality solutions and training to them. 
I practice and believe in Green IT initiatives, improve and optimize customer’sbusiness processes.


Example 2)  Replace an exact word in a file.

We use \b for boundation of exact word. I am replacing the word "Green" with "Black"


himanshu@himanshu-ThinkPad-T430 ~ $ sed 's/\bGreen\b/Black/g' DEMO.txt 
We are an IT Services and Training provider. We are the believers in quality services and support.
We develop, support and maintenance services across the globe. 
We have been dealing with customers across the globe and deliver quality solutions and training to them. 
We practice and believe in Black IT initiatives, improve and optimize customer’sbusiness processes.

Example 3)  Replace a pattern which comes in starting of a line.



I am going to replace "We" to "I" but only where it comes at beginning of line.


himanshu@himanshu-ThinkPad-T430 ~ $ sed 's/^We/I/g' DEMO.txt 
I are an IT Services and Training provider. We are the believers in quality services and support.
I develop, support and maintenance services across the globe. 
I have been dealing with customers across the globe and deliver quality solutions and training to them. 
I practice and believe in Green IT initiatives, improve and optimize customer’sbusiness processes.


Example 4) Replace a pattern which comes at end of line.


I am replacing "support" with "fun" but only present at end of line. Please also note that the pattern is "support."



himanshu@himanshu-ThinkPad-T430 ~ $ sed 's/support.$/fun/g' DEMO.txt 
We are an IT Services and Training provider. We are the believers in quality services and fun
We develop, support and maintenance services across the globe. 
We have been dealing with customers across the globe and deliver quality solutions and training to them. 
We practice and believe in Green IT initiatives, improve and optimize customer’sbusiness processes.

Example 5)  Delete any line that contains a pattern.


I am deleting lines which contains "support" .

himanshu@himanshu-ThinkPad-T430 ~ $ sed '/support/d' DEMO.txt 
We have been dealing with customers across the globe and deliver quality solutions and training to them. 
We practice and believe in Green IT initiatives, improve and optimize customer’sbusiness processes.




Example 6)  If we want to make changes directly to file permanently.

I want to permanently replace "We" to I.


himanshu@himanshu-ThinkPad-T430 ~ $ sed -i 's/We/I/g' DEMO.txt
himanshu@himanshu-ThinkPad-T430 ~ $ cat DEMO.txt
I are an IT Services and Training provider. I are the believers in quality services and support.
I develop, support and maintenance services across the globe. 
I have been dealing with customers across the globe and deliver quality solutions and training to them. 
I practice and believe in Green IT initiatives, improve and optimize customer’sbusiness processes.

No comments :

Post a Comment

Script to update profile in EBS R12

No comments

Script to update profile in EBS R12 



Script:

 Declare
Result Boolean;
BEGIN

   Result:= fnd_profile.SAVE ('APPS_SSO_LDAP_SYNC', 'N', 'SITE');
   IF Result
   THEN
      DBMS_OUTPUT.put_line ('Profile Updated');
   ELSE
      DBMS_OUTPUT.put_line ('Profile Not Updated');
   END IF;
   COMMIT;
END;

No comments :

Post a Comment

Completely Remove All VirtualBox Setup/Packages and Folders from Linux Mint

No comments

Completely Remove All VirtualBox Setup/Packages and Folders from Linux Mint

If we are installing virtual box after linux mint update, we might see error "The VirtualBox Kernel Modules Do Not Match This Version of VirtualBox" or rc=-1912.
This might happen due to conflicts with prior installed packages before upgrade.

Steps:

1. Check the packages which are installed for virtualbox.

himanshu@himanshu-LIFEBOOK-A555 ~ $ dpkg -l | grep virtualbox
rc  virtualbox                              5.2.34-dfsg-0~ubuntu18.04.1                         amd64        x86 virtualization solution - base binaries
rc  virtualbox-5.2                          5.2.22-126460~Ubuntu~xenial                         amd64        Oracle VM VirtualBox
ii  virtualbox-6.0                          6.0.16-135674~Ubuntu~bionic                         amd64        Oracle VM VirtualBox
rc  virtualbox-6.1                          6.1.2-135662~Ubuntu~bionic                          amd64        Oracle VM VirtualBox
ii  virtualbox-dkms                         5.2.34-dfsg-0~ubuntu18.04.1                         all          x86 virtualization solution - kernel module sources for dkms
rc  virtualbox-qt                           5.2.34-dfsg-0~ubuntu18.04.1                         amd64        x86 virtualization solution - Qt based user interface


2. Uninstall  packages for virtual box.

sudo apt-get remove virtualbox* --purge

3. Check again , all the packages would be removed.

No comments :

Post a Comment

Installing and Configuring VNC Server on Linux

No comments

Installing and Configuring VNC Server on Linux



In this post I am going to share the steps to install VNC server on Linux/Oracle Enterprise Linux server.

1)Install the VNC Server.

yum install tigervnc-server

2) Edit the file "/etc/sysconfig/vncservers" file to configure the required displays. 

 Note: Multiple "display:user" pairs are defined on a single line, but the arguments for each display are defined separately.

VNCSERVERS="2:root 3:oracle"
VNCSERVERARGS[2]="-geometry 1280x1024 -nolisten tcp -localhost"
VNCSERVERARGS[3]="-geometry 1280x1024"

3) Setup the VNC password for all users defined in the "/etc/sysconfig/vncservers" file.
Root User
# vncpasswd
Password:
Verify:
#

Oracle User
# su - oracle
$ vncpasswd
Password:
Verify:


4) From root user enable the "vncserver" service for autostart and start the service.

chkconfig vncserver on
 service vncserver start

5)Now install/use VNC viewer to connect to system using the display numbers and passwords defined.
hostname:2--> for root
hostname:3--> for oracle





6)Use the following commands to stop the service and disable autostart.

service vncserver stop
chkconfig vncserver off

No comments :

Post a Comment

Changing Weblogic Administrative Password in EBS/Apps R12.2 if it has been Lost or Forgot

1 comment

Changing Weblogic Administrative Password in EBS/Apps R12.2 if it has been Lost or Forgot


For the EBS WebLogic domain, the Node Manager and WebLogic AdminServer passwords must be same. If the passwords are different, the AD control scripts will not work properly.

The following steps has to be performed in RUN file system.

Steps:

1)  Shut down all running services. Since the AdminServer password is not known, the servers cannot be stopped from the console and so must be killed.

1. Connect to the Oracle E-Business Suite instance and source the application tier environment file.

2. Identify the PIDs of Node Manager, AdminServer, and all running Managed
Servers:
$ ps -ef | grep "NodeManager"
$ ps -ef | grep "weblogic.Name=AdminServer"
$ ps -ef | grep "weblogic.Name=forms-c4ws_server"
$ ps -ef | grep "weblogic.Name=forms_server"
$ ps -ef | grep "weblogic.Name=oafm_server"
$ ps -ef | grep "weblogic.Name=oacore_server"

3. Kill all these processes, starting with Node Manager and followed by the Managed Servers.

2) Back up these folders, and then delete them

/security/ DefaultAuthenticatorInit.ldift
/servers//data/ldap
/servers//security/boot.properties
/servers//data/nodemanager/boot.properties

3)  Set up a new environment to change the WLS AdminServer password.

1. Start a new session and connect to the Oracle E-Business Suite instance.
2. Do not source the application tier environment file.
3. Run the following command to source the WebLogic Server domain environment:
$ cd /bin
$ source setDomainEnv.sh
4. Run the following commands:
$ cd /security
$ java weblogic.security.utils.AdminAccount
.

4) Start AdminServer from the command line. You will be prompted for the WebLogic

Server username and password, so that the AdminServer boot.properties file can be generated.
1. Go to the EBS Domain Home:
$ cd
2. Start AdminServer:
$ java -Dweblogic.system.StoreBootIdentity=true -Dweblogic.Name=AdminServer weblogic.Server
Where:
is the same as the value of context variable
ss_nm_jvm_startup_properties
The above command prompts for the WebLogic Server username and
password:
Enter username to boot WebLogic server:
Enter password to boot WebLogic server:
Provide the same credentials as you provided in Step 3.

5) Change the Node Manager password.

1. Log in to the WebLogic Administration console.
2. Click the 'Lock & Edit' button.
3. In the left panel, click on the EBS Domain link.
4. Select the 'Security' tab.
5. Click on the 'Advanced' link.
6. Edit the 'Node Manager password' field and set it to the new WebLogic Server password. The password should be same as set in Step 3.
7. Edit the 'Confirm Node Manager Password' field and set it to the new
WebLogic Server password. The password should be same as set in Step 3.
8. Save and activate the changes.

6) The first time, AdminServer has to be stopped from the Admin console. Follow
these steps:
1. Log in to the WebLogic Administration console.
2. Shut down AdminServer.

7) Set up your environment to start AdminServer again. AdminServer should now be started using the normal AD script, which will also start Node Manager using the new password.

1. Launch a new session and connect to the Oracle E-Business Suite instance.
2. Source the application tier environment file.
3. Start AdminServer with the following command:
$ $ADMIN_SCRIPTS_HOME/adadminsrvctl.sh start

8) Start the Managed Servers. For the first time, all Managed Servers should be started from the WebLogic Server Admin console. This step will create boot.properties files for the respective Managed Servers. Follow these steps:

1. Log in to the WebLogic Server Administration Console.
2. Start all Managed Servers, one at a time.

9) Shut down all the Managed Servers. This is so the new credentials will be picked up at the next startup. Follow these steps:

1. Log in to the WebLogic AdminServer console.
2. Shut down all Managed Servers.
3. Shut down AdminServer.

10) Shut down Node Manager using the normal AD script.
$ $ADMIN_SCRIPTS_HOME/adnodemgrctl.sh stop

11) Copy the boot.properties file for each Managed Server.
WebLogic Server native scripts use the boot.properties file. The above steps have created the boot.properties file under /servers//data/nodemanager, which is used by Node Manager. For each Managed Server, copy the newly-generated boot.properties file from /servers/
name>/data/nodemanager to /servers//security.

The EBS WebLogic Server domain password has now been changed, and all servers can now be started using the normal AD scripts.
To start AdminServer:
$ADMIN_SCRIPTS_HOME/adadminsrvctl.sh start
To start the Managed Servers:
$ $ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh start

12) The above steps have changed the Oracle WebLogic AdminServer password on the run file system. You now need to perform an fs_clone operation, to change the WebLogic EBS Domain password on the patch file system:

1. Launch a new session and connect to the Oracle E-Business Suite instance.
2. Source the application tier environment file.
3. Run the following command:
$ adop phase=fs_clone

1 comment :

Post a Comment

Changing Weblogic Administrative Password in EBS/Apps R12.2

No comments

Changing Weblogic Administrative Password in EBS/Apps R12.2





We need to follow below steps to change the weblogic password in R12.2 EBS. 

Note: I am assuming that your EBS environment already has R12.TXK.C.Delta.7  or higher patch applied.

Steps:

1) Shut down all application tier services except the Admin Server.

1. On the primary node, run the command:
 $ /adstpall.sh -skipNM -skipAdmin

This command will not stop node manager and Weblogic Admin server as they are required to be running during password change.

2. On all secondary nodes, run the command:
 $ /adstpall.sh 

2) Change the Oracle WebLogic Server Administration User(weblogic) password by performing
the following steps as applicable.

1. Source the environment on the run file system.
2. Run the commands appropriate for your platform:

$ perl $FND_TOP/patch/115/bin/txkUpdateEBSDomain.pl -
action=updateAdminPassword

3) Now we need to start all services on all nodes using the appropriate
command for your platform.

$ /adstrtal.sh 

4) We  need to run  fs_clone  to change the WebLogic EBS Domain password on the patch file system:

1. Launch a new session and connect to the Oracle E-Business Suite instance.
2. Source the application tier environment file.
3. Run the following command:
$ adop phase=fs_clone

No comments :

Post a Comment

How to Find which Files Are Backed Up In RMAN Backup Set

No comments

How to Find which Files Are Backed Up In RMAN Backup Set 



Query to find the  Backed Up Logs.

SQL> select recid,set_stamp,sequence#,first_change#,next_change# 
     from  v$backup_redolog;

The V$BACKUP_REDOLOG view queries the Control File so this can be done with or 
without a Catalog.


Query to find sequence is kept in which backup piece

SQL> select r.sequence#, p.handle
 from v$backup_piece p, v$backup_redolog r
 where r.set_stamp = p.set_stamp
   and r.set_count = p.set_count
   and r.sequence# = 63 

Query to find datafiles  is kept  in which backup piece. 

 SQL> select d.file#, p.handle
from v$backup_piece p, v$backup_datafile d
where d.set_stamp = p.set_stamp
  and d.set_count = p.set_count
  and d.file# = 3

No comments :

Post a Comment

Query to find Session details using SPID with full details

No comments

Query to find Session details using SPID with full details



Script:

set serveroutput on;
define uxproc=29894; /*replace the value with SPID*/
DECLARE
  v_sid number;
  vs_cnt number;
  s sys.v_$session%ROWTYPE;
  p sys.v_$process%ROWTYPE;
  cursor cur_c1 is select sid from sys.gv_$process p, sys.gv_$session s  where  p.addr  = s.paddr and  (p.spid =  &uxproc or s.process = '&uxproc');
BEGIN
    dbms_output.put_line('=====================================================================');
select nvl(count(sid),0) into vs_cnt from sys.v_$process p, sys.v_$session s  where  p.addr  = s.paddr and  (p.spid =  &uxproc or s.process = '&uxproc');
dbms_output.put_line(to_char(vs_cnt)||' sessions were found with '||'&uxproc'||' as their unix process id.');  
dbms_output.put_line('=====================================================================');
open cur_c1;
LOOP   
      FETCH cur_c1 INTO v_sid;    
    EXIT WHEN (cur_c1%NOTFOUND);   
select * into s from sys.v_$session where sid  = v_sid;
  select * into p from sys.v_$process where addr = s.paddr;
dbms_output.put_line('SID/Serial  : '|| s.sid||','||s.serial#);
  dbms_output.put_line('Foreground  : '|| 'PID: '||s.process||' - '||s.program);
  dbms_output.put_line('Shadow      : '|| 'PID: '||p.spid||' - '||p.program);
  dbms_output.put_line('Terminal    : '|| s.terminal || '/ ' || p.terminal);
  dbms_output.put_line('OS User     : '|| s.osuser||' on '||s.machine);
  dbms_output.put_line('Ora User    : '|| s.username);
dbms_output.put_line('Details     : '|| s.action||' - '||s.module);
  dbms_output.put_line('Status Flags: '|| s.status||' '||s.server||' '||s.type);
  dbms_output.put_line('Tran Active : '|| nvl(s.taddr, 'NONE'));
  dbms_output.put_line('Login Time  : '|| to_char(s.logon_time, 'Dy HH24:MI:SS'));
  dbms_output.put_line('Last Call   : '|| to_char(sysdate-(s.last_call_et/60/60/24), 'Dy HH24:MI:SS') || ' - ' || to_char(s.last_call_et/60, '99990.0') || ' min');
  dbms_output.put_line('Lock/ Latch : '|| nvl(s.lockwait, 'NONE')||'/ '||nvl(p.latchwait, 'NONE'));
  dbms_output.put_line('Latch Spin  : '|| nvl(p.latchspin, 'NONE'));
  dbms_output.put_line('Current SQL statement:');
for c1 in ( select * from sys.v_$sqltext  where HASH_VALUE = s.sql_hash_value order by piece) 
loop
    dbms_output.put_line(chr(9)||c1.sql_text);
  end loop;
dbms_output.put_line('Previous SQL statement:');
  for c1 in ( select * from sys.v_$sqltext  where HASH_VALUE = s.prev_hash_value order by piece) 
loop
    dbms_output.put_line(chr(9)||c1.sql_text);
  end loop;
dbms_output.put_line('Session Waits:');
  for c1 in ( select * from sys.v_$session_wait where sid = s.sid) 
loop
    dbms_output.put_line(chr(9)||c1.state||': '||c1.event);
  end loop;
--  dbms_output.put_line('Connect Info:');
--  for c1 in ( select * from sys.v_$session_connect_info where sid = s.sid) loop
--    dbms_output.put_line(chr(9)||': '||c1.network_service_banner);
--  end loop;
  dbms_output.put_line('Locks:');
  for c1 in ( select  /*+ RULE */ decode(l.type,
          -- Long locks
                      'TM', 'DML/DATA ENQ',   'TX', 'TRANSAC ENQ',
                      'UL', 'PLS USR LOCK',
          -- Short locks
                      'BL', 'BUF HASH TBL',  'CF', 'CONTROL FILE',
                      'CI', 'CROSS INST F',  'DF', 'DATA FILE   ',
                      'CU', 'CURSOR BIND ',
                      'DL', 'DIRECT LOAD ',  'DM', 'MOUNT/STRTUP',
                      'DR', 'RECO LOCK   ',  'DX', 'DISTRIB TRAN',
                      'FS', 'FILE SET    ',  'IN', 'INSTANCE NUM',
                      'FI', 'SGA OPN FILE',
                      'IR', 'INSTCE RECVR',  'IS', 'GET STATE   ',
                      'IV', 'LIBCACHE INV',  'KK', 'LOG SW KICK ',
                      'LS', 'LOG SWITCH  ',
                      'MM', 'MOUNT DEF   ',  'MR', 'MEDIA RECVRY',
                      'PF', 'PWFILE ENQ  ',  'PR', 'PROCESS STRT',
                      'RT', 'REDO THREAD ',  'SC', 'SCN ENQ     ',
                      'RW', 'ROW WAIT    ',
                      'SM', 'SMON LOCK   ',  'SN', 'SEQNO INSTCE',
                      'SQ', 'SEQNO ENQ   ',  'ST', 'SPACE TRANSC',
                      'SV', 'SEQNO VALUE ',  'TA', 'GENERIC ENQ ',
                      'TD', 'DLL ENQ     ',  'TE', 'EXTEND SEG  ',
                      'TS', 'TEMP SEGMENT',  'TT', 'TEMP TABLE  ',
                      'UN', 'USER NAME   ',  'WL', 'WRITE REDO  ',
                      'TYPE='||l.type) type,
          decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                       4, 'S',    5, 'RSX',  6, 'X',
                       to_char(l.lmode) ) lmode,
           decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                         4, 'S', 5, 'RSX', 6, 'X',
                         to_char(l.request) ) lrequest,
        decode(l.type, 'MR', o.name,
                      'TD', o.name,
                      'TM', o.name,
                      'RW', 'FILE#='||substr(l.id1,1,3)||
                            ' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,
                      'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,
                      'WL', 'REDO LOG FILE#='||l.id1,
                      'RT', 'THREAD='||l.id1,
                      'TS', decode(l.id2, 0, 'ENQUEUE', 'NEW BLOCK ALLOCATION'),
                      'ID1='||l.id1||' ID2='||l.id2) objname
        from  sys.v_$lock l, sys.obj$ o
        where sid   = s.sid
          and l.id1 = o.obj#(+) ) 
loop
  dbms_output.put_line(chr(9)||c1.type||' H: '||c1.lmode||' R: '||c1.lrequest||' - '||c1.objname);
  end loop; 
dbms_output.put_line('=====================================================================');
END LOOP;  
dbms_output.put_line(to_char(vs_cnt)||' sessions were found with '||'&uxproc'||' as their unix process id.');  
dbms_output.put_line('Please scroll up to see details of all the sessions.');
dbms_output.put_line('=====================================================================');
  close cur_c1;
exception
    when no_data_found then
      dbms_output.put_line('Unable to find process id &&uxproc!!!');
  dbms_output.put_line('=====================================================================');
      return;
    when others then
      dbms_output.put_line(sqlerrm);
      return;
END;
/

No comments :

Post a Comment

Concurrent Manager Recovery Wizard

No comments

Concurrent Manager Recovery Wizard

In Oracle Application earlier we used CMCLEAN.sql. This script re-sets the flags for requests to completed to allow the Managers to come up. No longer supported and MUST not be used.

Concurrent Manager Recovery Wizard has to be used. It is a OAM managed GUI for recovering Concurrent Manager. It should only be run when the concurrent manager services are down.

How to use Concurrent Manager Recovery Wizard.

  • Go to OAM > Site Map > Diagnostics and Repair > Troubleshooting Wizards > Concurrent Manager Recovery

  • Ensure that the Concurrent Manager is down prior to progressing with launching the Wizard

  • This step will let you know if any of the concurrent managers are with status Running via backend tables, we can update directly here if we know for sure that managers are down.

  • This step will let  you know if any of the concurrent processes are running, we can directly update status here in GUI if we know for sure that Concurrent Manager is down.

  • Requests listed below need to be reset for conflict resolution. Also the status of all conflict domains will be reset to allow requests to run.

  • Summary screen is shown now with list of action taken in the previous screens. Concurrent Managers can be started now


No comments :

Post a Comment

How to make a FND_USER Non SSO in and SSO enabled EBS Environment

No comments

How to make a FND_USER Non SSO in and SSO enabled EBS Environment



Steps:

1) Connect as Apps user
2) SQL> @$FND_TOP/patch/115/sql/fndssouu.sql HIMANSHU.SINGH

PL/SQL procedure successfully completed.


Commit complete.
3) Set profile   at user level to "LOCAL"


4) Reset Password for user using FNDCPASS.

Password is changed successfully for user HIMANSHU.SINGH.
FNDCPASS completed successfully.

5) Login with Non SSO URL

No comments :

Post a Comment

Query to find Concurrent Request Details from Concurrent Program Name

No comments

Query to find Concurrent Request Details from Concurrent Program Name






Script

SELECT
   distinct user_concurrent_program_name,
    responsibility_name,
    request_date,
    argument_text,
    request_id,
    phase_code,
    status_code,
    logfile_name,
    outfile_name,
    output_file_type,
    hold_flag,
    user_name
FROM
    fnd_concurrent_requests fcr,
    fnd_concurrent_programs_tl fcp,
    fnd_responsibility_tl fr,
    fnd_user fu
WHERE
    fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
    and fcr.responsibility_id = fr.responsibility_id
    and fcr.requested_by = fu.user_id
    --and user_name = upper('HIMSINGH')
    and user_concurrent_program_name in 
('Active Users')
    and Phase_code='P'
ORDER BY REQUEST_DATE DESC;

The where conditions can be modified as per your need.

No comments :

Post a Comment