New answers tagged sqlplus
Use whenever sqlerror in your script before connecting. $ cat 1.sql whenever sqlerror exit sql.sqlcode connect bp/bp select * from dual; $ cat 2.sql whenever sqlerror exit sql.sqlcode connect bp/123 select * from dual; $ sqlplus /nolog SQL*Plus: Release 184.108.40.206.0 Production on Fri Nov 27 10:07:12 2015 Copyright (c) 1982, 2013, Oracle. All rights ...
Start your commands with the following: WHENEVER SQLERROR EXIT SQL.SQLCODE begin select * from dual; end; / When you are not connected then the SQL will fail and the other SQL statements will not get executed.
I forgot the most obvious thing: session parameters can be changed! I had this on the latest revision: ALTER SESSION SET NLS_LENGTH_SEMANTICS = 'CHAR'; ... but not the older one. I was running the scripts in a different session thus I couldn't spot the value change.
You have to use Service Names to connect to Pluggable Databases in 12c. It's just one of those things that can trip you up, I guess! SQL Plus connecting OK probably threw you.
Because this version I am using is Oracle 12c, so user SEC_MGR is replaced by SYSTEM user. Try to login with user SYSTEM/manager to access.
Top 50 recent answers are included