from v * ERROR at line 1: ORA-00942: table or view does not exist

brightking716發表於2010-08-20

在執行一個備份指令碼的時候,當執行在v$動態效能檢視時,就會報錯,如果單獨執行該sql語句的時候就不會有問題 ,具體情況如下:

#/bin/bash

$ORACLE_HOME/bin/sqlplus -s "/ as sysdba" << !

… …

spool &fil

select 'host cp ' || name ||' &dir' from v$datafile;

… …

spool off;

exit

!

select 'host cp ' || name ||' /u01/backup/cold' from v

*

ERROR at line 1:

ORA-00942: table or view does not exist

Solution:

Escape the $ in v$datafile with a like this v$datafile,

select 'host cp ' || name ||' &dir' from v$datafile;

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12472709/viewspace-1037106/,如需轉載,請註明出處,否則將追究法律責任。

相關文章