ORACLE RMAN命令总结一

 

最近准备复习一下rman命令,把从官方文档里学的东西,实验一下,翻译一下,供英文不好的朋友继续学习!

                                                                                                                            如有错误 mail to :770713697@qq.com  四爷


--检测坏块,逻辑坏块
RMAN> backup validate check logical database archivelog all;

Starting backup at 11-AUG-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
specification does not match any archived log in the repository
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1 OK 0 14930 94724 1571632
File Name: /u01/app/oracle/oradata/orcl/system01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 63232
Index 0 13034
Other 0 3524

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2 OK 0 21604 75527 1571632
File Name: /u01/app/oracle/oradata/orcl/sysaux01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 15984
Index 0 11694
Other 0 26238

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3 OK 0 1 4480 1571632
File Name: /u01/app/oracle/oradata/orcl/undotbs01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 0
Other 0 4479

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4 OK 0 19873 398240 1567281
File Name: /u01/app/oracle/oradata/orcl/users01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 373913
Index 0 2849
Other 0 1605

channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE OK 0 2
Control File OK 0 594
Finished backup at 11-AUG-17

RMAN>


--也可以检测备份集:

RMAN> VALIDATE BACKUPSET 4;


Starting validate at 11-AUG-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backup set
channel ORA_DISK_1: reading from backup piece /u02/backup/ORCL/backupset/2017_08_11/o1_mf_nnndf_TAG20170811T051317_drsm3fqm_.bkp
channel ORA_DISK_1: piece handle=/u02/backup/ORCL/backupset/2017_08_11/o1_mf_nnndf_TAG20170811T051317_drsm3fqm_.bkp tag=TAG20170811T051317
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:03
Finished validate at 11-AUG-17

RMAN>



-- 列举备份集的几种方法

RMAN> list backup by file;


List of Datafile Backups
========================

File Key TY LV S Ckp SCN Ckp Time #Pieces #Copies Compressed Tag
---- ------- - -- - ---------- --------- ------- ------- ---------- ---
1 5 B F A 1568493 11-AUG-17 1 1 YES TAG20170811T051317
2 5 B F A 1568493 11-AUG-17 1 1 YES TAG20170811T051317
3 4 B F A 1568493 11-AUG-17 1 1 YES TAG20170811T051317
4 4 B F A 1568493 11-AUG-17 1 1 YES TAG20170811T051317

List of Control File Backups
============================

CF Ckp SCN Ckp Time BS Key S #Pieces #Copies Compressed Tag
---------- --------- ------- - ------- ------- ---------- ---
1568493 11-AUG-17 6 A 1 1 NO TAG20170811T051352
1568434 11-AUG-17 1 X 1 1 NO TAG20170811T043444
List of SPFILE Backups
======================

Modification Time BS Key S #Pieces #Copies Compressed Tag
----------------- ------- - ------- ------- ---------- ---
11-AUG-17 6 A 1 1 NO TAG20170811T051352
11-AUG-17 1 X 1 1 NO TAG20170811T043444

RMAN> list backup summary;


List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1 B F X DISK 11-AUG-17 1 1 NO TAG20170811T043444
4 B F A DISK 11-AUG-17 1 1 YES TAG20170811T051317
5 B F A DISK 11-AUG-17 1 1 YES TAG20170811T051317
6 B F A DISK 11-AUG-17 1 1 NO TAG20170811T051352



RMAN> LIST BACKUP OF DATABASE BY BACKUP;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 7.23M DISK 00:00:01 11-AUG-17
BP Key: 4 Status: AVAILABLE Compressed: YES Tag: TAG20170811T051317
Piece Name: /u02/backup/ORCL/backupset/2017_08_11/o1_mf_nnndf_TAG20170811T051317_drsm3fqm_.bkp
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
3 Full 1568493 11-AUG-17 /u01/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 1568493 11-AUG-17 /u01/app/oracle/oradata/orcl/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 277.27M DISK 00:00:32 11-AUG-17
BP Key: 5 Status: AVAILABLE Compressed: YES Tag: TAG20170811T051317
Piece Name: /u02/backup/ORCL/backupset/2017_08_11/o1_mf_nnndf_TAG20170811T051317_drsm3fs4_.bkp
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1568493 11-AUG-17 /u01/app/oracle/oradata/orcl/system01.dbf
2 Full 1568493 11-AUG-17 /u01/app/oracle/oradata/orcl/sysaux01.dbf

RMAN>

-- 列举控制文件的备份
RMAN> list backup of controlfile;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 9.36M DISK 00:00:01 11-AUG-17
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20170811T051352
Piece Name: /u02/backup/ORCL/autobackup/2017_08_11/o1_mf_s_951712509_drsm4jy2_.bkp
Control File Included: Ckp SCN: 1568493 Ckp time: 11-AUG-17




-- 比较有用的两个命令


--Lists backups that are obsolete under the configured backup retention policy. Use the optional REDUNDANCY and RECOVERY WINDOW parameters --to override the default.


RMAN> report obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 1 11-AUG-17
Backup Piece 1 11-AUG-17 /u02/backup/ORCL/backupset/2017_08_11/o1_mf_ncsnf_TAG20170811T043444_drsjv5cx_.bkp


-- delete the obsolete file
RMAN> delete obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 1 11-AUG-17
Backup Piece 1 11-AUG-17 /u02/backup/ORCL/backupset/2017_08_11/o1_mf_ncsnf_TAG20170811T043444_drsjv5cx_.bkp

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u02/backup/ORCL/backupset/2017_08_11/o1_mf_ncsnf_TAG20170811T043444_drsjv5cx_.bkp RECID=1 STAMP=951712485
Deleted 1 objects
RMAN>



--Reports the tablespaces and data files in the database at the current time (default) or a different time.

RMAN> report schema;

Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 740 SYSTEM *** /u01/app/oracle/oradata/orcl/system01.dbf
2 590 SYSAUX *** /u01/app/oracle/oradata/orcl/sysaux01.dbf
3 35 UNDOTBS1 *** /u01/app/oracle/oradata/orcl/undotbs01.dbf
4 3111 USERS *** /u01/app/oracle/oradata/orcl/users01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 20 TEMP 32767 /u01/app/oracle/oradata/orcl/temp01.dbf

RMAN>


备份当前控制文件:
[oracle@hdp 2017_08_11]$ rman target/


Recovery Manager: Release 11.2.0.4.0 - Production on Fri Aug 11 08:18:43 2017


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1477533441)


RMAN> backup current controlfile;


Starting backup at 11-AUG-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=197 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 11-AUG-17
channel ORA_DISK_1: finished piece 1 at 11-AUG-17
piece handle=/u02/backup/ORCL/backupset/2017_08_11/o1_mf_ncnnf_TAG20170811T082157_drsy571c_.bkp tag=TAG20170811T082157 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-AUG-17


Starting Control File and SPFILE Autobackup at 11-AUG-17
piece handle=/u02/backup/ORCL/autobackup/2017_08_11/o1_mf_s_951726120_drsy5851_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 11-AUG-17


不过我已经设置了  控制文件的自动备份了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值