Wednesday, August 21, 2024


Editing files with vi


Lesson 1: How to Quit vi

To exit vi without saving changes, hit Escape a couple of times to ensure you are in Normal mode, and then type:
:q!

Lesson 2: Editing with vi

Start vi and press i. The cursor may change shape, and INSERT is displayed at the bottom of the screen (in most vi clones). You are now in insert mode — all your keystrokes are entered into the current buffer and are displayed to the screen.
Hit the Escape key. The cursor changes shape again, and INSERT has disappeared. You are back in Normal mode. Hitting Escape a few times will pretty much always cancel whatever you are doing and return you to Normal mode.
Command mode is also where you move around in the file. On most systems, you can use the arrow keys to move the cursor. If that fails, cursor movement can be accomplished with the hjkl keys:
h   move left one character
j   move down one character
k   move up one character
l   move right one character
vi has its own command line, which you access by typing a colon. Commands typed at the command line will not be executed until you hit Enter, just like in the shell.
Many of the commands that you will use in command mode begin with a colon. For example, the command to quit is :q, as we learned in Lesson 1 above. Actually, in Lesson 1 we added !, which tells vi to “force” the operation. If you have edited the file, typing :q will not immediately exit the program, but instead produce this error message:
E37: No write since last change (add ! to override)
To save your changes, use the :w command (“Write”). You can save and quit all in one go by typing both commands together:
:wq
Of course, if you started vi without giving a file name, you’ll need to provide one. For example, to save your working file as test.txt, you would type:
:w test.txt
Try editing some text now.
  • Start vi
  • Hit i to go to Insert mode.
  • Type some text.
  • Hit Escape to return to Normal mode.
  • Type :w test.txt to save your work
  • Type :q to quit

vi Quick Reference

Movement

hjkl
left, down, up, right
$
To the end of the line
^
To the beginning of the line
G
To the end of the file
:1
To the beginning of the file
:47
To line 47

Editing

dd
Remove a line
5dd
Removing five lines
r
Replace a character
x
Delete a character
5x
Delete 5 characters
u
Undo last action
J
Join current and next lines (Note the capital — hold the Shift key)

Saving and Quitting

:q
Quit
:q!
Quit without saving
:wq
Write and quit
:w
Write (without quitting)
:e!
Reload currently open file from disk
:w test.txt
Write buffer to file test.txt
:e test2.txt
Open file test2.txt

How To Apply/Install Patch Using BSU (bea smart update)?

This Demo Shows How To Apply/Install Patch Using BSU Utility Command 

Line


==> The purpose of applying patch to BEA_HOME OR WLS_HOME Is To Fix Bugs.

==> BSU Utility is shipped with weblogic product 

==> Oracle Releases PSU(Patch Set Update) OR CPU(Critical Patch Update) Patches Quarterly 
(January - April - July - October), As PSU patches Are Cumulative and all bug fixes are available 
hence it is highly recommended to apply psu quarterly   

Summary

  1. Download The PSU From Oracle Support
  2. Create Directory cache_dir inside $MW_HOME/utils/bsu
  3. Copy The Downloaded Patch To $MW_HOME/utils/bsu/cache_dir 
  4. Unzip The Copied Zip Patch File
  5. Set The Environment Using setWLSEnv.sh 
  6. Run The Patch Install Command Using bsu.sh
  7. Verify Whether Patch Applied To The BEA_HOME

1. Download The PSU From Oracle Support

  • Login To My Oracle Support http://support.oracle.com
  • Click on "Patches & Update" Tab
  • Click on Search ==> Click on "Recommended Patch Advisor"
  • Select Product: Oracle Weblogic Server
  • Select Release 10.3.6.0 OR Any of your prefered wls version
  • Platform Select Any
  • Click on Search
  • Result will lists latest available PSU
  • Click on "Patch Name" 20780171
  • Click on Download 

2. Create Directory cache_dir inside $MW_HOME/utils/bsu

      cd /oracle/Middleware1036/utils/bsu/
      mkdir cache_dir

3. Copy The Downloaded Patch To $MW_HOME/utils/bsu/cache_dir Using WinScp

4. Unzip The Copied Zip Patch File

     cd /oracle/Middleware1036/utils/bsu/cache_dir
   
      unzip p20780171_1036_Generic.zip

5. Set The Environment Using setWLSEnv.sh 

     cd /oracle/Middleware1036/wlserver_10.3/server/bin
   
     . ./setWLSEnv.sh

6. Run The Patch Install Command Using bsu.sh

     cd /oracle/Middleware1036/utils/bsu/

     ./bsu.sh -patch_download_dir=/oracle/Middleware1036/utils/bsu/cache_dir -patchlist=EJUW -prod_dir=/oracle/Middleware1036/wlserver_10.3 -install  -log=patch_apply.log -log_priority=trace

7. Verify Whether The Patch Applied To The BEA_HOME is Successfull

      cd /oracle/Middleware1036/utils/bsu

       ./bsu.sh -report -bea_home=/oracle/Middleware1036 -output_file=bsu_report.log

     View the file bsu_report.log. Below Snap Shot Shows That The Patch ID EJUW is applied
  

    OR
    You Can Verify by Checking Admin Server Start up log 
   


COMPLETED