Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Dan's handy perl script

Re: Dan's handy perl script

From: Robert Chin <robert_chin_2000_at_hotmail.com>
Date: Wed, 19 Dec 2001 01:43:14 GMT
Message-ID: <SgST7.57455$bs2.13098423@news02.optonline.net>


Thanks, good stuff on your web site !
I think I can learn a lot from the materials, so pls don't move a thing !

--
Robert Chin

"Dan Bikle" <dbikle_at_rahul.net>

>
> Hi,
>
> I found a useful perl command which comes in handy.
>
> Often I use it when I install an Oracle database using an existing
> tree of Oracle software rather than from a cdrom. I refer to this
> method as a "manual install".
>
> I started using this method when Oracle released 8.1.6.
>
> The reason for this is that after 8.1.6, I found that some of
> the sql scripts under $ORACLE_HOME have $ORACLE_HOME hard-coded
> into them.
>
> So, suppose I have an existing database which was installed via
> cdrom and has this:
>
> ORACLE_HOME=/oracle/app/oracle/product/BIKLE817
>
> At this point I could tar-up ORACLE_HOME and copy it to another host.
>
> Then suppose I unpack it here:
>
> ORACLE_HOME=/oracle/app/oracle/product/SMITH817
>
> Now is when my perl command comes into use:
>
> cd /oracle/app/oracle/product/SMITH817
> /bin/find . -type f -print|xargs /bin/grep -l BIKLE817|xargs /bin/perl -e
"s/BIKLE817/SMITH817/g" -p -i.bak
>
> The above perl command will find every file which contains the string:
> BIKLE817
>
> It will edit each file and replace BIKLE817 with SMITH817.
>
> All the files which contained BIKLE817 will be renamed with a .bak
> at the end of each file name.
>
> If we are confident we no longer need the .bak files,
> we could delete them with this command:
>
> /bin/find . -name '*.bak' -type f -print|xargs /bin/grep -l BIKLE817|xargs
/bin/rm
>
> I have more demos on my site.
>
> ---------------------------------------------------------------------
> Daniel B. Bikle/Independent Oracle Consultant
> bikle_at_bikle.com | 650/941-6276 | P.O. BOX AG LOS ALTOS CA 94023
> http://www.bikle.com
> ---------------------------------------------------------------------
Received on Tue Dec 18 2001 - 19:43:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US