DM7使用dmrestore執行並行對映檔案還原

eric0435發表於2021-04-08

使用dmrestore執行並行對映檔案還原
對於並行備份產生的備份檔案,系統支援利用還原工具對資料庫進行並行還原。與並行備份一樣,並行還原需要使用者指定並行對映檔案的儲存位置。由於並行備份可能是增量備份,而備份的基礎備份也有可能是並行備份,因此執行並行還原需要指定一個對映檔案存放的目錄,用於還原的並行備份的對映檔案都存放在該目錄下。並行還原能提高還原效能,使得資料服務迅速還原。需要說明的是,備份時的對映檔案內容應與還原時對映檔案內容保持一致,但這不是必需的,系統在還原前,會對使用者設定的對映檔案內容進行校驗,判斷對映檔案內容是否與備份時對映檔案內容相容,保證系統能正確還原資料庫。

建立並行對映檔案

[dmdba@shard1 backup]$ vi bak.parallel
[DMHR,USERS]=/dm_home/dmdba/dmdbms/backup/backup1
[FG_PERSON]=/dm_home/dmdba/dmdbms/backup/backup2
[default]=/dm_home/dmdba/dmdbms/backup/backup3

建立資料庫的備份檔案

SQL> backup database full to para_bak bakfile '/dm_home/dmdba/dmdbms/backup/parallel.bak' parallel '/dm_home/dmdba/dmdbms/backup/bak.parallel';
executed successfully
used time: 00:00:12.628. Execute id is 164.
[dmdba@shard1 backup]$ ls -lrt
-rw-r--r-- 1 dmdba dinstall       146 8月   4 11:50 bak.parallel
drwxr-xr-x 2 dmdba dinstall        47 8月   4 12:10 backup3
drwxr-xr-x 2 dmdba dinstall        47 8月   4 12:10 backup2
drwxr-xr-x 2 dmdba dinstall        47 8月   4 12:10 backup1
-rw-r--r-- 1 dmdba dinstall  33554432 8月   4 12:10 parallel.bak
[dmdba@shard1 backup]$ cd backup1
[dmdba@shard1 backup1]$ ls -lrt
總用量 1512
-rw-r--r-- 1 dmdba dinstall 33554432 8月   4 12:10 DB_jydm_20200804121005000554_1.bak
[dmdba@shard1 backup1]$ cd ..
[dmdba@shard1 backup]$ cd backup2
[dmdba@shard1 backup2]$ ls -lrt
總用量 28
-rw-r--r-- 1 dmdba dinstall 33554432 8月   4 12:10 DB_jydm_20200804121005000554_1.bak
[dmdba@shard1 backup2]$ cd ..
[dmdba@shard1 backup]$ cd backup3
[dmdba@shard1 backup3]$ ls -lrt
總用量 390420
-rw-r--r-- 1 dmdba dinstall 402653184 8月   4 12:10 DB_jydm_20200804121005000554_1.bak

使用並行備份檔案來還原資料庫,並行對映檔案為/dm_home/dmdba/dmdbms/backup/bak.parallel

[root@shard1 oracle]# service DmServicejydm stop
Redirecting to /bin/systemctl stop  DmServicejydm.service
[dmdba@shard1 backup]$ dmrestore ini_path=/dm_home/dmdba/dmdbms/data/jydm/dm.ini file=/dm_home/dmdba/dmdbms/backup/parallel.bak   parallel_dir=/dm_home/dmdba/dmdbms/backup/bak.parallel
restore V7.1.6.46-Build(2018.02.08-89107)ENT
file dm.key not found, use default license!
backup sig:            BA
backup tool version:   12595
backup db name:        jydm
backup db magic:       -848310636
backup pemnt magic:    1250320462
backup name:           PARA_BAK
backup type:           full
backup level:          online
backup range:          database
backup description:
compressed level:      0
encrypt_type:          0
encrypt_id:            2052
rac node:              0
page check:            0
rlog encrypt:          0
external cipher id:    0
external hash id:      0
length in char:        0
use new hash:          1
backup time:           2020-08-04 12:10:05
page size:             8 KB
extent size:           16
case sensitive:        1
log page size:         512 B
charset:               0
data version:          0x7000A
sys version:           V7.1.6.46-Build(2018.02.08-89107)ENT
enable policy:         0
mpp_timestamp:         1596514204
crc_check:             TRUE
parallel type:         1
parallel info len:     1536
backup db fil num:     9
archive flag:          1
backup with log:       Yes
before backup LSN:     32598802
after backup LSN:      32598813
$bak_seq |$file_path                                        |$size(K)       |$used(K)
        1|/dm_home/dmdba/dmdbms/backup/parallel.bak         |       32768.00|          47.50
$file_seq |$type|$ts_name       |$state    |$size(K)  |$seq_in_bak    |$off_in_bak(B) |$len_in_bak(B) |$file_path                                        |$mirror_path
         1|DBF  |SYSTEM         |ONLINE    |     23552|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF        |
         2|DBF  |ROLL           |ONLINE    |    229376|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF          |
         3|DBF  |MAIN           |ONLINE    |    305152|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF          |
         4|DBF  |BOOKSHOP       |ONLINE    |    153600|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF      |
         5|DBF  |DMHR           |ONLINE    |    131072|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF          |
         6|DBF  |USERS          |ONLINE    |     51200|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/users01.dbf       |
         7|DBF  |SYSAUX         |ONLINE    |    179200|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF        |
         8|DBF  |FG_PERSON      |ONLINE    |    131072|              1|              0|              0|/dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF     |
         9|LOG  |ARCHLOG        |ONLINE    |         0|              1|          44544|           4096|                                                  |
backup sig:            BA
backup tool version:   12595
backup db name:        jydm
backup db magic:       -848310636
backup pemnt magic:    1250320462
backup name:           PARA_BAK
backup type:           full
backup level:          online
backup range:          database
backup description:
compressed level:      0
encrypt_type:          0
encrypt_id:            2052
rac node:              0
page check:            0
rlog encrypt:          0
external cipher id:    0
external hash id:      0
length in char:        0
use new hash:          1
backup time:           2020-08-04 12:10:05
page size:             8 KB
extent size:           16
case sensitive:        1
log page size:         512 B
charset:               0
data version:          0x7000A
sys version:           V7.1.6.46-Build(2018.02.08-89107)ENT
enable policy:         0
mpp_timestamp:         1596514204
crc_check:             TRUE
parallel type:         2
parallel info len:     0
backup db fil num:     2
archive flag:          1
backup with log:       Yes
before backup LSN:     32598802
after backup LSN:      0
$bak_seq |$file_path                                        |$size(K)       |$used(K)
        1|/dm_home/dmdba/dmdbms/backup/backup1/DB_jydm_20200804121005000554_1.bak|       32768.00|        1510.00
$file_seq |$type|$ts_name       |$state    |$size(K)  |$seq_in_bak    |$off_in_bak(B) |$len_in_bak(B) |$file_path                                        |$mirror_path
         1|DBF  |DMHR           |ONLINE    |    131072|              1|          14336|         425984|/dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF          |
         2|DBF  |USERS          |ONLINE    |     51200|              1|         440320|        1105920|/dm_home/dmdba/dmdbms/data/jydm/users01.dbf       |
backup sig:            BA
backup tool version:   12595
backup db name:        jydm
backup db magic:       -848310636
backup pemnt magic:    1250320462
backup name:           PARA_BAK
backup type:           full
backup level:          online
backup range:          database
backup description:
compressed level:      0
encrypt_type:          0
encrypt_id:            2052
rac node:              0
page check:            0
rlog encrypt:          0
external cipher id:    0
external hash id:      0
length in char:        0
use new hash:          1
backup time:           2020-08-04 12:10:05
page size:             8 KB
extent size:           16
case sensitive:        1
log page size:         512 B
charset:               0
data version:          0x7000A
sys version:           V7.1.6.46-Build(2018.02.08-89107)ENT
enable policy:         0
mpp_timestamp:         1596514204
crc_check:             TRUE
parallel type:         2
parallel info len:     0
backup db fil num:     1
archive flag:          1
backup with log:       Yes
before backup LSN:     32598802
after backup LSN:      0
$bak_seq |$file_path                                        |$size(K)       |$used(K)
        1|/dm_home/dmdba/dmdbms/backup/backup2/DB_jydm_20200804121005000554_1.bak|       32768.00|          26.00
$file_seq |$type|$ts_name       |$state    |$size(K)  |$seq_in_bak    |$off_in_bak(B) |$len_in_bak(B) |$file_path                                        |$mirror_path
         1|DBF  |FG_PERSON      |ONLINE    |    131072|              1|          10240|          16384|/dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF     |
backup sig:            BA
backup tool version:   12595
backup db name:        jydm
backup db magic:       -848310636
backup pemnt magic:    1250320462
backup name:           PARA_BAK
backup type:           full
backup level:          online
backup range:          database
backup description:
compressed level:      0
encrypt_type:          0
encrypt_id:            2052
rac node:              0
page check:            0
rlog encrypt:          0
external cipher id:    0
external hash id:      0
length in char:        0
use new hash:          1
backup time:           2020-08-04 12:10:05
page size:             8 KB
extent size:           16
case sensitive:        1
log page size:         512 B
charset:               0
data version:          0x7000A
sys version:           V7.1.6.46-Build(2018.02.08-89107)ENT
enable policy:         0
mpp_timestamp:         1596514204
crc_check:             TRUE
parallel type:         2
parallel info len:     0
backup db fil num:     5
archive flag:          1
backup with log:       Yes
before backup LSN:     32598802
after backup LSN:      0
$bak_seq |$file_path                                        |$size(K)       |$used(K)
        1|/dm_home/dmdba/dmdbms/backup/backup3/DB_jydm_20200804121005000554_1.bak|      393216.00|      390418.00
$file_seq |$type|$ts_name       |$state    |$size(K)  |$seq_in_bak    |$off_in_bak(B) |$len_in_bak(B) |$file_path                                        |$mirror_path
         1|DBF  |SYSTEM         |ONLINE    |     23552|              1|          26624|        6766592|/dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF        |
         2|DBF  |ROLL           |ONLINE    |    229376|              1|        6793216|       10887168|/dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF          |
         3|DBF  |MAIN           |ONLINE    |    305152|              1|       17680384|      270917632|/dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF          |
         4|DBF  |BOOKSHOP       |ONLINE    |    153600|              1|      288598016|         933888|/dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF      |
         5|DBF  |SYSAUX         |ONLINE    |    179200|              1|      289531904|      110256128|/dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF        |
Continue?[Y/N]:Y
restore bak_file: /dm_home/dmdba/dmdbms/backup/parallel.bak ...
start restore database...
start restore database...
start restore database...
start restore file: /dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF(FG_PERSON), pages: 2
start restore file: /dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF(DMHR), pages: 52
start restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF(SYSTEM), pages: 826
end restore file: /dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF(FG_PERSON)
end restore database data files.
end restore file: /dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF(DMHR)
end restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF(SYSTEM)
start restore file: /dm_home/dmdba/dmdbms/data/jydm/users01.dbf(USERS), pages: 135
start restore file: /dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF(ROLL), pages: 1329
end restore file: /dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF(ROLL)
end restore file: /dm_home/dmdba/dmdbms/data/jydm/users01.dbf(USERS)
start restore file: /dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF(MAIN), pages: 33071
end restore database data files.
end restore file: /dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF(MAIN)
start restore file: /dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF(BOOKSHOP), pages: 114
end restore file: /dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF(BOOKSHOP)
start restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF(SYSAUX), pages: 13459
end restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF(SYSAUX)
end restore database data files.
redo tmp arch file: /dm_home/dmdba/dmdbms/backup/RES_TMP_ARCH_20200804121936840_0.log, rpages: 16
Apply archive log LSN from 32598814 to 32598813, time used:0.000s.
restore finished, code = 0!
restore successfully!
restore time used: 9800.081(ms)

啟動資料庫

[root@shard1 oracle]# service DmServicejydm start
Redirecting to /bin/systemctl start  DmServicejydm.service
SQL> select * from t1;
LINEID     C1          C2
---------- ----------- -----------
1          1           1
2          2           2
3          3           3
4          4           4
5          5           5
6          6           6
6 rows got
used time: 0.427(ms). Execute id is 101.


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

相關文章