24 марта 2008 г.

Создание standby с помощью rman

Поднятие standby из бэкапа с помощью rman имеет ряд преимуществ:
1) не нужно останавливать основную базу
2) не повлияет на производительность основной базы данных

Здесь я опишу главные моменты, где идет отличие от ручного поднятия standby. Предполагается, что настройка параметров инициализации для основной и резеврной БД, и другие моменты, уже знакомы.

И так, если еще нет полного бэкапа основной БД, то нужно ее забэкапить:
rman target / catalog rman/mypassword@RMCAT
RUN {
ALLOCATE CHANNEL ch1 TYPE 'SBT_TAPE';
CROSSCHECK ARCHIVELOG ALL;
BACKUP
INCREMENTAL LEVEL=0
FILESPERSET 5 FORMAT 'bk_%s_%p_%t'
DATABASE include current controlfile for standby;
BACKUP FORMAT 'al_%s_%p_%t' ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch1;
}


Дальше, на резервном сервере, после поднятия резервной БД в nomount:
rman
connect catalog rman/password@CATDB
connect target sys/"mypassword"@mydb
connect auxiliary /
run{
ALLOCATE AUXILIARY CHANNEL c1 TYPE 'SBT_TAPE' parms="ENV=(NB_ORA_CLIENT=primary_host, NB_ORA_SERV=backupsrv)";
duplicate target database for standby dorecover NOFILENAMECHECK;
}


Здесь список ошибок, которые могут возникнуть, и их решения:
Ошибка №1:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on c1 channel at 03/24/2008 19:59:18
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 2


Это из документации Oracle:
"The most important line of the error output is the ORA-27211 error. It indicates the basic problem, that the media management library could not be loaded. ......By default, the database expects to find the media management library at $ORACLE_HOME/lib/libobk.so on UNIX, or %ORACLE_HOME%/bin/orasbt.dll on NT."

Решение от Виталия Воронцова, Oracle DBA и продвинутого пользователя по Netbackup:
слинковать библиотеку Netbackupа
oracle@myhost$ ./usr/openv/netbackup/bin/oracle_link
Mon Mar 24 20:09:47 UZT 2008
All Oracle instances should be shutdown before running this script.
Please log into the Unix system as the Oracle owner for running this script
Do you want to continue? (y/n) [n] y
LIBOBK path: /usr/openv/netbackup/bin
ORACLE_HOME: /u01/app/oracle/product/9.2.0.7.0
Oracle version: 9.2.0.7.0
Linking LIBOBK:
ln -s /usr/openv/netbackup/bin/libobk.so64.1 /u01/app/oracle/product/9.2.0.7.0/lib/libobk.so
Done
Please check the trace file located in /tmp/make_trace.6960
to make sure the linking process was successful.


Ошибка №2:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/25/2008 17:49:18
RMAN-03015: error occurred in stored script Memory Script
ORA-19507: failed to retrieve sequential file, handle="bk_15539_1_650240673", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Failed to process backup file

Это из документации Veritas NetBackup 6 for Oracle: System Administrator's Guide:

"Ensure that the NetBackup server is configured to allow a redirected restore. The administrator can remove restrictions for all clients by creating the following file on the Netbackup master server:
/usr/openv/netbackup/db/altnames/No.Restrictions
Or, to restrict clients to restore only from certain other clients, create the following file:
/usr/openv/netbackup/db/altnames/client_name
Where client_name is the name of the client allowed to do the redirected restore (the destination client). Then, add the name of the NetBackup for Oracle source client to that file."