Operating System - HP-UX
1833788 Members
2424 Online
110063 Solutions
New Discussion

Recover to another directory

 
SOLVED
Go to solution
Augusto César
Advisor

Recover to another directory

Hi,

I need to recover a tape backup to another directory.

# tar -tvf /dev/rmt/0m
rwxr-xr-x 102/102 0 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/
rwxr-xr-x 102/102 0 Mar 6 03:35 2006 /u02/oradata/TESTE/backup/arch/
rw-r----- 102/102 89013248 Mar 2 03:35 2006 /u02/oradata/TESTE/backup/arch/ARCH_TESTE_290.ARC
rw-r----- 102/102 89330688 Mar 3 03:35 2006 /u02/oradata/TESTE/backup/arch/ARCH_TESTE_291.ARC
rw-r----- 102/102 89253888 Mar 4 03:35 2006 /u02/oradata/TESTE/backup/arch/ARCH_TESTE_292.ARC
rw-r----- 102/102 89113600 Mar 5 03:35 2006 /u02/oradata/TESTE/backup/arch/ARCH_TESTE_293.ARC
rw-r----- 102/102 88934400 Mar 6 03:35 2006 /u02/oradata/TESTE/backup/arch/ARCH_TESTE_294.ARC
rw-r----- 102/102 1056768 Mar 6 03:30 2006 /u02/oradata/TESTE/backup/cwmlite01.dbf
rw-r----- 102/102 15736832 Mar 6 03:30 2006 /u02/oradata/TESTE/backup/DRSYS01.DBF
rw-r----- 102/102 57679872 Mar 6 03:30 2006 /u02/oradata/TESTE/backup/EXAMPLE01.DBF
rw-r----- 102/102 26222592 Mar 6 03:30 2006 /u02/oradata/TESTE/backup/indx01.dbf
rw-r----- 102/102 20979712 Mar 6 03:30 2006 /u02/oradata/TESTE/backup/ODM01.DBF
rw-r----- 102/102 36716544 Mar 6 03:31 2006 /u02/oradata/TESTE/backup/oem_repository.dbf
rw-r----- 102/102 52436992 Mar 6 03:32 2006 /u02/oradata/TESTE/backup/safa.ora
rw-r----- 102/102 314580992 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/system01.dbf
rw-r----- 102/102 41295872 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/tools01.dbf
rw-r----- 102/102 209723392 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/undotbs01.dbf
rw-r----- 102/102 52436992 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/users01.dbf
rw-r----- 102/102 5251072 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/XDB01.DBF
rw-r----- 102/102 1630208 Mar 6 03:33 2006 /u02/oradata/TESTE/backup/backup_controlfile.ctl
rw-r--r-- 102/102 3402 Dec 23 08:25 2005 /u02/oradata/TESTE/backup/backup_initTESTE.ora

The source directory is /u06. I used the command "tar -xvf /dev/rmt/0m" but it recover into /u02 directory. How I can do this?

Thanks,

Augusto
(Brazil)
4 REPLIES 4
Peter Godron
Honored Contributor

Re: Recover to another directory

Augusto,
what you have on the tape is a absolute path tar. This means that the path where to restore the file is held for each file on the tape.
What you wanted was a relative tar, where dir path is relative to the location on restore i.e. ./oradata/TESTE

As far as I know there is no way to change the location were the files are restored to, all you can do is do the restore, possibly to a linked directory, and then copy the files.
Peter Godron
Honored Contributor
Solution

Re: Recover to another directory

Augusto,
after further checking there seem to be a way:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=192383

With pax, which can read tar files, you can change the location for restore.

man pax should provide further info
James R. Ferguson
Acclaimed Contributor

Re: Recover to another directory

Hi:

Use 'pax' to snip the absolute path. Consider:

# tar /tmp/myarchive /tmp/f1 /tmp/f2
# mkdir /tmp/dummydir
# cd /tmp/dummydir
# pax -r -pm -s%/tmp/*%% -f /tmp/myarchive

The above sequence created a 'tar' archive with absolute path names for /tmp/f1 and /tmp/f2. The 'pax' execution restored 'f1' and 'f2' without the leading directory into /tmp/dummydir.

Regards!

...JRF...
Augusto César
Advisor

Re: Recover to another directory

Thanks Peter and James. The command is:

# mkdir u06
# cd /u06
# pax -r -s ',^/u02/,,' -f /dev/rmt/0m -t

The pax command will put all files into current directory (/u06).