Usage Of Rman
1)Input Backupfile To Catalog
1@@@@rare
@@@backup dbfile online.
SQL> conn /as sysdba;
SQL> alter tablespace users begin backup;
@@@
[oracle@station60 orcl]$ cp -rp users01.dbf /u01/app/oracle/user$(date +%Y-%m-%d#%T).dbf
[oracle@station60 oracle]$ ls user2011-12-20#15:15:26.dbf
user2011-12-20#15:15:26.dbf
@@@
SQL> conn /as sysdba;
SQL> alter tablespace users end backup;
@@@
@@@connect to catalog.
[oracle@station60 oracle]$ rman target / catalog ucat/ucat@logorcl
RMAN> catalog datafilecopy '/u01/app/oracle/user2011-12-20#15:15:26.dbf';
cataloged datafile copy
datafile copy filename=/u01/app/oracle/user2011-12-20#15:15:26.dbf recid=12 stamp=770397504
@@@authentified crosscheck.
RMAN> run{
2> allocate channel a device type disk format '/u01/app/oracle/user_%U.bkp';
3> backup tablespace example;
4> }
@@@
[oracle@station60 oracle]$ mv user_36mumlep_1_1.bkp user_36mumlep_1_1.bkp.xxx
@@@
RMAN> list backup;
List of Backup Sets
...........................
BP Key: 508 Status: EXPIRED
RMAN> delete expired backupset 508;
@@@
[oracle@station60 oracle]$ mv user_37mumlor_1_1.bkpxxx user_37mumlor_1_1.bkp
@@@only if data exist,catalog would recovery it.
RMAN> catalog backuppiece '/u01/app/oracle/user_37mumlor_1_1.bkp';
cataloged backuppiece
backup piece handle=/u01/app/oracle/user_37mumlor_1_1.bkp recid=76 stamp=770398139
List of Backup Sets
===================
.............................
BP Key: 562 Status: AVAILABLE Compressed: NO Tag: TAG20111220T152619
Piece Name: /u01/app/oracle/user_37mumlor_1_1.bkp
2)Monitor Backup
1@@@@
@@@
RMAN> run{
2> set command id to 'rman';
3> backup datafile 4;
4> }
@@@
SQL> SELECT sid, spid, client_info FROM v$process p,
v$session s WHERE p.addr = s.paddr
AND client_info LIKE '%id=rman%';
SID SPID CLIENT_INFO
-----------------------------------
131 20606 id=rman
@@@
SQL> SELECT sid, serial#, context, sofar, totalwork,
round(sofar/totalwork*100,2) "% Complete"
FROM V$SESSION_LONGOPS
WHERE opname LIKE 'RMAN:%'
AND opname NOT LIKE 'RMAN: aggregate%'
AND totalwork != 0;
@@@
@@@check the hanging session
SQL> SELECT * FROM V$SESSION_WAIT WHERE event LIKE '%sbt%';
3)Noncritical Mistaken
1@@@@maintenance tempfile
SQL> ALTER TABLESPACE temp ADD TEMPFILE
'/u01/app/oracle/oradata/orcl/temp02.dbf' SIZE 20M;
SQL> ALTER TABLESPACE temp DROP TEMPFILE
'/u01/app/oracle/oradata/orcl/temp01.dbf';
2@@@@maintenance logfile group
SQL> ALTER DATABASE DROP LOGFILE MEMBER
> '/u01/app/oracle/oradata/orcl/redo02b.log';
SQL> !rm /u01/app/oracle/oradata/orcl/redo02b.log
SQL> ALTER DATABASE ADD LOGFILE MEMBER
> '/u01/app/oracle/oradata/orcl/redo02b.log'
> TO GROUP 2;
@@@you must backup database and switch logfiles afterward.
4)duration reduce load.
1@@@@
@@@it would be low loading for your system.but it cost 1 hour.
RMAN> run{
2> backup as backupset
3> format '/u01/app/oracle/%d_%s_%p'
4> duration 1:00 minimize load
5> tablespace users;
6> }
@@@
RMAN> backup duration 00:01 minimize load tablespace users;
5)backup using tag
1@@@@
RMAN> BACKUP TAG 'month_full_backup' DATAFILE 1,2,3,4;
RMAN> BACKUP TAG 'week_full_backup' DATAFILE 3,4;
6)backup tablespace or database to some other place.
1@@@@
@@@"as copy" would not be record in the list backup.
RMAN> backup as copy tablespace users format '/u01/app/oracle/%U.bkp';
RMAN> backup tablespace users format '/u01/app/oracle/%U.bkp';
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
50 Full 9.41M DISK 00:00:00 2011-12-20 12:05:28
BP Key: 59 Status: AVAILABLE Compressed: NO Tag: TAG20111220T120527
Piece Name: /u01/app/oracle/29muma08_1_1.bkp
List of Datafiles in backup set 50
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
4 Full 1356093 2011-12-20 12:05:28 /u01/app/oracle/oradata/orcl/users01.dbf
[root@station60 oracle]# ls /u01/app/oracle/
29muma08_1_1.bkp
data_D-ORCL_I-1213138977_TS-USERS_FNO-4_2amuma0q.bkp
7)backup archivelog to a backup piece
1@@@@
@@@
RMAN> list copy;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - ------------------- ----
22 1 38 A 2011-12-20 12:43:41 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_12_20/o1_mf_1_38_7h09lpn2_.arc
@@@
@@@delete input mean backup archivelog as a backup piece,but list of copy would exist
@@@the same archivelog in flashback_recovery_area,so delete input mean to delete them
@@@in other words, maintain flashback_recovery_area.
@@@when you "recover database" which is media recover, rman would release the archivelog
@@@from that backup piece automatically.
@@@Anyway,if you do "recover database" in the SQL,you must release the archivelog manually.
RMAN> backup archivelog like '%1_38%' delete input;
@@@
RMAN> list copy;
specification does not match any archive log in the recovery catalog
@@@
RMAN> BACKUP
2> FORMAT '/disk1/backup/ar_%t_%s_%p'
3> ARCHIVELOG FROM SEQUENCE=234
4> DELETE INPUT;
Rman Usage Skill
原创emperor_majesty 博主文章分类:B_Recovery ©著作权
©著作权归作者所有:来自51CTO博客作者emperor_majesty的原创作品,请联系作者获取转载授权,否则将追究法律责任

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
skill——iptables(四)
udp扩展模块、icmp 扩展模块、state 扩展模块
iptables skill -
skill——iptables(五)
黑白名单、自定义链
iptables skill