备注:RMAN备份(仅支持基于spfile的备份,不支持基于init.ora配置的备份)
练习:开启ARCHIVELOG模式 1为归档的重做日志被指FRA和单独的归档日志目标 SQL>show parameter db_recovery_file_dest; SQL>alter system set db_recovery_file_dest_size=2G; SQL>alter system set db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'; 2现在,定义两个归档日志目标目录,一个是FRA。设置数据库文件并设置LOG_ARCHIVE_DEST_1参数,让它指向预先定义的文件系统,该文件系统将是第一个归档日志目录,由于要配置LOG_ARCHIVE_DEST_1参数使用1=RA,因此需要使用参数USE_DB_RECOVERY_FILE_DEST参数来设置LOG_ARCHIVE_DEST_10参数以指向FRA. 使用show parameter命令来验证设置是否正确 SQL>alter system set log_archive_dest_1='location=/backup/archive/ORCL'; SQL>alter system set log_archive_dest_10='location=USE_DB_RECOVER_FILE_DEST'; SQL>show parameter log_archive_dest; SQL>show parameter recover; SQL>archive log list ; 3关闭数据库 SQL>shutdown immediate; 4加载数据库 SQL>startup mount; 5将数据库置入ARCHIVELOG模式 SQL>alter database archivelog; 查看归档模式 SQL>archive log list; 查看归档模式是否开启 SQL>select log_mode from v$database; 6打开数据库 SQL>alter database open;
练习:关闭归档模式 SQL>shutdown immediate; SQL>startup mount; SQL>alter database noarchivelog; SQL>alter database open
练习:执行一个联机备份操作 1启动RMAN [:~]$ rman target=backup_admin/111111 2启动备份操作 RMAN>backup database plus archivelog; 2备份后删除归档日志 RMAN>backup database plus archivelog delete input; 2备份,设置每个备份集里只有一个备份文件 RMAN>backup filesperset = 1 database plus archivelog delete input; 执行时报错'ORA-19809: limit exceeded for recovery files ' 解决方式增大闪回区大小: SQL>alter system set db_recovery_file_dest_size=10G; 配置归档日志的默认位置 configure channel 1 device type disk format '/backup/archive/ORCL/backup_%U' 配置备份有两个副本 configure datafile backup copies for device type disk to 2; 自动备份控制文件 configure controlfile autobackup on; 清除默认信道1的设置 configure channel 1 device type disk clear 设置控制文件备份格式 configure controlfile autobackup format for device type disk to '/backup/archive/ORCL/CONTROLFILE.ORCL.%F'; 检查归档日志 crosscheck archivelog all; 删除过期归档日志 delete expired archivelog all; delete archivelog all completed before 'sysdate-1'; delete archivelog all completed before 'sysdate'; run{ configure controlfile autobackup on; set controlfile autobackup format for device type disk to 'CONTROLFILE.ORCL.%F'; backup filesperset = 1 database plus archivelog delete input; }
-----end-------