首页 > Linux操作系统 > Linux操作系统 > rman backup
| QuickSql |
| Syntax: | |
| BACKUP [FULL] [backupOperand] backupSpec [backupSpecOperand] [PLUS ARCHIVELOG [backupSpecOperand]] | |
| Copies all blocks into the backup set, skipping datafile blocks never used. RMAN makes full backups by default if neither FULL nor INCREMENTAL is specified. Blocks are not skipped when backing up archived redo logs or control files. A full backup has no effect on subsequent incremental backups, so it is not considered a part of the incremental backup strategy. | |
| BACKUP [INCREMENTAL LEVEL [=] integer] [backupOperand] backupSpec [backupSpecOperand] [PLUS ARCHIVELOG [backupSpecOperand]] | |
| archivelogRecordSpecifier | |
| Specifies a range of archived redo logs to be backed up. | |
| BACKUPSET { ALL | completedTimeSpec } | |
| BACKUPSET primary_key | |
| CONTROLFILECOPY 'filename' | |
| Specifies the filename of a control file copy. The control file copy can be: ♦ A copy of a normal control file (that is, not a standby control file) created with COPY CURRENT CONTROLFILE or ALTER DATABASE BACKUP CONTROLFILE TO 'filename' . ♦ A standby control file copy created with COPY STANDBY CONTROLFILE command or ALTER DATABASE CREATE STANDBY CONTROLFILE. ♦ The header of the control file determines whether it is a standby or nonstandby control file. | |
| CURRENT CONTROLFILE [FOR STANDBY] | |
| Specifies the current control file. FOR STANDBY generates a backup of the control file that is usable during creation of a standby database. The backup contains only the standby control file. | |
| DATABASE | |
| Creates a backup set containing all datafiles in the database. The backup only includes datafiles and control files; not archived redo logs. If a backup includes datafile 1 and CONFIGURE CONTROLFILE AUTOBACKUP is OFF, then control file is automatically included in the backup set. If instance was started with a spfile, then it is included in the backup. If a backup includes datafile 1 and if CONFIGURECONTROLFILE AUTOBACKUP is ON, then control file is not automatically included in the backup set. Instead, a separate autobackup control file piece is generated. If instance was started with a spfile, then it is included in the autobackup piece. To force the current control file to be included in the backup set when CONFIGURECONTROLFILE AUTOBACKUP is ON use INCLUDE CURRENT CONTROLFILE. | |
| DATAFILE datafileSpec | |
| Specifies a list of one or more datafiles. | |
| DATAFILECOPY 'filename' | |
| Specifies the filenames of one or more datafile image copies. | |
| DATAFILECOPY TAG [=] ['] tag_name ['] | |
| Specifies a list of one or more datafile copies, identified by tag. If multiple datafile copies with this tag exist, then only the most current datafile copy of any particular datafile. | |
| TABLESPACE ['] tablespace_name ['] | |
| Specifies the names of one or more tablespaces. All datafiles currently part of the tablespace(s) are backed up. | |
| SPFILE | |
| Backs up spfile currently used by the database. | |
| CHANNEL ['] channel_id ['] | |
| Specifies the case-sensitive name of a channel to use when creating backup sets. | |
| CHECK LOGICAL | |
| Tests data and index blocks that pass physical corruption checks for logical corruption. | |
| COPIES [=] integer | |
| Sets the number of identical backups (1 - 4) that should be created. | |
| CUMULATIVE | |
| Copies the data blocks used since the most recent backup at level n-1 or lower, where n si from 1 to 4. For example, in a cumulative level 2 backup RMAN backs up all blocks used since the most recent level 1 or level 0 backup. | |
| DEVICE TYPE deviceSpecifier | |
| Allocates automatic channels for the specified device type only. Only valid configured channels exist and have not manually allocated channels. | |
| DISKRATIO [=] integer | |
| Directs RMAN to populate each backup set with datafiles from at least integer disks. | |
| FILESPERSET [=] integer | |
| Specifies the maximum number of input files in each backup set. FILESPERSET is more useful for managing I/O distribution for backups of files on multiple disks. | |
| FORCE | |
| BACKUP OPTIMIZATION will be ignored causing all files to be backed up. | |
| FORMAT [=] 'format_string' | |
| Specifies a filename to use for the backup piece. | |
| keepOption | |
| Overrides any configured retention policy for this backup so that the backup is not considered obsolete. Use CHANGE to alter the keep status. Must be connected to a recovery catalog when specifing KEEP FOREVER. | |
| MAXSETSIZE [=] integer [ K | M | G ] | |
| Specifies a maximum size for a backup set. All backup sets are limited to this size. | |
| NOCHECKSUM | |
| Suppresses block checksums. | |
| NOEXCLUDE | |
| Backs up all tablespaces, including any for which a CONFIGURE EXCLUDE command has been entered. However, will not override SKIP OFFLINE or SKIP READONLY. | |
| NOT BACKED UP [ SINCE TIME [=] 'date_string'] ] | |
| Specifies the date after which files that have not been backed up, should be backed up. | |
| NOT BACKED UP [ integer TIMES ] | |
| Backs up only those archived logs that have not been backed up at least integer times. | |
| PARMS [=] 'channel_parms' | |
| Specifies a quoted string containing operating system-specific information. | |
| POOL [=] integer | |
| Specifies the media pool in which the backup should be stored. | |
| PROXY [ONLY] | |
| Backs up the specified files by means of the proxy copy functionality. | |
| SKIP { OFFLINE | READONLY | INACCESSIBLE } | |
| Excludes datafiles or archived redo logs from the backup set according to the criteria specified. | |
| TAG [=] ['] tag_name ['] | |
| Creates a user-specified tag name for a backup set. | |
| VALIDATE | |
| Specified files are scanned and contents are verify. Generates no output. Use periodically to check for physical and logical errors in database files. | |
| CHANNEL ['] channel_id ['] | |
| Specifies the case-sensitive name of a channel to use when creating backup sets. | |
| DELETE [ALL] INPUT | |
| Deletes the input files upon successful creation of the backup set. Specify this option only when backing up archived logs, datafile copies, or backup sets. Is equivalent to issuing DELETE for the input files. The ALL option applies only to archived logs. | |
| DISKRATIO [=] integer | |
| Directs RMAN to populate each backup set with datafiles from at least integer disks. | |
| FILESPERSET [=] integer | |
| FORMAT [=] 'format_string' | |
| Specifies a filename to use for the backup piece. | |
| FORCE | |
| BACKUP OPTIMIZATION will be ignored causing all files to be backed up. | |
| INCLUDE CURRENT CONTROLFILE [FOR STANDBY] | |
| Creates a snapshot of the current control file and places it into each backup set produced. | |
| keepOption | |
| Overrides any configured retention policy for this backup so that the backup is not considered obsolete. Use CHANGE to alter the keep status. Must be connected to a recovery catalog when specifing KEEP FOREVER. | |
| MAXSETSIZE [=] integer [ K | M | G ] | |
| NOEXCLUDE | |
| Backs up all tablespaces, including any for which a CONFIGURE EXCLUDE command has been entered. However, will not override SKIP OFFLINE or SKIP READONLY. | |
| NOT BACKED UP [ SINCE TIME [=] 'date_string'] ] | |
| Specifies the date after which files that have not been backed up, should be backed up. | |
| NOT BACKED UP [ integer TIMES ] | |
| Backs up only those archived logs that have not been backed up at least integer times. | |
| PARMS [=] 'channel_parms' | |
| Specifies a quoted string containing operating system-specific information. | |
| POOL [=] integer | |
| Specifies the media pool in which the backup should be stored. | |
| TAG [=] ['] tag_name ['] | |
| Creates a user-specified tag name for a backup set. | |
| SKIP { OFFLINE | READONLY | INACCESSIBLE } | |
| Excludes datafiles or archived redo logs from the backup set according to the criteria specified. | |
| Related Commands: | |
| CHANGE | |
| CONFIGURE | |
| CROSSCHECK | |
| RECOVER | |
| RESTORE | |
| RUN | |
| SET | |
| SHOW |
--back up the database, and then the control file: (which contains a record of the backup)
RMAN> BACKUP DATABASE;
RMAN> BACKUP CURRENT CONTROLFILE;--backup datafiles
RMAN> BACKUP AS BACKUPSET DATAFILE
'ORACLE_HOME/oradata/trgt/users01.dbf',
'ORACLE_HOME/oradata/trgt/tools01.dbf';
--backup all datafiles in the database: (bit-for-bit copies, created on disk)
RMAN> BACKUP AS COPY DATABASE;Backup archive logs:
RMAN> BACKUP ARCHIVELOG COMPLETION TIME BETWEEN 'SYSDATE-28' AND 'SYSDATE-7';Backup tablespace:
RMAN> BACKUP TABLESPACE system, users, tools; Backup controlfile:
RMAN> BACKUP CURRENT CONTROLFILE TO '/backup/cntrlfile.copy';Backup parameter file:
RMAN> BACKUP SPFILE;Backup everything:
RMAN> BACKUP BACKUPSET ALL;Create a consistent backup and keep the backup for 1 year: (exempt from the retention policy) RMAN> SHUTDOWN;
RMAN> STARTUP MOUNT;
RMAN> BACKUP DATABASE UNTIL 'SYSDATE+365' NOLOGS;
Backup validation confirms that a backup could be run, by confirming that all database files
exist and are free of physical and logical corruption, this does not generate any output.
BACKUP VALIDATE DATABASE ARCHIVELOG ALL;backup all archive logs created more than 5 and less than 10 days ago. BACKUP ARCHIVELOG FROM TIME 'SYSDATE-10' UNTIL TIME 'SYSDATE-5'; backup all archive redo logs created between sequence numbers 9100 and 9111 BACKUP ARCHIVELOG FROM SEQUENCE 9100 UNTIL DEQUENCE 9111; backup all archive redo logs created between SCN 596000 and 597148 BACKUP ARCHIVELOG FROM SCN 506000 UNTIL SCN 597148;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23898243/viewspace-694034/ ,如需转载,请注明出处,否则将追究法律责任。