Not as dramatic as the subject heading suggests fortunately!
I have a function within a shell script 'kill_session' (below) which
queries the v$session table. However, when I run the script I get this
error message:
Connected.
select 'ALTER SYSTEM KILL SESSION '''||sid||','||serial#||''';' from v
where schemaname = upper('film')
*
ERROR at line 1:
ORA-00942: table or view does not exist
function kill_session
{
/opt/ora/oracle/product/9.2.0/db_1/bin/sqlplus -s /nolog<<EOF
@/home/oracle/system_conn.sql
set head off
set feed off
set verify off
set define off
set scan off
set serveroutput on
spool ${WK_DIR}kill_${schema}_sessions.sql
select 'ALTER SYSTEM KILL SESSION '''||sid||','||serial#||''';' from v
$session where schemaname = upper('${schema}');
spool off
exit
EOF
}
I would be ever so grateful if someone could help me out with this one
please.
Many thanks
tb3101
v\$session
Regards
Michel
ORA-00942 table or view does not exist
Cause: The table or view entered does not exist, a synonym that is not
allowed here was used, or a view was referenced where a table is
required. Existing user tables and views can be listed by querying the
data dictionary. Certain privileges may be required to access the
table. If an application returned this message, the table the
application tried to access does not exist in the database, or the
application does not have access to it.
Action: Check each of the following:
the spelling of the table or view name.
that a view is not specified where a table is required.
that an existing table or view name exists.
Contact the database administrator if the table needs to be created or
if user or application privileges are required to access the table.
Also, if attempting to access a table or view in another schema, make
certain the correct schema is referenced and that access to the object
is granted.
Thanks for your quick replies Michel and Eugene!
Top stuff! The script is now works!
Thanks again
tb3101
My guess is that your shell is interpreting $ in v$session as a variable
$session and expands it so that your table name ens up just being 'v'.
Quote the $ and see if that fixes it.
Tim
--
tcross (at) rapttech dot com dot au