Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Automatate the script to delete data in table.

Kenn Chen

Automatate the script to delete data in table.

How could I write a script to auto login to DB and delete data in certain tables.
Cyber Zen
Steven Sim Kok Leong
Honored Contributor

Re: Automatate the script to delete data in table.


To automate, you will need a shell script.

1) Execution of script as oracle account:
svrmgrl <connect internal

2) Execution of script as sqlplus user:
$ORACLE_HOME/bin/sqlplus userid/passwd <INSERT PL/SQL COMMANDS HERE
where userid is a oracle user with delete privileges. There is a security concern that the userid and password is displayed in a ps process listing.

3) To automate, use cron to call the script.
If you want to use root's crontab:
su - oracle -c

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
Email: Homepage: