Seven Online Rman Database backup
7.1 Online Database backup
To perform an online backup operation using Rman, the database must be placed in Archivelog mode. If you are not in archive mode, Rman generates an error when you attempt an online backup.
Oracle Archiving and non-archive switching
Http://blog.csdn.net/tianlesoftware/archive/2009/10/19/4693470.aspx
Connection Backup Example:
rman> Configure Default device type to disk;
Rman> Configure Channel 1 device type disk format ' F:/backup/orcl_%u.bak ';
Rman> backup Database plus archivelog tag= ' ORCL ';
7.2 Table Space Backup
You can simply use the Backup command with the tablespace parameter to perform a table-space back up operation:
Backup tablespace Dave;
If you want to back up the archived redo logs at the same time, you can perform:
Backup tablespace Dave Plus archivelog;
We want to make sure that the backup is the current control file:
Backup tablespace users include current Controlfile plus archivelog;
7.3 Data File Backup
RMAN allows backup of the data file using the backup command with the datafile parameter, followed by the file name or data file number to be backed up by the datafile parameter.
To view the data file number:
Sql> select File_id,file_name from Dba_data_files;
file_id file_name
---------- -----------------------------------------------------
4 d:/app/administrator/oradata/orcl/users01. Dbf
3 d:/app/administrator/oradata/orcl/undotbs01. Dbf
2 d:/app/administrator/oradata/orcl/sysaux01. Dbf
1 d:/app/administrator/oradata/orcl/system01. Dbf
5 d:/app/administrator/oradata/orcl/dave0. Dbf
Backup:
Rman>backup datafile 5;
Rman>backup datafile ' D:/app/administrator/oradata/orcl/dave0. DBF ';
Rman>backup datafile ' D:/app/administrator/oradata/orcl/dave0. DBF ' plus archivelog;
7.4 Archived Redo Log Backups
To back up all archived redo logs, you can use Backup Archivelog all. You can also back up a specified range of archived redo logs, with multiple options, including time, SCN, or redo
The log sequence.
Backup Archivelog All;
Backup Archivelog from time ' sysdate-1 ';
Backup Archivelog from sequence 400;
Once the backup is complete, you can use the Rman Delete input option to delete the archive redo logs.
Backup archivelog all Delete input;
Backup archivelog from sequence delete input;
You can also instruct Rman to back up multiple copies of the archived redo logs. In the following example, we use the backup command with the not backed up n times parameter to ensure that at least 3 redo
Log, and does not back up the archive redo logs that have been backed up more than 3 times.
Backup Archivelog not backed up to 3 times;
You can also use the backup and until time parameters to ensure that archived redo logs retain a certain number of days on disk:
Backup archivelog All delete input until time ' sysdate-2 ';
Note: The not backed up parameter and delete input parameters are mutually exclusive, and the delete input parameter deletes the archived redo log regardless of the number of backup times for the archive redo log
。
7.5 Control file and server parameter file backup
Use the backup SPFile command to back up the server parameter files.
Backup current Controlfile;
The current Controlfile parameter also provides a for standby clause that creates a backup control file to be used by an alternate database. You can use the backup command's
Controlfilecopy parameter to create a backup set containing externally created control file backups, execute ALTER DATABASE backup controlfile to ' filename ' command or Rman
Copy command to create an alternate database control file. In addition, you can back up the standby database control file created by the ALTER DATABASE create standby controlfile command
, a bit of the function is that you can use external control files to back up files, register them in Rman, and then create a backup set that contains a control file backup.
Alter database backup Controlfile to ' D:/backup/orcl_backup.ctl ';
Backup controlfilecopy ' D:/backup/orcl_backup.ctl ';
7.6 Backup Set Backup
We may now back up the data on disk and then back up the backup set on tape. In Oracle 10g, RMAN supports this operation through the backup command.
You can choose to back up all backup sets by using the backup Backupset command, or you can choose to back up a specific backup set. In addition, backup sets can only be backed up from disk to disk, or backup sets from disk
Back up to tape. In a backup backup set, you can use the Delete input option to delete a file of the source backup set after a successful backup operation.
Backup backupset all;
Backup backupset all format= ' D:/backup/orcl_%u.bak ' tag= ' ORCL ' channel ' ora_disk_1 ';
Backup backupset complete before ' sysdate-2 ';
Backup backupset complete before ' sysdate-2 ' delete input;
Backup backupset complete after ' sysdate-2 ' delete input;
7.7 Flash-back recovery area backup
RMAN provides the ability to back up the entire FRA to disk for the Backup Recovery Area Command, but not all files in the FRA are backed up, and the backup files include: Full backup sets and increments
Backup set, control file automatic backup, archive log and data file copy. If the backed up FRA contains a flash back log, the current control file and the online redo log do not back up the text
Thing Note that these files must be backed up to tape.