Chapter 1: UNIX and Shell Scripting
Common Ground
UNIX and its many flavors
Why UNIX?
What is a shell?
sh bash and other shells
The UNIX kernel
Memory and swap
Processes
Files and file systems
Why Shell Scripting?
The shell Oracle and you
When to script
A warning about script bloat
Building a shell script
Chapter 2: Key Concepts
Getting to your shell
What shell am I in?
Switching shells on-the-fly
Differences between interactive and non-interactive modes
Commands options arguments and input
Shell Variables
Conditions and if statements
Loops
Wildcards and Pattern Matching
Relative and Absolute Paths
Tilde the Short Way Home
Permissions & Ownership
Chapter 3: Setting up your environment
Configuring your default shell
Changing the Default Shell with usermod
Changing Your Own Default Shell with the chsh Command
Entering a shell
bash Shell Login Behavior
Bourne Shell Login Behavior
Non-Interactive Shell Behavior
Setting Your Command Prompt
Basic Command Prompts
Special Prompt Characters
Variables and Commands in Prompts
Setting Up the Binary Path
The Manual Path
The Library Path
Aliases
Keeping your scripts organized
The .forward file
Default Permissions and umask
Chapter 4: Key tools
man - The Online Manual Pages
Text Editors
Command-line and Graphical Editors – In Brief
vi - The Visual Editor
Manipulating Text
Searching with grep
More Complex Searches with egrep
sed Text Substitution
Breaking Out Columns with cut
Using awk to Find Just What You Need
Sort - Get Things in Order
View the Beginning or End of a File
Counting Characters Words and Lines with wc
Managing Processes
Stopping the Current Process
Finding and Stopping Other Processes
Viewing running processes with ps
Ending running processes with the kill command
pgrep and pkill
Examining how long a command takes
Job Control - Running Jobs in the Background
Making sure things keep running with nohup
File and Directory Ownership and Permissions
Managing the owner and group of a file
Managing File Permissions
How Permissions Affect Directories
Securing Important Files
Manipulating Input and Output
Redirecting Standard Input
Redirecting Standard Output and Standard Error
Linking Output to Input with Pipes
Performing Math with expr
Chapter 5: Simple Scripting
Setting Up Your First Script
The Significance of the Shebang
Commenting Your Script
Variables
Variable Scope
Variable Names
Using Arguments in Your Script
Prompting for Input
Debugging Shell Scripts
Place Temporary Markers in the Script
Echo Variables to the Display
Starting the Script in Debug Mode
Chapter 6: Interacting with SQL*Plus
Calling SQL Scripts from Shell Scripts
Embedding SQL within a Shell Script
Prompting for a password
Reading a Password from a File
Running shell commands from SQL*Plus
Passing variables into SQL*Plus
SQL Script Arguments
Shell Variables and Embedded SQL
Getting Information Out of SQL*Plus
|
|
Chapter
7: Making Decisions
Conditional Expressions
Comparing Numbers
Comparing Text
Checking Files
Combining Comparisons
Making Simple Decisions with if and else
Secondary Checks with elif
Choosing from a list with case
The while Loop
The for Loop
Breaking Out of Loops
Nesting Loops
Chapter 8: Checking and Reporting Results
The Exit Status: The Unseen Result
Setting the Exit Status of a Shell Script
Setting the Exit Status for SQL*Plus
Scanning Logs for Output
Checking the Output of Commands
Chapter 9: Making the Shell Behave
Listing multiple commands on one line
Conditional Execution
Listing Long Commands on Multiple Lines
Backslash as an Escape Character
Single Quotes
Double Quotes
Back Quotes
Exit a Shell Script Anytime
Chapter 10: Making Scripts Run Automatically
Scheduling Repeating Tasks with Cron
The cron Daemon
crontab Command Options
The Format of the crontab File
crontab Entries
Scheduling One-Time Tasks with at
Performing Tasks On Login
Chapter 11: Reaching Further
Transferring Files between Systems
sftp - Secure FTP
scp - Secure Copy
Executing commands on another system
Keep Directories in Sync with rsync
Getting Past the Password Problem
Executing Commands with Another User’s Permissions
Using su to become Another User
Emailing from scripts
Emailing System Users and the .forward File
Emails from cron and at Jobs
The mail command
Chapter 12: Oracle Database Maintenance
Monitoring and Maintaining the Alert Log
Checking for Errors in the Alert Log
Rotating the Alert Log
Finding and removing old dump files
Monitoring Tablespace Usage
Clean Up Old Statspack Data
Check Certain Database Accounts are Locked
Cleaning Old Data Out of Tables
Execute a SQL Script on Every Database
Copy the TNSNames File to a List of Systems
Chapter 13: Backup Scripts
Cold Backups without RMAN
Hot Backups without RMAN
Hot Backups with RMAN
Database and Schema Export
Chapter 14: Oracle Database Monitoring
Listener Availability
Database Availability
Monitor Free Space within Tablespaces
Table is Writeable Readable or Other Specific SQL
Check for Invalid Objects
Chapter 15: Oracle Application Server
Starting and Stopping Oracle Application Server
Cleaning Up Web Server Log Files
Starting and Stopping the Application Server Console
Check Running OPMN Processes
Chapter 16: Monitoring the System
Checking the System Log
Monitoring disk space
Find the Size of a Directory
Monitoring system load
Save Load Averages in Oracle
Gathering CPU Usage Statistics from sar
Synchronize a Directory on Several Systems
Chapter 17: Windows Scripting
What’s Different in Windows?
Database Exports
RMAN backups
Running a SQL Script
Other Scripting Options for Windows
Scheduling Scripts in Windows
|