Prerequisites & Environment Setup
Prerequisites & Environment Setup
Section titled “Prerequisites & Environment Setup”Quick setup guide to get your Oracle environment ready for the utility scripts.
📋 Prerequisites
Section titled “📋 Prerequisites”Oracle Client Required
Section titled “Oracle Client Required”You need an Oracle client to run the scripts:
- SQL*Plus (included with Oracle Client/Database)
- SQLcl (Oracle’s modern command line tool)
- Oracle Instant Client (minimum requirement)
Database Privileges
Section titled “Database Privileges”Scripts require appropriate database access:
For monitoring scripts:
GRANT SELECT ANY DICTIONARY TO your_user;GRANT SELECT_CATALOG_ROLE TO your_user;
For administrative scripts:
GRANT DBA TO your_admin_user;
🚀 Quick Start
Section titled “🚀 Quick Start”1. Test Your Connection
Section titled “1. Test Your Connection”sqlplus username/password@database
-- Verify accessSELECT name, open_mode FROM v$database;SELECT instance_name FROM v$instance;
2. Try a Script
Section titled “2. Try a Script”Copy any script from the site and run it:
-- Example: Database health checkSELECT name, open_mode, database_role, log_mode FROM v$database;
3. Improve Output Formatting
Section titled “3. Improve Output Formatting”For better script output, add these settings:
SET PAGESIZE 100SET LINESIZE 132SET TIMING ONSET SERVEROUTPUT ON
🔧 Enhanced Setup (Optional)
Section titled “🔧 Enhanced Setup (Optional)”SQL*Plus Login Script
Section titled “SQL*Plus Login Script”Create login.sql
in your working directory for automatic formatting:
-- login.sql - Auto-loaded by SQL*PlusSET PAGESIZE 100SET LINESIZE 132SET TIMING ONSET SERVEROUTPUT ON SIZE UNLIMITEDSET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER> "
-- Common column formattingCOLUMN username FORMAT A20COLUMN tablespace_name FORMAT A25COLUMN sql_text FORMAT A60 WORD_WRAPPED
Environment Variables (Linux/Unix)
Section titled “Environment Variables (Linux/Unix)”# Add to ~/.bashrc or ~/.profileexport ORACLE_HOME=/path/to/oracle/clientexport PATH=$ORACLE_HOME/bin:$PATHexport TNS_ADMIN=$ORACLE_HOME/network/admin
Database Connection Examples
Section titled “Database Connection Examples”# Easy connect (no TNS required)sqlplus hr/password@//server:1521/ORCL
# TNS connectionsqlplus hr/password@PRODDB
# Using wallet/external authenticationsqlplus /@PRODDB
🧪 Test Your Setup
Section titled “🧪 Test Your Setup”Verify everything works with this quick test:
-- Database infoSELECT name, version, open_mode FROM v$database;
-- Your privilegesSELECT COUNT(*) privileges FROM session_privs;SELECT COUNT(*) roles FROM session_roles;
-- Performance testSELECT metric_name, valueFROM v$sysmetricWHERE metric_name = 'CPU Usage Per Sec'AND group_id = 2;
🚨 Common Issues
Section titled “🚨 Common Issues”Cannot connect to database
- Verify Oracle client is installed and in PATH
- Check TNS configuration or use easy connect syntax
- Confirm database is running and accessible
Script privilege errors
- Request DBA to grant SELECT_CATALOG_ROLE
- For admin scripts, may need DBA privileges
- Some scripts work with limited privileges
Poor output formatting
- Use SET LINESIZE and PAGESIZE commands
- Create login.sql for automatic formatting
- Consider redirecting output:
SPOOL output.txt
🔗 Next Steps
Section titled “🔗 Next Steps”Your environment is ready! Now:
- Browse Scripts → - Explore the script library
- Quick Start → - Try essential scripts
- SQL*Plus Advanced Setup → - SQLPATH configuration