Using cpio command to copy oracle installation dir from one partition to another

Hi
My dba told me to use cpio to copy oracle installation dir, here's what I want to do:

copy /home/oracle to /prodcontent/

How do I do this, my dba said that I should be in ORACLE_HOME /home/oracle/product/9.2 and copy the cpio file to /content/oracle/product/9.2
 (But I have dir 10.0.2 aslo in oracle root dir and I want to copy the entire root dir not just 9.2. to the new location, which doesnt have oracle installation). Then I want to remove ORACLE from home partition and create sym link to the new location which is easy, but want to understand more on how to use cpio. Thank you:)

atwork2003Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian UtterbackPrinciple Software EngineerCommented:
cd into the oracle root directory, and the execute this:

find . -depth -print | cpio -pamVd /new/rootdir/dir

where /new/rootdir/dir is the directory you want to contain the new copy.

0
atwork2003Author Commented:
Do I have to create oracle dir first in the new location like mkdir or just use the command you gave. Thank you so much for urgent response:)
0
omarfaridCommented:
To copy please use

cd /my/old/dir (please put the correct one here)
find . -depth | cpio -pvd /newdir (please put the correct one here)

To remove, you may use (but be careful since you can not recover deleted files. Its better if you take backup on tape):

cd /my/old
rm -Rf dir
ln -s /newdir /my/old/dir
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Brian UtterbackPrinciple Software EngineerCommented:
You should do a mkdir on the new directory before you do the command.
0
atwork2003Author Commented:
blu thank you so much for the update. Can you also explain what the command is doing, so I can do it myself next time:) Thank you so much:)
0
Brian UtterbackPrinciple Software EngineerCommented:
Sure. The cpio command  is very similar to tar. However, unlike tar, it takes a list of files to add to the
archive on standard input. That is what the "find" part of the command is doing, printing the name of every
file to transfer. Now, like tar, cpio will write an archive file, but it also has a "passthru" option to skip
the archive file step and just go right to unarchive step. So, when you do this kind of thing
with tar you end up running two tar command and doing reads and writes on each block four times, but with
cpio each block get read and written once, which is much more efficient.

You could do the same kind of thing with a simple "cp" command, but the cp command does not necessarily
do what you expect with symbolic links, hard links, special files and acls.  On Solaris at least, the cpio
command is usually the first to be updated to be compatible with new whizz bang features.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
atwork2003Author Commented:
Awesome, one more thing what does -depth does. Thank you so much for such great response
0
Brian UtterbackPrinciple Software EngineerCommented:
It causes find to process all the files in a directory before the directory itself. Otherwise when the directory
had it's modified time set, the writes to the subdirectories and files would change it.
0
atwork2003Author Commented:
Thank you everyone for such great responses and help, I appreciate it very much:)
0
atwork2003Author Commented:
Exceptional guru, great and detailed responses
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.