oracle9 备份,oracle9i中Rman的备份使用点滴

rman的简单使用: catalog的建立,全备份,保留备份策略,删除过期备份。

1. 查看当前数据库的数据文件

SQL> select name from V$datafile;

NAME

--------------------------------------------------------------------------------

/oracle/oracle9i/oradata/testmysiteok/system01.dbf

/oracle/oracle9i/oradata/testmysiteok/undotbs01.dbf

/oracle/oracle9i/oradata/testmysiteok/cwmlite01.dbf

/oracle/oracle9i/oradata/testmysiteok/drsys01.dbf

/oracle/oracle9i/oradata/testmysiteok/example01.dbf

/oracle/oracle9i/oradata/testmysiteok/indx01.dbf

/oracle/oracle9i/oradata/testmysiteok/odm01.dbf

/oracle/oracle9i/oradata/testmysiteok/tools01.dbf

/oracle/oracle9i/oradata/testmysiteok/users01.dbf

/oracle/oracle9i/oradata/testmysiteok/xdb01.dbf

/oracle/oradata/webdb_file1.dbf

NAME

--------------------------------------------------------------------------------

/oracle/oradata/webdb_file2.dbf

/oracle/oradata/webdb_file3.dbf

/oracle/oradata/webdb_file4.dbf

14 rows selected.

2. 建立catalog表空间为back_up

SQL> create tablespace back_up datafile '/oracle/oradata/catalog.dbf' size 50m;

Tablespace created.

3. 建立rman用户密码为rman,rman默认的表空间为back_up,使用临时表空间temp

SQL> create user rman identified by rman default tablespace back_up temmporary tablespace temp;

create user rman identified by rman default tablespace back_up temmporary tablespace temp

*

ERROR at line 1:

ORA-00922: missing or invalid option

SQL> create user rman identified by rman default tablespace back_up temporary tablespace temp;

User created.

4. 给rman用户授权

SQL> grant connect,resource,recovery_catalog_owner to rman;

Grant succeeded.

SQL> quit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.1.0 - Production

5. 连接或者创建catalog到表空间 back_up

bash-2.05$ rman

Recovery Manager: Release 9.2.0.1.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

RMAN> connect catalog rman/rman;

connected to recovery catalog database

recovery catalog is not installed

RMAN> create catalog tablespace backup;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00558: error encountered while parsing input commands

RMAN-01005: syntax error: found "backup": expecting one of: "double-quoted-string, identifier, single-quoted-string"

RMAN-01007: at line 1 column 27 file: standard input

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00558: error encountered while parsing input commands

RMAN-01005: syntax error: found ";": expecting one of: "allocate, alter, backup, beginline, blockrecover, catalog, change, connect, copy, create, crosscheck, configure, duplicate, debug, delete, drop, exit, endinline, host, {, library, list, mount, open, print, quit, recover, register, release, replace, report, renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, spool, startup, shutdown, send, show, test, upgrade, validate"

RMAN-01007: at line 1 column 33 file: standard input

RMAN> create catalog tablespace back_up;

recovery catalog created

RMAN> quit

Recovery Manager complete.

6. 连接到sid 为testmysiteok的 catalog上 ,并注册testmysiteok数据库

bash-2.05$ rman  target 'testmysiteok' catalog rman/rman

Recovery Manager: Release 9.2.0.1.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

target database Password:

connected to target database: testmysiteOK (DBID=3999769622)

connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

7. 全备份testmysiteok数据库

RMAN> backup full tag 'testmysiteok' format '/data/ora_backup/testmysiteok_%u_%s_%p' database;

Starting backup at 07-AUG-05

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=31 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current SPFILE in backupset

including current controlfile in backupset

input datafile fno=00001 name=/oracle/oracle9i/oradata/testmysiteok/system01.dbf

input datafile fno=00002 name=/oracle/oracle9i/oradata/testmysiteok/undotbs01.dbf

input datafile fno=00005 name=/oracle/oracle9i/oradata/testmysiteok/example01.dbf

input datafile fno=00011 name=/oracle/oradata/webdb_file1.dbf

input datafile fno=00012 name=/oracle/oradata/webdb_file2.dbf

input datafile fno=00013 name=/oracle/oradata/webdb_file3.dbf

input datafile fno=00014 name=/oracle/oradata/webdb_file4.dbf

input datafile fno=00015 name=/oracle/oradata/catalog.dbf

input datafile fno=00010 name=/oracle/oracle9i/oradata/testmysiteok/xdb01.dbf

input datafile fno=00006 name=/oracle/oracle9i/oradata/testmysiteok/indx01.dbf

input datafile fno=00009 name=/oracle/oracle9i/oradata/testmysiteok/users01.dbf

input datafile fno=00003 name=/oracle/oracle9i/oradata/testmysiteok/cwmlite01.dbf

input datafile fno=00004 name=/oracle/oracle9i/oradata/testmysiteok/drsys01.dbf

input datafile fno=00007 name=/oracle/oracle9i/oradata/testmysiteok/odm01.dbf

input datafile fno=00008 name=/oracle/oracle9i/oradata/testmysiteok/tools01.dbf

channel ORA_DISK_1: starting piece 1 at 07-AUG-05

channel ORA_DISK_1: finished piece 1 at 07-AUG-05

piece handle=/data/ora_backup/testmysiteok_04grgroc_4_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36

Finished backup at 07-AUG-05

8. 设置保留最近的3次备份

RMAN> configure retention policy to redundancy 3;

old RMAN configuration parameters:

CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

new RMAN configuration parameters:

CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

new RMAN configuration parameters are successfully stored

starting full resync of recovery catalog

full resync complete

9. 查看过期的备份

RMAN> report obsolete;

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 2

Report of obsolete backups and copies

Type                 Key    Completion Time    Filename/Handle

-------------------- ------ ------------------ --------------------

Backup Set           590    16-OCT-05

Backup Piece       591    16-OCT-05          /oracle/testmysiteok20051016.dbf

Archive Log          424    29-SEP-05          /oracle/OraHome/dbs/arch1_56.dbf

10. 查看所有备份

RMAN> list backup;

11. 删除过期备份

RMAN> delete obsolete;

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 2

using channel ORA_DISK_1

Deleting the following obsolete backups and copies:

Type                 Key    Completion Time    Filename/Handle

-------------------- ------ ------------------ --------------------

Backup Set           590    16-OCT-05

Backup Piece       591    16-OCT-05          /oracle/testmysiteok20051016.dbf

Archive Log          424    29-SEP-05          /oracle/OraHome/dbs/arch1_56.dbf

Do you really want to delete the above objects (enter YES or NO)? y

deleted backup piece

backup piece handle=/oracle/testmysiteok20051016.dbf recid=15 stamp=571867105

Deleted 1 objects

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Oracle9RMAN设置和配置 RMAN设置和配置 1.9i下将数据库配置为ARCHIVELOG模式 虽说RMAN也可以在非归档模式下使用,但是我们不推荐。因为非归档模式下很多RMAN的功能都用不上。在9i必须配置如下参数: ¾ LOG_ARCHIVE_DEST_n:指定归档的重做日志文件的位置,并指定是否是必要的。N从1到10,也就是可以指定10个位置,至少指定一个。例如下面的参数设置: LOG_ARCHIVE_DEST_1= 'location=e:\oracle\backup mandatory' e:\oracle\backup是要备份文件要存放的位置,mandatory的意思是说这个目录下的日志是必须成功写入的;也可以是optional,也就是可选的。 ¾ LOG_ARCHIVE_START:这个参数指定Oracle实例启动数据库的时候启动ARCH程。这个参数需要设置成TRUE(书上第47页倒数第5行关于该参数的描述有误) 其它的与ARCH程相关的参数: ¾ LOG_ARCHIVE_STATE_n:这个参数与LOG_ARCHIVE_DEST_n相对应,可能的值有ENABLE和DISABLE两种。如果设置成ENABLE,ARCH程会认为与该状态关联的目标为一个有效的归档日志目标;如果设置成DEFER,ARCH程就不会再相关的位置归档。 ¾ LOG_ARCHIVE_FORMAT:该参数设定归档文件的命名规则 ¾ LOG_ARCHIVE_MIN_SUCCEED_DEST:定义归档日志必须成功的最小的副本数量。这个参数应该大于等于LOG_ARCHIVE_DEST_n的MANDATORY数量。 下面是9i下多个与归档相关的参数设置的例子: LOG_ARCHIVE_DEST_1= 'location=e:\oracle\backup mandatory' LOG_ARCHIVE_DEST_2= 'location=z:\oracle\backup optional' LOG_ARCHIVE_DEST_3= 'service=recover1 mandatory' LOG_ARCHIVE_MIN_SUCCEED_DEST=2 LOG_ARCHIVE_FORMAT= "tlxt_%s_%t.arc" LOG_ARCHIVE_START=TRUE 设置好参数后,就可以将数据库设置为归档模式了。这个操作需要在MOUNT状态下行,例如: SQL> connect / as sysdba 已连接。 SQL> shutdown immediate 数据库已经关闭。 已经卸载数据库。 ORACLE 例程已经关闭。 SQL> startup mount ORACLE 例程已经启动。 Total System Global Area 252780316 bytes Fixed Size 454428 bytes Variable Size 58720256 bytes Database Buffers 192937984 bytes

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值