知识大全 完整的oracle rman备份恢复的例子
Posted 文件
篇首语:眼前多少难甘事,自古男儿当自强。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 完整的oracle rman备份恢复的例子相关的知识,希望对你有一定的参考价值。
建rman库作为repository $more createrman_db sh set echo on spool makedb log create database rman datafile /export/home/oracle/oradata/rman_data/system dbf size m autoextend on next K logfile /export/home/oracle/oradata/rman_data/redo log SIZE M /export/home/oracle/oradata/rman_data/redo log SIZE M maxdatafiles maxinstances maxlogfiles character set US ASCII national character set US ASCII ; disconnect spool off exit @/export/home/oracle/ /rdbms/admin/catalog sql; REM ********** ALTER SYSTEM TABLESPACE ********* ALTER TABLESPACE SYSTEM DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS UNLIMITED PCTINCR EASE ); ALTER TABLESPACE SYSTEM MINIMUM EXTENT K; REM ********** TABLESPACE FOR ROLLBACK ********** CREATE TABLESPACE RBS DATAFILE /export/home/oracle/oradata/rman_data/rbs dbf s ize m AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS UNLIMITED PC TINCREASE ); REM ********** TABLESPACE FOR TEMPORARY ********** CREATE TABLESPACE TEMP DATAFILE /export/home/oracle/oradata/rman_data/temp dbf size m AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS UNLIMITED PCTINCR EASE ) TEMPORARY; REM **** Creating four rollback segments **************** CREATE PUBLIC ROLLBACK SEGMENT RBS_ TABLESPACE RBS STORAGE ( OPTIMAL K ); ALTER ROLLBACK SEGMENT RBS_ ONLINE; REM **** SYS and SYSTEM users **************** alter user sys temporary tablespace TEMP; alter user system temporary tablespace TEMP; disconnect spool off exit $more createrman_db sh spool crdb log @/export/home/oracle/ /rdbms/admin/catproc sql @/export/home/oracle/ /rdbms/admin/caths sql @/export/home/oracle/ /rdbms/admin/otrcsvr sql connect system/manager @/export/home/oracle/ /sqlplus/admin/pupbld sql disconnect spool off exit 建repository存放的表空间和rman用户 $more createrman_db sh connect internal create tablespace rman_ts datafile /export/home/oracle/oradata/rman_data/rman_ts dbf size M default storage (initial K next K pctincrease ); create user rman_hainan identified by rman_hainan temporary tablespace TEMP default tablespace rman_ts quota unlimited on rman_ts; grant recovery_catalog_owner to rman_hainan; grant connect resource to rman_hainan; 建catalog 注册目标数据库 $more createrman_db sh rman catalog rman_hainan/rman_hainan@rman msglog=rman log create catalog ; exit; rman target sys/oracle@db connect catalog rman_hainan/rman_hainan@rman register database; exit; 可以开始做备份了 做全备 $more rmanshell /export/home/oracle/ profile rman rcvcat rman_hainan/rman_hainan@rman target / cmdfile /export/home/oracle/ba ckup_level rcv log /export/home/oracle/backup log $more backup_level rcv resync catalog; run allocate channel t type disk; backup incremental level skip inaccessible tag hot_db_bk_level filesperset format /export/home/oracle/bk_%s_%p_%t bk (database); sql alter system archive log current ; backup filesperset format /export/home/oracle/a _%s_%p_%t ac (archivelog all delete input); backup format /export/home/oracle/df_t%t_s%s_p%p ct current controlfile ; 做增备 $more rmanshell rman rcvcat rman_hainan/rman_hainan@rman target / cmdfile backup_level rcv log backup log $more backup_level rcv resync catalog; run allocate channel t type disk; backup incremental level skip inaccessible tag hot_db_bk_level filesperset format bk_%s_%p_%t bk (database); sql alter system archive log current ; backup filesperset format a _%s_%p_%t ac (archivelog all delete input); backup current controlfile; 删除旧的全备 $rman rcvcat rman_hainan/rman_hainan@rman target / Recovery Manager: Release Production RMAN : connected to target database: TEST (DBID= ) RMAN : connected to recovery catalog database RMAN> list backupset; RMAN : piling mand: list List of Backup Sets Key Recid Stamp LV Set Stamp Set Count Completion Time JUN 根据key来删除旧的备份 RMAN> allocate channel for maintenance type disk; RMAN> change backupset delete; THIS IS THE MAND TO REMOVE THE ENTRY & OS FILE 做完后可以看到list backupset和操作系统的文件都没有了 恢复 ( ) 将数据库启动到nomount状态 $svrmgrl Oracle Server Manager Release Production Copyright (c) Oracle Corporation All Rights Reserved Oracle i Enterprise Edition Release bit Production With the Partitioning option JServer Release Production SVRMGR> connect internal Connected SVRMGR> startup nomount; ORACLE instance started Total System Global Area bytes Fixed Size bytes Variable Size bytes Database Buffers bytes Redo Buffers bytes SVRMGR> exit Server Manager plete ( ) 恢复控制文件 $rman rcvcat rman_hainan/rman_hainan@rman target / Recovery Manager: Release Production RMAN : connected to target database: test (not mounted) RMAN : connected to recovery catalog database RMAN> run > allocate channel d type disk; > restore controlfile; > release channel d ; > ( ) 恢复数据文件 RMAN> run > allocate channel d type disk; > sql alter database mount ; > restore datafile ; > restore datafile ; > restore datafile ; > restore datafile ; > release channel d ; > ( ) 恢复日志文件 RMAN> run > set archivelog destination to /export/home/oracle/admin/test/arch ; > allocate channel d type disk; > restore archivelog all; > release channel d ; > 会把所有的日志文件恢复 ( ) 根据日志做recover $svrmgrl Oracle Server Manager Release Production Copyright (c) Oracle Corporation All Rights Reserved Oracle i Enterprise Edition Release bit Production With the Partitioning option JServer Release Production SVRMGR> connect internal Connected SVRMGR> recover database using backup controlfile until cancel; ORA : change generated at / / : : needed for thread ORA : suggestion : /export/home/oracle/admin/test cha138/Article/program/Oracle/201311/17348相关参考
一RMAN是Oracle提供的一个数据库备份和恢复工具 特点 )备份和恢复数据库表空间控制文件数据文件和归档文件 )校验备份数据集 )通过备份检查损坏块 )增量备份 )脚本能力 )备
oracle9i中Rman的备份使用点滴 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! rman
如何简单测试Rman的备份恢复功能? 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 本文只是简单
RMAN的备份及恢复-丢失所有控制文件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 数据库基本
重装OS及Oracle软件,巧用RMAN恢复数据 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
oracle从备份的控制文件进行完全恢复 SYS@orcl#shutdownabort; ORACLE例程已经关闭 SYS@orcl# oracle@oracle:~/product//d
[测试]数据库在非归档模式数据库MOUNT数据文件丢失有表空间备份 RMAN>backuptablespaceusers; 启动backup于月分配的通道:ORA_DISK_通道ORA_
知识大全 oracle数据库备份与恢复apieceofcake(4)
oracle数据库日志备份(windows平台) 本片是接上次的数据库在线备份进行数据库全备份后需要备份归档的日志文件 建立数据库备份的脚本 在上面建立的目录下建立如下的两个脚本 建立执行
Oracle备份与恢复案例二 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 检查数据库的数据(完
Oracle备份与恢复案例一 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 一理解什么是数据库恢