rman commands with examples | In this post, we will discuss Important RMAN commands for Oracle database. We are using these rman commands to manage the Oracle Database. Below is the various RMAN commands list that will help it more for daily dba jobs.
Some rman commands with examples
SHOW COMMAND.
Best BACKUP COMMAND In Oracle.
Backup Database command.
RMAN> BACKUP DURATION 00:30 MINIMIZE TIME DATABASE;
RMAN> BACKUP DURATION 00:45 MINIMIZE LOAD DATABASE;
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
RMAN> BACKUP DATABASE NOEXCLUDE KEEP FOREVER TAG=’abc’;
RMAN> BACKUP DATABASE SKIP OFFLINE;
RMAN> BACKUP DATABASE SKIP INACCESSIBLE;
RMAN> BACKUP DATABASE SKIP READONLY SKIP OFFLINE SKIP INACCESSIBLE;
RMAN> BACKUP DATABASE NOT BACKED UP SINCE TIME=’SYSDATE–3’;
RMAN> BACKUP NOT BACKED UP SINCE TIME ‘SYSDATE-10’
RMAN> BACKUP DATABASE COPIES=2;
TAG quarterly KEEP UNTIL TIME ‘SYSDATE+365’ RESTORE POINT Q1FY12;
Backup DEVICE Commands: –
RMAN> BACKUP DEVICE TYPE sbt DATABASE PLUS ARCHIVELOG;
RMAN> BACKUP DEVICE TYPE sbt DATAFILECOPY FROM TAG ‘latest’ FORMAT ‘df%f_%d’;
RMAN> BACKUP DEVICE TYPE sbt ARCHIVELOG LIKE ‘/disk%arc%’ DELETE ALL INPUT;
RMAN> BACKUP DEVICE TYPE sbt BACKUPSET COMPLETED BEFORE ‘SYSDATE-14’DELETE INPUT;
RMAN> BACKUP CHECK LOGICAL DATABASE;
RMAN> BACKUP VALIDATE CHECK LOGICAL DATABASE;
RMAN> BACKUP VALIDATE DATABASE;
RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL;
RMAN> BACKUP TABLESPACE test;
RMAN> BACKUP TABLESPACE system, users, tools;
RMAN> BACKUP TABLESPACE 4;
RMAN> BACKUP TABLESPACE gld PLUS ARCHIVELOG;
RMAN> BACKUP TABLESPACE invd INCLUDE CURRENT CONTROLFILE;
RMAN> BACKUP TABLESPACE appsd INCLUDE CURRENT CONTROLFILE PLUS ARCHIVELOG;
RMAN> BACKUP TABLESPACE dwh SECTION SIZE 100M;
RMAN> BACKUP SECTION SIZE 250M TABLESPACE datamart;
RMAN> BACKUP DATAFILE 1;
RMAN> BACKUP DATAFILE 3, 2, 14;
RMAN> BACKUP DATAFILE ‘/u01/data/…’;
RMAN> BACKUP DATAFILE 1 PLUS ARCHIVELOG;
RMAN> BACKUP KEEP FOREVER FORMAT ‘?/dbs/%U_longterm.cpy’ TAG longterm_bck DATAFILE 1 DATAFILE 2;
RMAN> BACKUP SECTION SIZE 500M DATAFILE 6;
19) To Backup archivelog.
RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
RMAN> BACKUP ARCHIVELOG LIKE ‘/arch%’ DELETE ALL INPUT;
RMAN> BACKUP ARCHIVELOG FROM TIME ‘SYSDATE–3’;
RMAN> BACKUP ARCHIVELOG FROM SEQUENCE 100;
RMAN> BACKUP ARCHIVELOG FROM SEQUENCE 999 DELETE INPUT;
RMAN> BACKUP ARCHIVELOG COMPLETION TIME BETWEEN ‘SYSDATE-28’ AND ‘SYSDATE-7’;
RMAN> BACKUP FORMAT=’AL_%d/%t/%s/%p’ ARCHIVELOG LIKE ‘%arc_dest%’;
20)To Backup control files.
OR
RMAN> SQL “ALTER DATABASE BACKUP CONTROLFILE TO ’’/u01/ …/bkctl.ctl’’ “;
RMAN> BACKUP CURRENT CONTROLFILE TO ‘/backup/cntrlfile.copy’;
RMAN> BACKUP CONTROLFILE COPY ‘/u10/backup/control.bkp’;
RMAN> BACKUP DEVICE TYPE sbt SPFILE ARCHIVELOG ALL;
RMAN> BACKUP DEVICE TYPE sbt DATAFILECOPY ALL NODUPLICATES;
RMAN> BACKUP RECOVERY FILES;
RMAN> BACKUP BACKUPSET ALL;
RMAN> BACKUP BACKUPSET ALL FORMAT = ‘/u01/backup_%u.bak’;
RMAN> BACKUP BACKUPSET COMPLETED BEFORE ‘SYSDATE-3’ DELETE INPUT;
RMAN> BACKUP DEVICE TYPE sbt BACKUPSET COMPLETED BEFORE ‘SYSDATE-14’ DELETE INPUT;
RMAN> BACKUP COPIES 2 DEVICE TYPE sbt BACKUPSET ALL;
RMAN> BACKUP AS COMPRESSED BACKUPSET DEVICE TYPE DISK COPIES 2 DATABASE FORMAT ‘/disk1/db_%U’, ‘/disk2/db_%U’;
RMAN> BACKUP AS BACKUPSET DATAFILECOPY ALL;
RMAN> BACKUP AS BACKUPSET DATAFILECOPY ALL NODUPLICATES;
……Incremental backups……….
RMAN> BACKUP INCREMENTAL LEVEL=1 DATABASE;
RMAN> BACKUP INCREMENTAL LEVEL=0 DATABASE PLUS ARCHIVELOG;
RMAN> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG ‘incr’ DATABASE;
RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG ‘daily’ DATABASE;
RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 5343434 DATABASE FORMAT ‘/tmp/incr_stand_%f’;
RMAN> BACKUP INCREMENTAL FROM SCN 444544 DATAFILE 5 FORMAT ‘/tmp/ForStand_%d’ TAG ‘FORSTANDBYdatabase’;
RMAN> BACKUP AS COPY COPY OF DATABASE FROM TAG ‘weekly’ CHECK LOGICAL TAG ‘prod’;
RMAN> BACKUP AS COPY TABLESPACE 10;
RMAN> BACKUP AS COPY TABLESPACE users;
RMAN> BACKUP AS COPY TABLESPACE system, tools, users,apex;
RMAN> BACKUP AS COPY DATAFILE 4;
RMAN> BACKUP AS COPY DATAFILE 5 FORMAT ‘/backup/df2.cpy’ TAG daily_backup;
RMAN> BACKUP AS COPY CURRENT CONTROLFILE;
RMAN> BACKUP AS COPY CURRENT CONTROLFILE FORMAT ‘/backup/controlfilebkp.bkp’;
RMAN> BACKUP AS COPY ARCHIVELOG ALL;
RMAN> BACKUP AS COPY KEEP FOREVER NOLOGS CURRENT CONTROLFILE FORMAT ‘/backup/controlfl.cp’, DATAFILE 11 FORMAT ‘/backup/long.cp’, DATAFILE 4 FORMAT ‘/backup/long.cp’;
RMAN> BACKUP AS COPY DATAFILECOPY ‘prod_fl’ FORMAT ‘/—-‘;
RMAN> BACKUP AS COPY DATAFILECOPY ‘/backup/dfc.cp’ FORMAT ‘/backup1/dfb.cp’;
Rman LIST command
RMAN> LIST DB_UNIQUE_NAME OF DATABASE;
RMAN> LIST INCARNATION OF DATABASE;
RMAN> LIST INCARNATION OF DATABASE PROD;
RMAN> LIST BACKUP;
RMAN> LIST BACKUP SUMMARY;
RMAN> LIST BACKUP BY FILE;
RMAN> LIST BACKUP OF DATABASE;
RMAN> LIST BACKUP OF DATABASE BY BACKUP;
RMAN> LIST BACKUP OF TABLESPACE users SUMMARY;
RMAN> LIST BACKUP OF DATAFILE 200;
RMAN> LIST BACKUP OF DATAFILE 43 SUMMARY;
RMAN> LIST BACKUP OF CONTROLFILE;
RMAN> LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 2332;
RMAN> LIST EXPIRED BACKUP;
RMAN> LIST EXPIRED BACKUP OF ARCHIVELOG ALL SUMMARY;
RMAN> LIST COPY;
RMAN> LIST COPY OF DATABASE ARCHIVELOG ALL;
RMAN> LIST COPY OF TABLESPACE appl_idx;
RMAN> LIST COPY OF DATAFILE 13,4,56;
RMAN> LIST COPY OF CONTROLFILE;
RMAN> LIST EXPIRED COPY;
RMAN> LIST BACKUPSET SUMMARY;
RMAN> LIST BACKUPSET 87;
RMAN> LIST BACKUPSET OF DATAFILE 88;
RMAN> LIST ARCHIVELOG;
RMAN> LIST SCRIPT NAMES;
RMAN> LIST ALL SCRIPT NAMES;
RMAN> LIST GLOBAL SCRIPT NAMES;
RMAN> LIST FAILURE;
RMAN> LIST FAILURE 343 DETAIL;
RMAN REPORT commands
RMAN> REPORT SCHEMA;
RMAN> REPORT NEED BACKUP;
RMAN> REPORT NEED BACKUP RECOVERY WINDOW OF 4 DAYS;
RMAN> REPORT NEED BACKUP DAYS=5;
RMAN> REPORT NEED BACKUP DATABASE;
RMAN> REPORT NEED BACKUP INCREMENTAL 1;
RMAN> REPORT UNRECOVERABLE;
CHANGE commands.
To Update the status of a backup in the RMAN repository.
RMAN> CHANGE BACKUPSET 78788 KEEP FOREVER;
RMAN> CHANGE BACKUPSET 332 KEEP FOREVER NOLOGS;
RMAN> CHANGE BACKUP TAG ‘cold_db_bkup’ KEEP FOREVER;
RMAN> CHANGE BACKUP TAG ‘cold_db_bkup’ NOKEEP;
RMAN> CHANGE BACKUPSET 142 NOKEEP;
RMAN> CHANGE BACKUPSET 233,4540,3334,34223 UNCATALOG;
RMAN> CHANGE BACKUP OF DATABASE TAG=’daily’ UNAVAILABLE;
RMAN> CHANGE BACKUP OF DATABASE DEVICE TYPE DISK UNAVAILABLE;
RMAN> CHANGE ARCHIVELOG ALL UNCATALOG;
RMAN> CHANGE CONTROLFILECOPY ‘/tmp/controlfl.cp’ UNCATALOG;
RMAN> CHANGE FAILURE 4 PRIORITY LOW;
RMAN CROSSCHECK command.
RMAN> CROSSCHECK BACKUP;
RMAN> CROSSCHECK BACKUP TAG=’Daily_bkp’;
RMAN> CROSSCHECK BACKUP COMPLETED BETWEEN ‘SYSDATE-5’ AND ‘SYSDATE–1’;
RMAN> CROSSCHECK BACKUP COMPLETED BETWEEN ’03-MAY-17′ AND ’13-AUG-17′;
RMAN> CROSSCHECK BACKUP DEVICE TYPE sbt COMPLETED BETWEEN ’01-AUG-17′ AND ’10-SEP-17′;
RMAN> CROSSCHECK BACKUP DEVICE TYPE DISK COMPLETED BETWEEN ’01-JUN-16′ AND ’23-MAR-17′;
RMAN> CROSSCHECK BACKUP OF DATABASE;
RMAN> CROSSCHECK BACKUP OF TABLESPACE systems;
RMAN> CROSSCHECK BACKUP OF TABLESPACE users COMPLETED BEFORE ‘SYSDATE-7’;
RMAN> CROSSCHECK BACKUP OF TABLESPACES users,tools,apex;
RMAN> CROSSCHECK BACKUP OF DATAFILE 55;
RMAN> CROSSCHECK BACKUP OF DATAFILE 45 COMPLETED AFTER ‘SYSDATE-7’;
RMAN> CROSSCHECK BACKUP OF DATAFILE “/backup/system12.dbf” COMPLETED AFTER ‘SYSDATE-7’;
RMAN> CROSSCHECK BACKUP OF CONTROLFILE;
RMAN> CROSSCHECK BACKUP OF SPFILE;
RMAN> CROSSCHECK BACKUP OF ARCHIVELOG ALL;
RMAN> CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;
RMAN> CROSSCHECK COPY;
RMAN> CROSSCHECK COPY OF DATABASE;
RMAN> CROSSCHECK DATAFILECOPY 11,15,45;
RMAN> CROSSCHECK CONTROLFILECOPY ‘/tmp/control01.ctl’;
RMAN> CROSSCHECK ARCHIVELOG ALL;
RMAN> CROSSCHECK BACKUPSET;
RMAN> CROSSCHECK BACKUPSET 12232,12533,23324;
RMAN> CROSSCHECK BACKUPPIECE TAG = ‘weekly_backup’;
RMAN> CROSSCHECK PROXY 754;
RMAN SQL command.
Execute a SQL statement from within RMAN prompt.
RMAN> SQL “ALTER SYSTEM SWITCH LOGFILE”;
RMAN> SQL ‘ALTER TABLESPACE users ONLINE’;
RMAN> SQL ‘ALTER DATABASE DATAFILE 23 OFFLINE’;
RMAN> SQL “ALTER DATABASE BACKUP CONTROLFILE TO TRACE”;
RMAN> SQL “ALTER TABLESPACE users ADD DATAFILE ”/data01/users01.dbf” SIZE 100K AUTOEXTEND ON NEXT 10K MAXSIZE 400K”;
RMAN RESTORE command.
RMAN> RESTORE DATABASE;
RMAN> RESTORE DATABASE VALIDATE;
RMAN> RESTORE DATABASE PREVIEW;
RMAN> RESTORE DATABASE PREVIEW SUMMARY;
RMAN> RESTORE DATABASE SKIP TABLESPACE temp, history;
RMAN> RESTORE DATABASE UNTIL SCN 887655;
RMAN> RESTORE TABLESPACE users;
RMAN> RESTORE TABLESPACE apex,systems,apps01;
RMAN> RESTORE TABLESPACE tbs1 PREVIEW;
RMAN> RESTORE TABLESPACE users VALIDATE;
RMAN> RESTORE DATAFILE 88;
RMAN> RESTORE DATAFILE 98 PREVIEW;
RMAN> RESTORE DATAFILE 33 VALIDATE;
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
RMAN> RESTORE CONTROLFILE FROM TAG ‘Daily_backup’;
RMAN> RESTORE CONTROLFILE TO ‘/tmp/autobkp.dbf’ FROM AUTOBACKUP MAXSEQ 20 MAXDAYS 200;
RMAN> RESTORE SPFILE;
RMAN> RESTORE SPFILE FROM AUTOBACKUP;
RMAN> RESTORE ARCHIVELOG ALL VALIDATE;
RMAN> RESTORE ARCHIVELOG ALL PREVIEW;
RMAN> RESTORE ARCHIVELOG ALL PREVIEW RECALL;
RMAN> RESTORE ARCHIVELOG ALL DEVICE TYPE sbt PREVIEW;
RMAN RECOVER command.
RMAN> RECOVER DATABASE;
RMAN> RECOVER DATABASE NOREDO;
RMAN> RECOVER DATABASE SKIP TABLESPACE temp;
RMAN> RECOVER DATABASE SKIP FOREVER TABLESPACE exam;
RMAN> RECOVER DATABASE UNTIL SCN 355334;
RMAN> RECOVER TABLESPACE apex;
RMAN> RECOVER TABLESPACE tools DELETE ARCHIVELOG MAXSIZE 5M;
RMAN> RECOVER DATAFILE 454;
RMAN> RECOVER COPY OF DATABASE WITH TAG ‘incr_monday’;
RMAN> RECOVER COPY OF DATABASE WITH TAG ‘incr_tuesday’ UNTIL TIME ‘SYSDATE – 6’;
RMAN> RECOVER CORRUPTION LIST;
RMAN> RECOVER TABLESPACE users;
RMAN DELETE command.
RMAN> DELETE EXPIRED BACKUP;
RMAN> DELETE OBSOLETE;
RMAN> DELETE NOPROMPT OBSOLETE;
RMAN> DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 8 DAYS;
RMAN> DELETE EXPIRED BACKUP DEVICE TYPE sbt;
RMAN> DELETE BACKUP OF DATABASE LIKE ‘/tmp%’;
RMAN> DELETE NOPROMPT EXPIRED BACKUP OF TABLESPACE users COMPLETED BEFORE ‘SYSDATE-7’;
RMAN> DELETE BACKUP OF SPFILE TABLESPACE users DEVICE TYPE SBT;
RMAN> DELETE EXPIRED COPY;
RMAN> DELETE COPY TAG ‘Cold’;
RMAN> DELETE ARCHIVELOG ALL;
RMAN> DELETE EXPIRED ARCHIVELOG ALL;
RMAN> DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
RMAN> DELETE BACKUPSET 23,24,25;
RMAN> DELETE NOPROMPT BACKUPSET TAG ‘Daily_bkp’;
RMAN> DELETE FORCE NOPROMPT BACKUPSET TAG weekly_bkp;
RMAN> DELETE DATAFILECOPY “/backup01/datafile/system01.cp”;
RMAN> DELETE CONTROLFILECOPY ‘/tmp/cntrlfile.cp’;
RMAN> DELETE BACKUP DEVICE TYPE SBT;
RMAN> DELETE BACKUP DEVICE TYPE DISK;
RMAN DROP DATABASE command.
Delete the target database.
RMAN> DROP DATABASE;
RMAN> DROP DATABASE NOPROMPT;
RMAN> DROP DATABASE INCLUDING BACKUPS;
RMAN> DROP DATABASE INCLUDING BACKUPS NOPROMPT;
rman commands with examples related to DUPLICATE command.
RMAN> DUPLICATE TARGET DATABASE TO prod;
RMAN> DUPLICATE TARGET DATABASE TO dev PFILE=/data04/initDEV.ora;
RMAN> DUPLICATE TARGET DATABASE TO devdb NOFILENAMECHECK;
RMAN> DUPLICATE DATABASE ‘prod’ DBID 1232323 TO ‘dev’ NOFILENAMECHECK;
RMAN> DUPLICATE TARGET DATABASE TO dprod
LOGFILE GROUP 1 (‘?/dbs/dprod_log01.f’,’?/dbs/dprod_log02.f’) SIZE 300K, GROUP 2 (‘?/dbs/dprod_log_2_3.f’,’?/dbs/dprod_log_2_2.f’) SIZE 400K REUSE;
RMAN> DUPLICATE TARGET DATABASE TO dup FOR STANDBY FROM ACTIVE DATABASE PASSWORD FILE SPFILE PARAMETER_VALUE_CONVERT ‘/data01’, ‘/ddata02’
SET DB_FILE_NAME_CONVERT ‘/data01′,’/data02’
SET LOG_FILE_NAME_CONVERT ‘/data01′,’/data02’
SET SGA_MAX_SIZE 200M SET SGA_TARGET 100M;
rman commands with examples for SWITCH command.
RMAN> SWITCH TABLESPACE users TO COPY;
RMAN> SWITCH DATAFILE ‘/data03/tools.dbf’ TO DATAFILECOPY ‘/data05/tools.copy’;
RMAN> SWITCH DATAFILE “/db/datafile/sysaux.dbf” TO COPY;
RMAN> SWITCH TEMPFILE 1;
RMAN> SWITCH TEMPFILE 1 TO ‘/oracle/dbs/temp1.f’;
RMAN> SWITCH TEMPFILE ALL;
RMAN CATALOG command .
RMAN> CATALOG CONTROLFILECOPY ‘/backup/ctrl.bkp’;
RMAN> CATALOG ARCHIVELOG ‘/backup/arch1_123.dbf’, ‘/backup02/arch1_543.dbf’;
RMAN> CATALOG BACKUPPIECE ‘/backup/dailybkp_0199832’;
RMAN> CATALOG LIKE ‘/backup02’;
RMAN> CATALOG START WITH ‘/backup/prod/’;
RMAN> CATALOG START WITH ‘+dg1’;
RMAN> CATALOG RECOVERY AREA;
rman commands with examples for ALLOCATE command.
RMAN> ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
RMAN> ALLOCATE CHANNEL ch DEVICE TYPE DISK FORMAT ‘/backup/DB_U%’;
RMAN> ALLOCATE CHANNEL t1 DEVICE TYPE DISK CONNECT ‘sys/***@bksrv’;
RMAN> ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS ‘ENV=(OB_MEDIA_FAMILY=fullbkp_mf)’;
RMAN> ALLOCATE CHANNEL t1 DEVICE TYPE sbt PARMS ‘ENV=(OB_DEVICE_1=tape1, OB_DEVICE_2=tape4)’;
RMAN> ALLOCATE CHANNEL t1 TYPE ‘sbt_tape’ PARMS=’SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so.1′;
RMAN> ALLOCATE CHANNEL t1 TYPE ‘sbt_tape’ SEND “NB_ORA_CLIENT=CLIENT_MACHINE_NAME”;
RMAN> ALLOCATE CHANNEL ‘dev1’ TYPE ‘sbt_tape’ PARMS ‘ENV=OB2BARTYPE=ORACLE8, OB2APPNAME=ORCL, OB2BARLIST=MACHINENAME_ORCL_ARCHLOGS)’;
RMAN> ALLOCATE AUXILIARY CHANNEL ac2 DEVICE TYPE sbt;
ALLOCATE CHANNEL FOR MAINTENANCE – allocate a channel in preparation for issuing maintenance commands such as DELETE.
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK FORMAT “/backup2/%U”;
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK CONNECT ‘@test1’;
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt PARMS ‘SBT_LIBRARY=/usr/local/oracle/backup/lib/libobk.so, ENV=(OB_DEVICE_1=tape2)’;
RMAN RELEASE CHANNEL command.
RMAN> RELEASE CHANNEL;
RMAN> RELEASE CHANNEL c1;
RMAN BLOCKRECOVER command.
RMAN> BLOCKRECOVER DATAFILE 8 BLOCK 22;
RMAN> BLOCKRECOVER DATAFILE 7 BLOCK 233,235 DATAFILE 4 BLOCK 101;
RMAN> BLOCKRECOVER DATAFILE 2 BLOCK 12,13 DATAFILE 3 BLOCK 34345 DATAFILE 4 BLOCK 19;
RMAN> BLOCKRECOVER DATAFILE 3 BLOCK 2,4,5 TABLESPACE sales DBA 23232,412 FROM DATAFILECOPY;
RMAN> BLOCKRECOVER TABLESPACE dwh DBA 4194404,4194405 FROM TAG “weekly”;
RMAN> BLOCKRECOVER TABLESPACE dwh DBA 94404 RESTORE UNTIL TIME ‘SYSDATE-2’;
RMAN ADVISE FAILURE command.
RMAN> ADVISE FAILURE;
RMAN> ADVISE FAILURE 555, 242;
RMAN> ADVISE FAILURE ALL;
RMAN> ADVISE FAILURE CRITICAL;
RMAN> ADVISE FAILURE HIGH;
RMAN> ADVISE FAILURE LOW;
RMAN> ADVISE FAILURE HIGH EXCLUDE FAILURE 625;
REPAIR FAILURE command
Repair one or more failures recorded in the automated diagnostic repository.
RMAN> REPAIR FAILURE PREVIEW;
RMAN> REPAIR FAILURE NOPROMPT;
RMAN> REPAIR FAILURE USING ADVISE OPTION integer;
SPOOL command.
RMAN> SPOOL LOG TO ‘/tmp/spool.log’;
RMAN> SPOOL LOG TO ‘/tmp/backup.log’ APPEND;
RMAN> SPOOL LOG OFF;
RMAN VALIDATE command.
RMAN> VALIDATE BACKUPSET 776;
RMAN> VALIDATE BACKUPSET 9987, 9998;
RMAN> VALIDATE DATABASE;
RMAN> VALIDATE COPY OF TABLESPACE users;
RMAN> VALIDATE DATAFILE 23;
RMAN> VALIDATE DATAFILE 4,8;
RMAN> VALIDATE DATAFILE 4 BLOCK 56;
RMAN> VALIDATE SPFILE;
RMAN> VALIDATE RECOVERY FILES;
RMAN> VALIDATE RECOVERY AREA;
RMAN> VALIDATE DB_RECOVERY_FILE_DEST;
RMAN RUN command.
rman commands with examples To Execute one or more RMAN commands.
ALLOCATE CHANNEL c1 TYPE DISK FORMAT ‘/backup01/%U’;
BACKUP TABLESPACE users;
}
RMAN> run {
ALLOCATE CHANNEL c1 TYPE DISK FORMAT ‘/backup4/%U’;
BACKUP TABLESPACE users;
}
RMAN> run
{
ALLOCATE CHANNEL dev1 DEVICE TYPE DISK FORMAT ‘/backup05/%U’;
ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT ‘/backup06/%U’;
BACKUP(TABLESPACE system,fin,mark FILESPERSET 20) (DATAFILE 23,53,65);
}
RMAN CREATE SCRIPT command.
Create a stored script within recovery catalog.
RMAN> CREATE SCRIPT backup_full
COMMENT “Full backup of whole database and archived redo log files”
{BACKUP INCREMENTAL LEVEL 0 TAG backup_full FORMAT “backup/%U” DATABASE PLUS ARCHIVELOG;}
RMAN> CREATE SCRIPT backup_ts_tools
COMMENT ‘tablespace users backup’
{ALLOCATE CHANNEL c1 TYPE DISK FORMAT ‘/backup/%U’;
BACKUP TABLESPACE users;}
RMAN> CREATE SCRIPT backup_ts_apex FROM FILE ‘backup_apex.rman’;
RMAN> CREATE GLOBAL SCRIPT gl_prod_bkp {BACKUP DATABASE PLUS ARCHIVELOG;}
RMAN> CREATE GLOBAL SCRIPT backup_prod_db
COMMENT “backup database”
{BACKUP DATABASE;}
RMAN PRINT SCRIPT command.
To Display a stored script.
RMAN> PRINT GLOBAL SCRIPT backup_prod_db;
RMAN> PRINT GLOBAL SCRIPT gl_prod_bkp TO FILE “/tmp/gl_prod_bkp.rman”;
RMAN REPLACE SCRIPT command.
Replace an existing script stored rman recovery catalog.
RMAN> REPLACE SCRIPT backup_prod_db {BACKUP DATABASE PLUS ARCHIVELOG;}
RMAN> REPLACE SCRIPT df {BACKUP DATAFILE &1 TAG &2.1 FORMAT ‘&3_%U’;}
RMAN> REPLACE GLOBAL SCRIPT backup_prod_db {BACKUP DATABASE PLUS ARCHIVELOG;}
RMAN> REPLACE GLOBAL SCRIPT gl_full_bkp FROM FILE ‘/tmp/script_file.txt’;
RMAN> RUN {EXECUTE SCRIPT backup_full;}
RMAN> RUN {EXECUTE SCRIPT backup_ts_any USING ‘example’;}
RMAN> RUN {EXECUTE SCRIPT backup_proddb_bkp USING 3 test_backup df3;}
RMAN> RUN {EXECUTE GLOBAL SCRIPT gl_backup_db;}
RMAN DELETE SCRIPT command.
To Delete a stored script from rman recovery catalog.
RMAN> DELETE GLOBAL SCRIPT gl_backup_db;
RMAN FLASHBACK DATABASE command.
To Return the database to a past time or SCN.
RMAN> FLASHBACK DATABASE TO RESTORE POINT ‘restore_233’;
RMAN TRANSPORT TABLESPACE command.
Transportable tablespaces permit the copying or moving of a tablespace from one Oracle database to another.
TABLESPACE DESTINATION ‘/data01/prod’ AUXILIARY DESTINATION ‘/data04/aux’ UNTIL TIME ‘SYSDATE-14/1434’;
RMAN> TRANSPORT TABLESPACE apex
TABLESPACE DESTINATION ‘/data95/transport’ AUXILIARY DESTINATION ‘/data09/aux’ DATAPUMP DIRECTORY dpdirectory DUMP FILE ‘dmpfiles.dmp’ IMPORT SCRIPT ‘impscripts.sql’ EXPORT LOG ‘explogs.log’;
EXIT or QUIT Command.
RMAN> exit;
RMAN> quit;
———————————————————————————————————–
Multitenant Environment RMAN Command. —> Coming soon.
Excellent Blog. Keep it up
Hey, Check This content for more information about klean uv pro Photostick Omni vs Photo Stick Mobile