ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN使用方法

RMAN使用方法

原创 Linux操作系统 作者:zhaoqing0803 时间:2012-07-16 14:35:41 0 删除 编辑

1、首先怎么连接rman
1.1oracle@/opt/oracle/db/product/11.1.0:~>$ORACLE_HOME/bin/rman

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Jun 25 11:27:20 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

RMAN> connect target target sys/oracle@orcl
1.2  CONNECT TARGET /

1、noarchive模式全库备份,需在shutdown immediate 启动到mount状态下备份数据库
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP FORCE DBA;------这种只能是rman target /
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP MOUNT;
RMAN> BACKUP DATABASE;

如果不设置DB_RECOVERY_FILE_DEST这个参数,备份文件在$ORACLE_HOME/dbs/

alter system set DB_RECOVERY_FILE_DEST ='/enip/oracle/oradata/orcl/db_recovery_flash' scope=spfile;
alter system set DB_RECOVERY_FILE_DEST_SIZE =10G scope=both;

修改DB_RECOVERY_FILE_DEST ='/home/oracle/db/oradata/orcl/db_flash_recovery'
DB_RECOVERY_FILE_DEST_SIZE=
2、增量性备份----如果是noarchive的,直接报错ORA-19602:
BACKUP INCREMENTAL LEVEL 0 DATABASE;
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;  都是基于0级的备份
BACKUP INCREMENTAL LEVEL 1 DATABASE;  基于上一级的备份
BACKUP VALIDATE CHECK LOGICAL
DATABASE ARCHIVELOG ALL;
3鉴别有效的备份文件
BACKUP VALIDATE CHECK LOGICAL
DATABASE ARCHIVELOG ALL;   ------鉴别有效地所有文件
4 如果要看所有备份:list backup;
   report obsolete
5 鉴别有效备份VALIDATE BACKUPSET 1;
6 同步文件头CROSSCHECK BACKUP;
7 DELETE OBSOLETE;

闪回数据库:-----前提需要打开flash database :alter database flash database on;
1、SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
2、FLASHBACK DATABASE TO SCN 17380260;
3、ALTER DATABASE OPEN READ ONLY;----检查结果是否正确
4、SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE OPEN RESETLOGS;
恢复整个数据库
2. Place the database in a mounted state.
The following example terminates the database instance (if it is started) and
mounts the database:
RMAN> STARTUP FORCE MOUNT;
3. Restore the database.
The following example uses the preconfigured disk channel to restore the
database:
RMAN> RESTORE DATABASE;
4. Recover the database, as shown in the following example:
RMAN> RECOVER DATABASE;
5. Open the database, as shown in the following example:
RMAN> ALTER DATABASE OPEN;

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

下一篇: 数据库连接缓慢
请登录后发表评论 登录
全部评论

注册时间:2010-01-18

  • 博文量
    21
  • 访问量
    33869