1) rman catalog rmanbk/rmanbk@axibk
rman catalog rmanbk/rmanbk@axibk target sys/richel@axisoft1
2) create catalog tablespace "RMAN_TS"
3) CONNECT TARGET SYS/RICHEL@AXISOFT1
4) register database
5) RMAN> run {
allocate channel d1 type disk;
backup tag=db_full_bk_20050419 format='e:ora_backup%d%s%p.bak' (database);
release channel d1;} //全部备份;
RMAN> run {
allocate channel d1 type disk;
backup incremental level 1 tag=db_inc_bk_200506017 format='e:ora_backup%d%s%p.bak' (database);
release channel d1;} //基于LEVEL 1 备份;
RMAN> run {
allocate channel d1 type disk;
backup tag='BK_TS_TOOLS' FORMAT='E:ORA_BACKUP%d%s%p.bak' tablespace 'TOOLS';
release channel d1;} //备份单个表空间TOOLS;
//备份归档的日志文件后,删除那些已经备份的归档日志文件。(还可以加option 如:delete all input 或,like等)
BACKUP TAG='ARC_LOG04062005' FORMAT='E:ORA_BACKUPARC_LOG04062005.LOG' ARCHIVELOG ALL DELETE INPUT;
6) RMAN基本命令列表:
1. REPORT SCHEMA;
2. LIST COPY(BACKUP) OF TABLESPACE 'TOOLS';
3. VALIDATE BACKUPSET 117; //首先list backup,找到某个backupset,然后进行有效性确认。
4. show default device; show default device type; show channel;
5.
6.
7.
7) backup current controlfile;
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/07/2005 10:32:26
ORA-19504: failed to create file "e:ora_backup"
ORA-27038: skgfrcre: file exists
OSD-04010: <create> option specified, file already exists
BACKUP ... PLUS ARCHIVELOG
backup tablespace "TOOLS" plus archivelog DELETE INPUT; //备份表空间和归档的日志文件。
BACKUP DEVICE TYPE sbt DATABASE PLUS ARCHIVELOG; //这里指定设备类型"SBT"
// 在三个地方存有备份。BACKUP COPIES, SET BACKUP COPIES, or CONFIGURE ... BACKUP COPIES
backup copies 3 datafile 9 format 'e:backup_1%n%p%s%c.cpy','e:backup_2%n%p%s%c.cpy','e:backup_3%n%p%s%c.cpy';
//同样可以备份 backupset 。甚至是多个 copies。
BACKUP COPIES 2 DEVICE TYPE sbt BACKUPSET ALL;
8) channel 上的选项:
(rate、maxpiecesize、maxsetsize备份集的最大大小、maxopenfile同时操作的文件数、send,parms ,connect)
CONFIGURE CHANNEL 2 DEVICE TYPE sbt RATE 1M;
level 0 backup和 full backup 的不同之处就在于 full backup不能包括在incremental备份策略中。
(The only difference between a level 0 backup and a full backup is that a full backup is never included in an incremental strategy)
PUT 命令也可以存储OS 文件,例如:参数文件和密码文件 到恢复目录中。
(The PUT command can also store operating system files such as parameter and password files in the recovery catalog)
NOT BACKED UP SINCE
11:19 AM 4/8/2005
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE RETENTION POLICY TO NONE;
CONFIGURE RETENTION POLICY CLEAR;
# exempts the backup from retention policy until last day of 2002
BACKUP DATABASE KEEP UNTIL TIME "TO_DATE('31-DEC-2002', 'dd-mon-yyyy')" NOLOGS;
# alters status of backup set 231 from KEEP to NOKEEP
CHANGE BACKUPSET 231 NOKEEP;
# specifies that this backup and the logs required to recover it are indefinitely exempt
# from the retention policy
BACKUP TABLESPACE tbs2 KEEP FOREVER NOLOGS;