Monday, June 17, 2013

RMAN Script for taking backup of Oracle Database through TSM 6.x

[oracle@oraxxxx ~]$ ls -l
-rwxr--r-- 1 oracle oinstall   460 Feb 18 16:03 rman_bkp.sh
-rwxr-xr-x 1 oracle oinstall   106 Feb 13 16:49 rman.sh

[oracle@oraxxxx ~]$ cat rman.sh
export ORACLE_BASE=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=orcl
rman target / @rman_bkp.sh

[oracle@oraxxxx ~]$ cat rman_bkp.sh
run
{
allocate channel sbt1 type sbt parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
crosscheck archivelog all;
BACKUP FORMAT '/orcl/bk_%s_%p_%t'
    DATABASE;
    sql 'alter system archive log current';
BACKUP
    filesperset 20
   FORMAT '/orcl/al_%s_%p_%t'
   ARCHIVELOG ALL;
BACKUP
    FORMAT '/orcl/cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
delete noprompt expired archivelog all;
delete noprompt obsolete;
RELEASE CHANNEL sbt1;
}

[oracle@oraxxxx ~]$ ./rman.sh
            :
          :
sql statement: alter system archive log current
released channel: sbt1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 06/17/2013 15:39:20
RMAN-11003: failure during parse/execution of SQL statement: alter system archive log current
ORA-01109: database not open

Note: Database is not open. Check & Correct as below.

[oracle@oraxxxx ~]$ sqlplus "/ as sysdba"
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.
Total System Global Area 1052233728 bytes
Fixed Size                  2220032 bytes
Variable Size             792723456 bytes
Database Buffers          251658240 bytes
Redo Buffers                5632000 bytes
Database mounted.
Database opened.

SQL> quit

No comments:

Post a Comment