Link to home
Start Free TrialLog in
Avatar of atwork2003
atwork2003

asked on

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:)

Avatar of Brian Utterback
Brian Utterback
Flag of United States of America image

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.

Avatar of atwork2003
atwork2003

ASKER

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:)
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
You should do a mkdir on the new directory before you do the command.
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:)
ASKER CERTIFIED SOLUTION
Avatar of Brian Utterback
Brian Utterback
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome, one more thing what does -depth does. Thank you so much for such great response
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.
Thank you everyone for such great responses and help, I appreciate it very much:)
Exceptional guru, great and detailed responses