Home » Infrastructure » Linux » find with rm fails in script (RHEL 6 RDBMS 11.2.0.2)
find with rm fails in script [message #532500] Wed, 23 November 2011 02:53 Go to next message
hristo
Messages: 258
Registered: May 2007
Senior Member
Hi!

I have a script that flashes a database to a previous checkpoint. In the script I remove older files. But the code below fails:


! find /database/data/flash_recovery_area/database/autobackup -ctime +4 -exec rm -rf {} \;
! find /erpdev2/data/flash_recovery_area/database/flashback/*.flb -ctime +5 -exec rm {} \;

find: missing argument to `-exec'

find: missing argument to `-exec'


What argument is missing, I can run the commands on the terminal without any errors.

The complete script:

#----------------------------ENVIRONMENT-------------------------------#
. /etc/profile
. /home/oracle/.bash_profile
. /database/oracle/.database_profile

export ORACLE_SID=DATABASE

                     sqlplus -s '/ as sysdba' <<EOF
                        whenever sqlerror exit sql.sqlcode
                        shutdown immediate;
                        startup mount;
                        flashback database to restore point RP1;
                        alter database open resetlogs;
                        drop restore point RP1;
                        ! find /database/data/flash_recovery_area/database/autobackup -ctime +4 -exec rm -rf {} \;
                        ! find /database/data/flash_recovery_area/database/flashback/*.flb -ctime +5 -exec rm {} \;
                        create restore point RP1 guarantee flashback database;



The scipt finishes but throws the errors mentioned above.

Regards
H


[Updated on: Wed, 23 November 2011 02:54]

Report message to a moderator

Re: find with rm fails in script [message #532509 is a reply to message #532500] Wed, 23 November 2011 03:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68043
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
EXEC is a keyword for SQL*Plus, maybe this is the root of the problem.

Regards
Michel
Re: find with rm fails in script [message #532523 is a reply to message #532509] Wed, 23 November 2011 04:19 Go to previous message
hristo
Messages: 258
Registered: May 2007
Senior Member
Ah, ok, that migth be the problem. I put the rm in CRONTAB instead.
Previous Topic: Oracle 11g R2 Installation problem on Redhat Linux 6 ES (2 Merged)
Next Topic: oracleasmlib
Goto Forum:
  


Current Time: Thu Dec 02 13:15:09 CST 2021