Friday, December 11, 2009

Be very careful when using tar

I often use tar to make cold database file backup since one big file is faster to copy via network. One time I accidentally entered wrong command on tar, I entered 'tar cvfj /u01/oracle/DEV/db/apps_st/data/* data.tar.bz2'. The tar ran fine until encountered error at the end with no tar file created. Then I realized that the tar command should be 'tar cvfj data.tar.bz2 /u01/oracle/DEV/db/apps_st/data/'.
When I tried to start the DEV database instance, it woudn't start. It said a_archive01 is corrupted (I don't remember the exact error). Luckily it was a DEV instance, I can easily clone again from production instace.
I haven't tried it for second time to make sure it was wrong tar command that made the corruption, but still it is better to be more careful.

No comments: