UNIX COMMANDS USEFUL FOR ORACLE DBA

This item was filled under [ General, Solaris, Unix Reference ]

Monitoring database is one of the role Oracle database administrator has to fulfil. I have listed some of the basic and useful commands which are generally used in database administration. If you feel the list is incomplete, please suggest more Unix commands used by database adminstrators in day to day monitoring and administration.

1. To create a file.
cat > [filname]
2. To view contents of a file.
cat [filname]  OR   more [filname]  OR   less [filname]
3. To append a file.
cat >>  [filname]
4. Creating an empty file.
touch [filname1][filname2][filname3]…. so on. OR  touch filname{1,2,3….}
5.  Removing a file.
rm [filname] OR  rm -i [filname]  OR  rm -f [filname]
6. To check file type.
file [filname]
7. To create directory.
mkdir [directoryname]
8. To see present working directory.
pwd
9. To list file and directory in current directory.
ls    OR      ls -l          (for long list)
OR     ls -p         (puts slash to directories)
OR     ls -a          (shows all directories including hidden files,hidden files or directories                                   starts  with dot.)
10. To create nested directories.
mkdir -p dir/dir1/dir2/dir3
11. To see directories in mapped way.
ls -R  [directoryname]
12. To enter in another directory
cd [directoryname]
13. To go to home directory.
cd
14. To back to last directory
cd -
15. To enter in to parent directory
cd..
16. Remove directories
rmdir [directoryname] OR  rm -r  [directoryname](asks permission before deletion)
17. Removing nested directories
rm -r dir1/dir2/dir3 (dir3 is deleted)

18. Commands to compress and uncompress.
A) compress [filname] (compressed file is renamed with .z extension)
To read this file command is zcat [filname].
To uncompress this filecommand is uncompress [filname].
B) gzip[filname] (compressed file is renamed with .gz extension)
To read this file command is gzcat [filname].
To uncompress this filecommand is gunzip [filname]
C) bzip2[filname] (compressed file is renamed with .bz2 extension)
To read this file command is bzcat [filname].
To uncompress this filecommand is bunzip2 [filname]

19. Disk based utilities.
A) du command(disk usage command)
du [filname](displays file size in blocks)
OR du -k [filname](displays file size in KB)
OR  du -h [filname](displays file size in human readable form)
OR du -sh[filename]

B) df command(disk free command)
df (displays diskfilesystems in blocks)
OR df -k (displays filesystem in KB)
OR df -h (displays file system in human readable form)
These commands lists only mounted file systems.

20. Help commands
A) man [command]      (displays manual page for specified command)
OR man -a [command]  (displays all manual pages for specified command)
B) info[command]
C) [command]  –help
21. cp COMMAND
This comman is used to copy files and directories from one location to other location
cp <source> <destination>
OR   cp  -r <source> <destination>
22. mv COMMAND
This command is used to move directory from one location to other location as
well as to rename them.
mv <source> <destination>                     (moving)
mv sundir/suntest suntest/moontest         (renaming suntest to moontest)
23. Change group of the file
chgrp[options] group file
24. Changing file or directory access permissions
chmod [options] file


25 Reporting current date and time

date [options]
26. Comparing the two files and display the differences(text files only)
diff[options] file1 file2
27. Remotely copy files from this machine to another machine
rcp[options] hostname
28. Displaying the last few lines (or parts)of a file
tail [options] file
tail -100 file(displays last 100 lines of file)
29. Removing repeated lines in file
uniq [options] file.
30. Communicating with another host using telnet protocol
telnet[host[port]]
31. Reporting who is logged in and what process are running
who OR w.

32. Killing the process
kill <process id>
33. Set or change your password
passwd[options]
34. Showing status of active process
ps [options]

Surely there are many other unix commands which are used in Oracle dba’s daily work, please add all useful commands here.

  • Share/Bookmark
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment

  • Google Translator

      Translate to: