how to TAR up archived logs and then GZIP it together in a single unix command?
DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: how to TAR up archived logs and then GZIP it together in a single unix command?

  1. #1
    Join Date
    Jul 2001
    Location
    Singapore(Asia)-WebCentre business company
    Posts
    456

    how to TAR up archived logs and then GZIP it together in a single unix command?

    hi guys,

    I must apologize for raising this qn here as it might not b too relevant...but I am running into space contraints and I am trying to tar my archived logs and then gzip it at one go without running the command twice ?? and restoring the file likewise in a single command??

    anyone can help?

    many thanks in advance

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,331
    why not just gzip the files, how will tar save you any space?

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095
    1. tar to stdout and gzip through a pipe
    2. setup a named pipe and gzip through it
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  4. #4
    Join Date
    Feb 2003
    Location
    Leeds, UK
    Posts
    367
    Just to expand on what Jeff has said, I believe the following should work:

    Code:
    tar cvf - $ORACLE_BASE/admin/$ORACLE_SID/arch/*.arc | gzip > arch.tar.gz

  5. #5
    Join Date
    Jul 2001
    Location
    Singapore(Asia)-WebCentre business company
    Posts
    456
    yes!! bingo!! that's wat i needed! thanks! )

  6. #6
    Join Date
    Jul 2001
    Location
    Singapore(Asia)-WebCentre business company
    Posts
    456
    hacketta,

    ..in the reverse way...how can i gunzip and then untar the *.tar.gz files?? i must admit that I am not too gd at unix command manipulation...


    thanks in advance.

  7. #7
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,331
    gunzip "file" | tar xvf -

  8. #8
    Join Date
    Jul 2001
    Location
    Singapore(Asia)-WebCentre business company
    Posts
    456
    hi davey23uk,

    i hv tried ur method...the cmd run w/o any error but the *.tar.gz becomes *.tar after the run w/o untar the *.tar at all...wondering y???

  9. #9
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,331
    hmm, ive used that command lots of time - try guncip -c at the start instead

  10. #10
    Join Date
    Feb 2003
    Location
    Leeds, UK
    Posts
    367
    Code:
    gunzip < file.tar.gz | tar xvf -
    or with GNU tar

    Code:
    gtar xvzf file.tar.gz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width