備份歸檔日誌檔案

skyin_1603發表於2016-11-11
歸檔日誌檔案在資料庫中也是重要的檔案,記錄著歷史資料變化的資訊。
備份歸檔有多種方法,有在全庫備份中新增備份歸檔,有備份控制檔案中新增備份
歸檔,有獨立備份歸檔的。以下只簡單介紹後兩種的備份歸檔方法。

----單獨備份歸檔日誌:

--檢視快速恢復區的目錄:

system@PROD>show parameter recover

NAME                                 TYPE        VALUE

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

db_recovery_file_dest                string      /u01/app/FRA

db_recovery_file_dest_size           big integer 4182M

db_unrecoverable_scn_tracking        boolean     TRUE

recovery_parallelism                 integer     0

#便於管理起見,一般把控制檔案的自動備份與歸檔日誌都放在快速恢復區,這也是為了

便於恢復。

 

--檢視歸檔日誌的存放路徑:

[oracle@enmo ~]$ cd /u01/app/FRA

[oracle@enmo FRA]$ ls

PROD

[oracle@enmo FRA]$ cd PROD/

[oracle@enmo PROD]$ ls

archivelog  autobackup  backupset  onlinelog

[oracle@enmo PROD]$ cd archivelog/

[oracle@enmo archivelog]$ ls

2016_11_07  2016_11_10

[oracle@enmo archivelog]$ cd 2016_11_07

[oracle@enmo 2016_11_07]$ ll

total 10876

-rw-r----- 1 oracle oinstall 1977856 Nov  7 14:49 o1_mf_1_1_d2090khf_.arc

-rw-r----- 1 oracle oinstall 1977856 Nov  7 15:33 o1_mf_1_1_d20cknr8_.arc

-rw-r----- 1 oracle oinstall 2412032 Nov  7 16:33 o1_mf_1_1_d20h2h6h_.arc

-rw-r----- 1 oracle oinstall 2544640 Nov  7 17:32 o1_mf_1_1_d20ljx1s_.arc

-rw-r----- 1 oracle oinstall 2199552 Nov  7 15:33 o1_mf_1_2_d20ckovg_.arc

[oracle@enmo 2016_11_07]$ cd ..

[oracle@enmo archivelog]$ cd 2016_11_10

[oracle@enmo 2016_11_10]$ ll

total 49320

-rw-r----- 1 oracle oinstall 50445824 Nov 10 22:17 o1_mf_1_3_d290d550_.arc

[oracle@enmo 2016_11_10]$

 

---單獨備份歸檔日誌:

--檢視rman引數設定:

[oracle@enmo ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Nov 11 10:44:00 2016

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

connected to target database: PROD (DBID=338469376)

 

RMAN> show all;

 

RMAN configuration parameters for database with db_unique_name PROD are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

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 CHANNEL DEVICE TYPE DISK FORMAT   '/u01/app/backup/db_%U.rmn';

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD.f'; # default

#可以看到備份檔案存放的路徑以及命名方式,還有控制檔案(和引數檔案)自動備份。

 

--單獨備份歸檔日誌檔案:

RMAN> backup as backupset archivelog all;

 

Starting backup at 11-NOV-16

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=44 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=3 STAMP=927307485

input archived log thread=1 sequence=2 RECID=4 STAMP=927307485

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/FRA/PROD/backupset/2016_11_11/o1_mf_annnn_TAG20161111T110639_d2bfg03d_.bkp tag=TAG20161111T110639 comment=NONE

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

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=1 STAMP=927304399

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/FRA/PROD/backupset/2016_11_11/o1_mf_annnn_TAG20161111T110639_d2bfg3lf_.bkp tag=TAG20161111T110639 comment=NONE

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

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=5 STAMP=927307933

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/FRA/PROD/backupset/2016_11_11/o1_mf_annnn_TAG20161111T110639_d2bfg6o0_.bkp tag=TAG20161111T110639 comment=NONE

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

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=3 RECID=6 STAMP=927584271

input archived log thread=1 sequence=4 RECID=7 STAMP=927630398

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/FRA/PROD/backupset/2016_11_11/o1_mf_annnn_TAG20161111T110639_d2bfg7xd_.bkp tag=TAG20161111T110639 comment=NONE

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

Finished backup at 11-NOV-16

RMAN>

#備份完成。

 

--在作業系統檢視生成的備份檔案:

[oracle@enmo ~]$ cd /u01/app/FRA/PROD/backupset/

[oracle@enmo backupset]$

[oracle@enmo backupset]$ pwd

/u01/app/FRA/PROD/backupset

[oracle@enmo backupset]$ ll

total 8

drwxr-x--- 2 oracle oinstall 4096 Nov  7 18:09 2016_11_07

drwxr-x--- 2 oracle oinstall 4096 Nov 11 11:06 2016_11_11

[oracle@enmo backupset]$ cd 2016_11_11

[oracle@enmo 2016_11_11]$ ll

total 79108

-rw-r----- 1 oracle oinstall  4178432 Nov 11 11:06 o1_mf_annnn_TAG20161111T110639_d2bfg03d_.bkp

-rw-r----- 1 oracle oinstall  2413568 Nov 11 11:06 o1_mf_annnn_TAG20161111T110639_d2bfg3lf_.bkp

-rw-r----- 1 oracle oinstall  2546176 Nov 11 11:06 o1_mf_annnn_TAG20161111T110639_d2bfg6o0_.bkp

-rw-r----- 1 oracle oinstall 71767040 Nov 11 11:07 o1_mf_annnn_TAG20161111T110639_d2bfg7xd_.bkp

[oracle@enmo 2016_11_11]$

#可以檢視到生成4個備份檔案:

 

----備份控制檔案,加上備份歸檔日誌檔案:

RMAN> backup current controlfile plus archivelog;

 

Starting backup at 11-NOV-16

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=44 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=3 STAMP=927307485

input archived log thread=1 sequence=2 RECID=4 STAMP=927307485

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/backup/db_0brkl2fr_1_1.rmn tag=TAG20161111T113107 comment=NONE

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

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=1 STAMP=927304399

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/backup/db_0crkl2fs_1_1.rmn tag=TAG20161111T113107 comment=NONE

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

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=5 STAMP=927307933

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/backup/db_0drkl2ft_1_1.rmn tag=TAG20161111T113107 comment=NONE

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

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=3 RECID=6 STAMP=927584271

input archived log thread=1 sequence=4 RECID=7 STAMP=927630398

input archived log thread=1 sequence=5 RECID=8 STAMP=927631866

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/backup/db_0erkl2fu_1_1.rmn tag=TAG20161111T113107 comment=NONE

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

Finished backup at 11-NOV-16

 

Starting backup at 11-NOV-16

using channel ORA_DISK_1

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-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/backup/db_0frkl2gd_1_1.rmn tag=TAG20161111T113125 comment=NONE

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

Finished backup at 11-NOV-16

 

Starting backup at 11-NOV-16

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=6 RECID=9 STAMP=927631891

channel ORA_DISK_1: starting piece 1 at 11-NOV-16

channel ORA_DISK_1: finished piece 1 at 11-NOV-16

piece handle=/u01/app/backup/db_0grkl2gk_1_1.rmn tag=TAG20161111T113132 comment=NONE

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

Finished backup at 11-NOV-16

 

Starting Control File and SPFILE Autobackup at 11-NOV-16

piece handle=/u01/app/FRA/PROD/autobackup/2016_11_11/o1_mf_s_927631893_d2bgwplv_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 11-NOV-16

RMAN>

#備份完成。

 

--進入作業系統檢視生成的備份檔案:

[oracle@enmo ~]$ cd /u01/app

[oracle@enmo app]$ ls

backup  FRA  oracle  oraInventory

[oracle@enmo app]$ cd backup/

[oracle@enmo backup]$ ll

total 1715432

-rw-r----- 1 oracle oinstall 675209216 Oct 31 22:46 db_01rjp9rn_1_1.rmn

-rw-r----- 1 oracle oinstall   4178432 Nov 11 11:31 db_0brkl2fr_1_1.rmn

-rw-r----- 1 oracle oinstall 310026240 Nov  7 13:23 db_0crkane1_1_1.rmn

-rw-r----- 1 oracle oinstall   2413568 Nov 11 11:31 db_0crkl2fs_1_1.rmn

-rw-r----- 1 oracle oinstall   2546176 Nov 11 11:31 db_0drkl2ft_1_1.rmn

-rw-r----- 1 oracle oinstall  72494080 Nov 11 11:31 db_0erkl2fu_1_1.rmn

-rw-r----- 1 oracle oinstall 677847040 Nov  7 14:34 db_0frkarjn_1_1.rmn

-rw-r----- 1 oracle oinstall  10125312 Nov 11 11:31 db_0frkl2gd_1_1.rmn

-rw-r----- 1 oracle oinstall      6144 Nov 11 11:31 db_0grkl2gk_1_1.rmn

[oracle@enmo backup]$

#已經生成相應的備份檔案:


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

相關文章