Hi, unix gurnis
I need help for following requirement for writing a shell scritp.
log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file.
Thanks in advance
Hi, unix gurnis
I need help for following requirement for writing a shell scritp.
log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file.
Thanks in advance
There are quite a few ways to do it..on of which is
#!/bin/ksh
# saving the file as get_count.ksh
sqlplus -s $1/$2@$3 << EOF >> output_file.txt 2>&1
set newpage 0
set heading off
set feedback off
set linesize 9999
set pagesize 0
select count(*) from table1;
exit
EOF
run as
./get_count.ksh db_username passwd database
As you would know in place of db_username passwd database give the respective database names etc..
Thanks Michael,
It is really helpful.