Pause execution of SQL file on error
I have a build file where I am calling the create scripts of my DB objects. Eg:
@@COUNTRY_MASTER.sql
@@COUNTRY_MASTER_AUDIT.sql
@@COUNTRY_MASTER_TEMPTABLE.sql
@@COUNTRY_MASTER_WORKTABLE.sql
I want to pause or exit the execution of this script in case any script fails. Also in case of failure I want to know where the script failed (which line and file name).
You can exit sqlplus when an error occurs using the WHENEVER command macro:
WHENEVER OSERROR
Performs the specified action (exits SQL*Plus by default) if an
operating system error occurs (such as a file writing error).
In iSQL*Plus, performs the specified action (stops the current
script by default) and returns focus to the Workspace if an
operating system error occurs.
WHENEVER OSERROR {EXIT [SUCCESS|FAILURE|n|variable|:BindVariable]
[COMMIT|ROLLBACK] | CONTINUE [COMMIT|ROLLBACK|NONE]}
WHENEVER SQLERROR
Performs the specified action (exits SQL*Plus by default) if a
SQL command or PL/SQL block generates an error.
In iSQL*Plus, performs the specified action (stops the current
script by default) and returns focus to the Workspace if a SQL
command or PL/SQL block generates an error.
WHENEVER SQLERROR {EXIT [SUCCESS|FAILURE|WARNING|n|variable|:BindVariable]
[COMMIT|ROLLBACK] | CONTINUE [COMMIT|ROLLBACK|NONE]}There is no command for pausing processing when an error occurs. The command language of sqlplus is very primitive. There is no easy way to do conditional processing. And user interaction is limited to prompting for substitution variable values.
Similar Messages
-
Experts,
I am performing Homogeneous System copy using backup/restore method.I have taken QA system backup ie dump files and trying to build on Sandbox system for testing purpose.Everything went fine and was able to load the dump but stuck at one of the point and throwing me error
ERROR [cinstallercallbackimpl.cpp:228]
CJS-00030 Assertion failed: Execution of SQL script reports an unexpected error.
When I checked the sapinst_dev log I found the below error but not able to fix it and not aware to proceed further
1> use SID
1> EXEC sp_changedbowner sapsa
Msg 17362, Level 16, State 1:
Server 'SID', Procedure 'sp_changedbowner', Line 181:
The proposed new db owner already is a user in the database or owns the database.
(return status = 1)
I am sure these may be small changes that have to be made by changing the db owner and Im not exactly sure how to perform it.
Note:I am Using the Windows environment with Sybase ase database and SWPM tool to perform.
Appreciate your suggestions
ThanksI fixed the issue ..by changing the owner sapsa.Bingo !!!!
-
Error after executing dbowner.sql file
I'm installing People Soft and I'm on the step for executing sql files
I'm trying to execute dbowner.sql that is content of it
set echo on
spool dbowner.log
GRANT DBA TO PS IDENTIFIED BY PS;
CONNECT PS/PS;
CREATE TABLE PSDBOWNER (DBNAME VARCHAR2(8) NOT NULL, OWNERID VARCHAR2(8) NOT NULL ) TABLESPACE PSDEFAULT;
CREATE UNIQUE INDEX PS_PSDBOWNER ON PSDBOWNER (DBNAME) TABLESPACE PSDEFAULT;
CREATE PUBLIC SYNONYM PSDBOWNER FOR PSDBOWNER;
CONNECT system/manager;
REVOKE DBA FROM PS;
ALTER USER PS QUOTA UNLIMITED ON PSDEFAULT;
spool off
after execution i received this
SQL>
SQL> GRANT DBA TO PS IDENTIFIED BY PS;
Grant succeeded.
SQL> CONNECT PS/PS;
Error accessing PRODUCT_USER_PROFILE
Warning: Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM
Connected.
SQL> CREATE TABLE PSDBOWNER (DBNAME VARCHAR2(8) NOT NULL, OWNERID VARCHAR2(8) NOT NULL ) TABLESPACE PSDEFAULT;
Table created.
SQL> CREATE UNIQUE INDEX PS_PSDBOWNER ON PSDBOWNER (DBNAME) TABLESPACE PSDEFAULT;
Index created.
SQL> CREATE PUBLIC SYNONYM PSDBOWNER FOR PSDBOWNER;
Synonym created.
SQL> CONNECT system/manager;
Connected.
SQL> REVOKE DBA FROM PS;
Revoke succeeded.
SQL> ALTER USER PS QUOTA UNLIMITED ON PSDEFAULT;
User altered.
SQL>
SQL> spool off
could you help me?
If you need more info write me>
SQL> CONNECT PS/PS;
Error accessing PRODUCT_USER_PROFILE
Warning: Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM
>
script PUPBLD.SQL runs from psadmin.sql, but this is run after the dbowner.sql
+@%ORACLE_HOME%\sqlplus\admin\pupbld+
You can try running this script (PUPBLD.SQL) manually, but I never saw this going wrong. Something has gone wrong, which will most likely give more errors later on.
Did you run the scripts in the correct order with the correct user:
createdb10.sql - as sysdba
utlspace.sql - as sysdba
dbowner.sql - as sysdba
XXddl.sql - as sysdba
psroles.sql - as system
psadmin.sql - as system
connect.sql - as system
Regards,
Hakan
Added psroles.sql thanks to bandar
Edited by: Hakan Biroglu on Aug 21, 2012 8:26 AM -
Error while executing the .sql file
Hello,
Every time when i execute the below plsql it's keep throwing the error message as show in below output, this happens even when i manually create the trigger before executing the .sql file of all the below statements, can you please correct me what i am doing wrong here. Thank you.
DROP TABLE FCSDWH.REF_DATA_MASTER;
CREATE TABLE FCSDWH.REF_DATA_MASTER
REF_DATA_MASTER_ID NUMBER PRIMARY KEY,
DESCRIPTION VARCHAR2(255 CHAR),
CREATE_ID VARCHAR2(10 CHAR),
CREATE_DT DATE,
LST_UPD_ID VARCHAR2(10 CHAR),
LST_UPD_DT DATE,
ACT_STRT_DT DATE,
ACT_END_DT DATE
TABLESPACE FCSDWH
STORAGE(INITIAL 50K);
DROP SEQUENCE FCSDWH.REF_DATA_MASTER_SEQ;
CREATE SEQUENCE FCSDWH.REF_DATA_MASTER_SEQ START WITH 1 INCREMENT BY 1;
DROP TRIGGER "FCSDWH.REF_DATA_MASTER_TRG";
CREATE OR REPLACE TRIGGER FCSDWH.REF_DATA_MASTER_TRG
BEFORE INSERT ON FCSDWH.REF_DATA_MASTER
FOR EACH ROW
BEGIN
SELECT FCSDWH.REF_DATA_MASTER_SEQ.NEXTVAL INTO :NEW.REF_DATA_MASTER_ID FROM DUAL;
END;
/Output:
SQL> @/home/smadala/REF_DATA_MASTER.SQL
Table dropped.
Table created.
Sequence dropped.
Sequence created.
DROP TRIGGER "FCSDWH.REF_DATA_MASTER_TRG"
ERROR at line 1:
ORA-04080: trigger 'FCSDWH.REF_DATA_MASTER_TRG' does not exist
Trigger created.
SQL>The trigger is "attached" to the table so when you drop the table the trigger goes as well.
John -
Error while executing Multiple Stored Procedure through .sql file
Hi Guru's.
I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
I have one test.sql file with Stored Procedure is like,
CREATE OR REPLACE PROCEDURE skeleton1
AS
BEGIN
DBMS_Output.Put_Line('skeleton1');
END skeleton1;
CREATE OR REPLACE PROCEDURE skeleton2
AS
BEGIN
DBMS_Output.Put_Line('skeleton2');
END skeleton2;
Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
I am opening test.sql file from SQL PLUS,
SQL>
1 CREATE OR REPLACE PROCEDURE skeleton1
2 AS
3 BEGIN
4 DBMS_Output.Put_Line('skeleton1');
5 END skeleton1;
6 /
7 CREATE OR REPLACE PROCEDURE skeleton2
8 AS
9 BEGIN
10 DBMS_Output.Put_Line('skeleton2');
11* END skeleton2;
SQL> /
Warning: Procedure created with compilation errors.
SQL> show errors;
Errors for PROCEDURE SKELETON1:
LINE/COL ERROR
6/1 PLS-00103: Encountered the symbol "/"
SQL>
Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
Regards,
ShatrughanHi,
Try this
CREATE OR REPLACE PROCEDURE skeleton1
AS
BEGIN
DBMS_Output.Put_Line('skeleton1');
END ;
CREATE OR REPLACE PROCEDURE skeleton2
AS
BEGIN
DBMS_Output.Put_Line('skeleton2');
END;
/Save the file and call it.
Regards,
Bhushan -
Oracle 9i export error after running catexp.sql file
After running catexp.sql file in oracle 9i 9.2.0.7.0 as system user,it gives the following error while logging
ORA-04020: deadlock detected while trying to lock object SYS.DBMS_STANDARD
please help me.............."catexp.sql" is to be run by SYS AS SYSDBA.
You'd have to cleanup any extra objects that you created in the SYSTEM account.
Why did you think that you needed to run "catexp.sql" ? Are you exporting using 9i exp against a 10g database or against a 9i database ? -
System Copy Error @ CreateDB using control.sql file
Hi Experts,
I am doing A Homogeneous System Copy. I have installed DB and patched 10.2.0.2 as source is of the same level.
After DB Installation, restored DB , run the control.sql file and opened it. Recovered DB using this way: "Recover Database using backup controlfile until cancel;" and opened reset logs
Once DB is open, i continued other steps from the point Backup/Restore DB in sapinst. It said CONTROL.SQL file is missing, so i have placed the same in installation directory. In this step "CREATE DATABASE with control.sql file" it has been throwing me error: Ora-00265 instance recovery required, cannot set ARCHIVE log mode DB altered. DB Closed. DB Dismounted and DB Closed.
Could you please explain why it is asking for Archive logs and shutting down the DB.
Thanks,
SubbuHi,
well the copy guide says you have to do an OFFLINE backup.
So sapinst expects a restored database (from offline backup) with non existing controlfiles
and the need to do a CREATE CONTROLFILE ...
You already did that manually. You already opened the db...
So there is no way to run a CREATE CONTROLFILE with "SET database" (not sure
about the RESETLOGS in this case for a second time...).
I do not know what state your DB is in right now. If it is completely operational
and fully recovered and can be opened and shutdown normal, try to substitute
your control.sql with simply (copy the original content somewhere else)
alter database mount;
alter database open;
Repeat the sapinst step.
Depending on how far it put in the progress bars in the xml file, you might need
only one of those two statements in control.sql.
If the restored DB is not operational now, then the controlfiles might be garbled due to the
second try top create them from sapinst. Not sure what the situation is then.
Volker -
SQL Error 130, not found in ERROR.SQL file.
Dear All,
While connecting my application with Oracle Release 9.2.0.8.0 I am having the following error message would any one help in this regard please?
SQL Error 130, not found in ERROR.SQL file
Thanks
GQHow is this connection being made?
Is it Oracle Forms, SQL*Plus, Java, .NET, JDBC etc?
The error message doesn't look like a standard ORA-XXXXX oracle error so I would suggest the message relates to the application trying to make the connection. -
Open .sql file, pop out error message box
When I double-click the .sql file, sql developer open this file, but windows pop an error message box: windows can't find c:\aaa\bbb.sql. Make sure you type the file name correctly...... I don't know why?
my sql developer version is 1.0.0.15.57, OS is windowsxp.This is a known problem. There is some problem with the way sqldeveloper registers.
-
Data Pump import to a sql file error :ORA-31655 no data or metadata objects
Hello,
I'm using Data Pump to export/import data, one requirement is to import data to a sql file. The OS is window.
I made the follow export :
expdp system/password directory=dpump_dir dumpfile=tablesdump.dmp content=DATA_ONLY tables=user.tablename
and it works, I can see the file TABLESDUMP.DMP in the directory path.
then when I tried to import it to a sql file:
impdp system/password directory=dpump_dir dumpfile=tablesdump.dmp sqlfile=tables_export.sql
the log show :
ORA-31655 no data or metadata objects selected for job
and the sql file is created empty in the directory path.
I'm not DBA, I'm a Java developer , Can you help me?
ThksHi, I added the command line :
expdp system/system directory=dpump_dir dumpfile=tablesdump.dmp content=DATA_ONLY schemas=ko1 tables=KO1QT01 logfile=capture.log
the log in the console screen is (is in Spanish), no log file was cerated in the directory path.
Export: Release 10.2.0.1.0 - Production on Martes, 26 Enero, 2010 12:59:14
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Conectado a: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
UDE-00010: se han solicitado varios modos de trabajo, schema y tables.
(English error)
UDE-00010: multiple job modes requested,schema y tables.
This is why I used tables=user.tablename instead, is this right ?
Thks -
Detecting *.sql file errors
hi,
I am inserting records with @c:/*.sql file but it has too many errors
How can I know about the errors occured during running this *.sql file
Thanks & best regardsI may not able previously to describe my problem
===========================================================
e.g. I scanned a book and want to extract name + roll no for my database the file is as follow
My name is Justin Cave and my roll no is 1214. My email is [email protected]
my program reads and make .sql file in this way:
insert into my table(name,rollno) values('Justin Cave',1214);
and in this way read the whole records till end of the book that may be 1000 pages book
===========================================================
Now when I ran this file it displays e.g.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
Say here is the errro ORA-???????
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.
SQL>1 row inserted.and that may continue for 1k records for example. this is very hard to go up and down to read the error. I was supposing that like a trigger we can know where is the error, Can we know only errors of .sql file?
Thanks again for replying and helping -
SQLS/internalExecute-SQLError: 'Error #3128: Disk I/O error occurred.', details:'', operation:'execute'
Is this happening when a specific .muse file is open? Does it happen during or immediately after the open completes? Or is it occurring randomly while working with Muse?
Please send the MuseLog.txt file from your Documents folder to [email protected] along with a link to this thread.
As you work, Muse both reads from the file you opened and writes the changes you're making to disk in temp files stored on your startup drive. Without more information it's unclear which file is generating this error. Answers to the questions above along with the MuseLog.txt file will help. -
Regarding execution problem of PL/SQL file
Hi,
I have PL/SQL file. When I try to compile the file in a machine namely machine A it just hangs. Where as when I ftp the code to machine B wd then try to compile, then it compiles successfully. Bot the machines are unix machines. I just wante to know whether its a problem with my code or something wrong with the machine
Thanks in advanceIn database A, if session 1 is executing a stored procedure, the stored procedure will be locked. If you come along in session 2 and try to recompile the stored procedure, session 2 will be blocked until session 1 finishes. If there are lots of sessions trying to execute the stored procedure, session 2 could well be blocked for a long time.
Justin -
Help with creating a sql file that will capture any database table changes.
We are in the process of creating DROP/Create tables, and using exp/imp data into the tables (the data is in flat files).
Our client is bit curious to work with. They do the alterations to their database (change the layout, change the datatype, drops tables) without our knowing. This has created a hell lot of issues with us.
Is there a way that we can create a sql script which can capture any table changes on the database, so that when the client trys to execute imp batch file, the sql file should first check to see if any changes are made. If made, then it should stop execution and give an error message.
Any help/suggestions would be highly appreciable.
Thanks,Just to clarify...
1. DDL commands are like CREATE, DROP, ALTER. (These are different than DML commands - INSERT, UPDATE, DELETE).
2. The DDL trigger is created at the database level, not on each table. You only need one DDL trigger.
3. You can choose the DDL commands for which you want the trigger to fire (probably, you'll want CREATE, DROP, ALTER, at a minimum).
4. The DDL trigger only fires when one of these DDL commands is run.
Whether you have 50 tables or 50,000 tables is not significant to performance in this context.
What's signficant is how often you'll be executing the DDL commands on which the trigger is set to fire and whether the DDL commands execute in acceptable time with the trigger in place. -
Execution of SQL statement 'alter tablespace PSAPSR3
Dear mastah,
I trying extend tablesapce at oracle, but not succesfully, and have problem,
maybe can help this issue..
error problem add tablespace:
BR0280I BRSPACE time stamp: 2014-01-06 10.27.31
BR0370I Directory /oracle/SID/sapreorg/semxnacf created
BR0280I BRSPACE time stamp: 2014-01-06 10.27.32
BR0319I Control file copy created: /oracle/SID/sapreorg/semxnacf/cntrlSID.old 99106816
BR0280I BRSPACE time stamp: 2014-01-06 10.27.32
BR1088I Extending tablespace PSAPSR3...
BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
BR0301E SQL error -59 at location BrSqlExecute-1, SQL statement:
'/* BRSPACE */ alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off'
ORA-00059: maximum number of DB_FILES exceeded
BR1017E Execution of SQL statement 'alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off' failed
BR0669I Cannot continue due to previous warnings or errors - you can go back to repeat the last action
BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
BR0671I Enter 'b[ack]' to go back, 's[top]' to abort:
regards,
aminBR1088I Extending tablespace PSAPSR3...
BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
BR0301E SQL error -59 at location BrSqlExecute-1, SQL statement:
'/* BRSPACE */ alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off'
ORA-00059: maximum number of DB_FILES exceeded
$ oerr ora 59
00059, 00000, "maximum number of DB_FILES exceeded"
// *Cause: The value of the DB_FILES initialization parameter was exceeded.
// *Action: Increase the value of the DB_FILES parameter and warm start.
$
Maybe you are looking for
-
Functionality of BPC 10.0
Hi all, I would like to know if the BPC can perform the following functions: Requirement Yes/No Automatic mapping of accounts between parent and children entities with different Chart of Accounts Ability to adjust historical foreign exchange rates pa
-
How do I save a filled out form in pdf?
Won't let me save, says its read only or someone else has open. We've checked, no one else has it open and I"m doing Save As. Help
-
Hi, I am trying to send an email on a button click event. I do not see any error when the function module to send email is executed but I did not see any email to my personal email address too. Can you please guide me step by step that which all sett
-
How to add videos to Camera Roll?
Somehow when I setup my new iPhone 4, all my photos/videos from my 3GS got synced into my Camera Roll. Today, I had over 2k photos/videos in the camera roll, so I decided to organize them. I sunk everything into iPhoto on my MacBook Pro, and then DEL
-
Specific Workitems should not go to substitutes
Hi We have developed some custom workflow which has some sensitive data. If a user has maintained substitutes for himself the sensitive workflow should not be recived by substitutes. We have a custom clasification for the tasks. we tried creating a p