Search This Blog

Linux commands that are commonly used in Oracle Database administration tasks

Oracle DBAs often work in a Linux environment, and there are specific Linux commands that are commonly used in Oracle Database administration tasks. Here are some Linux commands that Oracle DBAs might find useful:

  1. File System and Navigation:
    • cd: Change directory.
      • Example: cd /path/to/directory
    • pwd: Print working directory.
      • Example: pwd
    • ls: List directory contents.
      • Example: ls -l (long format), ls -a (include hidden files)
    • cp: Copy files or directories.
      • Example: cp source_file destination
    • mv: Move or rename files or directories.
      • Example: mv old_name new_name
    • rm: Remove files or directories.
      • Example: rm file_name
    • mkdir: Create a new directory.
      • Example: mkdir new_directory

2.      Searching for Files and Text:

find: Search for files and directories.

    • Example: find /path/to/search -name "filename"

grep: Search for a specific pattern in files.

    • Example: grep "pattern" filename
  1. File Viewing and Editing:
    • cat: Concatenate and display the content of files.
      • Example: cat filename
    • more or less: Display file contents one screen at a time.
      • Example: more filename or less filename
    • vi or vim: Text editor for viewing and editing files.
      • Example: vi filename or vim filename
  2. Process Management:
    • ps: Display information about processes.
      • Example: ps aux
    • kill: Terminate a process.
      • Example: kill -9 process_id
    • pkill: Signal processes based on their name.
      • Example: pkill -f process_name
  3. System Information:
    • df: Display disk space usage.
      • Example: df -h (human-readable format)
    • free: Display system memory usage.
      • Example: free -m (megabytes)
    • top or htop: Display real-time system statistics.
      • Example: top or htop (if installed)
  4. User and Permissions:
    • who: Display information about currently logged-in users.
      • Example: who
    • chmod: Change file permissions.
      • Example: chmod 755 filename
    • chown: Change file owner and group.
      • Example: chown user:group filename
  5. Networking:
    • ping: Test network connectivity.
      • Example: ping server_address
    • ifconfig or ip: Display network interface configuration.
      • Example: ifconfig or ip addr
    • netstat: Display network connections and routing tables.
      • Example: netstat -an
  6. Database Administration Commands:
    • sqlplus: Oracle command-line interface.
      • Example: sqlplus username/password@SID
    • lsnrctl: Oracle Listener Control utility.
      • Example: lsnrctl status
    • rman: Oracle Recovery Manager.
      • Example: rman target /
    • datapump (expdp/impdp): Oracle Data Pump utility.
      • Example: expdp username/password@SID DIRECTORY=dpump_dir DUMPFILE=export.dmp
    • tnsping: Test the TNS (Transparent Network Substrate) connectivity to a remote Oracle database.
      • Example: tnsping SID
  7. "vi" editor commands on Linux. If that's the case, here are some basic vi commands:

    1. Opening and Saving Files:

      • vi filename: Open or create a file named "filename."
      • Press i to enter insert mode (where you can type and edit text).
      • Press Esc to exit insert mode and enter command mode.
      • :w saves changes.
      • :q quits the editor.
      • :wq saves and quits.
      • :q! quits without saving changes.
    2. Moving the Cursor:

      • h, j, k, l: Move left, down, up, and right, respectively.
      • w: Move to the beginning of the next word.
      • b: Move back to the beginning of the previous word.
      • $: Move to the end of the line.
      • ^: Move to the beginning of the line.
      • G: Move to the end of the file.
      • 1G or gg: Move to the beginning of the file.
      • Ctrl + F: Move forward one page.
      • Ctrl + B: Move backward one page.
    3. Editing Text:

      • x: Delete the character under the cursor.
      • dd: Delete the current line.
      • yy: Copy the current line.
      • p: Paste the copied or deleted text after the cursor.
      • u: Undo the last change.
      • Ctrl + r: Redo the last undone change.
    4. Searching and Replacing:

      • /search_term: Search for "search_term" forward in the document.
      • ?search_term: Search for "search_term" backward in the document.
      • n: Move to the next occurrence of the search term.
      • N: Move to the previous occurrence of the search term.
      • :s/old/new/g: Replace all occurrences of "old" with "new" in the entire document.
    5. Exiting vi:

      • :wq: Save and quit.
      • :x: Similar to :wq.
      • :q!: Quit without saving changes.
      • ZZ: Save and quit (in command mode).
    Swith user
    su username

    Use sudo to become root:
    Ex: sudo su root

    --To check server version
    cat /etc/*-release

    --Kernal version
    uname -a

    Difference between rpm & yum

    Difference between su user  & su - user

    echo -- print command
    Ex: eco $ORACLE_SID

These are just a few examples of Linux commands that Oracle DBAs may find useful. The specific commands used can depend on the tasks at hand and the specifics of the Oracle environment being managed. Always refer to the Oracle documentation and your organization's best practices for Oracle Database administration.

 

No comments:

Post a Comment

Featured Post

Oracle Architecture

  An Oracle Database consists of at least one database instance and one database. The database instance handles memory and...