oracle10g_rman_語法測試_6

wisdomone1發表於2009-09-21
bash-3.00$ rman target sys/system@ora10g catalog rman/system@newly

Recovery Manager: Release 10.2.0.2.0 - Production on Tue Sep 22 06:46:21 2009

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

connected to target database: ORA10G (DBID=4016423416)
connected to recovery catalog database

RMAN> delete script. backup_db; ---刪除rman catalog中的指令碼,如本地target無,就在catalog中找,有就刪除掉它

deleted script. backup_db

RMAN> backup device type disk datafile 3; --backup在中間可以指定device type選項

Starting backup at 22-SEP-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=/oracle/oradata/ora10g/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 22-SEP-09
channel ORA_DISK_1: finished piece 1 at 22-SEP-09
piece handle=/oracle/auto/backup_3tkps28n_1_1 tag=TAG20090922T064750 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:28
Finished backup at 22-SEP-09

Starting Control File and SPFILE Autobackup at 22-SEP-09
piece handle=/oracle/c-4016423416-20090922-00 comment=NONE
Finished Control File and SPFILE Autobackup at 22-SEP-09

RMAN> restore device type disk archivelog all; --為restore歸檔日誌指定device type

Starting restore at 22-SEP-09
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK

archive log thread 1 sequence 2 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_14/o1_mf_1_2_5bvk77qx_.arc
archive log thread 1 sequence 3 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_14/o1_mf_1_3_5bvkt5lf_.arc
archive log thread 1 sequence 4 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_14/o1_mf_1_4_5bvl5n25_.arc
archive log thread 1 sequence 5 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_14/o1_mf_1_5_5bvpm10h_.arc
archive log thread 1 sequence 6 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_15/o1_mf_1_6_5bxlsqto_.arc
archive log thread 1 sequence 12 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_18/o1_mf_1_12_5c5y4j19_.arc
archive log thread 1 sequence 13 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_18/o1_mf_1_13_5c5z02yj_.arc
archive log thread 1 sequence 14 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_19/o1_mf_1_14_5c8rtgb9_.arc
archive log thread 1 sequence 15 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_19/o1_mf_1_15_5c8xhg2z_.arc
archive log thread 1 sequence 16 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_19/o1_mf_1_16_5c8xlw31_.arc
archive log thread 1 sequence 17 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_19/o1_mf_1_17_5c8zv15h_.arc
archive log thread 1 sequence 18 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_19/o1_mf_1_18_5c8zywfm_.arc
archive log thread 1 sequence 19 is already on disk as file /oracle/flash_recovery_area/ORA10G/archivelog/2009_09_22/o1_mf_1_19_5chy59gp_.arc
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=11
channel ORA_DISK_1: reading from backup piece /oracle/arch_2kkpbfpo_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/arch_2kkpbfpo_1_1 tag=TAG20090915T235431
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 22-SEP-09

RMAN> drop catalog;--如果你沒有catalog的備份,在rman catalog中儲存的目標庫的備份資訊就完完了,呵呵。

recovery catalog owner is RMAN
enter DROP CATALOG command again to confirm catalog removal

RMAN> drop catalog;--drop catalog系統要你再確認輸入一次,就刪除掉了

recovery catalog dropped

RMAN> create catalog;--必須連線到catalog,然後建立catalog

recovery catalog created

RMAN>

RMAN> backup as copy db_file_name_convert=('/oracle','/oracle/newly') tablespace zxy;  ---db_file_name_convert放中間,且報錯,在恢復目錄中找不到目標庫

Starting backup at 22-SEP-09
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 09/22/2009 15:09:49
RMAN-03014: implicit resync of recovery catalog failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

RMAN> register database; --為了處理以上錯誤,在恢復目錄中註冊資料庫

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete



RMAN> backup as copy db_file_name_convert=('/oracle','/oracle/newly') tablespace zxy;--搞個資料庫表空間複製(利用此引數作個儲存位置的轉換)

Starting backup at 22-SEP-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=150 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/oracle/zxy.dbf
output filename=/oracle/newly/zxy.dbf tag=TAG20090922T151027 recid=9 stamp=698253042
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16
Finished backup at 22-SEP-09

Starting Control File and SPFILE Autobackup at 22-SEP-09
piece handle=/oracle/c-4016423416-20090922-01 comment=NONE
Finished Control File and SPFILE Autobackup at 22-SEP-09

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-615195/,如需轉載,請註明出處,否則將追究法律責任。

相關文章