8 Replies Latest reply: May 10, 2013 6:32 PM by jgarry RSS

    database backup through batch file

    1005961
      hi...

      can anybody tell me how to backup my oracle 11g database with the help of a .bat file.
      what will be the script of the file???say my database is in c drive and i want to take the backup of the database into another drive through the .bat file.also i want to keep a link in the application which has been developed in forms 6i to call the .bat file to backup my database automatically.if possible plz help ..
        • 1. Re: database backup through batch file
          Sunny kichloo
          You are using RMAN or something else for database backups.

          For RMAN:

          http://www.oracle-dba-support.com/2011/09/automating-rman-via-bat.html
          • 2. Re: database backup through batch file
            sybrand_b
            Oracle 11g comes with database control, which you run through your browser.
            In database control there is an option to submit a backup.
            Your .bat file is not required, and there is no reason to run a backup through your application, as database control is already taking care of that.

            ----------
            Sybrand Bakker
            Senior Oracle DBA
            • 3. Re: database backup through batch file
              1005961
              ya Sunny ,m using RMAN
              Sunny where and how to set the destination path of the backup in the two files means the location of the backup file???
              And is there any need of assigning the SID variable?
              because if i have more than one database and i want to backup a particular database then how can i do that??
              plz excuse if i made a stupid question.if possible plz help..

              Edited by: 1002958 on May 10, 2013 5:33 AM
              • 4. Re: database backup through batch file
                Ashish
                Since you mentioned you are having multiple database hosted on the system. You need to set the sid.

                user set SID="sid_name" before rman command.
                • 5. Re: database backup through batch file
                  DK2010
                  Hi,

                  You can use something like that
                  -- in .rcv file
                  run {
                  allocate channel d1 type disk format '<path>/file_name_t%t_s%s_p%p.rmn';
                  allocate channel d2 type disk format '<path>/file_name_t%t_s%s_p%p.rmn';
                  backup database plus archivelog;
                  release channel d1;
                  release channel d2;
                  }
                  exit
                  
                  -- in bat file
                  
                  set ORACLE_SID=<sidname>
                  set ORACLE_HOME=<oracle_home>
                  rman target / cmdfile <rcvfilename> log <logfilename>
                  HTH
                  • 6. Re: database backup through batch file
                    1005961
                    THANKS DK..

                    are the channel d1 and d2 for source and destination respectively??
                    where to write the script of user name and password??
                    and can u plz tell me ,,say i want to keep two backup directory at my destination, one for the previous backup and another one for the current backup.this is because if previous one is needed to restore.and if another new backup occurs again then i store the backup files in the current directory but before storing, whatever in the current backup directory should be moved to the previous directory with overwriting.
                    • 7. Re: database backup through batch file
                      DK2010
                      Hi,

                      I Think you should go through the link first

                      http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmbckba.htm
                      • 8. Re: database backup through batch file
                        jgarry
                        In addition to what the others say, if you have a separate PC you can download XE on, it has some informative examples on how to do it.

                        But I'd second the dbconsole way, it helps with keeping logs of backups organized and the database scheduling is better than bat files.