Monday, April 19, 2010

DIFF utility: Find Differences Between Files

Working as a DBA , you may encounter situations like to compare two files to check whether the contents are same or not.
diff will surely make your life easy.Believe IT or ....

$ diff init.ora init1.ora

Check the output showing the differences in the files:
16,17c16,17
< sga_max_size=900M
< sga_target=700M
---
> sga_max_size=800M
> sga_target=600M
19a20
> # sort_area_size=0

here, < refer to file1 & > refer to file 2.
And , c stands for change
a stands for append (looks like file 2 has one more line & that is 20 which shows contents "# sort_area_size=0"

There is another tag like d (beside c & a) which stands for delete.

$ diff init.ora init1.ora > change.diff
To convert init.ora to init1.ora, use the "patch" command with the difference report output:
$ patch init.ora change.diff


We can even use "sdiff" utility too.
Ex: $ sdiff init.ora init1.ora

This will show the changes in more readable format.

Note: can also use "diff3" utility to compare differences between three files.

Find Differences Between Directories:

Possible guys!!!!

$ diff /oracle/scripts /u01/oracle/scripts


thanks... have a nice day.

1 comment:

  1. hello there and thanκ you for your іnfo – I have definitely
    pісκeԁ up аnythіng new fгom right
    here. І dіd hοweѵer expегtiѕe a fеw
    tесhnical points using thіs ѕite, as I expeгіencеd to reload thе wеbѕite lots of tіmes
    ρrevіouѕ to I cοuld get it tο lоaԁ correctly.
    I had been wondeгіng if youг web hosting
    is OΚ? Νot that I am complainіng, but sluggish loаdіng
    instаncеs times will often affect youг placеment in google and can ԁamage уour
    high qualіtу scoгe іf advеrtiѕing and marketіng with Αdwords.
    Wеll І'm adding this RSS to my e-mail and could look out for a lot more of your respective exciting content. Ensure that you update this again soon.
    Look at my web-site : birthday decorations for girls

    ReplyDelete