Oracle DBA Tips and Techniques

By Arjun Raja

Archive for the ‘Unix’ Category

Unix – tar and gzip commands

Posted by Arjun Raja on July 23, 2009

tar and compress a bunch of datafiles and then untar and uncompress them

cd /u02/oradata/test– (area of database files )

Now tar and compress and copy the files to backup area – /u02/oradata/test_bkup and name the file as test.tar.gz

tar cvf – * |gzip -c >/u02/oradata/test_bkup/test.tar.gz –

cd /u02/oradata/test_bkup > ls -lrt

-rw-r–r– 1 ofsad1 dba 105952962 Feb 26 11:31 test.tar.gz

Now to untar and uncompress the files back to the original area –

cd /u02/oradata/test

gzip -dc < /u02/oradata/test_bkup/test.tar.gz | tar xvf –

Posted in Unix | Tagged: , , | Leave a Comment »

Unix – remove file with unseen characters

Posted by Gavin Soorma on June 25, 2009

This works on AIX – Please test on other systems.

If a file name is vague and can’t be removed.

Ex – a file name has some hidden characters which prevents it’s removal as the name is not recognized by the rm command.

ls -lai sqlnet.log
19462 -rw-r—– 1 oraofsap dba 7741 Jun 4 13:14 sqlnet.log

look for number against file and rm number .

find . -inum 19462 -exec rm {} \;

Posted in Unix | Tagged: | Leave a Comment »

List and remove all files older than 30 days

Posted by Gavin Soorma on June 22, 2009

 

 

find /u01/local/logs -mtime +30 -exec ls -l {} \;

find /u01/local/logs -mtime +30 -exec rm {} \;

 

Posted in Unix | Leave a Comment »