When I execute with following scripts, I have this error :
SQL> SQL> SQL> SQL> SP2-0042: unknown command "SQL>" - rest of line ignored.
SP2-0734: unknown command beginning "SQL> SELEC..." - rest of line ignored.
export SID=$1export SCHEMA=$2export ANA_LOG=/opt/oracle/logsexport ANA_SQL=/opt/oracle/scriptsexport HOME=/home/oracle. ${HOME}/.bash_profileif [ -f ${ANA_LOG}/rebuild_index_$1_$2.log ] ; then rm ${ANA_LOG}/rebuild_index_$1_$2.logfilogf=${ANA_LOG}/rebuild_index_$1_$2.logdate >${logf}export ORACLE_SID=${SID}sqlplus /nolog << EOF >>${logf}connect / as sysdbaset feedback offset pagesize 0SPOOL /opt/oracle/scripts/Indexrebuild_${ORACLE_SID}_${SCHEMA}.SQL SELECT 'ALTER INDEX '||OWNER||'.'||SEGMENT_NAME||' REBUILD TABLESPACE '||TABLESPACE_NAME||';' FROM DBA_SEGMENTS WHERE OWNER='${SCHEMA}' AND SEGMENT_TYPE='INDEX';SPOOL OFF@/opt/oracle/scripts/Indexrebuild_${ORACLE_SID}_${SCHEMA}.SQLEOFdate >>${logf}exit;
Take a look at the SQL file that is being generated. I believe you are going to see the SQL statements echoed in the file.
You should add at least these to your settings:
set echo off
set lines 32767
set trimspool on
That should get you closer.
I believe that your resulting script is actually working, those errors are just extraneous messages.
If you could post at least the first few lines of the SQL file, through the first couple of alter statements, then we could help more. Please make the suggested changes first.
bibi92
ASKER
I modified the settings like :
set feedback off
set pagesize 0
set echo off
set lines 32767
set trimspool on
The following error occurs:
SQL> Connected.
SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2 SQL> SQL> SQL> SQL> SP2-0042: unknown command "SQL>" - rest of line ignored.
SP2-0734: unknown command beginning "SQL> SELEC..." - rest of line ignored.
SP2-0042: unknown command "SQL>" - rest of line ignored.
SP2-0734: unknown command beginning "SQL> SPOOL..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Sun Dec 29 15:53:41 CET 2013
SQL> SQL> SQL> SQL> SP2-0042: unknown command "SQL>" - rest of line ignored.
SP2-0734: unknown command beginning "SQL> SELEC..." - rest of line ignored.
You should add at least these to your settings:
set echo off
set lines 32767
set trimspool on
That should get you closer.
I believe that your resulting script is actually working, those errors are just extraneous messages.
If you could post at least the first few lines of the SQL file, through the first couple of alter statements, then we could help more. Please make the suggested changes first.