Oracle 11G 備份與恢復 使用RMAN建立映象拷貝舉例

LuiseDalian發表於2014-08-28

--1. 檢視歸檔目的地

sys@TESTDB11>show parameter log_archive_dest_

 

NAME                                 TYPE        VALUE

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

log_archive_dest_1                   string

log_archive_dest_10                  string

log_archive_dest_11                  string

log_archive_dest_12                  string

log_archive_dest_13                  string

log_archive_dest_14                  string

log_archive_dest_15                  string

log_archive_dest_16                  string

log_archive_dest_17                  string

......

 

--2. 配置2個歸檔目的地(否則預設歸檔日誌將儲存在快速恢復區)

--2.1 建立目錄並授權

[root@OL54.cuug.net: /root]$ mkdir -p /arch_dest1

[root@OL54.cuug.net: /root]$ mkdir -p /arch_dest2

[root@OL54.cuug.net: /root]$ chown -R oracle:oinstall /arch_dest1

[root@OL54.cuug.net: /root]$ chown -R oracle:oinstall /arch_dest2

[root@OL54.cuug.net: /root]$ chmod -R 775 /arch_dest1

[root@OL54.cuug.net: /root]$ chmod -R 775 /arch_dest2

 

--2.2 設定新的歸檔目的地

sys@TESTDB11>alter system set log_archive_dest_1 = 'location=/arch_dest1';

 

System altered.

 

sys@TESTDB11>alter system set log_archive_dest_2 = 'location=/arch_dest2';

 

System altered.

 

--2.3 切換3次歸檔日誌

sys@TESTDB11>alter system switch logfile;

 

System altered.

 

sys@TESTDB11>/

 

System altered.

 

sys@TESTDB11>/

 

System altered.

 

--2.4 檢視生成的歸檔日誌

[oracle@OL54.cuug.net:/arch_dest1]$ ls -l

total 30368

-rw-r----- 1 oracle dba 31045120 Aug  9 12:13 1_23_855020031.dbf

-rw-r----- 1 oracle dba     1024 Aug  9 12:13 1_24_855020031.dbf

-rw-r----- 1 oracle dba     6144 Aug  9 12:13 1_25_855020031.dbf

 

[oracle@OL54.cuug.net:/arch_dest2]$ ls -l

total 30368

-rw-r----- 1 oracle dba 31045120 Aug  9 12:13 1_23_855020031.dbf

-rw-r----- 1 oracle dba     1024 Aug  9 12:13 1_24_855020031.dbf

-rw-r----- 1 oracle dba     6144 Aug  9 12:13 1_25_855020031.dbf

 

 

 

--3. 對資料檔案進行備份,產生映象拷貝

RMAN> backup as copy datafile '+DISKGROUP01/testdb11/users01.dbf';

 

Starting backup at 09-AUG-14

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=+DISKGROUP01/testdb11/users01.dbf

output file name=/backup01/data_D-TESTDB11_I-2620210741_TS-USERS_FNO-4_10pfgt5l tag=TAG20140809T115325 RECID=3 STAMP=855143607

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

Finished backup at 09-AUG-14

 

--3.1 檢視產生的備份檔案

[oracle@OL54.cuug.net:/backup01]$ ls -l

total 5140

-rw-r----- 1 oracle dba 5251072 Aug  9 11:53 data_D-TESTDB11_I-2620210741_TS-USERS_FNO-4_10pfgt5l

 

 

--4. 對歸檔日誌進行備份,產生映象拷貝

--4.1 對恢復目錄進行同步

RMAN> resync catalog;

 

starting full resync of recovery catalog

full resync complete

 

--4.2 備份在/arch_dest1目錄下的歸檔日誌

RMAN> backup as copy archivelog like '/arch_dest1%';

 

Starting backup at 09-AUG-14

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=23 RECID=11 STAMP=855144794

output file name=/backup01/arch_D-TESTDB11_id-2620210741_S-23_T-1_A-855020031_11pfguk9 RECID=17 STAMP=855145099

channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=24 RECID=13 STAMP=855144794

output file name=/backup01/arch_D-TESTDB11_id-2620210741_S-24_T-1_A-855020031_12pfgukc RECID=18 STAMP=855145100

channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=25 RECID=15 STAMP=855144799

output file name=/backup01/arch_D-TESTDB11_id-2620210741_S-25_T-1_A-855020031_13pfgukd RECID=19 STAMP=855145101

channel ORA_DISK_1: archived log copy

 

--4.3 檢視生成的備份

[oracle@OL54.cuug.net:/backup01]$ ls

arch_D-TESTDB11_id-2620210741_S-23_T-1_A-855020031_11pfguk9

arch_D-TESTDB11_id-2620210741_S-24_T-1_A-855020031_12pfgukc

arch_D-TESTDB11_id-2620210741_S-25_T-1_A-855020031_13pfgukd

data_D-TESTDB11_I-2620210741_TS-USERS_FNO-4_10pfgt5l

 

--5. 刪除上面練習中生成的所有映象拷貝型別的備份

RMAN> delete copy;

 

released channel: ORA_DISK_1

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=23 device type=DISK

specification does not match any control file copy in the repository

List of Datafile Copies

=======================

 

Key     File S Completion Time Ckp SCN    Ckp Time      

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

616     4    A 09-AUG-14       1111774    09-AUG-14     

        Name: /backup01/data_D-TESTDB11_I-2620210741_TS-USERS_FNO-4_10pfgt5l

        Tag: TAG20140809T115325

 

List of Archived Log Copies for database with db_unique_name TESTDB11

=====================================================================

 

Key     Thrd Seq     S Low Time

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

676     1    23      A 09-AUG-14

        Name: /backup01/arch_D-TESTDB11_id-2620210741_S-23_T-1_A-855020031_11pfguk9

 

645     1    23      A 09-AUG-14

        Name: /arch_dest2/1_23_855020031.dbf

 

644     1    23      A 09-AUG-14

        Name: /arch_dest1/1_23_855020031.dbf

 

677     1    24      A 09-AUG-14

        Name: /backup01/arch_D-TESTDB11_id-2620210741_S-24_T-1_A-855020031_12pfgukc

 

646     1    24      A 09-AUG-14

        Name: /arch_dest1/1_24_855020031.dbf

 

647     1    24      A 09-AUG-14

        Name: /arch_dest2/1_24_855020031.dbf

 

678     1    25      A 09-AUG-14

        Name: /backup01/arch_D-TESTDB11_id-2620210741_S-25_T-1_A-855020031_13pfgukd

 

649     1    25      A 09-AUG-14

        Name: /arch_dest2/1_25_855020031.dbf

 

648     1    25      A 09-AUG-14

        Name: /arch_dest1/1_25_855020031.dbf

 

 

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

deleted datafile copy

datafile copy file name=/backup01/data_D-TESTDB11_I-2620210741_TS-USERS_FNO-4_10pfgt5l RECID=3 STAMP=855143607

deleted archived log

archived log file name=/backup01/arch_D-TESTDB11_id-2620210741_S-23_T-1_A-855020031_11pfguk9 RECID=17 STAMP=855145099

deleted archived log

archived log file name=/arch_dest2/1_23_855020031.dbf RECID=12 STAMP=855144794

deleted archived log

archived log file name=/arch_dest1/1_23_855020031.dbf RECID=11 STAMP=855144794

deleted archived log

archived log file name=/backup01/arch_D-TESTDB11_id-2620210741_S-24_T-1_A-855020031_12pfgukc RECID=18 STAMP=855145100

deleted archived log

archived log file name=/arch_dest1/1_24_855020031.dbf RECID=13 STAMP=855144794

deleted archived log

archived log file name=/arch_dest2/1_24_855020031.dbf RECID=14 STAMP=855144794

deleted archived log

archived log file name=/backup01/arch_D-TESTDB11_id-2620210741_S-25_T-1_A-855020031_13pfgukd RECID=19 STAMP=855145101

deleted archived log

archived log file name=/arch_dest2/1_25_855020031.dbf RECID=16 STAMP=855144799

deleted archived log

archived log file name=/arch_dest1/1_25_855020031.dbf RECID=15 STAMP=855144799

Deleted 10 objects

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

相關文章