Script for cold backup

Hello friends;
I'm trying to run following script which I copied from somewhere using .sh file but the same is not running and showing errors:
Script:
#!/bin/sh
dy=`date +%D`
bk='/backup/test'
cm_oracle='tar -czhf '$bk'/'$dy'_db_bkp.tar.gz /TEST/oracle'
[oracle@visionerp ]$ sh cold_bkp.sh
: command not found:
: command not found:
: command not found:
OS Linux 5.8.
Regards
Aneel Ahmed

Hi ,
I see this : ^M: bad interpreter. Can you vi your file and see if you have ^M character ?
you may need to remove this. Dont do it manually.
follow any of the links below :
https://www.google.co.in/search?q=remove+%5Em+linux&oq=remove+%5EM+&aqs=chrome.1.69i57j0l5.7360j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

Similar Messages

  • Script for cold backup using RMAN

    Dear all,
    db_version:-10.2.0.4
    os_version:- Windows 2003 server
    I wish to schedule a script that will take cold backup of my database using RMAN.
    Any help is appreciated ..
    Edited by: user12000301 on May 18, 2011 5:02 AM

    Dear All,
    Thanks a lot for your valuable time :
    However i have managed to do it as follows :
    1. First i have configure the parameter of RMAN ( Since it is my UAT in Noarchive log mode), I have never tried RMAN cold backup on the same.
    Following is the out put of SHOW ALL;
    RMAN> show all;
    using target database control file instead of recovery catalog
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
    CONFIGURE BACKUP OPTIMIZATION OFF;
    CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'D:\DB\RMAN_BKP\BACKUPS%F';
    CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
    CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\DB\RMAN_BKP\BACKUPS\DB_%U.%r';
    CONFIGURE MAXSETSIZE TO UNLIMITED;
    CONFIGURE ENCRYPTION FOR DATABASE OFF;
    CONFIGURE ENCRYPTION ALGORITHM 'AES128';
    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\DB\RMAN_BKP\BACKUPS\SNCFDB.ORA';
    2. I have created a rman_cold_bkp.bat file which has following entry :
    cd c:\oracle10g\bin
    set oracle_sid=DB
    rman target system/*** @D:\DB\RMAN_BKP\SCRIPT\rman_cold_bkp.rcv log=D:\DB\RMAN_BKP\SCRIPT\rman_cold_bkp.log
    exit
    3. Whereas rman_cold_bkp.rcv file contains following contents:
    run
    allocate channel C1 device type disk;
    shutdown immediate;
    startup mount;
    backup database;
    alter database open;
    release channel C1;
    exit
    I did checked it and it;s working fine for me :-)
    Regards,
    Girish

  • Script for cold backup on windows

    looking for a script that can be scheduled nightly to perform
    a cold backup to disk of a 8.1.7 database on windows.
    while i've seen many, i'm looking for one that will keep 3 days worth
    of backups... then write over the oldest etc...
    thanks
    dg

    set term off
    set head off
    set feedback off
    set verify off
    spool c:\coldbackup.bat
    select 'copy '||name||' c:\DBBACKUP' from v$datafile;
    select 'copy '||name||' c:\DBBACKUP' from v$controlfile;
    select 'copy '||name||' c:\DBBACKUP' from v$tempfile;
    select 'copy '||member||' c:\DBBACKUP' from v$logfile;
    spool off
    shutdown IMMEDIATE
    host c:\coldbackup.bat
    startup
    host del c:\coldbackup.bat
    set term on
    set head on
    set feedback on
    set verify on

  • Getting error while running script for online backup

    Hi,
    I am running a script for online backup but ended up with an the below error.
    *ERROR* [Backup Worker Thread] com.day.crx.core.backup.Backup Failed to create temporary directory
    Please help out in resolving this.
    Thanks in Advnace.
    Maheswar

    Hi mahesh,
    If you are using backup feature from crx console, I mean http://localhost:4502/crx/config/backup.jsp  I can say that we had also some problems with this functionalities.
    First off all what you need to check are the permissions, because when you check a source code there is line which creates a File object using a path specified by you to make a backup of repository.
    File targetDir = new File(req.getParameter("targetDir", listDir.getParentFile().getAbsolutePath()));
    You need to have sure that the proper read write access has been granted for this path.
    Another issue is that maybe there was already prepared some hotfix if you are using CQ5.4. Please refer to the following link:
    http://dev.day.com/content/kb/home/Crx/CrxSystemAdministration/CRXOnlineBackup.html
    and also to this one:
    http://dev.day.com/content/docs/en/crx/current/release_notes/overview.html which contains a hotfix number #34797 which was applied to backup.jsp file.
    Regards,
    kasq

  • 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

  • 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

  • Stop and start database for cold backup

    Hi,
    Database :Oracle 10g R1
    OS : Red hat 3
    I have a RAC database with 2 nodes.
    I build this script to make a cold backup of the database. (I will put it in the cron tab).
    My question is the SRVCTL will work in this scripts??
    # ***** COLDBACKUP ORACLE DATABASE ON LINUX *****
    DIRECTORY=/u02/backup/script/; export DIRECTORY
    cd ${DIRECTORY}
    # ***** SHUTDOWN THE DATABASE *******
    export oracle_sid=RCDB
    srvctl stop database -d RCDB
    # *****cold backup for "RCDB" database on 13-FEB-07 ... *****
    # ***** COPY FILES *****
    # Redo logs
    cp /u02/oradata/RCDB/redo01.log ${DIRECTORY}
    cp /u02/oradata/RCDB/redo07.log ${DIRECTORY}
    cp /u02/oradata/RCDB/redo03.log ${DIRECTORY}
    cp /u02/oradata/RCDB/redo08.log ${DIRECTORY}
    # Datafiles
    #*********START UP DATABASE AND SERVICES********
    srvctl start database -d RCDB
    exit
    Message was edited by:
    ASkika
    Message was edited by:
    ASkika

    I need to put a quick policy backup ... and cold
    backup it's what I use and it works.And reduces the availability of your cluster.
    The problem about RMAN is that we never use it. I
    have to learn about it to make scripts to test....
    and this will tack me 2 or 3 days...I'd assume that installing RAC didn't go overnight, so why underfund the crucial part of any database system, the backup?
    There's even a step by step guide for backup on the Getting Started: DBAs page.
    Samples (and changes) on the latest version of RMAN can be found for example in RMAN Enhancements.
    Or take a look at this Oracle Magazine article:Faster Backup, Faster Recovery
    Backup and Recovery Basics in the user documentation may also be a good starting point.
    C.

  • Database hangs in shutdown immediate for cold backup

    Dear experts ,
    we have scheduled cold backup for our database.
    is there any solution to resolve below mentioned errors other than RMAN hot backup or shutdown abort ?
    Sat Jan 26 00:20:55 2013
    Active call for process 3939 user 'oracle' program '[email protected]'
    SHUTDOWN: waiting for active calls to complete.
    Sat Jan 26 01:15:59 2013
    SHUTDOWN: Active sessions prevent database close operation
    Instance shutdown aborted

    Hi,
    should we daily kill these processes with LOCAL=NO
    what is proposed solution in such cases ?
    is it not harmful for OS or database to kill these processes daily ?Yon can create shell script to find kill session only when you find active calls in your database alert log. You need not have to kill it on daily basis.
    Refer MOS tech notes for more details:
    *Alert Log: Shutdown Waiting for Active Calls to Complete [ID 1039389.6]*
    *What Is The Fastest Way To Cleanly Shutdown An Oracle Database? [ID 386408.1]*
    thanks,
    X A H E E R

  • 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 {} \;

  • RMAN script for hot backup (looking for code critic) code attached.

    Hello Guru's,
    I have been having soem trouble running a successful hot full rman backup nightly.
    We max our CPU load whenever our RMAN takes too long and conflicts with a Legato tape backup. I have a development server that I attempted to get a consistent backup time duration that is rock solid as to not conflict with the Legato backup time.
    I just found out about duration with RMAN scripts here is my code:
    #!/bin/bash
    #rman backup script for daily hot whole database backup
    at -f /hd1/rman_scripts/rman_backup 0600 tomorrow
    rman target/
    run {
    allocate channel d1 device type disk format '/path/%U';
    backup duration 1:00 partial minimize load database filesperset 1;
    backup as BACKUPSET tag '%TAG' database;
    backup as BACKUPSET tag '%TAG' archivelog all delete all input;
    delete noprompt obsolete;
    release channel d1;
    exit
    It completes the backup, but does not use the 1 hour allocated- it only uses 15 minutes on average and creates many files instead of normally three backup files.
    Here is the results from querying the v$rman_status table for operation,status,start_time:
    RMAN,FAILED, 17-OCT-06 0600
    BACKUP,FAILED,17-OCT-06 0600
    RMAN,FAILED,17-OCT-06 0606
    BACKUP,COMPLETED,17-OCT-06 0606
    BACKUP,COMPLETED,17-OCT-06 0606
    BACKUP,FAILED,17-OCT-06 0615
    RMAN,COMPLETED,17-OCT-06 1513
    REPORT,COMPLETED,17-OCT-06 1513
    DELETE,COMPLETED,17-OCT-06 1513
    However, the timestamps of the backupset files it creates is:
    06:15 and not 1513?????????????
    RMAN appears to have only taken 15 minutes to create the files, why do I have a completed timestamp from v$rman_status of 1513???
    Please advise and comment, I am just learning RMAN.

    Try to remove the DURATION option in your script.
    Here more details about that part.
    http://download-east.oracle.com/docs/cd/B19306_01/backup.102/b14194/rcmsynta009.htm#i1010261
    Bye, Aron

  • Need clarification for cold backup and recovery

    Hello Everyone ..
    I have much confusion on cold backup and recovery topic.
    Already i posted a scanario regarding this and i want to know some clarity points to understand.
    1. I had cold backup two days before
    2. I am creating an object *(EMP)* and inserting some records then issue log switch continiously.
    3. Manually i removed all physical files (datafiles , control files , log files , redolog files ...)
    4. then i issued STARTUP FORCE MOUNT;
    5. here i am getting error identifying control file.
    6. cold backup two days before all files restored
    6. then i issue recover database using backup controlfile until cancel;
    7. i am trying to issue select * from emp; i am getting error
    select * from emp
    *ERROR at line 1:
    ORA-00942: table or view does not existMy QUESTION IS
    After cold backup finished , i created emp table ..
    when restoring old back " There is no emp table"
    *- then , can i recover emp table ? - If so , please explain about this ..*
    Note : REF - LINK https://forums.oracle.com/forums/message.jspa?messageID=11056341#11056341
    - Above link says what i did ? . In this thread i am asking concept & logic ..
    please do NOT consider as "*DUPLICATE*"

    When you recover the database using backup controlfile until cancel, you have to apply archived logs. Did you apply all of them?
    If the create command was in the online redo, not yet archived, and you lost the online redo, then you won't have it. This is why you want to have redo multiplexed, it is a critical piece.
    In some recovery scenarios, if you haven't lost the online redo, you need to specify those files as if they were archives.
    It is normally easier to just be sure you have the latest controlfiles and let Oracle figure it out automatically (which is why you want to use online RMAN backups rather than cold backups). But yes, it is important to understand what is going on for different scenarios. I used to have manual standbys, and one of the disaster instruction sets explained to try to get online redo over to the standby to lose as few transactions as possible. That could still be useful for some snapshot hardware type scenarios, assuming the business is too cheap to do proper failovers.

  • Revised script for online backup

    Hi everybody,
    in http://linux-dba.gutzmann.com you can find a revised and
    enhanced version of a script for a full online backup. It
    requires the database to be in archive mode, of course, and
    contains compress steps so you can use it for a disk backup.
    Any comments are welcome.
    Cheers
    Thomas
    null

    Hi mahesh,
    If you are using backup feature from crx console, I mean http://localhost:4502/crx/config/backup.jsp  I can say that we had also some problems with this functionalities.
    First off all what you need to check are the permissions, because when you check a source code there is line which creates a File object using a path specified by you to make a backup of repository.
    File targetDir = new File(req.getParameter("targetDir", listDir.getParentFile().getAbsolutePath()));
    You need to have sure that the proper read write access has been granted for this path.
    Another issue is that maybe there was already prepared some hotfix if you are using CQ5.4. Please refer to the following link:
    http://dev.day.com/content/kb/home/Crx/CrxSystemAdministration/CRXOnlineBackup.html
    and also to this one:
    http://dev.day.com/content/docs/en/crx/current/release_notes/overview.html which contains a hotfix number #34797 which was applied to backup.jsp file.
    Regards,
    kasq

  • Steps for Cold Backup..

    Hi,
    I am new for DBA, i need to take cold backup, can some help me what are all step (commands) i need to follow to perform the successful cold backup.
    Advance Thanks
    Suresh

    Hi Suresh,
    A cold backup is very simple.Hope your Database is test or Development or practise one,If it is production Database You have inform users for suitable downtime depending on size of your Database. You have to peform these basic steps,Which I'm doing it for you:
    Step 1:Find the location of all the physical file(Datafiles,controlfiles,redologs):
    For Datafile:
    SQL> select file_name||' '||tablespace_name||' '||bytes from dba_data_files;
    FILE_NAME||''||TABLESPACE_NAME||''||BYTES
    D:\ORADATA\BOSCHDB\USER123.DBF USER123 104857600
    D:\ORADATA\BOSCHDB\EXAMPLE01.DBF EXAMPLE 104857600
    D:\ORADATA\BOSCHDB\USERS01.DBF USERS 5242880
    D:\ORADATA\BOSCHDB\SYSAUX01.DBF SYSAUX 304087040
    D:\ORADATA\BOSCHDB\UNDOTBS01.DBF UNDOTBS1 26214400
    D:\ORADATA\BOSCHDB\SYSTEM01.DBF SYSTEM 513802240
    For logfile:
    SQL> select group#||' '||member from v$logfile;
    GROUP#||''||MEMBER
    3 D:\ORADATA\BOSCHDB\REDO03.LOG
    2 D:\ORADATA\BOSCHDB\REDO02.LOG
    1 D:\ORADATA\BOSCHDB\REDO01.LOG
    SQL> sho parameter %control%
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string D:\ORADATA\BOSCHDB\CONTROL01.C
    TL, D:\ORADATA\BOSCHDB\CONTROL
    02.CTL, D:\ORADATA\BOSCHDB\CON
    TROL03.CTL
    Step 2: Shutdown the database (IMMEDIATE or NORMAL option):
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    Step 3: Use OS commands or utilities to copy the database datafiles and control files to your backup destination:
    Note 1:Make sure this Backup destination is having enough space
    Note 2:If you are doing in any unix flavour use command cp
    D:\oradata\BoschDB>copy /b *.DBF D:\TESTDB_BACKUP
    EXAMPLE01.DBF
    SYSAUX01.DBF
    SYSTEM01.DBF
    TEMP01.DBF
    UNDOTBS01.DBF
    USER123.DBF
    USERS01.DBF
    7 file(s) copied.
    D:\oradata\BoschDB>copy /b *.LOG D:\TESTDB_BACKUP
    REDO01.LOG
    REDO02.LOG
    REDO03.LOG
    3 file(s) copied.
    D:\oradata\BoschDB>copy /b *.CTL D:\TESTDB_BACKUP
    CONTROL01.CTL
    CONTROL02.CTL
    CONTROL03.CTL
    3 file(s) copied.
    Step 3. Startup the database.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 289406976 bytes
    Fixed Size 1248600 bytes
    Variable Size 130024104 bytes
    Database Buffers 155189248 bytes
    Redo Buffers 2945024 bytes
    Database mounted.
    Database opened.
    Step 4:Verify your Backup.
    D:\>cd TESTDB_BACKUP
    D:\TESTDB_BACKUP>dir
    Volume in drive D is PEACY_DATA
    Volume Serial Number is 9CAF-C076
    Directory of D:\TESTDB_BACKUP
    02/25/2011 11:00 AM <DIR> .
    02/25/2011 11:00 AM <DIR> ..
    02/23/2011 12:15 PM <DIR> Archives
    02/25/2011 10:53 AM 7,389,184 CONTROL01.CTL
    02/25/2011 10:53 AM 7,389,184 CONTROL02.CTL
    02/25/2011 10:53 AM 7,389,184 CONTROL03.CTL
    02/25/2011 10:53 AM 104,865,792 EXAMPLE01.DBF
    02/25/2011 10:53 AM 52,429,312 REDO01.LOG
    02/25/2011 10:53 AM 52,429,312 REDO02.LOG
    02/25/2011 10:53 AM 52,429,312 REDO03.LOG
    02/25/2011 10:53 AM 304,095,232 SYSAUX01.DBF
    02/25/2011 10:53 AM 513,810,432 SYSTEM01.DBF
    02/10/2011 10:03 PM 20,979,712 TEMP01.DBF
    02/25/2011 10:53 AM 26,222,592 UNDOTBS01.DBF
    02/25/2011 10:53 AM 104,865,792 USER123.DBF
    02/25/2011 10:53 AM 5,251,072 USERS01.DBF
    13 File(s) 1,259,546,112 bytes
    3 Dir(s) 2,820,775,936 bytes free
    Hope it helps.
    Best regards,
    Rafi.
    http://rafioracledba.blogspot.com

  • Write a ms dos script for rman backup

    Hi all,
    i wanna write a dos batch file to take the rman backup..
    i have written one...actually there are 2 files. one is for login purpose...other one is for sql commands
    rman.bat-->
    rman target sys/sysadmin@hnbhrm @'c:\rm.sql'
    ==============================
    rm.sql-->
    configure retention policy to recovery window of 7 days;
    configure controlfile autobackup on;
    run {
    alter system switch logfile;
    crosscheck archivelog all;
    crosscheck backupset;
    backup database plus archivelog;
    DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'sysdate -1';
    DELETE NOPROMPT OBSOLETE REDUNDANCY = 1;
    ========================================
    but i have problem in first file rman.bat. it doesnt run at all. but if i write sqlplus / as sysdba instead of rman thing.. then it works fine.
    can anybody tell me whats happening over there please..? Have i done this correctly? or u have some other simple way to do this...
    both files are located in C drive.. and oracle is installed to E drive... oracle path has set already.
    can anybody please give me a hand to solve this issue please...
    Thanks in Advance,
    Max

    write a ms dos script for rman backupImpossible. rman does not support MS-DOS. It is not a 16bit real mode application that can be run inside the MS-DOS operating system.
    So get your terminology straight - the Windows console is a character based 32bit virtual machine. It is not MS-DOS. It never was MS-DOS. Do not confuse the two simply because of superficial similarities. A stick-it note can be yellow - but because it is yellow does not mean it is a banana.

  • Script for RMAN backup

    kindly send the script for RMAN bacup

    Hi,
    About RMAN backup
    http://dbataj.blogspot.com/2007/01/about-rman-backups.html
    About RMAN architechture
    http://dbataj.blogspot.com/2007/01/recovery-manager-architecture.html
    About RECOVERY CATALOG
    http://dbataj.blogspot.com/2006/12/recovery-catalog.html
    RMAN backup script
    http://dbataj.blogspot.com/2007/01/hotfullrmanbkpscirpt.html
    above is my own work on RMAN you have to edit according you needs.
    regards
    Taj

Maybe you are looking for

  • ICloud and iTunes Match with different Apple IDs

    I won't bore you with how it happened, but I ended up with two AppleID accounts using two different email addresses, one for iCloud (upgraded from MobileMe) and one for iTunes.  I enabled iTunes Match before realizing this, and now my iPhone and iPad

  • Security!.... What program should I use?

    Suddenly we realize that the bad guys are now targeting the more-n-more popular Apple products.... As I always predicted, it's a matter of when, not if, they start attacking us with malicious stuff. So what's the best way to protect our Mac?  I've be

  • Opening pdf files

    Why can I not open certain pdf files in my email?

  • Understand MIBC Output

    Hi Gurus, I have a question on MIBC result's output field "%". Based on my understanding, this field displays the percentage of a material's consumption value based on the total consumption value. I run MIBC with below options. With that said, the su

  • Lost my ipad. How do I unpair it from my phone?

    Unfortunately I lost my Ipad whilst travelling on Thursday, I have reported it to the police, lost property at the train station etc. I have changed my passwords etc on my accounts but could someone please advise how I unpair it from my phone? It's p