Home » Infrastructure » Unix » for loop to cp file
for loop to cp file [message #194687] Sun, 24 September 2006 02:33 Go to next message
prakashrao.k
Messages: 13
Registered: September 2006
Location: BANGALORE
Junior Member


Hi,

I have data files from sql,and I have store in data files list "data_list".

datafile_list=&acute;sqlplus -s internal <<EOF
set heading off feedback off
select file_name from dba_data_files order by tablespace_name;
exit
EOF&acute;

I want to cp this into some other directory using for loop.
How can I implement this with 'for' loop ..

Thanks in Advance
Prakash Rao K
Re: for loop to cp file [message #194694 is a reply to message #194687] Sun, 24 September 2006 04:42 Go to previous messageGo to next message
orausern
Messages: 817
Registered: December 2005
Senior Member
if u mean that you want to copy the datafiles from one directory to another, then perhaps that is best done via operating system commands and not from sqlplus. Still if you want to execute from sql plus then the script should have commands like :

host copy n1.sql n2.sql

(to copy n1.sql file to n2.sql)

Re: for loop to cp file [message #194880 is a reply to message #194694] Mon, 25 September 2006 19:45 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
/users/home/scott>>ksh
/users/home/scott>>ls *.log > t.txt
/users/home/scott>>while read i
> do
>   echo "---> $i"
> done < t.txt
---> a.log
---> b.log
---> c.log
Previous Topic: pro*c or pl/sql
Next Topic: Duplicate or move an instance Oracle with new name from a host HP-UX to another host HP-UX
Goto Forum:
  


Current Time: Sun Dec 04 19:02:03 CST 2016

Total time taken to generate the page: 0.08039 seconds