Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8236824
  • 博文数量: 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-17 10:21:09

环境配置:

$ORACLE_HOME=/app1/oracle/product/10.2.1
$ORACLE_SID=BTDB10
一下是我学些实录,供大家参考,文字解释的比较少,请谅解:

1.连接
[oracle@localhost ~]$ cd $ORACLE_HOME
[oracle@localhost 10.2.1]$ pwd
/app1/oracle/product/10.2.1
[oracle@localhost 10.2.1]$ cd bin
[oracle@localhost bin]$ ls  -l rman
-rwxr-x--x  1 oracle oinstall 10460495 Oct 10 11:51 rman
[oracle@localhost bin]$ rman

[oracle@localhost bin]$ ./rman /

Argument     Value          Description
-----------------------------------------------------------------------------
target       quoted-string  connect-string for target database
catalog      quoted-string  connect-string for recovery catalog
nocatalog    none           if specified, then no recovery catalog
cmdfile      quoted-string  name of input command file
log          quoted-string  name of output message log file
trace        quoted-string  name of output debugging message log file
append       none           if specified, log is opened in append mode
debug        optional-args  activate debugging
msgno        none           show RMAN-nnnn prefix for all messages
send         quoted-string  send a command to the media manager
pipe         string         building block for pipe names
timeout      integer        number of seconds to wait for pipe input
checksyntax  none           check the command file for syntax errors
-----------------------------------------------------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00552: syntax error in command line arguments
RMAN-01006: error signalled during parse
RMAN-02001: unrecognized punctuation symbol "/"
[oracle@localhost bin]$ ps -ef|grep pmon
oracle    6038     1  0 08:58 ?        00:00:00 ora_pmon_btdb10
oracle    6246  6111  0 09:39 pts/1    00:00:00 grep pmon
[oracle@localhost bin]$ export ORACLE_SID=btdb10
[oracle@localhost bin]$ ./rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 28 09:39:31 2009

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

connected to target database: BTDB10 (DBID=2565085230)

RMAN>

2.查看RMAN配置:

RMAN> show all
2> ;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/app1/oracle/product/10.2.1/dbs/snapcf_btdb10.f'; # default

单个参数查看
RMAN> show device type;

RMAN configuration parameters are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

3.使用RMAN备份数据库

 使用RMAN备份的数据库必须是启动为Archive Mode,修改数据库为Archive log 模式:

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  268435456 bytes
Fixed Size                  1218920 bytes
Variable Size              79693464 bytes
Database Buffers          184549376 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /app1/oracle/product/10.2.1/dbs/arch
Oldest online log sequence     14
Next log sequence to archive   16
Current log sequence           16
SQL> !


对数据库执行全备:
RMAN> BACKUP DATABASE;

Starting backup at 28-DEC-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/app1/oracle/oradata/btdb10/system01.dbf
input datafile fno=00003 name=/app1/oracle/oradata/btdb10/sysaux01.dbf
input datafile fno=00002 name=/app1/oracle/oradata/btdb10/undotbs01.dbf
input datafile fno=00005 name=/app1/oracle/oradata/btdb10/rmain01.dbf
input datafile fno=00004 name=/app1/oracle/oradata/btdb10/users01.dbf
channel ORA_DISK_1: starting piece 1 at 28-DEC-09
channel ORA_DISK_1: finished piece 1 at 28-DEC-09
piece handle=/app1/oracle/product/10.2.1/dbs/06l21fn1_1_1 tag=TAG20091228T101809 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:46
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 28-DEC-09
channel ORA_DISK_1: finished piece 1 at 28-DEC-09
piece handle=/app1/oracle/product/10.2.1/dbs/07l21fqb_1_1 tag=TAG20091228T101809 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 28-DEC-09

RMAN>

RMAN> list backup of database;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    602.27M    DISK        00:01:45     28-DEC-09     
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20091228T101809
        Piece Name: /app1/oracle/product/10.2.1/dbs/06l21fn1_1_1
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 807286     28-DEC-09 /app1/oracle/oradata/btdb10/system01.dbf
  2       Full 807286     28-DEC-09 /app1/oracle/oradata/btdb10/undotbs01.dbf
  3       Full 807286     28-DEC-09 /app1/oracle/oradata/btdb10/sysaux01.dbf
  4       Full 807286     28-DEC-09 /app1/oracle/oradata/btdb10/users01.dbf
  5       Full 807286     28-DEC-09 /app1/oracle/oradata/btdb10/rmain01.dbf

RMAN> 

阅读(1054) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~