RMAN Commands
RMAN Commands :
===============
An incremental backup:
=======================
stores only blocks changed since a previous backup. Thus, they provide more compact backups and faster
recovery, thereby reducing the need to apply redo during data file media recovery.
If you enable block change tracking, then you can improve performance by avoiding full scans of
every input data file. You use the BACKUP INCREMENTAL command to perform incremental backups.
cumulative incremental backup
==============================
A level 1 backup can be a cumulative incremental backup, which includes all blocks changed since the
most recent level 0 backup, or a differential incremental backup, which includes only blocks changed
since the most recent incremental backup.
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
You can use the VALIDATE command to confirm that all database files exist, are in their correct location,
and are free of physical corruption.
The CROSSCHECK command synchronizes the logical records of RMAN backups and copies with the files on
storage media. If a backup is on disk, then CROSSCHECK determines whether the header of
the file is valid
RMAN Commands:
We can return any setting to its default value by using CONFIGURE command or we can change the settings .
RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS -----> indicates that we are will be keeping our
database backup file for next 14 days. After that it will become obsolete/invalid which is no longer useful
for restore and recovery.
Data Recovery Advisor:
=======================
Oracle Database includes a Data Recovery Advisor tool that automatically diagnoses
persistent data
failures, presents appropriate repair options, and executes repairs at your request.
RMAN> LIST FAILURE;
RMAN> ADVISE FAILURE;
RMAN> REPAIR FAILURE;
TSPITR: enables quick recovery of one or more tablespaces in a database to an earlier time without
affecting the rest of the tablespaces and objects in the database.
V$RECOVER_FILE to list data files requiring recovery by data file number with their status and
error information SELECT FILE#, ERROR, ONLINE_STATUS, CHANGE#, TIME FROM V$RECOVER_FILE;
Which backup can be delete (obsolete)
RMAN> report obsolete and Delete obsolete
The primary purpose of list command is to determine which backups or copies are available
To list backup sets, backup pieces and proxy copies
RMAN> list backup
To list backups by file
RMAN> list backup by file
To list backups in summary mode
RMAN> list backup summary
To list backups of all files in database
RMAN> list backup of database;
To list archivelog files
RMAN> list archivelog all;
To show all RMAN configuration settings
RMAN> show all;
To show retention policy configuration settings
RMAN> show retention policy
To show the automatic channel settings
RMAN> show channel
To show the default device type
RMAN> show default device type
You can back an individual tables if database running in archive log mode
Backing up a datafile,CF,Archive and tablespace;
=======================================
RMAN> backup tablespace users
backup datafile 1,3,5;
RMAN> BACKUP ARCHIVELOG ALL;
RMAN>sql ‘alter database backup controlfile to trace’
RMAN> backup current controlfile;
RMAN> backup tablespace system, users, tools
Resynch catalog:Perform a full resynchronization, which creates a snapshot control file and
then copies
Restore:Restore files from backup sets or from disk copies to the default or a new location.
Duplicate:Use backups of the target database to create a duplicate database
CROSSCHECK ARCHIVELOG ALL -----> indicates that it is checking the archive logs whether
they are valid
or not
CROSSCHECK BACKUP -----> tells us whether the previously taken database backups are valid
or not/Check whether backup items still exist
allocate channel -----> this command is to manually assign a channel to back up specified files.
An RMAN channel represents one stream of data to a device type.
Type disk ----->indicates backup files are going to take in disk
Format ----->indicates the naming convention of my backup files and their extention with .bck
format. it can be any
maxpiecesize 5120m----->indicates that my each backup file should be atmost 5GB of size.
Backup incremental level = 0 ----->indicates that i am taking full backup of database. other
than this i can iake incremental,cumulative database backups as per my wish just by replacing 0
with either 1 or 2.
COMPRESSED ----->indicates that the backup should be compressed one.the purpose of using this
is it will reduce the backup size.
Tag = full_open_backup_disk ----->A tag is a symbolic name for a backup set. it tells us that
it is full backup.
release channel t1 ----->RELEASE CHANNEL command to release a normal or maintenance channel
while maintaining a connection to a target database instance.
Allocate channel t3 & release channel t3 ----->channel t3 is initiated and closed for backing
up archive logs
backup archivelog until time 'sysdate -1' delete input ----->indicates that it is taking
backup of archive logs till before 24 hours and dekleting the files from disk
sql 'alter system archive log current' ----->this indicates a normal sql to take a log switch.
the purpose of it is to archive all transactions
backup archivelog all ----->it backs up all the archivelogs till now
backup current controlfile ----->indicates taking backup of control file
delete noprompt obsolete ----->indicates deletion of previous backups(greater than 14 days)
without prompting/asking
delete noprompt expired backup ----->indicates deletion of expired(manually deleted in OS level)
backups without prompting/asking
delete noprompt expired archivelog all ----->indicates deletion of expired archivelogs without
prompting/asking.
in RMAN prompt type show all , then it will display all the settings defined for rman.
The backup we took from above steps are useful for recovery operations in future(with in 14 days).
When NOFILENAMECHECK:
=====================
is used with the DUPLICATE command, RMAN does not validate the filenames during restoration.
If the primary database and the standby database are on the same host,
The DUPLICATE NOFILENAMECHECK option should not be used.
===============
An incremental backup:
=======================
stores only blocks changed since a previous backup. Thus, they provide more compact backups and faster
recovery, thereby reducing the need to apply redo during data file media recovery.
If you enable block change tracking, then you can improve performance by avoiding full scans of
every input data file. You use the BACKUP INCREMENTAL command to perform incremental backups.
cumulative incremental backup
==============================
A level 1 backup can be a cumulative incremental backup, which includes all blocks changed since the
most recent level 0 backup, or a differential incremental backup, which includes only blocks changed
since the most recent incremental backup.
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
You can use the VALIDATE command to confirm that all database files exist, are in their correct location,
and are free of physical corruption.
The CROSSCHECK command synchronizes the logical records of RMAN backups and copies with the files on
storage media. If a backup is on disk, then CROSSCHECK determines whether the header of
the file is valid
RMAN Commands:
We can return any setting to its default value by using CONFIGURE command or we can change the settings .
RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS -----> indicates that we are will be keeping our
database backup file for next 14 days. After that it will become obsolete/invalid which is no longer useful
for restore and recovery.
Data Recovery Advisor:
=======================
Oracle Database includes a Data Recovery Advisor tool that automatically diagnoses
persistent data
failures, presents appropriate repair options, and executes repairs at your request.
RMAN> LIST FAILURE;
RMAN> ADVISE FAILURE;
RMAN> REPAIR FAILURE;
TSPITR: enables quick recovery of one or more tablespaces in a database to an earlier time without
affecting the rest of the tablespaces and objects in the database.
V$RECOVER_FILE to list data files requiring recovery by data file number with their status and
error information SELECT FILE#, ERROR, ONLINE_STATUS, CHANGE#, TIME FROM V$RECOVER_FILE;
Which backup can be delete (obsolete)
RMAN> report obsolete and Delete obsolete
The primary purpose of list command is to determine which backups or copies are available
To list backup sets, backup pieces and proxy copies
RMAN> list backup
To list backups by file
RMAN> list backup by file
To list backups in summary mode
RMAN> list backup summary
To list backups of all files in database
RMAN> list backup of database;
To list archivelog files
RMAN> list archivelog all;
To show all RMAN configuration settings
RMAN> show all;
To show retention policy configuration settings
RMAN> show retention policy
To show the automatic channel settings
RMAN> show channel
To show the default device type
RMAN> show default device type
You can back an individual tables if database running in archive log mode
Backing up a datafile,CF,Archive and tablespace;
=======================================
RMAN> backup tablespace users
backup datafile 1,3,5;
RMAN> BACKUP ARCHIVELOG ALL;
RMAN>sql ‘alter database backup controlfile to trace’
RMAN> backup current controlfile;
RMAN> backup tablespace system, users, tools
Resynch catalog:Perform a full resynchronization, which creates a snapshot control file and
then copies
Restore:Restore files from backup sets or from disk copies to the default or a new location.
Duplicate:Use backups of the target database to create a duplicate database
CROSSCHECK ARCHIVELOG ALL -----> indicates that it is checking the archive logs whether
they are valid
or not
CROSSCHECK BACKUP -----> tells us whether the previously taken database backups are valid
or not/Check whether backup items still exist
allocate channel -----> this command is to manually assign a channel to back up specified files.
An RMAN channel represents one stream of data to a device type.
Type disk ----->indicates backup files are going to take in disk
Format ----->indicates the naming convention of my backup files and their extention with .bck
format. it can be any
maxpiecesize 5120m----->indicates that my each backup file should be atmost 5GB of size.
Backup incremental level = 0 ----->indicates that i am taking full backup of database. other
than this i can iake incremental,cumulative database backups as per my wish just by replacing 0
with either 1 or 2.
COMPRESSED ----->indicates that the backup should be compressed one.the purpose of using this
is it will reduce the backup size.
Tag = full_open_backup_disk ----->A tag is a symbolic name for a backup set. it tells us that
it is full backup.
release channel t1 ----->RELEASE CHANNEL command to release a normal or maintenance channel
while maintaining a connection to a target database instance.
Allocate channel t3 & release channel t3 ----->channel t3 is initiated and closed for backing
up archive logs
backup archivelog until time 'sysdate -1' delete input ----->indicates that it is taking
backup of archive logs till before 24 hours and dekleting the files from disk
sql 'alter system archive log current' ----->this indicates a normal sql to take a log switch.
the purpose of it is to archive all transactions
backup archivelog all ----->it backs up all the archivelogs till now
backup current controlfile ----->indicates taking backup of control file
delete noprompt obsolete ----->indicates deletion of previous backups(greater than 14 days)
without prompting/asking
delete noprompt expired backup ----->indicates deletion of expired(manually deleted in OS level)
backups without prompting/asking
delete noprompt expired archivelog all ----->indicates deletion of expired archivelogs without
prompting/asking.
in RMAN prompt type show all , then it will display all the settings defined for rman.
The backup we took from above steps are useful for recovery operations in future(with in 14 days).
When NOFILENAMECHECK:
=====================
is used with the DUPLICATE command, RMAN does not validate the filenames during restoration.
If the primary database and the standby database are on the same host,
The DUPLICATE NOFILENAMECHECK option should not be used.
Comments
Post a Comment