A decent cold backup script

Oracle version : 11G release 2
Platform : AIX
After going through various OTN posts, i wrote the below Cold backup script (Untested). If there are any unnecessary stuff or enhancements required, please let me know
$ rman target /
RMAN>
run
     allocate channel c1  type disk format '/u05/rmanbkp/%d_COLD_DB_%u';
     sql 'alter system archive log current';
     shutdown immediate;
     startup mount;
     backup database including current controlfile tag='mydbname_full_bkp';
     backup spfile tag = 'mydbname_SPFILE';
     release channel c1;
}

Hi T.Boyd
What do you guys think of the backup script? Any room for improvement? I found in a small percentage of the shutdown immediate commands issued, the instance hangs (specially when the machine is very busy).
I have modified my rman coldbackup the procedure to:
shutdown abort;
host 'sleep 3';
startup restrict;
shutdown immediate;
startup mount;Maybe you can add more channels to improve performance. You can use more resources as there are no users on the database anyway....
Regards,
Tycho

Similar Messages

  • RMAN Cold backup script

    DB version :10.2.0.4
    Do you find anything wrong in the below mentioned RMAN cold backup script? Any enhancements, corrections required?
    shutdown immediate;
    startup mount;
    backup database including current controlfile tag='full_bkp';
    startup;
    crosscheck backup;
    delete noprompt obsolete device type disk;
    resync catalog;
    }

    Since you are doing a SHUTDOWN IMMEDIATE and STARTUP MOUNT before the BACKUP, there will be no ArchiveLogs generated while the backup is running --- as the database is not OPEN.
    However, the PLUS ARCHIVELOG can include ArchiveLogs that had been generated from the previous STARTUP or ALTER DATABASE OPEN.
    (In that case, I would suggest an SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT' before the SHUTDOWN IMMEDIATE).
    Is your database running in ARCHIVELOG mode ? If not, then this discussion is moot.
    If yes, the next question is, obviously : Why not take a Hot Backup while the database is running (in which case you MUST backup archivelogs !)
    Hemant K Chitale

  • Cold backup script

    Hi,
    i want to make a cold backup and schedule it in CRON, but don't know why but it doesn't work. This is what i've in de "full.rman" file:
    connect target /
    shutdown immediate;
    startup mount;
    backup database as compressed backupset;
    crosscheck backup;
    delete expired backup;
    alter database open;
    exit
    i tried to run this script by rman @full.rman
    but when i do this i'm getting the following error:
    RMAN> backup database as
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01009: syntax error: found "as": expecting one of: "archivelog, backup, backupset, channel, copy, controlfilecopy, current, database, datafile, datafilecopy, delete, diskratio, db_recovery_file_dest, filesperset, format, from, force, include, keep, (, maxsetsize, noexclude, nokeep, not, pool, plus, reuse, recovery, ;, skip, spfile, setsize, tablespace, tag, to"
    RMAN-01007: at line 1 column 17 file: full.rman
    In the past i had another error where it looked like it wasn't shutting down the database and starting it up in mount mode. So how can i make a script what wil do what i want :)
    Thanks in advance.
    regards,
    Osman

    Try:
    backup as compressed backupset database;

  • 10g windows cold backup script ...

    we have 10g db on windows server.
    I wnat to perform cold backup of db everyday night.
    at present I am in process on writting .bat to shoudown 10g db
    I nee .bat file to shutdown 10g database

    user580175 wrote:
    Script .bat shutdown database:
    C:\oracle\product\10.2.0\bin\oradim -shutdown -sid ORCL -shuttype INST -shutmode immediate
    Script .bat startup database:
    C:\oracle\product\10.2.0\bin\oradim -startup -sid ORCL -usrpwd oracle -starttype INST -pfile C:\oracle\admin\10.2.0\pfile\initORCL.oraYou might want to get rid of pfile section if using spfile.

  • Cold Backup Script for windows

    Hi,
    I have the following script for windows
    set pages 0 lines 500;
    set heading off echo off feedback off verify off pagesize 0;
    select 'copy ' || name || ' c:\BACKUP\COLD_BACKUP\ORADATA\' from v$datafile
    union all
    select 'copy ' || name || ' c:\BACKUP\COLD_BACKUP' from v$controlfile
    union all
    select 'copy ' || member ||' c:\BACKUP\COLD_BACKUP' from v$logfile
    union all
    select 'copy ' || name || ' c:\BACKUP\COLD_BACKUP' from v$tempfile;
    exit;
    In the above script I have given COLD_BACKUP directory for Backup....But what i want is Dynamically it should create the Directory with timestamp in COLD_BACKUP Directory and copy the files to that directory..
    for example
    script should create like this
    c:\BACKUP\COLD_BACKUP\ORCL_11112007
    Like that..it should create the ORCL_11112007 directory and copy the files....
    how can i acheive this...I know we can do it in UNIX..
    But in windows..how we can acheive this...please help me

    You can try to adapt the following SQL*Plus script to create a directory:
    set echo on
    alter session set nls_date_format = 'DDMMYYYY';
    var dd varchar2(10);
    begin
    :dd := trunc(sysdate);
    end;
    set echo off
    spool mkd.sql
    set heading off
    select 'host mkdir ' || :dd from dual;
    spool off
    set echo on
    @mkd.sqlOutput is:
    dev001> alter session set nls_date_format = 'DDMMYYYY';
    Session altered.
    dev001> var dd varchar2(10);
    dev001>
    dev001> begin
      2  :dd := trunc(sysdate);
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    dev001>
    dev001> set echo off
    host mkdir 08112007
    dev001> @mkd.sql
    dev001>
    dev001> host mkdir 08112007
    dev001>
    dev001>
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Simple cold backup script

    I am a linux newbie and I need a simple script that will do the following for me. I am using Oracle 11g and RHEL 6 ....I wanting to use VI to write a script and schedule it nightly....
    1.) shutdown the database
    2.) copy the dbf's and maybe the archivelogs
    3.) start the database
    Then I am hoping to copy the dbf's to another server and clone.
    thanks for the help
    Edited by: user2857110 on Jan 4, 2012 8:10 AM

    This is the coolest way to clone:
    SYS password must be the same on both databases.
    In this RMAN code you will see the labels "Target" and "Auxiliary". Just remember that the "Target" is the DB you will be cloning FROM. It is more like the "Source". The "Auxiliary" is the DB that you will be cloning TO. The "Auxiliary" will be completely erased and replaced by the "Target".
    Must be able to SQLPlus to the "Auxiliary" DB from the command line of the server that hosts the "Target" DB.
    The "Auxiliary" database needs to be mounted but not open.
    Then run this. (I run it from the server that hosts the "Auxiliary" DB)
    rman target sys/password@PROD
    connect auxiliary sys/password@TEST
    run
    allocate channel c1 device type disk;
    allocate auxiliary channel c2 device type disk;
    duplicate target database to TEST from active database nofilenamecheck;
    }

  • Cold backup using script

    Dear all,
    I need a script to take cold backup of oracle database 10.2.0.3.0 .. such that if todays date is 28-oct-08.. then a folder with the name 28oct08 to be created in the backup location.then using the script user should login to the database shutdown the db and listener and make sure this is completely down and copy the complete oracle files and home location to the above mentioned folder in the server.. any links or points will help a lot ?
    Kai

    Kai, rather than write a script to perform a cold backup for whatever platform you are on I suggest you write a script to generate the cold backup script. The script can connect to the database, read various v$ and dba views such as dba_data_files to get the necessary data file information, and place the file names into OS copy commands. The resulting script should probably include steps to connect to and stop the database and to restart the database instance when it is complete.
    Be sure to include a copy of your control file and the spfile in your backup. You do not need to include the online redo logs in your manual cold backup.
    An alternate might be to run an rman backup while the database is in restricted session depending on how freely your site has given out the DBA role and/or restricted session privilege.
    HTH -- Mark D Powell --

  • Cold backup automated script

    Hi--
    Can any one provide me one cold backup script,,with that i need to delete 2 days old backup and need to put current backup in that mountpoint.
    Thanks in advance.

    user8683962 wrote:
    We are not using RMAN So what is preventing you from starting? The real value of rman will be when you have to recover, it will already know where all the necessary peices are and what needs to be done. Plus, it will take care of the housekeeping of deleting your old, obsolete backups.
    and Hot backups.....So you don't care if you lose any changes that occur between your cold backups?
    i want to take a cold backup of my database every day and delete need to delete 2 days old backup, so that i can maintain 2 backups(today's and yesterday's) in my hand... Again, rman will do this for you, and more, and much more simply
    for this can any one provide me a script to make it automate by adding to crontab.If someone else hasn't by the time I get back to my hotel room this evening, I'll post an rman solution. It is a waste of time to work on a non-rman solution.

  • User tablespace did not copy during cold backup

    Can anybody explain why this happened and how to fix?
    I was doing regular weekly coldbackup and all other tablespaces got copied except user tablespace. I can not find any error in alert log and windows event log. The file size is 25G. Any idea?
    Thanks

    The original poster has declared that this a cold backup, so presumably no BEGIN/END BACKUP involved here. Further, how would those commands do anything to cause a backup script to SKIP the files for a tablespace?
    As for the OP's problem, I will guess that this is occurring on Windows. Because the default flag that Windows programs use to open files often specify exclusivity, many backup scripts and packages will not be able to open (or copy) a file that is open by another process. Notably, if the backup is hitting such a problem it should be receiving (and hopefully logging) and error.
    I can't guess what other program might have had the files open, but if Oracle did not successfully shut down completely, or if some threads failed to exit during shutdown, you would end up with some files with open filehandles. That would prevent commands like COPY from working on those files.
    Solutions (if this is windows and my theory holds water) would include:
    - Providing exception handling in the cold backup script to verify that Oracle has shutdown completely and that no Oracle threads remain.
    - Switching to ocopy.exe (Oracle nonexclusive copy program for Windows) so that the backup would not fail on files with open filehandles. I guess this is a little reckless since the database could be open and the cold backup could proceed heedless of that fact.
    - Use process explorer to track down what program has the files open after shutdown.
    Hope this helps,
    Jeremiah Wilton
    ORA-600 Consulting
    http://www.ora-600.net

  • Cold backup for dataguard dbs

    There is request to take cold backup of primary & standby db , i am New to dataguard backups, Should i take backup of only primary db or both?

    Yes apps owner is insisting to take cold backup of both db this weekend(they are patching apps), and here are the step i had in mind to do that to stop , primary & llogical standby dbs , take cold backups ( scripts, usermanaged backups, dont have rman there) & start the dbs.
    On standby db
    SQL > set numformat “999999999999999”
    SQL > select newest_scn,applied_scn from dba_logstdby_progress ; (both should match)
    SQL > select thread#,sequence#,applied from dba_logstdby_log;
    SQL> select sequence#, status from v$archived_log;( on primary) Both sequence# should match
    on primary db
    SQL > alter system switch logfile ;
    SQL > alter system archive log current ; ( to make sure current transactions come thru)
    check tail of alert log of standby to make sure these redologs shipped & mined
    standby db
    SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY; (stop SQL Apply)
    SQL> shutdown immediate;
    Lsnrctl stop listener_corp_remrpt-haprimary db
    SQL > shutdown immediate ;
    Lsnrctl stop listener_corp_remprd-ha
    Dont shutdown abort for any case, if both dbs are going down, first stop SQL apply on standby, take primary down and then take standby down)
    Startup
    primary
    SQL>startup;
    Lsnrctl start listener_corp_remprd-ha
    Standby
    SQL > startup
    SQL > alter database start logical standby apply immediate ;
    Lsnrctl start listener_corp_remrpt-ha

  • A script for oracle10g cold backup on linux

    Hi,
    I have a urgent need to do a cold backup using o/s command. Can anyone please send me a script for this.
    Thanks in advance
    PK

    I ended up writing the script
    define 3 = &backup_directory
    define 4 = &instance_name
    define 5 = &user_dump_directory
    Set Heading Off
    Set Verify Off
    Set FeedBack Off
    Set LineSize 132
    Set PageSize 1000
    set termout off
    Spool cold_back.sql
    select 'connect /as sysdba' from dual;
    Select 'Startup Force' || CHR(10) ||
    'Shutdown Normal' From Dual;
    select '! mkdir '||'&&3'||'/'||to_char(sysdate,'yyyyddmm') from dual
    /* Data Files */
    Select '!cp ' || File_Name || ' &&3'||'/'||to_char(sysdate,'yyyyddmm') || CHR(10) ||'!gzip ' || '&&3' ||'/'||to_char(sysdate,'yyyyddmm')|| '/' || SubStr(File_Name, InStr(File_Name, '/', -1)+1) From Sys.DBA_Data_Files
    /* Redo Log Files */
    Select '!cp ' || Member || ' &&3'||'/'||to_char(sysdate,'yyyyddmm') || CHR(10) || '!gzip ' || '&&3'||'/'||to_char(sysdate,'yyyyddmm') || '/' || SubStr(Member, InStr(Member, '/', -1)+1) From V$LogFile
    /* Control Files */
    Select '!cp ' || name || ' &&3'||'/'||to_char(sysdate,'yyyyddmm') From V$controlfile
    /* Init and Config Files */
    Select '!cp $ORACLE_HOME/dbs/init&&4' || '.ora &&3'||'/'||to_char(sysdate,'yyyyddmm') From Dual
    alter session set tracefile_identifier=coldbackup
    alter database backup controlfile to trace
    select '!mv '||'&&5/*COLDBACKUP*' ||' &&3'||'/'||to_char(sysdate,'yyyyddmm') FROM dual
    Select 'Startup' From Dual;
    Select 'Exit' from dual;
    set termout on
    PROMPT " Run the output cold_back.sql script [sqlplus -s '/as sysdba' @cold_back.sql ]"
    Spool Off
    -----------------------

  • 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

  • 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.

  • Scripted Cold Backups / Archived Logs / Flashback

    Facts:
    uname -a:
    SunOS {hostname omitted} 5.8 Generic_117350-39 sun4u sparc SUNW,Sun-Fire-V240
    select * from v$version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for Solaris: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Archivelog enabled
    Flashback enabled
    db_flashback_retention_target = 7200 (5 days)
    archive_lag_target = 1800 (30 minutes)
    No, we are not using rman (yet). This system does not have a 24/7 SLA, so we run a cold backup every Saturday: a shell script shuts down the database and copies all the necessary files to a safe location on another host.
    We do have one problem: an accumulation of archived logs. I know that we don't need to keep the logs older than the latest cold backup, but I am unsure of the correct way to clean them up, especially given that we have flashback enabled. Any suggestions?
    Thanks!

    I think maybe I just found the answer to my own question.
    Upon examining the flashback_recovery_area more closely, I see an archivelog directory and a flashback directory, which contains a number of flb files going back to 12/14 (today is 12/20). This makes a certain amount of sense since we have the flashback retention target set to 5 days.
    Would I be correct in stating that the flashback files are self-managing and completely independent of the archived logs?
    Would I also be correct in stating that I can happily delete the archive logs older than my last cold backup?
    The thing which gives me pause is that I swear I remember reading somewhere that flashback uses the archived logs. Did I misunderstand something?

Maybe you are looking for

  • My ipod classic will not play any of my sounds on it...can anyone tell me how to solve this problem?

    hi i am looking for help..i recently added new music to my ipod but it does not play them at all, i can press everything and nothing is stuck but it just wont start to play. i have checked the music volume to see if that was the problem but the sound

  • Width Wrong for Imported Graphics in Frame 9

    Has anyone else had issues with Framemaker detecting the wrong width when importing graphics?  As an example, when I import a JPG of a button that should be 21 x 21 pixels, Framemaker displays the width as 24px and the height as 21px.  This results i

  • Store Order Surcharges and Discount to Post to Warehouse Cost Center?

    Dear All In an order from store to warehouse, our setting is such that if there is a logistic charge, it will post to the store's profit center as per below as the Store is the receiving site in the document. From PK     GL             Desc          

  • The start!!

    Hi experts,    i am new to XI. I know about some adapters like file,idoc,rfc,http,jdbc. My question is, 1. Apart from these adapters, what are the other adapters that are used most in projects in real time. 2. I also request you to kindly send me inf

  • Adobe Document Services Need Seperate Licence ?

    Dear All,             To activate Adobe Document Services, do we need seperate licence and does that need to be installed seperately on ERP 6.0 ? , Do we need to order /download required components ? Please advice. N