Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8350514
  • 博文数量: 444
  • 博客积分: 10593
  • 博客等级: 上将
  • 技术积分: 3852
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-09 15:26
文章分类

全部博文(444)

文章存档

2014年(1)

2013年(10)

2012年(18)

2011年(35)

2010年(125)

2009年(108)

2008年(52)

2007年(72)

2006年(23)

分类: Oracle

2010-01-18 22:10:49

首先连接数据库
$rman target ;
然后根据提示输入密码
然后备份表空间
$backup tablespace users format "/home/%U"
备份users 到/home目录下。
报错,提示非日志归档模式下不能备份活动的目录
只好转入非激活状态
$sqlplus /nolog;
SQL> connect /as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 2550136832 bytes
Fixed Size                  2023024 bytes
Variable Size             251658640 bytes
Database Buffers         2281701376 bytes
Redo Buffers               14753792 bytes
Database mounted.
SQL> quit
然后重新进行备份
$ rman target ;
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jan 18 21:55:57 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
target database Password:
connected to target database: DB (DBID=1539873842, not open)
RMAN> backup tablespace users format "/home/%U";
Starting backup at 18-JAN-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
。。。。。。。。。。。。。。。。。。。。。。。

备份完毕后,将数据库恢复正常
$ sqlplus /nolog;
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 18 23:05:45 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> connect /as sysdba;
Connected.
SQL> alter database open;
Database altered.
可以限制备份文件大小
run{
allocate channel d1 type disk maxpiecesize=10G;
allocate channel d2 type disk maxpiecesize=10G;
backup full database filesperset 10 include current controlfile format '/home/oracle/fullbak_%d_%T_%s_%p' plus archivelog format '/home/oracle/archbak_%d_%T_%s' delete all input;
release channel d1;
release channel d2;
}
手工建立2个通道,备份文件限制到10g。
 
oracle10g增加压缩备份
你可以选择在备份命令里显示指定压缩选项:
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
--仅对1,5文件压缩备份
BACKUP AS COMPRESSED BACKUPSET DATAFILE 1,5;

也可以配置RMAN指定压缩选项:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;

但是压缩备份会消耗更多的资源以及时间。
run{
allocate channel d1 type disk maxpiecesize=10G;
allocate channel d2 type disk maxpiecesize=10G;
backup AS COMPRESSED BACKUPSET full database filesperset 10 include current controlfile format '/home/oracle/3090100/fullbak_%d_%T_%s_%p' plus archivelog format '/home/oracle/3090100/archbak_%d_%T_%s' delete all input;
release channel d1;
release channel d2;
}
 
阅读(981) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~