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

Similar Messages

  • Rman dataguard script for oracle10g

    Dear Friends ,
    I am going to configure oracle10g dataguard on oracle wnterprise linux  5.0 . I am trying to do this configuration
    using RMAN .
      After succesfully configuration of the PRIMARY End as well as I am going to configure standby end .
    n the standby end I have to run the below rman script and got the syntax error :
    [oracle@server dbs]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 12:59:01 2012
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup nomount pfile=initstan.ora
    ORACLE instance started.
    Total System Global Area  217157632 bytes
    Fixed Size                  2211928 bytes
    Variable Size             159387560 bytes
    Database Buffers           50331648 bytes
    Redo Buffers                5226496 bytes
    SQL>
    6) Run RMAN and connect to the Standby database and make an auxiliary connection to the Primary database like below :
    bash-3.2$ rman target sys@prim
    Recovery Manager: Release 11.2.0.3.0 - Production on Fri Mar 24 10:54:37 2000
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    connected to target database:PRIM (DBID=1247570709)
    RMAN> connect auxiliary sys/sys123@stan
    connected to auxiliary database: STAN (not mounted)
    RMAN
    run {
          allocate channel prmy1 type disk;
      allocate channel prmy2 type disk;
      allocate channel prmy3 type disk;
      allocate channel prmy4 type disk;
            allocate channel prmy5 type disk;
      allocate auxiliary channel stby type disk;
      duplicate target database for standby from active database
      spfile
      parameter_value_convert 'prim','stan'
      set db_unique_name='prim'
      set db_file_name_convert='/u01/app/oracle/oradata/prim/','/u01/app/oracle/oradata/stan/'
      set log_file_name_convert='/u01/app/oracle/oradata/prim/','/u01/app/oracle/oradata/stan/'
      set control_files='/u01/app/oracle/oradata/stan/control01.ctl','/u01/app/oracle/oradata/stan/control02.ctl','/u01/app/oracle/oradata/stan/control03.ctl'
      set log_archive_max_processes='5'
      set fal_client='stan'
      set fal_server='prim'
      set standby_file_management='AUTO'
      set log_archive_config='dg_config=(prim,stan)'
      set log_archive_dest_2='service=prim  ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=prim'
      NOFILENAMECHECK
    Each and every time when I run the above script  got the below error :
    RMAN> 2> 3> 4> 5> 6> 7> 8>
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01009: syntax error: found "from": expecting one of: "dorecover, db_file_name_convert, nofilenamecheck, ;"
    RMAN-01007: at line 9 column 39 file: standard input
    RMAN>
    RMAN>
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01009: syntax error: found "identifier": expecting one of: "allocate, alter, backup, beginline, blockrecover, catalog, change, connect, copy, convert, create, crosscheck, configure, duplicate, debug, delete, drop, exit, endinline, flashback, host, {, library, list, mount, open, print, quit, recover, register, release, replace, report, renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, switch, spool, startup, shutdown, send, show, test, transport, upgrade, unregister, validate"
    RMAN-01008: the bad identifier was: parameter_value_convert
    RMAN-01007: at line 2 column 1 file: standard input
    Does anybody please correct the above script for 10g or if there any document for configuring oracle10g dataguard
    using RMAN , then please help me .
    Thx in advance .. ..

    shipon_97 wrote:
    Dear Friends ,
    I am going to configure oracle10g dataguard on oracle wnterprise linux  5.0 . I am trying to do this configuration
    using RMAN .
      After succesfully configuration of the PRIMARY End as well as I am going to configure standby end .
    n the standby end I have to run the below rman script and got the syntax error :
    You cannot use FROM ACTIVE DATABASE - option, If your database version is 10g .
    Regards
    Mahir M. Quluzade

  • Script for daily Incremental Backup with Weekly full back?

    Hi Can abybody plz give me the scrip for the daily incremental backup and weekly full backup.
    Do we need 2 different scripts each for Incrmental and Full Backup or one will do.
    Thanx in advance
    Gagan

    I will suggest you always
    -backup archivelog daily when after yours backup database completion
    -keep two days archivelog out of yours database storage to others device or
    always take frequent archivelog to tape cartrideg after an hour depends yours
    database activity pace.
    You should also include archivelog backup within these backup scripts to others teriotry device i.e tape cartridge as well keep frequent archivelog backup if you think yours backup storage space is an issue or if you dont trust on yours backup storage media,keep an alternate tape cartridge for archivleog for frequent archivelog backup after every one hours depends the pace of yours database activity.Either backup archivelog frequently or multiplex the archvivelog to other devices.
    Now you probably may confuse thats why i need archivelog backup command within this script when i am going to take incremental/full backup, its due to some thing happened with yours last backup got corrupted then you have alternate to restore before last backup.
    Mon      Incremental + Archivelogs
    Tue       Incremental + Archvielogs
    Wed      Yours Database files got smokesWhat will you do
    You will restore Tue backup and will apply alls redo from archivelogs which are generated to other devices yours data chances to be lost is minumum.You may lose only the current archivelog which is not yet to be log switched.If yours archivelog destination devices may corrupt then you have alternate to restore from tape cartridge.
    If yours Tue backup cannot be restored even though you validate it after backup then you will have alternate to restore monday backup and you have backup of tue archivelog as well yours two days archivelog is also at another device then you may also recover the database till before crash.In this case you may lose only the current archivelog which is not yet to be log switched.
    You cannot pile up archivelog to others device cause they begin to take a serious issue on disk thats why i mentioned two days archivelog to other device.
    I hope now you clear why archivelog backup is essential with daily backup either its incremental or non incremental.
    Khurram

  • Scripts for exp and imp in linux

    please give me some links for exp and imp tables peridical bactch script in oracle 10 R2 over RHEL 4.5.

    user13653962 wrote:
    please give me some links for exp and imp tables peridical bactch script in oracle 10 R2 over RHEL 4.5.try this.. change the same script for your environment
    $ crontab -l
    00 22 * * * sh /u01/db/scripts/testing_user1.sh
    $ cat /u01/db/scripts/testing_user1.sh
    . /home/oracle/TEST1.env
    export ORACLE_SID=TEST1
    export ORA_USER=dbdump
    export ORA_PASSWORD=dbdump
    export TNS_ALIAS=TEST1
    expdp $ORA_USER/$ORA_PASSWORD@$TNS_ALIAS tables=YOUR_tables_NAMEs  dumpfile=TEST_`date +'%Y-%m-%d`.dmp directory=YOUR_DUMPDIR logfile=TEST_`date +'%Y-%m-%d`.logif you need for original export change the exp command,
    exp username/password tables=table_name1,table_name2,etc... file=your_file_name log=your_log_file_name

  • ARCHIVELOG mode needless for offline (cold) backups ?

    When I read some tutorials or comments about backup with rman or expdb I saw often the recommendation to put database in ARCHIVELOG mode.
    But this is from my point of view useless when I do such a backups in offline mode.
    I want to backup the current state of the database - full stop.
    Redo logs from ARCHIVELOG are not necessary. Only if I want to go further back from the current state back to the past they are of use.
    Am I right?
    Peter

    Data pump does not require or use archivelog mode for importing, or exporting.
    The archivelog mode is required, however, for RMAN backups, except for full database copy which it copies while the database is shutdown.
    The Data Pump utility uses a parameter called FLASHBACK_SCN (and FLASHBACK_TIME) which reads the undo data, but not to be confused with archivelogs.
    NOTE that if you set archivelog mode on, you may want to either turn off archivelog mode when importing, or set the tabelspaces to nologging (then back to logging when done). Otherwise, it may cause enough archive logs during import to fill up your file system.
    Re: http://www.oracle.com/technology/products/manageability/database/pdf/ow06/Motorola_datapump.pdf
    Hope this helps.
    ji li

  • Pleaseprovide the script for the tape backup

    Hi All,
    I am a new to Oracle Apps DBA.Here, the client needs to take the full Tape backup of a Oracle Apps GL Server.
    Please help me in this regard.
    Thanks

    You should use CONFIGURE CHANNEL DEVICE TYPE sbt.
    Check Configuring SBT Channels for Use with a Media Manager for the full details.

  • Scripting for Windows Server Backup for Exchange 2010

    Hi,
    I'm new to writing scripts and was wondering if anyone could assist with writing a script to backup an Exchange Server in a windows 2008 r2 environment.  I currently use Windows Server Backup with a full VSS backup to run exchange backups, however,
    each backup overwrites the previous one, and i would really like to have multiple backups.  I would also like  to specify backup log locations, and have emails sent upon successful backups or failed backups.  I am trying to write this powershell
    but cant seem to get things to work.
    Thanks
    Debbian

    You can use PowerShell in conjunction with the Windows Backup command line utility, wbadmin.exe. The code below should help get you started. I have included the date in order to help maintain multiple back ups, but if you do more than one back up per day,
    you will need to change the date format to include the time. You cannot control the built in logging of Windows Backup, but you could collect your own backup information and write that out to a text file. As far as sending emails, look into the Send-MailMessage
    cmdlet including the -Attachment parameter that could send your log file with your mail message. Cheers.
    $Date = Get-Date -Format 'MM-dd-yyyy'
    $Path = "\\server\share\$Date"
    New-Item -Path $Path -ItemType Directory | Out-Null
    Start-Process wbadmin.exe -ArgumentList "start backup -backupTarget:$Path -allCritical -vssFull -quiet"

  • RMAN script for RAC Hot Backup

    Anyone who want to share an RMAN script to Hot Backup a 9i RAC Database.

    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

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

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

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

  • Cold Backup

    Hi,
    I am doing the following steps for taking Cold Backup
    of my Oracle 9i Database (On Solaris).
    The Database is not enabled for Archive Mode.
    a)sqlplus /nolog
    b)conn / as sysdba
    c)start up
    d)alter database backup control file to '/backup/control.ctl'
    e)alter database backup control file to trace
    f)shutdown immediate
    g)exit
    h)Manually copy all the .dbf and init.ora files to a seperate directory.
    Are all the above steps correct.
    If yes,can anyone give me a script which i can run manually so as to take the cold Backup.
    Regards
    Deepak

    Here is a scrip which I wrote to take a cold backup.
    REM
    REM Script for backing up the I2ORADEV database running in NOARCHIVELOG mode.
    REM Created by Deepak Jaisingh on 24.11.2003.
    REM
    PROMPT
    PROMPT Backup started for I2ORADEV.
    PROMPT
    REM
    REM Stop the listener to restrict access.
    REM
    HOST LSNRCTL STOP;
    PROMPT Listerner stopped.
    PROMPT
    PROMPT
    PROMPT Shutting down I2ORADEV for backup.
    shutdown immediate;
    PROMPT
    PROMPT Backing up database, redolog and control files.
    HOST COPY G:\oracle\oradata\apildata\* D:\BACKUP\ORADATA\I2ORADEV\;
    HOST COPY G:\ORACLE\ORADATA\I2ORADEV\* D:\BACKUP\ORADATA\I2ORADEV\;
    PROMPT
    PROMPT Backup for database, redolog and control files complete.
    PROMPT
    PROMPT Starting I2ORADEV.
    startup;
    REM
    REM START the listener.
    REM
    HOST LSNRCTL START;
    PROMPT Listerner started.
    PROMPT
    PROMPT Backup for I2ORADEV complete.
    PROMPT

  • About hot & cold backups in rman

    Hi all,
    I've found out that with rman 9i the following script:
    - shutdown immediate;
    - startup mount;
    - backup database plus archivelog;
    - alter database open;
    is what I need for a cold backup; somewhere somehow I've caught a glimpse about
    this script
    - backup database plus archivelog;
    which 'should' be able to produce a reliable hot backup, but actually Oracle docs
    is not crystal clear on this point: I'd rather ask if:
    a/ would "backup database plus archivelog" create an usable full backup on
    a 9i archivelogged db?
    b/ would the same statement work on a 8.1.7 archivelogged db? (yes, the syntax is different...)
    hope somebody may shed some light
    thanks for help,
    daniele rizzi ([email protected])

    backup database plus archivelog; is a 9i RMAN command so it cannot be used in 8i. Here is what it does as stated in the Oracle9i Recovery Manager User's Guide and Reference:
    Backing Up Logs Using BACKUP ... PLUS ARCHIVELOG
    When backing up objects other than archived logs, you can specify BACKUP ... PLUS ARCHIVELOG to include backups of archived logs. The command performs the following sequential actions:
    - Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.
    - Runs BACKUP ARCHIVELOG ALL. Note that if backup optimization is enabled (refer to "Backing Up Files Using Backup Optimization"), then RMAN skips logs that it has already backed up to the specified device.
    - Backs up files specified in BACKUP command.
    - Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.
    - Backs up any remaining archived logs generated during the backup.
    From what I read it backs up all current archivelogs, backs up the datafiles, and backs up any remaining archivelogs created during the datafile backup. It basically makes it easier to backup the archivelogs by not having to issue a archvielog backup before and after the datafiles to ensure all archivelogs are backed up.

  • Cold Backup ERROR ORA-01113

    Hi Friends,
    Oracle 10g R2 DB
    I have taken a cold backup pf my database.
    I shutdown the db, and copy all the datafile,logfile,controlfile to /u01/BACKUP_DB.
    Then I tried to test my backup by pointing all the dbfs to /u01/BACKUP_DB.
    startup mount
    alter database rename file ... to ...;
    alter database open;
    ORA-01113: file 1 needs media recovery
    ORA-01110: data file 1 '/u01/BACKUP_DB/system01.dbf'
    Where did I go wrong? :(
    I am sure I shutdown the database.
    Thanks a lot

    Why do I get ORA-01113 for the cold backup?
    To get some clue why ora-01113 error comes during backup and recovery review following link.
    I  recreated controlfile, but recover database failed!
    Khurram                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Upgrade scripts for other platforms...

    We are in a need for upgrade scripts (Portal 3.0) for other platforms like HP-UX, when will these be available?
    Or can we use the scripts for the other Operating Systems, provided we invoke them from that O/S?
    thanks
    Tim
    null

    We'll be posting new versions of the upgrade scripts for HP-UX, IBM AIX, Linux and others shortly on OTN. (I don't have an ETA, but it won't be long, I think). Earlier versions of these upgrade scripts have also been posted to metalink.oracle.com.
    Best Regards,
    Harry

Maybe you are looking for

  • Monospace Font question

    I am somewhat new to Oracle forms, i am using 10G so don't shoot me if these are dumb questions. I want to left align my Prompts on my form but using Tahoma or Verdana the alignment is always off. I fixed it by using a monospace font like Courier but

  • Inspection lot creation after receipt of certain quantities?

    Gurus, My user requires the creation of an inspection lot of 1 piece after the receipt of 200 pcs in stock as a kind of audit. This is not a goods receipt feom production as it will be done for each piece. .but was is needed is an event to create a l

  • I need to add symbols!!

    Hello there and Greetings, I need to add a few symbols to my keyboard, but I don't know how to do it. I need to add a registered symbol and a copyright symbol. I have been looking on my mac for hours and can't find out how to do it, and I can't find

  • Upgrading from iPhoto 2 to iPhoto 5

    I am about to upgrade to iPhoto 5. Aside from having a backup of all my pictures, what else (if anything) should I do before upgrading? After I upgrade? Any other suggestions? Thanks.

  • Issue with Chinese Translations not picked up in Extended Notifications

    All Gurus, We are on ECC 6.0 with the below settings. SAP_BASIS     700     0015     SAPKB70015     SAP Basis Component SAP_ABA     700     0015     SAPKA70015     Cross-Application Component We have been using Extended Notifications for quite some t