Slapconfig backup shell script?

Trying to create a shell script scheduled with launchctl to backup an open directory master.
Googling seems to come up with this script:
#!/usr/bin/expect -f
spawn /usr/sbin/slapconfig -backupdb "Volumes/MacHD/Backups/odbackup"
expect “Enter archive password”
send “password\r”
expect eof
It gets caught up on the "Enter archive password" part, and complains that the spawn and send commands are not found.
Anyone see what I'm doing wrong or can suggest an alternative?

Ahhhh as always within minutes of posting here, I find an answer.
Throw above into a file odbackup.txt
Make a shell script that has:
cat odbackup.txt
expect -f odbackup.txt

Similar Messages

  • RMAN backup shell script

    Hi,
    I am trying to setup incremental backup shell script to run anutomatic every night. I am getting below errors when I run script. What am I missing here?
    oradev]/home/oradev ./RMAN_DEV_incr1.sh
    RMAN> exit
    ./RMAN_DEV_incr1.sh[13]: CONFIGURE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[14]: CONFIGURE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[15]: CONFIGURE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[16]: run: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[17]: ALLOCATE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[18]: CROSSCHECK: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[19]: BACKUP: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[20]: sql: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[21]: BACKUP: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[22]: BACKUP: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[23]: CROSSCHECK: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[24]: DELETE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[25]: DELETE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh[26]: RELEASE: not found [No such file or directory]
    ./RMAN_DEV_incr1.sh: line 26: syntax error at line 27: `}' unexpected
    ==============
    Here is copy of my shell script:
    #!/bin/ksh
    # Declare your ORACLE environment variables
    export ORACLE_SID=DEV
    export ORACLE_BASE=/d01/oracle/DEV
    export ORACLE_HOME=/d01/oracle/DEV/db/tech_st/11.1.0
    export PATH=$PATH:${ORACLE_HOME}/bin
    # Start the rman commands
    rman target / msglog=/d01/RMAN/logs/rman_INCR_1_${ORACLE_SID}_${DATE}.log
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/d01/RMAN/autobackup_control_file%F';
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
    run {
    ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK;
    CROSSCHECK BACKUP;
    BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 DATABASE FORMAT '/d01/RMAN/databasefiles_%d_%u_%s_%T';
    sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
    BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '/d01/RMAN/archivelogs_%d_%u_%s_%T' DELETE INPUT;
    BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT '/d01/RMAN/controlfile_%d_%u_%s_%T';
    CROSSCHECK BACKUP;
    DELETE NOPROMPT OBSOLETE;
    DELETE NOPROMPT EXPIRED BACKUP;
    RELEASE CHANNEL RMAN_BACK_CH01;
    EXIT;
    EOF
    #

    Hi,
    You missed to redirect the rman command
    rman target / msglog=/d01/RMAN/logs/rman_INCR_1_${ORACLE_SID}_${DATE}.log <<eof
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/d01/RMAN/autobackup_control_file%F';
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
    run {
    ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK;
    CROSSCHECK BACKUP;
    BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 DATABASE FORMAT '/d01/RMAN/databasefiles_%d_%u_%s_%T';
    sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
    BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '/d01/RMAN/archivelogs_%d_%u_%s_%T' DELETE INPUT;
    BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT '/d01/RMAN/controlfile_%d_%u_%s_%T';
    CROSSCHECK BACKUP;
    DELETE NOPROMPT OBSOLETE;
    DELETE NOPROMPT EXPIRED BACKUP;
    RELEASE CHANNEL RMAN_BACK_CH01;
    EXIT;
    EOF
    #

  • Cold backup shell scripts

    Could anyone please send me Shell script for taking Cold backups on solaris
    The script will be run and will start taking backup
    if possible Automatically it will Down and UP the Database
    Thanks
    Mark

    I'm sure that a short google search should find some example for you.
    Here some scripts :
    http://orafaq.com/scripts/
    http://www.dbasupport.com/oracle/scripts/Backup_Recovery/
    But, that would be better to google for more results :
    http://www.google.fr/search?q=oracle+script+backup&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:fr:official
    Nicolas.

  • My cold backup shell script not working

    I have written a shell script for cold backup but. It says that line 42 has unexpected syntex error '{' and line 57 unexpected end of file. Please help
    BKUP_DIR=/u03/backups/abu/nightly_backup
    LOG_FILE=/u03/backups/abu/backup.log
    ORACLE_HOME= /u01/app/oracle/product/10.2; export ORACLE_HOME
    ORACLE_SID=SEED; export ORACLE_SID
    PATH="$PATH:$ORACLE_HOME/bin";export PATH
    # Execute the backup procedure
    echo ymd=`date +%Y%m%d` >> $LOG_FILE
    echo "Database BACKUP starting." >> $LOG_FILE
    ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
    ORACLE_SID=SEED; export ORACLE_SID
    PATH="$PATH:$ORACLE_HOME/bin";export PATH
    rman target=/ << EOF
    shutdown immediate
    EOF
    if [ $? -eq 0 ]
    then
    mkdir -p ${BKUP_DIR} # make directory
    echo "Database shut down.">> $LOG_FILE
    else echo "not shutdown".>> $LOG_FILE
    fi
    if [ ! -d ${BKUP_DIR} ]
    then
    echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
    exit 1
    fi
    echo "Previous Backup is being removed." >> $LOG_FILE
    rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
    echo "Cold backup being performed." >> $LOG_FILE
    cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
    cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
    cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
    echo "Cold backup of archive logs being performed." >> $LOG_FILE
    mv /u01/app/oracle/product/10.2/dbs/arch/* ${BKUP_DIR}/$ymd-${cmsv}.gz
    gzip ${BKUP_DIR}/$ymd-${cmsv}
    echo "Restarting Database" >> $LOG_FILE
    rman target=/ << EOF
    startup
    EOF
    else
    echo "Database will NOT start up." >> $LOG_FILE
    fi
    echo 'ymd='date +%Y%m%d' >> $LOG_FILE
    echo "Database BACKUP has completed." >> $LOG_FILE
    exit

    I trying to write that script for our new production database. My script will create a folder automatically and will copy all database files into the folder. Now my script dont copy the files into the direcory that automatically create. I want my directory name with timestamp that i already speciy in my code. The scripts now generate an error that now such files or directory. I mean when it tries to copy files from source to destination folder. Please give me some suggestions.
    if [ $? -eq 0 ]
    then
    mkdir -p ${BKUP_DIR} # make directory
    echo "Database shut down.">> $LOG_FILE
    else echo "not shutdown".>> $LOG_FILE
    fi
    if [ ! -d ${BKUP_DIR} ]
    then
    echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
    exit 1
    fi
    echo "Previous Backup is being removed." >> $LOG_FILE
    rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
    echo "Cold backup being performed." >> $LOG_FILE
    cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
    cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
    cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gzecho "Cold backup of archive logs being performed." >> $LOG_FILE

  • Need a shell script to backup archive log daily

    Hi All,
    We need a shell script to backup the archive logs daily after shutting down the concurrent manager and once the backup is completed, needs to start the concurrent manager through the script itself, if you have any ideas or sample scripts, please provide and help us.
    The objective is to backup the daily archive logs with out any loss of data.
    Thanks,

    I do not have a similar script to share, sorry. However, you may review the following links/notes:
    Note: 137181.1 - RMAN Backup Shell Script Example
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=137181.1
    Recovery Manager (RMAN) Manuals
    http://www.oracle.com/pls/db102/homepage

  • Shell Script for automatic backup

    Hello Every one,
    We have windows network and sun solaris sparc box. (both from Sun Box and from Windows machine I can communcate using Telnet.)
    I wish to take data backup of a system having windows operating system, into
    the sun solaris sparc box automatically by week end .
    Can anyone help me with the shell script which does this operation.
    Regards,
    Dwarak

    first of all, is there nfs running? and on windoze box, do u have any nfs client program running?
    you cant transfer files frm the windoze machine via telnet..
    once you can settle the above, what you can do is a simple copy script and put it in your crontab.

  • Shell script for export backup in oracle 11g

    Hi,
    Oracle version 11.2.0..
    O/S-AIX
    How to write shell script for export full backup in oracle 11g and also need to remove 2 days of old backup.
    Regards,
    Raju

    How to write shell script for export full backup in oracle 11g
    Do you mean that export is your backup strategy ? is your database running in noarchivelog mode ? if so, then why ? if not so, then why not RMAN ?
    need to remove 2 days of old backup.
    If that mean remove files older than 2 days, you can use something like this :
    $ find <absolute directory path> -mtime +2 -exec rm {} \;

  • Shell script for DB backup

    HI,
    i have written some java code Database backup but there are some problems with that so now i need to write shell script for db backup.
    what i was doing in java code i was running command like that
    /usr/local/bin/tar cvzf /export/home/monitor/FILE_20091005.tar.gz FILES/*20091005.*which compress the all *20091005* files (myisam table files)
    but after compression file doesn't extract
    so i have to write shell script for that ..... can any body guide me how can i write that kind of script and put it in cron job.
    thanks

    soundar wrote:
    Hi all,
    I have migrated database from 8i to 10gr2.For Backup in 8i, we used a RMAN shell script (scheduled uding cron tab) to backup the database to Tape.(VERITAS BACKUP).
    I am new to 10G.I checked out the options to backup the database using Oracle Enterprise manager DB console.
    http://www.oracle.com/technology/obe/10gr2_db_single/ha/rman/rman_otn.htm#t1d
    I am planning to take a test backup using the steps mentioned inthe above url.Could any one suggest whcih is the best option for database backup,eiether to use Oracle Enterprise manager DB console or thru RMAN shell script for backup..?
    Edited by: soundar on Mar 9, 2010 10:53 PMDear soudar
    I woudn't suggest you to work with EM if you want to be a professional DBA. Start learning RMAN and use CLI instead of GUI
    Those who live by the GUI, die by the GUI

  • Generate RMAN backup Script using unix shell script

    Hello,
    Could somebody give me a unix shell script that would generate RMAN script based on some user defined parameters in a config file.
    e.g.
    rman.conf
    CHANNELS=4
    USE_CATALOG=Y
    DEVICE='sbt_tabe'
    etc.,
    many thanks,
    kam

    You can actually encapsulate the RMAN commands inside the shell script.
    However if you really want to create a seperate RMAN script file, you can use the unix shell's "echo" command to write set variables to a file.
    Thus, for example,
    echo "rman target / catalog rman/rmanpassword@crcat" > RMAN_Script.rmn
    echo "backup database plus archivelog" >> RMAN_Script.rmn
    echo "backup archivelog all" >> RMAN_Script.rmn
    creates RMAN_Script.rmn with 3 commands.

  • Unix shell script to do a cold backup

    i want to do a coldback using a unix shell script.
    the db capacity is around 12 Tb
    wen the backup is done i need to zip it too.at this moment i dont want to copy to the disk.
    kindly help me regarding this
    thanks in advance
    NK

    i used something like this until recently:
    #!/bin/bash
    umask 0077
    export ORACLE_HOME="/u01/app/oracle/product/10.2.0/webdb1"
    export PATH="$ORACLE_HOME/bin:$PATH"
    export NLS_LANG="AMERICAN_AMERICA.WE8ISO8859P1"
    db="dbname"
    pipe="export.pipe"
    file="$db-`date "+%Y-%m-%d"`.dmp"
    if [ ! -p $pipe ]; then
    ## could exist but not be a pipe
    rm -f $pipe
    mknod $pipe p || (echo "could not create pipe $pipe"; exit 1)
    fi
    gzip -c > $file.gz < $pipe &
    exp system/****@$db FULL=Y CONSISTENT=Y FILE=$pipe DIRECT=Y GRANTS=Y
    you could of course also use zip|bzip2|pbzip2 or whatever.
    hth, rgds, armin walland

  • Shell script for RMAN backup

    Hi,
    on 10G R2 in AIX 6.1
    I'm looking for Shell script for RMAN backup.
    Moreover , if we should connect like this :
    rman nocatalog target sys/password@myDB << EOF
    backup as compressed backupset format '$savdir/ctl_%d_%T_%s_%p' current controlfile;
    exit
    EOFHow to avoid writting password in shell script ?
    Thank you.

    user522961 wrote:
    Can you please tell me in case of having a catalog , how to connect to catalog without writting password in script ? I mean , how to write the following in a way without password :
    #!/usr/bin/ksh
    export ORACLE_SID=myDB
    ORACLE_ENV_ASK=NO
    . /usr/local/bin/oraenv
    export savedir=/backups/myDB
    rman target /  << EOF
    connect catalog rman/password@myrepository
    backup as compressed backupset
        format '$savdir/ctl_%d_%T_%s_%p'
        include current controlfile;
    exit
    EOF:p

  • Shell scripting for hot backup

    Hi,
    can you please give me shell scripting and it's explanation for taking hot backup. and which shell scripts are frequently use in real time.
    thank a lot in advance.

    HAve you ever heard about RMAN ? Much better than reinvent the wheel.
    http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmquick.htm
    Nicolas.

  • Can anybody provide AIX shell script for Oracle Apps R12 instance backup

    Hi
    Can anybody provide AIX shell script for Oracle Apps R12 instance backup? Manually, i am able to backup but i donot have shell script to schedule through crontab.
    Help me please.
    Thanks

    Rman can be used for Database, not for Application tier. Again, I assumed you are looking for a script to backup the database. For the application tier, you can simply do a filesystem backup.
    I still do not understand your concern? Is it about using crontab? If so, then check here --> man crontab <--

  • Delete backup files using shell script

    Hi Gurus,
    I have to delete previous month backupfiles like sample.ttp-04-24-06 file from directory called 0424. Like that I need to delete the whole month files by using shell script.
    Please I will run this script once in a month. So it will delete all previous month's backup files which are available in the date directory of that month(0401,0402,0403 etc).
    Please help me out to solve this issue.
    Thanks in advance.

    Hi Fish,
    Its working fine. Thanks a lot for your excellent idea to solve my issue.
    Thanks again.
    bye,
    Peter.

  • Automatic Database Backup using Shell script

    Hi,
    Can anybody share a sample shell script to take automatict backup of database.So, that It help preparing the same in our enviroment.
    Thanks,
    Sami

    Hi,
    Thanks for your inputs. But here are the details
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    Platform 86_64 linux.-redhat-release-4ES-7.
    Can you please suggest taking automatic backup as a sample script. so that a demo can be created and tested in development environment.
    --sami                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Editing XML stored in an Oracle database

    We are planning to store many thousands of text articles in an Oracle database, in XML format. Once stored we need an easy interface to allow librarians and lawyers to edit these documents. Does Oracle have its own integrated XML editor (i.e. one tha

  • Different Ouptput in SQL & Oracle Report

    Hi, I have two tables. (1) TST_P (2) CUSTOMER_LIMIT I use one select query for this SELECT distinct ORG_ID,CUSTOMER_ID,CUSTOMER_NAME,CUSTOMER_NUMBER, (select distinct NVL(sum(amount_due_original),0) from TST_P WHERE CUSTOMER_ID=P.CUSTOMER_ID AND P_FL

  • Solaris machine rebooted when displaying kern error.

    Solaris machine rebooted when displaying kern error. The following info can be found in system log. What is thje problem? Thanks! Jun 14 13:47:44 nsclfmaz1-01 unix: [ID 836849 kern.notice] Jun 14 13:47:44 nsclfmaz1-01 ^Mpanic[cpu21]/thread=2a100a9fcc

  • Content Aware Fill for CS5

    Just saw this for CS5: http://tv.adobe.com/watch/photoshop-20th-anniversary/contentaware-fill-sneak-peek/ Me like alot.

  • Who is smart enough to make...

    Who is smart enough to make NAMES OF PALETTE IN ALL CAPS CASE? It's new word in interface design or something?