Tag Archives: sqlplus

Bash Script to run a sql file (Draft) – Part 1

#!/usr/bin/bash # This script calls the Ad_1.sql script and spools the output with date stamp to a log file# Update: You MUST add your environment variables one way or another, e.g. look below export ORACLE_BASE=/oracleexport ORACLE_HOME=/oracle/OraHome_1PATH=${PATH}:${ORACLE_HOME}/bin; export PATHexport LIBPATH=${LIBPATH}:${ORACLE_HOME}/lib32:${ORACLE_HOME}/lib if … Continue reading

Tagged , | Leave a comment

Putting the Current Date in a Spool File Name in sqlplus

 Using SYSDATE you can query the current date and put it in a substitution variable. The substitution variable can then be used in a SPOOL command: column dcol new_value mydate noprintselect to_char(sysdate,’YYYYMMDD’) dcol from dual;spool &mydate.report.txt— my report goes hereselect … Continue reading

Tagged | Leave a comment

How to add a new data file to Oracle Tablespace using sqlplus

First login as the “oracle” user, and issue the command “sqlplus “/ as sysdba”” (I am assuming that you already have configured the  PATH environment variable correctly) and then type the following:   alter tablespace tablespace_name  add datafile ‘/oracle/data/file1.dbf’ size … Continue reading

Tagged , , | Leave a comment