From: trub3101 on 8 Jul 2010 09:12 Hi all, 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
From: Michel Cadot on 8 Jul 2010 09:40 "trub3101" <trub3101(a)sky.com> a �crit dans le message de news: 8a604fd7-8ed9-4f93-b242-a5fda52caa98(a)e5g2000yqn.googlegroups.com... | Hi all, | | 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
From: Eugene Pokopac on 8 Jul 2010 09:41 Probably just a "privilege" issue. V$SESSION is usually a Public Synonym for the SYS.V_$SESSION table. Have your DBA grant an explicit SELECT privilege on the SYS.V_$SESSION table and see if that works. 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.
From: trub3101 on 8 Jul 2010 10:03 On 8 July, 14:41, Eugene Pokopac <epoko...(a)gmail.com> wrote: > Probably just a "privilege" issue. V$SESSION is usually a Public > Synonym for the SYS.V_$SESSION table. Have your DBA grant an explicit > SELECT privilege on the SYS.V_$SESSION table and see if that works. > > 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
From: Tim X on 8 Jul 2010 18:37 trub3101 <trub3101(a)sky.com> writes: > Hi all, > > 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 > 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
|
Pages: 1 Prev: Kindly add me in your Distribution List Next: Cheap ny caps ( www.nike-black.com ) |