set echo off pagesize 0 heading off feedback off termout off

 
spool select.sh
 
select 'cp -v '||name ||' /home/y' from v$controlfile
union all
select 'cp -v '||member|| ' /home/y' from v$logfile
union all
select 'cp -v '||name|| ' /home/y' from v$datafile;
 
spool off
//select结果中cp -v是以字符形式 出现,并不执行,后面的目录路径相同。
 
这样就把select查询的结果重定向到文本select.sh中了。
 
之后可以在系统中sh select.sh直接执行这个脚本。在数据库冷备份中使用很有效。