tar and untar the files


Tar file using the script:

vi fullbackuptar.sh

latest_file=$(ls -t /oracle/backup/backups/KRONO40/Full | awk 'NR==1{print}')
cd /oracle/backup/backups/KRONO40/Full; tar -cvzf "${latest_file}.tar.gz" "${latest_file}"

Tar simple with nohup:

nohup tar -czvf K40_FULLst1nfdr3_1_1.bkp.tar.gz /oracle/backup/backups/K40/Full/KRONO40_FULLst1nfdr3_1_1.bkp &

Tar with log file:

1)vi x.sh
2)in x.sh file copy the code
tar -czvf oldkronodbf.tar.gz oldkronodbf
tar -czvf K40_backup_11_feb.dmp.tar.gz KRONO40_backup_11_feb.dmp
3)then save .wq!
4)nohup sh x.sh > x.out & ---------> run this command
5) tail -f x.out -------------> to check log file.

==================================================================

To untar or extract tar file in the same location, modify the component value based on the number of directories

tar -xf KRONOTESTDB_FULL_bakka1l6tcb_1_1.tar.gz --strip-components=4




Akash

I am working as a Data Engineer

Post a Comment

Previous Post Next Post