How to do RMAN Scripting
Manual RMAN Script execute
[oracle@dg1 backup_script]$ cat /u01/app/oracle/backup_script/fullbackup.rs
backup database format '/u01/app/oracle/backup_script/delhi%u.rman' tag 'fullbackscript';
[oracle@dg1 backup_script]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Jun 1 12:42:36 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DELHI (DBID=3274584472)
RMAN> @/u01/app/oracle/backup_script/fullbackup.rs
RMAN> backup database format '/u01/app/oracle/backup_script/delhi%u.rman' tag 'fullbackscript';
Starting backup at 2025-06-01:12:44:22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=147 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_system_mqz6odrj_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_sysaux_mqz6p5vm_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_undotbs1_mqz6pny7_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_users_mqz6pp19_.dbf
channel ORA_DISK_1: starting piece 1 at 2025-06-01:12:44:23
channel ORA_DISK_1: finished piece 1 at 2025-06-01:12:44:26
piece handle=/u01/app/oracle/backup_script/delhi463qtsd7.rman tag=FULLBACKSCRIPT comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2025-06-01:12:44:26
Starting Control File and SPFILE Autobackup at 2025-06-01:12:44:26
piece handle=/u01/app/oracle/fra/DELHI/autobackup/2025_06_01/o1_mf_s_1202647466_n3qzgl9j_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2025-06-01:12:44:27
RMAN> **end-of-file**
Script Execute in Recovery catalog
[oracle@dg1 backup_script]$ cat /u01/app/oracle/backup_script/fullbackup.rs
backup database format '/u01/app/oracle/backup_script/delhi%u.rman' tag 'fullbackscript';
[oracle@dg1 backup_script]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Jun 1 13:27:48 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DELHI (DBID=3274584472)
RMAN> connect catalog catowner/oracle@delhi
connected to recovery catalog database
RMAN> create script fullbackup { backup database format '/u01/app/oracle/backup_script/delhi%u.rman' tag 'fullbackscript';
2> }
created script fullbackup
RMAN> replace script fullbackup { backup database format '/u01/app/oracle/backup_script/delhi%u.rman' tag 'fullbackscript_new';
2> }
replaced script fullbackup
RMAN> run { execute script fullbackup;}
executing script: fullbackup
Starting backup at 2025-06-01:13:33:15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=137 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/DELHI/datafile/rec_catalog01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_system_mqz6odrj_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_sysaux_mqz6p5vm_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_undotbs1_mqz6pny7_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/DELHI/datafile/o1_mf_users_mqz6pp19_.dbf
channel ORA_DISK_1: starting piece 1 at 2025-06-01:13:33:15
channel ORA_DISK_1: finished piece 1 at 2025-06-01:13:33:22
piece handle=/u01/app/oracle/backup_script/delhi493qtv8r.rman tag=FULLBACKSCRIPT_NEW comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 2025-06-01:13:33:22
Starting Control File and SPFILE Autobackup at 2025-06-01:13:33:22
piece handle=/u01/app/oracle/fra/DELHI/autobackup/2025_06_01/o1_mf_s_1202650403_n3r2bcgw_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2025-06-01:13:33:24
RMAN> list script names;
List of Stored Scripts in Recovery Catalog
Scripts of Target Database DELHI
Script Name
Description
-----------------------------------------------------------------------
fullbackup
RMAN> exit
Recovery Manager complete.
Check Script Details
[oracle@dg1 backup_script]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 1 13:35:04 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> desc catowner.rc_stored_script;
Name Null? Type
----------------------------------------- -------- ----------------------------
DB_KEY NUMBER
DB_NAME VARCHAR2(8)
SCRIPT_NAME NOT NULL VARCHAR2(100)
SCRIPT_COMMENT VARCHAR2(255)
SQL> select * from catowner.rc_stored_script;
DB_KEY DB_NAME SCRIPT_NAME SCRIPT_COMMENT
---------- -------- ------------------------------ ------------------------------
1 DELHI fullbackup
Comments
Post a Comment