ITPub博客

首页 > 数据库 > Oracle > rman学习笔记

rman学习笔记

原创 Oracle 作者:xiaoqiang917 时间:2011-02-18 16:47:56 0 删除 编辑
记录rman学习过程中搜集的资料。。。[@more@] 1024x768 Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE MicrosoftInternetExplorer4

启用归档

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

Total System Global Area 583008256 bytes

Fixed Size 1250260 bytes

Variable Size 113249324 bytes

Database Buffers 461373440 bytes

Redo Buffers 7135232 bytes

Database mounted.

SQL> archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 399

Current log sequence 400

SQL> alter database archivelog;

Database altered.

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 399

Next log sequence to archive 400

Current log sequence 400

SQL> alter database open

2 /

Database altered.

SQL> show parameter recovery

NAME TYPE VALUE

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

db_recovery_file_dest string C:oracle/flash_recovery_area

db_recovery_file_dest_size big integer 2G

recovery_parallelism integer 0

SQL>

RMAN> show all;

RMAN> backup spfile;

RMAN> backup tablespace users;

RMAN> connect target sys/sys

RMAN> list backup of database

RMAN> delete backupset 3;

Backup存放目录设置与修改

RMAN> backup database;

In the following example no backup location was specified meaning that the backups will automatically be placed in the Flash Recovery Area (FRA). If the FRA has not been setup then all backups default to $ORACLE_HOME/dbs.

How to check if the RFA has been setup:

SQL> show parameter recovery_file_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /recovery_area
db_recovery_file_dest_size big integer 50G


If your FRA is not setup (ie values are null) please refer to the following note for assistance in setting it up.

Note 305648.1 What is a Flash Recovery Area and how to configure it ?



If you wish to place your backup outside the FRA then following RMAN syntax may be used.

RMAN> backup database format '/backups/PROD/df_t%t_s%s_p%p';

What is a Flash Recovery Area ?

The flash recovery area is an Oracle-managed directory, file system, or Automatic Storage Management disk group that provides a centralized disk location for backup and recovery files. All the files you need to completely recover a database from a media failure are part of the Flash Recovery Area. Oracle creates archived logs and flashback logs in the flash recovery area. RMAN can store its backup sets and image copies in the flash recovery area, and it uses it when restoring files during media recovery. The flash recovery area also acts as a disk cache for tape.

Flash recovery extends the functionality of Oracle Managed Files to all recovery related files (backup sets, image copies, and archived logs). Oracle Database automatically manages this storage, deleting files that are no longer needed. The user specifies only the location of a Flash Recovery Area, and the amount of disk space that Oracle is allowed to use for recovery related files. This feature is integrated with the 10G MMON feature, so that out of space conditions can be handled through the standard Oracle monitoring framework.

Periodically copying backups to tape frees space in the flash recovery area for other files. Oracle recommends that you enable a recovery area to simplify backup management.

The following recovery-related files are stored in the flash recovery area:
-- Current control file
-- Online redo logs
-- Archived redo logs
-- Flashback logs
-- Control file autobackups
-- Datafile and control file copies
-- Backup pieces
-- Foreign archived redo log ( An archived redo log received by a logical standby database for a LogMiner session.)

What should be the size of Flash Recovery Area ?

The larger the flash recovery area is, the more useful it becomes. Ideally, the flash recovery area should be large enough to contain the required files. The recovery area should be able to contain a copy of all datafiles in the database and the incremental backups used by your chosen backup strategy.

If providing this much space is impractical, then it is best to create an area large enough to keep a backup of the most important tablespaces and all the archived logs not yet on tape. At an absolute minimum, the flash recovery area must be large enough to contain the archived redo logs not yet on tape. If the recovery area has insufficient space to store flashback logs and meet other backup retention requirements, then the recovery area may delete flashback logs to make room.

Formulas for estimating a useful flash recovery area size depend on whether:

-- Your database has a small or large number of data blocks that change frequently .
-- You store backups only on disk, or on disk and tape.
-- You use a redundancy-based backup retention policy, or a recovery window-based retention policy .
-- You plan to use Flashback Database or a guaranteed restore point as alternatives to point-in-time recovery.

If you plan to enable flashback logging, then note that the volume of flashback log generation is approximately the same order of magnitude as redo log generation. For example, if you intend to set DB_FLASHBACK_RETENTION_TARGET to 24 hours, and if the database generates 20 GB of redo in a day, then a rule of thumb is to allow 20 GB to 30 GB disk space for the flashback logs. The same rule applies to guaranteed restore points when flashback logging is enabled. For example, if the database generates 20 GB redo every day, and if the guaranteed restore point will be kept for a day, then plan to allocate 20 to 30 GB.

For an example suppose that you want to determine the size of a flash recovery when the backup retention policy is set to REDUNDANCY 1 and you intend to follow the Oracle Suggested Strategy of using an incrementally updated backup. You use the following formula to estimate the disk quota

Disk Quota =
Size of a copy of database +
Size of an incremental backup +
Size of (n+1) days of archived redo logs +
Size of (y+1) days of foreign archived redo logs (for logical standby) +
Size of control file +
Size of an online redo log member * number of log groups +
Size of flashback logs (based on DB_FLASHBACK_RETENTION_TARGET value)



Where n is the interval in days between incremental updates and y is the delay in applying the foreign archived redo logs on a logical standby database:

For Oracle suggested backup kindly refer Note.303861.1 Incrementally Updated Backup In 10G

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u04/oracle/test92_bak/%F';

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u04/oracle/test92_bak/%d_%U';

CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u04/oracle/test92_bak/%d_%U';

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u03/oracle/product/9.2/dbs/snapcf_test92.f'; # default

有没有办法让rman产生的文件到别台机器上?

http://www.itpub.net/viewthread.php?tid=108605&extra=&highlight=rman&page=3

SELECT s.SID, p.SPID, s.CLIENT_INFO

FROM V$PROCESS p, V$SESSION s

WHERE p.ADDR = s.PADDR

AND CLIENT_INFO LIKE 'rman%';

1024x768 Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE MicrosoftInternetExplorer4

时间估算

SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,

ROUND(SOFAR/TOTALWORK*100,2) "% COMPLETE"

FROM V$SESSION_LONGOPS

WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%'

AND TOTALWORK != 0 AND SOFAR <> TOTALWORK;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25274175/viewspace-1046172/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2011-02-18

  • 博文量
    11
  • 访问量
    10422