Chapter09-Oracle Recover Manager Overview and Configuration
1、RMAN连接远端数据库
rman target sys/oracle@DB200 nocatalog
2、查看RMAN的配置信息
show all;(rman登陆成功后,执行show all命令;)
3、修改rman配置文件
之前默认Device type是Disk,现在需要修改成sbt;操作命令如下:
configure default device type to sbt;
恢复Device type为Disk
configure default device type clear;
4、数据库备份
backup database;
View Code
RMAN> backup database; Starting backup at 19-MAR-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=196 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/oradata/poli/system01.dbf input datafile file number=00002 name=/u01/oradata/poli/sysaux01.dbf input datafile file number=00005 name=/u01/oradata/poli/example01.dbf input datafile file number=00003 name=/u01/oradata/poli/undotbs01.dbf input datafile file number=00004 name=/u01/oradata/poli/users01.dbf channel ORA_DISK_1: starting piece 1 at 19-MAR-13 channel ORA_DISK_1: finished piece 1 at 19-MAR-13 piece handle=/u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_nnndf_TAG20130319T154228_8nj5q5sd_.bkp tag=TAG20130319T154228 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:46 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 19-MAR-13 channel ORA_DISK_1: finished piece 1 at 19-MAR-13 piece handle=/u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_ncnnf_TAG20130319T154228_8nj5ro16_.bkp tag=TAG20130319T154228 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 19-MAR-13
5、Without a Recovery Catalog
- Starting RMAN locally
UNIX: $ORACLE_SID=DB01;export ORACLE_SID
$rman target / as sysdba
WINDOWS NT:
c:\>set ORACLE_SID=DB01
c:\>rman target / as sysdba
- Starting RMAN remotely
rman target sys/target_pwd@DB01
6、Recovery Manager Mode
- Interactive mode
- Use it when doing analysis
- Minimize regular usage
- Avoid using with log option
- Batch mode
- Meant for automated jobs
- Minimize operator errors
- Set the log file to obtain information
7、在RMAN 命令行模式下,查看tablespace信息
View Code
RMAN> report schema; Report of database schema for database with db_unique_name POLI List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 680 SYSTEM *** /u01/oradata/poli/system01.dbf 2 510 SYSAUX *** /u01/oradata/poli/sysaux01.dbf 3 85 UNDOTBS1 *** /u01/oradata/poli/undotbs01.dbf 4 35 USERS *** /u01/oradata/poli/users01.dbf 5 100 EXAMPLE *** /u01/oradata/poli/example01.dbf List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 1 29 TEMP 32767 /u01/oradata/poli/temp01.dbf
查看单个文件的备份详细信息:
View Code
RMAN> list backup of datafile '/u01/oradata/poli/system01.dbf'; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 1 Full 1.05G DISK 00:00:43 19-MAR-13 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20130319T154228 Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_nnndf_TAG20130319T154228_8nj5q5sd_.bkp List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 1194625 19-MAR-13 /u01/oradata/poli/system01.dbf
rman backup have two types:copy & backup
8、The REPORT Command
- Produces a detail analysis of the respository
- Produces reports to answer:
- which files need a backup?
- which backups can be deleted?
- while files are unrecoverable?