Most Oracle DBA's are responsible for managing Oracle data files in the database servers. Here we will discuss some of the routine UNIX file system management tasks. see also - UNDERSTANDING UNIX FILE PERMISSIONS
1. List recently touched files - $ls -alt 2. List recently changed files - $ls -alc |tail 3. Delete unchanged/obsolete arch files older than 5 days - $find $ORACLE_BASE/arch/arch*.arc -ctime +5 -exec rm {} \; 4. Display file sizes in 512-byte blocks - $du -s * |sort -n|tail or $du -sh * |sort -n|tail 5. Locate files that contains certain strings - $find . -print|xargs grep -i v\$session 6. Find recently created files - $find . -mtime -1 -print (displays files created during the past day) 7. Find files with very large size - $find . -size +50000 -print (displays all files greater than 50000 bytes) 8. Delete files older than a week or certain period. - $find . -mtime +7 -exec rm {} \; (remove all files more than 7 days old) 9. Delete old trace,log,dump,audit files- Same as above except you need to start from ADR home. $find /u01/app/oracle/diag/rdbms/testdb/DB11G/ -name "*.trc" -mtime +7 -exec rm {} \; 10. Allocate an empty files - $touch test.txt 11.Change default file permissions - $umask 644 12. Change file ownership - $chown oracle:oinstall *.dmp 13.Change file permissions - $chmod 755 *.sql 14. Tar and UNTAR files -$tar -cvf new.tar *.sql (TAR) $tar -xvf new.tar (UNTAR) 15. SCP files from one server to another server - $ scp *.dmp user@host_name:/backup/. (push) $scl user@host_name:/backup/*.dmp /backup/. (pull) . To copy a directory, use the -r (recursive) option. Example: $scp -r mydir xyz@sdcc7:mydir 16. gzip and gunzip files: $gzip *.dmp $gunzip *.zip 17. WINSCP - Copy files from windows to Unix and vice versa. 18. umask $umask 755 |