14配置和使用恢复管理器_第1页
14配置和使用恢复管理器_第2页
14配置和使用恢复管理器_第3页
14配置和使用恢复管理器_第4页
14配置和使用恢复管理器_第5页
已阅读5页,还剩63页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、14.配置和使用恢复管理器Backup and Recovery: ReviewThe major backup and recoveryrelated topics covered in the Database Administration I Course are:Types of failure that can happenStatement, session, instance, media, and so onHow to configure ARCHIVELOG modeHow to automate backupsHow to do incremental backups H

2、ow to perform and tune instance recoveryServersessionChannelServersessionEnterprise ManagerRecovery Manager ComponentsTargetdatabaseRecoverycatalog databaseAuxiliarydatabaseDiskFlash recoveryareaChannelChannelMMLOptionsRecoveryManager(RMAN)Recovery Manager Components(notes only slide)Steps for Confi

3、guring RMAN 1.Determine the repository location: control file or recovery catalog.2.Define database and environment variables.3.Start RMAN and connect to the target and, optionally, the recovery catalog databases.4.Configure persistent settings.RMAN Repository Data Storage:Comparison of OptionsContr

4、ol file:Simpler administrationDefaultRecovery catalog:Replicates control file dataHas room for more dataCan service many targetsCan store RMAN scriptsMetadataBackup set listImage copy list.RMAN Repository Data Storage:Comparison of Options(notes only slide)Backup DestinationsBackups can be written t

5、o:Disk directoryMedia Management Library (tape device)Typically used for disaster recovery, when disk backups are lostFlash recovery areaThis is a disk area set aside for backup and recovery and flashback database purposes.You define the location and the size.Files are automatically named by using O

6、racle Managed Files.Files are automatically retained and deleted as necessary.Media ManagementRecovery ManagerMedia management server softwareMedia management libraryServersession(channel)Oracle SecureBackup withbuilt-in MMLOrUsing a Flash Recovery Area with RMANYou can configure RMAN to use the fla

7、sh recovery area.Database areaRMAN backupprocessFlash recovery areaDB_RECOVERY_FILE_DEST = /u01/oracle/fraDB_RECOVERY_FILE_DEST_SIZE = 2GUsing a Flash Recovery Area with RMAN(notes only slide)Monitoring the Flash Recovery Areawith EMFlash Recovery Area Space UsageConfigure the retention policy to th

8、e minimum value appropriate for your database.Back up the archive log files regularly and delete the files upon completion of the backup.Use the RMAN REPORT OBSOLETE and DELETE OBSOLETE commands to remove backups and file copies that are not required.V$FLASH_RECOVERY_AREA_USAGEYou can query V$FLASH_

9、RECOVERY_AREA_USAGE to view the flash recovery area disk space usage.SQL SELECT file_type, 2 percent_space_used AS used, 3 percent_space_reclaimable AS reclaimable, 4 number_of_files AS number 5 FROM v$flash_recovery_area_usage ;FILE_TYPE USED RECLAIMABLE FILES V$FLASH_RECOVERY_AREA_USAGEOutput from

10、 the V$FLASH_RECOVERY_AREA_USAGE queryFILE_TYPE USED RECLAIMABLE FILES CONTROLFILE 0 0 0ONLINELOG 0 0 0ARCHIVELOG 69.13 0 593BACKUPPIECE 0 0 0IMAGECOPY 0 0 0FLASHBACKLOG 1.77 0 37Backing Up the Flash Recovery AreaRMAN BACKUP RECOVERY FILES;Benefits of Using a Flash Recovery AreaUsing the flash recov

11、ery area for recovery-related files:Simplifies the location of database backupsAutomatically manages the disk space allocated for recovery filesDoes not require changes to existing scriptsPuts database backups, archive logs, and control file backups in the flash recovery areaSetting Parameters That

12、Affect RMANDatabase initialization parametersCONTROL_FILE_RECORD_KEEP_TIMEDB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE, if using the flash recovery areaEnvironment variablesNLS_DATE_FORMAT NLS_LANGSetting Parameters that Affect RMAN(notes only slide)RMAN Usage ConsiderationsResources: Shared

13、 memory, more processesPrivileges given to users: Database: SYSDBAOperating system: Access to devicesRemote operations: Set up the password fileEnsure that the password file is backed upConnection Types with RMANTargetdatabaseRecoverycatalog DBAuxiliarydatabaseRecovery ManagerStarting RMANStarting R

14、MAN locallyStarting RMAN remotelyUNIX:$ ORACLE_SID=DB01; export ORACLE_SID$ rman target / rman target sys/passwordDB01Windows NT:C: set ORACLE_SID=DB01C: rman target / Additional RMAN Command-Line ArgumentsWriting RMAN output to a log fileExecuting a command file when RMAN is invokedEstablishing dat

15、abase connections on RMAN startup$ rman TARGET sys/oracle CMDFILE=$HOME/scripts/my_rman_script.rcv$ rman TARGET sys/oracle LOG=$HOME/oradata/u03/rman.log APPEND$ rman TARGET SYS/sys_pwdorcl CATALOG rman/rmanrcatConfiguring RMAN Settings by Using EM Control File AutobackupsRMAN CONFIGURE CONTROLFILE

16、AUTOBACKUP ON;Best practice: Oracle recommends that you enable control file autobackup.Control File Autobackups(notes only page)A retention policy describes which backups will be kept and for how long.There are two types of retention policies:Recovery window: Establishes a period of time within whic

17、h point-in-time recovery must be possibleRedundancy: Establishes a fixed number of backups that must be keptThese policies are mutually exclusive and can be set with the CONFIGURE command.Retention PoliciesNowSeven-day retentionFile1File2File2 needsto be backed up:Retention Policies(notes only page)

18、Managing Persistent SettingsUse the SHOW command to list current settings:Use the CLEAR command to reset any persistent setting to its default value:RMAN SHOW CONTROLFILE AUTOBACKUP FORMAT;RMAN SHOW EXCLUDE;RMAN SHOW ALL; RMAN CONFIGURE BACKUP OPTIMIZATION CLEAR;RMAN CONFIGURE MAXSETSIZE CLEAR;RMAN

19、CONFIGURE DEFAULT DEVICE TYPE CLEAR;Channel AllocationChannel (DISK)BACKUP RESTORERECOVERServersessionServersessionTargetdatabaseChannel (SBT)RMANAutomatic and Manual Channel AllocationAn automatic channel is one that is preconfigured and used for subsequent commands. To change the default device ty

20、pe for automatic channel allocation, use:A manually allocated channel is one that overrides the automatic channel setting. This channel overrides the automatic channel for this run block:RMAN CONFIGURE DEFAULT DEVICE TYPE TO sbt;RMAN RUN 2 ALLOCATE CHANNEL c1 DEVICE TYPE disk; 3 BACKUP DATAFILE /u01

21、/oradata/user01.dbf; 4 Channel Control OptionsConfigure parallelism:Specify the maximum backup piece size:Format the name of generated backup files:RMAN CONFIGURE DEVICE TYPE DISK PARALLELISM 3;RMAN CONFIGURE CHANNEL DEVICE TYPE DISK 2 MAXPIECESIZE 2G;RMAN RUN 2 ALLOCATE CHANNEL d1 DEVICE TYPE DISK

22、3 FORMAT /disk1/backups/%U; 4 BACKUP DATABASE PLUS ARCHIVELOG; SummaryIn this lesson, you should have learned how to:Use either the control file or a recovery catalog for the RMAN repositoryChange RMAN default settings with CONFIGUREUse the flash recovery area for RMAN operationsMonitor the flash re

23、covery area by using v$ views and Enterprise ManagerImplement recovery window and redundancy retention policiesImplement manual and automatic channel allocationIssuing Recovery Manager CommandsInteractive clientEnter commands at RMAN prompt.Use when performing analysis, or when running reports or st

24、ored scripts.Batch modeUse with automated jobs.Specify a command file when starting RMAN.Specify the log file name to capture session log.Pipe interfaceSpecify the PIPE command-line argument.Use to communicate data between sessions or between RMAN and an external application.Issuing Recovery Manager

25、 Commands(notes only slide) Types of RMAN CommandsRMAN commands are of the following types:Stand-alone command:Is executed individually at the RMAN promptCannot appear as subcommands within RUNJob command:Must be within the braces of a RUN commandIs executed as a groupSome commands can be executed a

26、s either astand-alone or a job command.Job Commands: ExampleJob commands appear inside a RUN command block:RMANRUN 2BACKUP AS BACKUPSET 3FORMAT /u01/db01/backup/%d_%s_%p 4 DURATION 10:00 MINIMIZE LOAD 5(DATABASE); 6SQL alter system archive log current; 7RMAN Commands: OverviewTargetdatabaseREPORTLIS

27、TCatalog databaseEnterprise ManagerRESTORERECOVERFLASHBACKSPFILEBACKUPControlfileArchivedlog filesRMANCatalog maintenanceCROSSCHECKDELETEEXPIREDCHANGEStoredscriptsRMAN Command Overview(notes only slide)BACKUP CommandRMAN BACKUP AS BACKUPSET 2 FORMAT /BACKUP/df_%d_%s_%p.bus 3 TABLESPACE hr_data;Backu

28、psetData file 1Data file 2Data file 3Data file 1Data file 2Data file 3Tablespace HR_DATACommandsBACKUPBlock C.T.Inc. UpdateLISTREPORTDELETEBackup ConstraintsThe database must be mounted or open.You cannot back up online redo logs.Only “clean” backups are usable in NOARCHIVELOG mode.Only “current” da

29、ta file backups are usable in ARCHIVELOG mode.Parallelization of Backup SetsFor performance, allocate multiple channels and assign files to specific channels.Data file 4Data file 1Data file 5ChannelMMLBackuppiece 1Backuppiece 2Data file 2Data file 3Data file 9ChannelMMLData file 6Data file 7Data fil

30、e 8BackupPiece 3ChannelMMLCompressed BackupsRMAN BACKUP AS 2 COMPRESSED BACKUPSET 3 DATABASE;RMAN CONFIGURE DEVICE TYPE 2 DISK PARALLELISM 2 3 BACKUP TYPE TO 4 COMPRESSED BACKUPSET;Compressed backup filesDatabase filesImage CopyCopy of data file 3Copy of archived logData file 3Archivedlog fileData f

31、ile 3Archivedlog fileRMAN BACKUP AS COPY 2 DATAFILE /ORADATA/users_01_db01.dbf 3 FORMAT /BACKUP/users01.dbf;RMAN BACKUP AS COPY 4 ARCHIVELOG LIKE arch_1060.arc 5 FORMAT arch_1060.bak;Tags for Backups and Image CopiesA tag is a logical name assigned to a backup set or image copy.month_full_backupweek

32、_full_backupData file 3Data file 4Backup setData files 1,3Data files 2,4Backup setBACKUP Command OptionsCheck for physical block corruptions.Scan for logical corruptions and physical corruptions.Set a threshold on the number of detected corruptions allowed before aborting.Validate the target input f

33、iles before performing a backup operation.Duplex the backup set.Overwrite an existing backup set or image copy.Pass control of the data transfer between storage devices and the data files on disk to the media management layer.Encrypt the backup files.Backing Up Archived Redo LogsOnline redo log file

34、 switch is automatic. Archived log failover is performed.You can specify a range of archived redo logs to back up.Backup sets of archived redo log files cannot contain any other type of file.RMAN BACKUP 2 FORMAT /disk1/backup/ar_%t_%s_%p 3 ARCHIVELOG FROM SEQUENCE=234 4 DELETE INPUT;Backing Up Archi

35、ved Redo Logs(notes only slide)Whole Database BackupRMAN BACKUP DATABASE PLUS ARCHIVELOG;Archived log file copiesSPFILEControlfileData file copiesRMAN Backup TypesA full backup contains all used data file blocks.A level 0 incremental backup is equivalent to a full backup that has been marked as leve

36、l 0.A cumulative level 1 incremental backup contains only blocks modified since thelast level 0 incremental backup.A differential level 1 incremental backup contains only blocks modified since the last incremental backup.Differentialincremental backup Cumulativeincremental backup Full, or level 0inc

37、remental backupDifferential Versus CumulativeA differential incremental backup contains all blocks changed since the last incremental backup.A cumulative incremental backup contains all blocks changed since the last level 0 incremental backup.LvlDaySunMonTueWedThuFriSatSunLevel 0Level 0111c11001cBlo

38、ck Change TrackingThe backup process can be streamlined by enabling block change tracking, which:Records changed blocks in a change tracking fileIs used automatically by RMAN, if enabledOptimizes incremental backups by avoiding full data file scans during backupList of changed blocksRedogenerationRe

39、do log101100101011000011101001011010101110011Change trackingfileSGACTWRCommandsBACKUPBlock C.T.Inc. UpdateLISTREPORTDELETEEnabling Block Change TrackingSQL ALTER DATABASE ENABLE 2 BLOCK CHANGE TRACKING 3 USING FILE /mydir/rman_change_track.f 4 REUSE;Incrementally UpdatingBackupsIncremental backup fi

40、lesRecovered data fileImage copyof data fileImage copy of data file updated to a more recent stateRMAN RECOVER COPY OF 2 DATAFILE n|file_name 3 WITH TAG incr_upd_df1;CommandsBACKUPBlock C.T.Inc. UpdateLISTREPORTDELETELIST CommandList backup sets and copies of data files:List backup sets and copies o

41、f any data file for a specified tablespace:List backup sets and copies containing archive logs for a specified range:RMAN LIST BACKUP OF DATAFILE 2 /db01/ORADATA/u03/users01.dbf;RMAN LIST BACKUP OF DATABASE;RMAN LIST COPY OF TABLESPACE SYSTEM;RMAN LIST COPY OF DATABASE ARCHIVELOG 2 FROM TIME=SYSDATE

42、-7;CommandsBACKUPBlock C.T.Inc. UpdateLISTREPORTDELETEREPORT CommandProduces a detailed analysis of the repositoryProduces reports to answer:What are the data files in the database?Which files need a backup?Which backups can be deleted?Which files are unrecoverable?CommandsBACKUPBlock C.T.Inc. Updat

43、eLISTREPORTDELETEREPORT NEED BACKUP CommandLists all data files that require a backupAssumes that the most recent backup is used during a restoreProvides four options:IncrementalDaysRedundancyRecovery windowUses the current retention policy configuration if no options are specifiedREPORT NEED BACKUP: ExamplesFiles that need more than three incremental b

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论