【oracle案例】ORA-19809,ORA-19804

 

ORA-19809: limit exceeded for recovery files
ORA-19804: cannot reclaim 52428800 bytes disk space from 1073741824 limit
错误是由于Flash Recovery Area 空间不足引起的,
在sql*plus中查看recovery参数

SQL> show parameter recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      D:/oracle/product/10.2.0/flash
                                                 _recovery_area/sun
db_recovery_file_dest_size           big integer 1G
recovery_parallelism                 integer     0

恢复目录大小是1G,剩余空间不够用于备份,所以先修改空间大小
SQL> alter system set db_recovery_file_dest_size=2g scope=both ;
System altered.
更改成功。
SQL> show parameter recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      D:/oracle/product/10.2.0/flash
                                                 _recovery_area/sun
db_recovery_file_dest_size           big integer 2G
recovery_parallelism                 integer     0

运行cmd进入命令提示符
进入RMAN
C:/>rman

连接目标数据库
rman> connect target sys/password@sun
连接Recovery Catalog Database, the user who owns the Recovery Catalog schema
rman> connect catalog sys/password@orcl
进行备份
rman> backup database
...
查看备份信息
rman> list backupsets

退出RMAN
rman> exit

/*
或者直接连接目标数据库
C:/rman target sys/password@sun catalog sys/pasword@orcl
*/

设置channel类型,disk,sbt_tape
rman> configure default device type to disk | sbt_tape;
设置并行度
rman> configure device type disk parallelism 4;
设置maxpiecesize 备份集大小,%s和%p会根据back up set number 和 the piece number with the set生成唯一的输出文件名
rman> configure channel device type disk | sbt_tape maxpiecesize 5g format 'ocp10g:%s:%p.bkp‘;
备份数据库, RMAN 默认以备份集方式备份数据库,不会备份空数据块,所以比image copy备份节省空间
rman> backup as compressed backupset database;
设置控制文件controlfile自动备份,备份在Flash Recovery Area以防丢失repository 后,无法找到备份位置
rman> configure controlfile autobackup on;
设置备份优化 the BACKUP command skips backing up files when the identical file has already been backed up to the specified device type.
rman> configure backup optimization on;
查看备份优化设置
rman> show backup optimization;

设置保留策略,每个datafile,archive log, controlfile 都只保留一个副本
rman> configure retention policy redundancy 1;
保留策略,保留 30天以内的备份
rman> configure retention policy to recovery window of 30 days;
回复默认保留策略
rman> configure retention policy clear;
删除过期的备份,obsolete
rman> delete obsolete;

 

LIST显示已经完成的备份,REPORT显示需要备份的信息。

 


 

Command     List

Function

RMAN>list backup;

List all your backup set.

RMAN>list copy;

List all your image copies.

RMAN>list backup of database;

List all whole database backup sets,

whether full or incremental.

RMAN>list backup of datafile 1;

RMAN>list backup of tablespace users;

List the backup sets that include datafile 1 and the backups that include the USERS tablespace.

RMAN>list backup of archivelog all;

 

RMAN>list copy of archivelog from time=’sysdate – 7’;

List all image copies of archive logs generated in the last 7 days.

RMAN>list backup of archivelog from sequence 1000 until sequence 1050;

List all backup sets containing archive logs of log switch sequence numbers 1000-1050.

 

 

Command      Report

Function

RMAN> report schema;

List the datafiles only(but not the controlfile or archived logs) that make up the database.

RMAN> report need backup;

Apply the configured retention policy and list all the datafiles and archive log files that need at least one backup to conform to the policy.

RMAN> report need backup days 3;

List all objects that haven’t been backed up for three days. Use this command or the next to ignore the configured retention policy.

RMAN> report need backup redundancy 3;

List all files of which there are not at least three bakups.

 

 

 

RMAN> report schema;


Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    490      SYSTEM               ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
SUN/DATAFILE/O1_MF_SYSTEM_6Z1VFNST_.DBF
2    345      UNDOTBS1             ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
SUN/DATAFILE/O1_MF_UNDOTBS1_6Z1VGFVG_.DBF
3    280      SYSAUX               ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
SUN/DATAFILE/O1_MF_SYSAUX_6Z1VG8CK_.DBF
4    5        USERS                ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
SUN/DATAFILE/O1_MF_USERS_6Z1VGH49_.DBF
5    100      EXAMPLE              ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
SUN/DATAFILE/O1_MF_EXAMPLE_6Z1VLCKW_.DBF
6    10       ORACLE8_DATA         ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
ORACLE8/ORACLE8_DATA.DBF
7    150      ORACLE8_DATA         ***     D:/ORACLE/PRODUCT/10.2.0/ORADATA/SUN/
ORACLE8/ORACLE8_DATA1.DBF

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    29       TEMP                 32767       D:/ORACLE/PRODUCT/10.2.0/ORADATA/
SUN/SUN/DATAFILE/O1_MF_TEMP_6Z1VKQ71_.TMP
2    10       ORACLE8_TEMP         10          D:/ORACLE/PRODUCT/10.2.0/ORADATA/
SUN/ORACLE8/ORACLE8_TEMP.DBF

 

---------------------------------------------------------------

某个文件的备份

datafile

RMAN>run{

backup as compressed backupset

format 'D:/oracle/product/10.2.0/flash_recovery_area/sun/backupset/file5.bus'

datafile 5;}

 

tablespace

RMAN>run{

backup as compressed backupset

format 'D:/oracle/product/10.2.0/flash_recovery_area/sun/backupset/%U.dbf'

tablespace users;}

 

current controlfile

RMAN> run{

backup as compressed bakupset

format 'D:/oracle/product/10.2.0/flash_recovery_area/sun/backupset/%U.ctl'

current controlfile;}

 

--------------------------------------------------image copies

RMAN>backup as copy database;

RMAN> backup as copy archivelog all delete all input;

 

----------------------------tags for backup sets and image copies

// a tag is a logical name used to reference a backup set or a set of image copies. Whenever a backup set or image copy is made ,it is assigned a tag.    you can use LIST BACKUPSET command to see it.

 

run {

backup as compressed backupset

tablespace system tag=dd_backup;}

生成的备份文件名是自动生成的,使用List backupset命令查看备份信息,可以看到刚刚生成的备份的tag是DD_BACKUP

 

run{

backup as compressed backupset

format 'D:/oracle/product/10.2.0/flash_recovery_area/sun/sun/backupset/'%U.dbf'

tablespace system tag=dd_backup;}

格式化输出文件

 

删除标记

RMAN> delete backupset tag=dd_backup;

 

run{

delete backupset tag monthly;

backup as backupset

database tag=monthly;}

 

----------------------------incremental backup

incremental backups apply only to datafile backups.      --backupset

 

RMAN> backup incremental level 0 database;

 

RMAN> backup incremental level 1 database;     ---default differential backup, backup the blocks

 

RMAN>backup incremental level 1 cumulative database;             --cumulate the change since last level 0 backup

 

----------------------------combining incremental backups and image copies

RMAN> backup as copy incremental level 0

database tag db_whole_copy;

 

run{

backup incremental level 1

for recover of copy with tag db_whole_copy

database tag db_copy_upd;

recover copy of database with tag db_whole_copy;

delete backupset tag db_copy_upd;}

??????????????

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值