Home » SQL & PL/SQL » SQL & PL/SQL » Error in Executing Spool file
Error in Executing Spool file [message #242039] Thu, 31 May 2007 08:29 Go to next message
atif_arl
Messages: 15
Registered: May 2007
Junior Member
i am creating a spool file and what i have to do ot execute it ?
i am writing only "@begin",
an error encountered (ORA-00900: invalid SQL statement).
am i mistaking in creating or executing ?


CONNECT system/manager
SET FEEDBACK off
SET PAGESIZE 0
SPOOL o:\orascripts\begin.sql
SELECT
'ALTER TABLESPACE ' ||
tablespace_name ||
' BEGIN BACKUP;'
FROM
dba_tablespaces;
SPOOL off
@begin
EXIT
Re: Error in Executing Spool file [message #242043 is a reply to message #242039] Thu, 31 May 2007 08:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64110
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and apply How to format your posts.
Copy and paste your screen. No blablabla.

Regards
Michel
Re: Error in Executing Spool file [message #242046 is a reply to message #242039] Thu, 31 May 2007 08:42 Go to previous messageGo to next message
atif_arl
Messages: 15
Registered: May 2007
Junior Member
i am creating a spool file and what i have to do ot execute it ?
i am writing only "@begin",
an error encountered (ORA-00900: invalid SQL statement).
am i mistaking in creating or executing ?

-----------------------------------------------------------
CONNECT system/manager

SQL> SET FEEDBACK off

SQL> SET PAGESIZE 0

SQL> SPOOL o:\orascripts\begin.sql

SQL SELECT 'ALTER TABLESPACE ' || tablespace_name ||
' BEGIN BACKUP;'
FROM dba_tablespaces;

SQL> SPOOL off
SQL> @begin
-------------------------------------------------------------
Re: Error in Executing Spool file [message #242051 is a reply to message #242046] Thu, 31 May 2007 08:52 Go to previous messageGo to next message
atif_arl
Messages: 15
Registered: May 2007
Junior Member
i am creating a spool file and what i have to do ot execute it ?
i am writing only "@begin",
an error encountered (ORA-00900: invalid SQL statement).
am i mistaking in creating or executing ?



CONNECT system/manager

SQL> SET FEEDBACK off

SQL> SET PAGESIZE 0

SQL> SPOOL o:\orascripts\begin.sql

SQL> SELECT 'ALTER TABLESPACE ' || tablespace_name ||
' BEGIN BACKUP;'
FROM dba_tablespaces;

SQL> SPOOL off
SQL> @begin
Re: Error in Executing Spool file [message #242053 is a reply to message #242051] Thu, 31 May 2007 09:01 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
I didn't test anything but I'd check the following:

1. BEGIN is an Oracle keyword, you might want to use another name for the file.
2. Does the content of file look ok?
3. The "@" command will look for the "begin.sql" file on the current directory. Is it "o:\orascripts\"?

MHE
Re: Error in Executing Spool file [message #242055 is a reply to message #242051] Thu, 31 May 2007 09:05 Go to previous messageGo to next message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
atif_arl wrote on Thu, 31 May 2007 08:52
i am creating a spool file and what i have to do ot execute it ?
i am writing only "@begin",
an error encountered (ORA-00900: invalid SQL statement).
am i mistaking in creating or executing ?



CONNECT system/manager

SQL> SET FEEDBACK off

SQL> SET PAGESIZE 0

SQL> SPOOL o:\orascripts\begin.sql

SQL> SELECT 'ALTER TABLESPACE ' || tablespace_name ||
' BEGIN BACKUP;'
FROM dba_tablespaces;

SQL> SPOOL off
SQL> @begin



replace @begin with @i:\orascripts\begin.sql and see what happens
Re: Error in Executing Spool file [message #242063 is a reply to message #242053] Thu, 31 May 2007 09:16 Go to previous messageGo to next message
atif_arl
Messages: 15
Registered: May 2007
Junior Member
Please find attached the print screens

Thanks & Regards.
  • Attachment: Spool_1.JPG
    (Size: 84.36KB, Downloaded 430 times)
Re: Error in Executing Spool file [message #242064 is a reply to message #242055] Thu, 31 May 2007 09:19 Go to previous messageGo to next message
atif_arl
Messages: 15
Registered: May 2007
Junior Member
Thanks for Reply
  • Attachment: reply.JPG
    (Size: 117.47KB, Downloaded 391 times)
Re: Error in Executing Spool file [message #242065 is a reply to message #242064] Thu, 31 May 2007 09:20 Go to previous messageGo to next message
atif_arl
Messages: 15
Registered: May 2007
Junior Member
No Message Body
  • Attachment: Spool_2.JPG
    (Size: 106.58KB, Downloaded 372 times)
Re: Error in Executing Spool file [message #242072 is a reply to message #242039] Thu, 31 May 2007 09:34 Go to previous message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
add the following commands to your script. You do not want to spool the actual select command that is generating your commands.

set echo off
set trimspool on
Previous Topic: not urgent - problem writing into text file in oracle 8i
Next Topic: Equivalent datatypes in oracle
Goto Forum:
  


Current Time: Mon Dec 05 10:58:34 CST 2016

Total time taken to generate the page: 0.08998 seconds