Настройка EMC Networker - RMAN
Резервное копирование RMAN
RUN {
ALLOCATE CHANNEL ch1 DEVICE TYPE 'SBT_TAPE';
SEND DEVICE TYPE 'SBT_TAPE' 'NSR_ENV=(NSR_SERVER=backup-server.com, NSR_SAVESET_RETENTION=2days)';
BACKUP FULL DATABASE TAG "FULL_DATABASE_DATAFILES";
SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
BACKUP ARCHIVELOG ALL TAG "FULL_DATABASE_ARCHIVELOGS";
BACKUP CURRENT CONTROLFILE TAG "FULL_DATABASE_CONTROLFILE";
BACKUP SPFILE TAG "FULL_DATABASE_SPFILE";
RELEASE CHANNEL ch1;
}
Восстановление RMAN
Поиск соответствующей резервной копии (Emc Networker)
[oracle@host]$ mminfo -c 'orac-client.com' -s 'backup-server.com' -o tR -r "name,ssid,level,fragsize,savetime(25),nsavetime"
name ssid lvl size date time save time
RMAN:c-367044326-20180706-03 3846112434 manual 7169 KB 06.07.2018 10:57:03 1530856623
RMAN:ARCDB_ebt7aj3t_1_1 3862889646 manual 257 KB 06.07.2018 10:57:02 1530856622
RMAN:ARCDB_eat7aj3p_1_1 3879666858 manual 7169 KB 06.07.2018 10:56:58 1530856618
RMAN:ARCDB_e9t7aj04_1_1 3896443956 manual 3029 MB 06.07.2018 10:55:00 1530856500
RMAN:ARCDB_e8t7aiv0_1_1 3913221163 manual 2817 KB 06.07.2018 10:54:25 1530856465
Рашифровка
RMAN:c-367044326-20180706-03
- имя РК
367044326
- DBID
Восстановление SPFILE
Перполагается база выключена
[oracle@arc-db lib]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jul 6 11:54:01 2018
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> SET DBID 367044326; Значение автоматически не копируется и должно быть взято из внешено источника (mminfo)
executing command: SET DBID
RMAN> startup nomount;
Oracle instance started
Total System Global Area 1174405120 bytes
Fixed Size 1219040 bytes
Variable Size 184550944 bytes
Database Buffers 973078528 bytes
Redo Buffers 15556608 bytes
RMAN> run {
2> allocate channel ch1 type 'SBT_TAPE';
Указываем адрес EMC Networker сервера
3> send device type 'SBT_TAPE' 'NSR_ENV=(NSR_SERVER=backup-server.com)';
Куда и откуда (c-367044326-20180706-03 - из mminfo) восстановить SPFILE
4> restore spfile to '/home/oracle/test/spfileSID.ora' from 'c-367044326-20180706-03';
5> release channel ch1;
6> }
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: sid=156 devtype=SBT_TAPE
channel ch1: NMDA Oracle v9.2.1.1
sent command to channel: ch1
Starting restore at 06-JUL-18
channel ch1: autobackup found: c-367044326-20180706-03
channel ch1: SPFILE restore from autobackup complete
Finished restore at 06-JUL-18
released channel: ch1
Восстановление CONTROLFILE
RMAN> run {
2> allocate channel ch1 type 'SBT_TAPE';
Указываем адрес EMC Networker сервера
3> send device type 'SBT_TAPE' 'NSR_ENV=(NSR_SERVER=backup-server.com)';
откуда (c-367044326-20180706-03 - из mminfo) восстановить CONTROLFILE
4> restore controlfile from 'c-367044326-20180706-03';
5> }
allocated channel: ch1
channel ch1: sid=156 devtype=SBT_TAPE
channel ch1: NMDA Oracle v9.2.1.1
sent command to channel: ch1
Starting restore at 06-JUL-18
channel ch1: restoring control file
channel ch1: restore complete, elapsed time: 00:00:25
output filename=/oracle/oradata/db/control01.ctl
output filename=/oracle/oradata/db/control02.ctl
output filename=/oracle/oradata/db/control03.ctl
Finished restore at 06-JUL-18
released channel: ch1
Просмотр истории backup-ов
В CONTROLFILE содержиться история РК,
читать CONTROLFILE можно в режиме MOUNT и выше
RMAN> alter database mount;
database mounted
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31087 Full 2.89G SBT_TAPE 00:03:20 06-JUL-18
BP Key: 31087 Status: AVAILABLE Compressed: NO Tag: FULL_DATABASE_DATAFILES
Handle: edt7b0jp_1_1 Media:
List of Datafiles in backup set 31087
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/system01.dbf
2 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/undotbs01.dbf
3 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/sysaux01.dbf
4 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/users01.dbf
5 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/arc01.dbf
6 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/arc_aaaa_01.dbf
7 Full 317349608711 06-JUL-18 /oracle/oradata/arcdb/hr01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31088 Full 7.00M SBT_TAPE 00:00:01 06-JUL-18
BP Key: 31088 Status: AVAILABLE Compressed: NO Tag: TAG20180706T145046
Handle: c-367044326-20180706-04 Media:
Control File Included: Ckp SCN: 317349609084 Ckp time: 06-JUL-18
SPFILE Included: Modification time: 05-JUL-18
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
31089 20.50M SBT_TAPE 00:00:03 06-JUL-18
BP Key: 31089 Status: AVAILABLE Compressed: NO Tag: FULL_DATABASE_ARCHIVELOGS
Handle: eft7b0qb_1_1 Media:
List of Archived Logs in backup set 31089
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 13612 317349584617 06-JUL-18 317349588360 06-JUL-18
1 13613 317349588360 06-JUL-18 317349588434 06-JUL-18
1 13614 317349588434 06-JUL-18 317349609096 06-JUL-18
1 13615 317349609096 06-JUL-18 317349609101 06-JUL-18
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31090 Full 7.00M SBT_TAPE 00:00:01 06-JUL-18
BP Key: 31090 Status: AVAILABLE Compressed: NO Tag: FULL_DATABASE_CONTROLFILE
Handle: egt7b0qh_1_1 Media:
Control File Included: Ckp SCN: 317349609113 Ckp time: 06-JUL-18
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31091 Full 256.00K SBT_TAPE 00:00:00 06-JUL-18
BP Key: 31091 Status: AVAILABLE Compressed: NO Tag: FULL_DATABASE_SPFILE
Handle: eht7b0qi_1_1 Media:
SPFILE Included: Modification time: 05-JUL-18
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31092 Full 6.89M DISK 00:00:00 06-JUL-18
BP Key: 31092 Status: AVAILABLE Compressed: NO Tag: TAG20180706T124452
Piece Name: /oracle/flash_recovery_area/ARCDB/autobackup/2018_07_06/o1_mf_s_980772292_fmy7hnd5_.bkp
Control File Included: Ckp SCN: 317349590649 Ckp time: 06-JUL-18
SPFILE Included: Modification time: 06-JUL-18
Расшифровка RMAN - list backup
full backup
BS Key |
Type LV |
Size |
Device Type |
Elapsed Time |
Completion Time |
31087Номер РК Oracle |
FullТип копии |
2.89GРазмер копии |
SBT_TAPEУстройство на котором храниться РК |
00:03:20 |
06-JUL-18Дата РК |
|
BP Key: 31087 Status: AVAILABLE(Доступность РК) Compressed: NO Tag: FULL_DATABASE_DATAFILES(Метка) |
List of Datafiles in backup set 31087
File |
LV |
Type |
Ckp SCN
Номер изменения в БД
|
Ckp Time |
Name |
1 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/system01.dbf |
2 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/undotbs01.dbf |
3 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/sysaux01.dbf |
4 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/users01.dbf |
5 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/arc01.dbf |
6 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/arc_data_01.dbf |
7 |
Full |
317349608711 |
06-JUL-18 |
/oracle/oradata/arcdb/hr01.dbf |
|
archive logs
BS Key |
Size |
Device Type |
Elapsed Time |
Completion Time |
31089 |
20.50M |
SBT_TAPE |
00:00:03 |
06-JUL-18 |
|
BP Key: 31089 Status: AVAILABLE Compressed: NO Tag: FULL_DATABASE_ARCHIVELOGS |
|
Handle: eft7b0qb_1_1 Media: |
List of Archived Logs in backup set 31089 Список архивных логов в этой РК
Thrd |
Seq |
Low SCNНомер изменения в БД |
Low Time |
Next SCNНомер изменения в БД |
Next Time |
1 |
13612 |
317349584617 |
06-JUL-18 |
317349588360 |
06-JUL-18 |
1 |
13613 |
317349588360 |
06-JUL-18 |
317349588434 |
06-JUL-18 |
1 |
13614 |
317349588434 |
06-JUL-18 |
317349609096 |
06-JUL-18 |
1 |
13615 |
317349609096
До этого номера будет восстановлена БД
|
06-JUL-18 |
317349609101 |
06-JUL-18 |
|
controlfile / spfile
BS Key |
Type LV |
Size |
Device Type |
Elapsed Time |
Completion Time |
31092 |
Full |
6.89M |
DISKрезервная копися расположена на диске |
00:00:00 |
06-JUL-18 |
|
BP Key: 31092 Status: AVAILABLE Compressed: NO Tag: TAG20180706T124452 |
|
Piece Name: /oracle/flashrecoveryarea/ARCDB/autobackup/2018_07_06/o1_mf_s_980772292_fmy7hnd5_.bkp
РК состоит из одно файла и находиться по указаному пути на диске
|
Control File Included: Ckp SCN: 317349590649 Ckp time: 06-JUL-18
РК содержит CONTROLFILE
|
SPFILE Included: Modification time: 06-JUL-18
РК содержит SPFILE
|
Восстановление базы на момент времени/SCN
RMAN> run {
2> allocate channel ch1 type 'SBT_TAPE';
Указываем адрес EMC Networker сервера
3> send device type 'SBT_TAPE' 'NSR_ENV=(NSR_SERVER=backup-server.com)';
До кого номера SCN восстанавливаем базу
4> set until scn = 317349609096;
5> restore database;
6> recover database;
7> alter database open resetlogs;
8> }
allocated channel: ch1
channel ch1: sid=156 devtype=SBT_TAPE
channel ch1: NMDA Oracle v9.2.1.1
sent command to channel: ch1
executing command: SET until clause
Starting restore at 06-JUL-18
channel ch1: starting datafile backupset restore
channel ch1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/arcdb/system01.dbf
restoring datafile 00002 to /oracle/oradata/arcdb/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/arcdb/sysaux01.dbf
restoring datafile 00004 to /oracle/oradata/arcdb/users01.dbf
restoring datafile 00005 to /oracle/oradata/arcdb/arc01.dbf
restoring datafile 00006 to /oracle/oradata/arcdb/arc_aaaa_01.dbf
restoring datafile 00007 to /oracle/oradata/arcdb/hr01.dbf
channel ch1: reading from backup piece ARCDB_e9t7aj04_1_1
channel ch1: restored backup piece 1
piece handle=ARCDB_e9t7aj04_1_1 tag=TAG20180706T105500
channel ch1: restore complete, elapsed time: 00:00:56
Finished restore at 06-JUL-18
Starting recover at 06-JUL-18
starting media recovery
archive log thread 1 sequence 13609 is already on disk as file /oracle/flash_recovery_area/ARCDB/archivelog/2018_07_06/o1_mf_1_13609_fmy7hgmv_.arc
archive log thread 1 sequence 13613 is already on disk as file /oracle/flash_recovery_area/ARCDB/archivelog/2018_07_06/o1_mf_1_13613_fmy7366o_.arc
archive log thread 1 sequence 1 is already on disk as file /oracle/oradata/arcdb/redo02.log
archive log filename=/oracle/flash_recovery_area/ARCDB/archivelog/2018_07_06/o1_mf_1_13613_fmy7366o_.arc thread=1 sequence=13613
archive log filename=/oracle/oradata/arcdb/redo02.log thread=1 sequence=1
media recovery complete, elapsed time: 00:00:04
Finished recover at 06-JUL-18
database opened
released channel: ch1