dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

shell script & SQLPlus - Database Discussions

This is a discussion on shell script & SQLPlus - Database Discussions ; Hi guys, Im new here. I have a script that calls a pl/sql script with sqlplus, and shows how much time it take. SHELL SCRIPT Code: #!/usr/bin/ksh echo '----- APAGAR DADOS DA TABELA INTERF.BDG_DIVIDA_AUX -----' echo "" inicio=`date +%s`; echo ...



Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 06-12-2008, 01:58 PM
Database Newbie
 
Join Date: Jun 2008
Posts: 1
galmeida is on a distinguished road
Default shell script & SQLPlus

Hi guys,
Im new here.

I have a script that calls a pl/sql script with sqlplus, and shows how much time it take.

SHELL SCRIPT
Code:
#!/usr/bin/ksh

echo '----- APAGAR DADOS DA TABELA INTERF.BDG_DIVIDA_AUX -----'
echo ""
inicio=`date +%s`;

echo "Iniciar sessão no oracle e correr scripts"
sqlplus -s 'login/password-at-Database' << END
@apagar.sql;
exit
END

fim=`date +%s`;
diff=$(($fim-$inicio));
echo "Demorou $diff segundos."

echo 'FIM'
PL/SQL script - apagar.sql
Code:
declare
data date;
begin
for num in 1..9
loop

select trunc(sysdate-30,'MM') into data from dual;

delete from schem.divida_aux where id_empresa=num and d_inicioThe PL/SQL executes well in TOAD. So i think that is not the problem... perhaps is the calling with sqlplus... but i cant imagine why!!

someone can help?

thanks a lot
Reply With Quote
  #2  
Old 07-25-2008, 07:59 PM
Database Newbie
 
Join Date: Jul 2008
Posts: 2
justinrush is on a distinguished road
Default Re: shell script & SQLPlus

I have always done something like:
echo "select count(*) from some_table" |sqlplus myuser/mypass

What error are you getting?
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 02:22 AM.