Die folgende Anleitung ist als eine Ergänzung zu dem ORACLE

Werbung
25$&/(J'DWD*XDUGDXIGHU.RPPDQGR]HLOH
8ZH+HVVH3ULQFLSDO,QVWUXFWRU25$&/(8QLYHUVLW\
______________________________________________________________
Die folgende Anleitung ist als eine Ergänzung zu dem ORACLE University Kurs
Oracle Database 10g: Data Guard Administration entstanden. Sie
behandelt die Erzeugung und Verwaltung von Physical und Logical Standby
Databases ohne Zuhilfenahme von ORACLE Grid Control.
Die Anleitung ist entwickelt worden auf
Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
Kernel 2.6.9-22.EL on an i686,
dürfte aber nahezu identisch auf allen zertifizierten Plattformen funktionieren.
Die eingesetzte ORACLE Version ist
Oracle Database 10g Enterprise Edition Release 10.2.0.2
Es wird hier auf nur einem Server eine Primary Database, eine Physical und eine
Logical Standby Database angelegt. Zu Test- und Demonstrationszwecken ist das
gut geeignet; eine realistische Umsetzung würde natürlich 3 Rechner verlangen. Die
Anleitung ist dazu aber leicht anpassbar; tatsächlich ist es sogar etwas schwieriger,
alles auf einem Rechner anzulegen.
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
(U]HXJXQJGHU3ULPDU\'DWDEDVH (U]HXJXQJGHU3K\VLFDO6WDQGE\'DWDEDVH Kontrolldatei für Physical Standby erzeugen:......................................................................................3
Standby Logs auf Physical Standby anlegen........................................................................................3
Auf Primary LOG_ARCHIVE_DEST_2 anpassen: ............................................................................4
Auf Primary ebenfalls Standby Logs anlegen für ev. SWITCHOVER................................................4
(U]HXJXQJGHU'DWD*XDUG%URNHU.RQILJXUDWLRQ DMON Hintergrundprozess auf Primary und Standby starten:............................................................5
'ata *uard 0ana JeU /inemode aufrufen und Konfiguration erstellen: .............................................5
bQGHUXQJGHV3URWHFWLRQ/HYHOVXQGGHU7UDQVSRUWPHWKRGH Maximum Protection; hier sind 2 Standby Datenbanken empfohlen. ..................................................6
Maximum Availability .........................................................................................................................6
Maximum Performance mit LGWR-Transport ....................................................................................6
Maximum Performance mit ARCH-Transport (Ausgangslage)...........................................................6
(U]HXJXQJGHU/RJLFDO6WDQGE\'DWDEDVH Zuvor sollte man prüfen, ob die Logical Standby Database überhaupt sinnvoll ist .............................7
Bei welchen Tabellen müssen Primary/Unique Constraints hinzugefügt werden? ..............................7
Zusaetzliches Logging auf der Primary einschalten.............................................................................7
Verzeichnisse und Passwordfile für Logical Standby anlegen.............................................................7
Zunächst wird nun (mit 50$1) eine Physical Standby Database erzeugt. ........................................7
Parameter für die neue Standby Database auf der Primary setzen .......................................................8
Standby Dictionary anlegen .................................................................................................................8
Nun wird die Physical Standby Database in eine Logical Standby Database verwandelt....................8
/RJLFDO6WDQGE\LQGLH%URNHU.RQILJXUDWLRQDXIQHKPHQ Maximum Protection mit Logical Standby Database...........................................................................9
6ZLWFKRYHUXQG)DLORYHU Switchover: Der Rollentausch zw. Primary und Standby ....................................................................9
Failover: Der Ernstfall ist eingetreten, Primary ist kaputt....................................................................9
)ODVKEDFN'DWDEDVH Flashback für alle Datenbanken ermöglichen ....................................................................................10
Physical Standby Flashback ausführen ..............................................................................................10
Physical Standby Read Only öffnen...................................................................................................10
Nach Failover alte Primary zur Standby Database machen ...............................................................10
6WDQGE\5HDG:ULWH|IIQHQIODVKEDFN )DVW6WDUW)DLORYHU Broker-Konfiguration anpassen .........................................................................................................11
Observer auf anderem Rechner starten ..............................................................................................11
$QKDQJ VALID_FOR - Konfigurationen ........................................................................................................12
Primary und Physical Standby.......................................................................... 12
Primary und Logical Standby ........................................................................... 12
Primary, Physical Standby und Logical Standby .............................................. 12
#initprima.ora .....................................................................................................................................13
#initphyst.ora......................................................................................................................................13
#initlogst.ora ......................................................................................................................................14
#physt.sh ............................................................................................................................................14
--phystcp.sql.......................................................................................................................................14
#logst.sh .............................................................................................................................................15
#dupli.rcv ...........................................................................................................................................15
--flashbackon.sql ................................................................................................................................15
#listener.ora........................................................................................................................................16
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
(U]HXJXQJGHU3ULPDU\'DWDEDVH
listener.ora und tnsnames.ora anpassen (mit netmgr oder editor)
Wichtig in listener.ora für spätere Data Guard Broker Verwendung:
GLOBAL_DBNAME = primaB'*0*5/
GLOBAL_DBNAME = physt_DGMGRL
cd skripte
./prima.sh
(U]HXJXQJGHU3K\VLFDO6WDQGE\'DWDEDVH
3ULPDU\'%YRUEHUHLWHQ
connect sys/oracle@prima as sysdba
alter database force logging;
shutdown immediate;
startup mount
alter database archivelog;
alter database open;
9HU]HLFKQLVVHDQOHJHQXQG'DWHQGDWHLHQNRSLHUHQ
:
exit;
cd $HOME/skripte
./physt.sh
.RQWUROOGDWHLIU3K\VLFDO6WDQGE\HU]HXJHQ
connect sys/oracle@prima as sysdba
alter database create standby controlfile as
’/home/oracle/physt/control01.ctl’;
6WDQGE\'DWDEDVH
connect sys/oracle@physt as sysdba
create spfile from pfile=’/home/oracle/skripte/initphyst.ora’;
startup nomount;
alter database mount standby database;
6WDQGE\/RJVDXI3K\VLFDO6WDQGE\DQOHJHQ
alter database add standby logfile
’/home/oracle/physt/sblog_g1m1.rdo’ size 100m;
alter database add standby logfile
’/home/oracle/physt/sblog_g2m1.rdo’ size 100m;
alter database add standby logfile
’/home/oracle/physt/sblog_g3m1.rdo’ size 100m;
recover managed standby database disconnect;
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
$XI3ULPDU\/2*B$5&+,9(B'(67BDQSDVVHQ
connect sys/oracle@prima as sysdba
alter system set log_archive_dest_2=’service=physt
valid_for=(online_logfiles,primary_role) db_unique_name=physt’;
7HVWHQ
alter system archive log current;
6HVVLRQ
tail –f $HOME/physt/bdump/ale*
$XI3ULPDU\HEHQIDOOV6WDQGE\/RJVDQOHJHQIUHY6:,7&+29(5
connect sys/oracle@prima as sysdba
alter database add standby logfile
'/home/oracle/prima/sblog_g1m1.rdo' size 100m;
alter database add standby logfile
'/home/oracle/prima/sblog_g2m1.rdo' size 100m;
alter database add standby logfile
'/home/oracle/prima/sblog_g3m1.rdo' size 100m;
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
(U]HXJXQJGHU'DWD*XDUG%URNHU.RQILJXUDWLRQ
'021+LQWHUJUXQGSUR]HVVDXI3ULPDU\XQG6WDQGE\VWDUWHQ
connect sys/oracle@prima as sysdba
alter system set dg_broker_start=true;
connect sys/oracle@physt as sysdba
alter system set dg_broker_start=true;
exit
'DWD*XDUG0DQDJHU/LQHPRGHDXIUXIHQXQG.RQILJXUDWLRQHUVWHOOHQ
dgmgrl
help
connect sys/oracle@prima
create configuration myconfig as
primary database is prima
connect identifier is prima;
add database physt as
connect identifier is physt
maintained as physical;
enable configuration;
show configuration verbose;
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
bQGHUXQJGHV3URWHFWLRQ/HYHOVXQGGHU7UDQVSRUWPHWKRGH
dgmgrl> connect sys/oracle@prima
show configuration verbose;
show database verbose physt;
0D[LPXP3URWHFWLRQKLHUVLQG6WDQGE\'DWHQEDQNHQHPSIRKOHQ
'LHbQGHUXQJHQZHUGHQIUGHQ)DOOHLQHVHYHQWXHOOHQ6ZLWFKRYHUVVWHWVDQEHLGHQ
'DWHQEDQNHQDXVJHIKUW
edit database prima set property LogXptMode=SYNC;
edit database physt set property LogXptMode=SYNC;
edit configuration set protection mode as maxprotection;
show configuration verbose;
0D[LPXP$YDLODELOLW\
edit database prima set property LogXptMode=SYNC;
edit database physt set property LogXptMode=SYNC;
edit configuration set protection mode as maxavailability;
show configuration verbose;
0D[LPXP3HUIRUPDQFHPLW/*:57UDQVSRUW
)DOOVYRUKHUHLQK|KHUHU3URWHFWLRQ/HYHONRQILJXULHUWZDUPX‰HU]XHUVWDXI
0D[LPXP3HUIRUPDQFHDEJHVHQNWZHUGHQ
edit configuration set protection mode as maxperformance;
edit database prima set property LogXptMode=ASYNC;
edit database physt set property LogXptMode=ASYNC;
show configuration verbose;
0D[LPXP3HUIRUPDQFHPLW$5&+7UDQVSRUW$XVJDQJVODJH
)DOOVYRUKHUHLQK|KHUHU3URWHFWLRQ/HYHONRQILJXULHUWZDUPX‰HU]XHUVWDXI
0D[LPXP3HUIRUPDQFHDEJHVHQNWZHUGHQ
edit configuration set protection mode as maxperformance;
edit database prima set property LogXptMode=ARCH;
edit database physt set property LogXptMode=ARCH;
show configuration verbose;
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
(U]HXJXQJGHU/RJLFDO6WDQGE\'DWDEDVH
=XYRUVROOWHPDQSUIHQREGLH/RJLFDO6WDQGE\'DWDEDVHEHUKDXSWVLQQYROOLVW
select distinct owner,table_name from dba_logstdby_unsupported
order by owner,table_name;
%HLZHOFKHQ7DEHOOHQPVVHQ3ULPDU\8QLTXH&RQVWUDLQWVKLQ]XJHIJWZHUGHQ"
select owner, table_name from dba_logstdby_not_unique
where table_name not in (select table_name from
dba_logstdby_unsupported);
=XVDHW]OLFKHV/RJJLQJDXIGHU3ULPDU\HLQVFKDOWHQ
0HKU,QIRUPDWLRQHQPVVHQLQGLH/RJGDWHLHQGHU3ULPDU\NRPPHQXPGLH=HLOHQ
DXIGHU/RJLFDO6WDQGE\HLQGHXWLJ]XRUGQHQ]XNRHQQHQ
alter database add supplemental log data (primary key, unique
index) columns;
9HU]HLFKQLVVHXQG3DVVZRUGILOHIU/RJLFDO6WDQGE\DQOHJHQ
exit
./logst.sh
VSILOHIU/RJLFDO6WDQGE\DQOHJHQ
connect sys/oracle@logst as sysdba
create spfile from pfile=’/home/oracle/skripte/initlogst.ora’;
startup nomount
=XQlFKVWZLUGQXQPLW50$1HLQH3K\VLFDO6WDQGE\'DWDEDVHHU]HXJW
'LHVH3K\VLFDO6WDQGE\ZLUGPLWWHOVHLQHV50$12QOLQH%DFNXSVHU]HXJWGLH
3ULPDU\EOHLEWDOVRRIIHQ'LHVHOEH0HWKRGHKlWWHPDQDXFK]XU(U]HXJXQJYRQ
SK\VWQHKPHQN|QQHQ6RVLQGEHLGH9DULDQWHQGHPRQVWULHUW
exit
rman cmdfile=dupli.rcv
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
3DUDPHWHUIUGLHQHXH6WDQGE\'DWDEDVHDXIGHU3ULPDU\VHW]HQ
connect sys/oracle@prima as sysdba
alter system set log_archive_dest_3=’service=logst
valid_for=(online_logfiles, primary_role) db_unique_name=logst’;
alter system set undo_retention=3600;
6WDQGE\'LFWLRQDU\DQOHJHQ
execute dbms_logstdby.build
1XQZLUGGLH3K\VLFDO6WDQGE\'DWDEDVHLQHLQH/RJLFDO6WDQGE\'DWDEDVH
YHUZDQGHOW
connect sys/oracle@logst as sysdba
alter database recover to logical standby logst;
shutdown immediate
startup mount
alter database open resetlogs;
alter database start logical standby apply;
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
/RJLFDO6WDQGE\LQGLH%URNHU.RQILJXUDWLRQDXIQHKPHQ
connect sys/oracle@logst as sysdba
alter system set dg_broker_start=true;
dgmgrl>connect sys/oracle@prima
show configuration verbose;
add database logst as
connect identifier is logst
maintained as logical;
enable database logst;
show configuration verbose;
0D[LPXP3URWHFWLRQPLW/RJLFDO6WDQGE\'DWDEDVH
'LHKLHU]XHUIRUGHUOLFKHQ6WDQGE\/RJILOHVPVVHQZLH]XYRUEHLGHU3K\VLFDO
6WDQGE\'DWDEDVH]XQlFKVWDQJHOHJWZHUGHQ$QVFKOLH‰HQG
edit database prima set property LogXptMode=SYNC;
edit database physt set property LogXptMode=SYNC;
edit database logst set property LogXptMode=SYNC;
edit configuration set protection mode as maxprotection;
show configuration verbose;
6ZLWFKRYHUXQG)DLORYHU
6ZLWFKRYHU'HU5ROOHQWDXVFK]Z3ULPDU\XQG6WDQGE\
dgmgrl>connect sys/oracle@SULPD
switchover to physt;
)DLORYHU'HU(UQVWIDOOLVWHLQJHWUHWHQ3ULPDU\LVWNDSXWW
dgmgrl>connect sys/oracle@SK\VW
failover to physt;
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
)ODVKEDFN'DWDEDVH
)ODVKEDFNIUDOOH'DWHQEDQNHQHUP|JOLFKHQ
connect sys/oracle@prima as sysdba
@$HOME/skripte/flashbackon;
3K\VLFDO6WDQGE\)ODVKEDFNDXVIKUHQ
recover managed standby database cancel;
flashback database to timestamp
to_timestamp(’2005-10-20:16:30:00’,’yyyy-mm-dd:hh24:mi:ss’);
3K\VLFDO6WDQGE\5HDG2QO\|IIQHQ
alter database open read only;
select ...;
shutdown immediate
startup mount
recover managed standby database [using current logfile]
disconnect;
1DFK)DLORYHUDOWH3ULPDU\]XU6WDQGE\'DWDEDVHPDFKHQ
NewPrimary > select standby_became_primary_scn from v$database;
OldPrimary
OldPrimary
OldPrimary
OldPrimary
>
>
>
>
flashback database to scn <s.o.>;
alter database convert to physical standby;
shutdown immediate
startup mount
DGMGRL> reinstate database OldPrimary;
!"#
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
6WDQGE\5HDG:ULWH|IIQHQIODVKEDFN
Standby > recover managed standby database cancel;
Standby > create restore point stehbei guarantee flashback database;
Primary > alter system archive log current;
Primary > alter system set log_archive_dest_state_2=defer;
Standby > alter database set standby database to maximize performance;
Standby > alter database activate standby database;
Standby > alter database open;
... Beliebige Tests mit der jetzt Read Write geöffneten Datenbank ...
Standby
Standby
Standby
Standby
>
>
>
>
startup mount force;
flashback database to restore point stehbei;
alter database convert to physical standby;
startup mount force;
)DVW6WDUW)DLORYHU
%URNHU.RQILJXUDWLRQDQSDVVHQ
EDIT DATABASE prima SET PROPERTY FastStartFailoverTarget = physt;
EDIT DATABASE physt SET PROPERTY FastStartFailoverTarget = prima;
EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 20;
ENABLE FAST_START FAILOVER;
2EVHUYHUDXIDQGHUHP5HFKQHUVWDUWHQ
START OBSERVER;
$
!"#
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
$QKDQJ
9$/,'B)25.RQILJXUDWLRQHQ
3ULPDU\XQG3K\VLFDO6WDQGE\
%'&
()'*,+ -),./(*0
1.!24365
%,&
798
(),*'+ -)'./(*0=19.!2636?$@/A
LOG_ARCHIVE_CONFIG=
’DG_CONFIG=(prima,physt)’
LOG_ARCHIVE_DEST_1=
’LOCATION=/home/oracle/prima/archive/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=prima’
LOG_ARCHIVE_DEST_2=
:
LOG_ARCHIVE_CONFIG=
’DG_CONFIG=(prima,physt)’
LOG_ARCHIVE_DEST_1=
’LOCATION=/home/oracle/physt/archive/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=physt’
LOG_ARCHIVE_DEST_2=
798
:
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=physt’
STANDBY_ARCHIVE_DEST=/home/oracle/prima/archive/
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=prima’
STANDBY_ARCHIVE_DEST=/home/oracle/physt/archive/
.;!<=+ >
.!2636?$@$A
.;!<=+ >
.!26345
3ULPDU\XQG/RJLFDO6WDQGE\
%'&
()'*,+ -),./(*0
1.!24365
%'&
798
()'*,+ -),./(*0
1.!24B
4C A
LOG_ARCHIVE_CONFIG=
’DG_CONFIG=(prima,logst)’
LOG_ARCHIVE_DEST_1=
’LOCATION=/home/oracle/prima/archive1/
VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=prima’
LOG_ARCHIVE_DEST_2=
’LOCATION=/home/oracle/prima/archive2
VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=prima’
LOG_ARCHIVE_DEST_3=
6C :
LOG_ARCHIVE_CONFIG=
’DG_CONFIG=(prima,logst)’
LOG_ARCHIVE_DEST_1=
’LOCATION=/home/oracle/logst/archive1/
VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=logst’
LOG_ARCHIVE_DEST_2=
’LOCATION=/home/oracle/logst/archive2/
VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=logst’
LOG_ARCHIVE_DEST_3=
798
:
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=logst’
STANDBY_ARCHIVE_DEST=/home/oracle/prima/archive2
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=prima’
STANDBY_ARCHIVE_DEST=/home/oracle/logst/archive2
.;!<=+ >
.!26B
A
.;<=+ >
.!26365
%'&
3ULPDU\3K\VLFDO6WDQGE\XQG/RJLFDO6WDQGE\
()'*,+ -),./(*0
1.!24365
%,&
798
(),*,+ -),./(*0
1.!2636?/@$A
%,&
(),*'+ -)'./(*0
1.!26B
6C A
LOG_ARCHIVE_CONFIG=
’DG_CONFIG=(prima,physt, logst)’
LOG_ARCHIVE_DEST_1=
’LOCATION=/home/oracle/prima/archive/
VALID_FOR=
(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=prima’
LOG_ARCHIVE_DEST_2=
:
LOG_ARCHIVE_CONFIG=
'
DG_CONFIG=(prima,physt, logst)'
LOG_ARCHIVE_DEST_1=
'
LOCATION=/home/oracle/physt/archive/
VALID_FOR=
(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=physt'
LOG_ARCHIVE_DEST_2=
798
:
VALID_FOR=
(ONLINE_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=logst'
LOG_ARCHIVE_DEST_2=
679 8$J 6C 8
: DE
E
VALID_FOR=
(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=physt’
LOG_ARCHIVE_DEST_3=
6C :
VALID_FOR=
(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=prima'
LOG_ARCHIVE_DEST_3=
6C :
VALID_FOR=
(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=logst'
STANDBY_ARCHVE_DEST=
’/home/oracle/logst/archive2’
VALID_FOR=
(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=logst’
STANDBY_ARCHIVE_DEST=
’/home/oracle/prima/archive’
VALID_FOR=
(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=logst’
STANDBY_ARCHIVE_DEST=
’/home/oracle/physt/archive’
.;!<=+ >
.!2636?$@$A
.;!<=+ >
.!26B
A
!"#
.;<=+ >
.!24365
.;<=+ >
.!24B
A
LOG_ARCHIVE_CONFIG=
'
DG_CONFIG=(prima,physt, logst)'
LOG_ARCHIVE_DEST_1=
679 8$J 4C 8 J
: DE
E
/6
>0,F+ *G2$HI?
H 5
B HB
A H 5 ?
>0,F+ *G2$HI?
H 5
B HB
J /
A H 5 ?
H
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
H
LQLWSULPDRUD
compatible=10.2.0
db_block_size=8192
db_name=’prima’
db_unique_name=’prima’
instance_name=’prima’
control_files=’/home/oracle/prima/control01.ctl’
sga_target=180m
pga_aggregate_target=20m
undo_management=auto
undo_tablespace=undotbs1
log_archive_config=’dg_config=(prima,physt,logst)’
log_archive_dest_1=’location=/home/oracle/prima/archive
valid_for=(all_logfiles,all_roles) db_unique_name=prima’
standby_archive_dest=’/home/oracle/prima/archive/’
standby_file_management=auto
processes=100
db_recovery_file_dest=’’
db_domain=’’
background_dump_dest=/home/oracle/prima/bdump
core_dump_dest=/home/oracle/prima/cdump
user_dump_dest=/home/oracle/prima/udump
remote_login_passwordfile=exclusive
LQLWSK\VWRUD
compatible=10.2.0
db_block_size=8192
db_name=’prima’
db_unique_name=’physt’
instance_name=’physt’
control_files=’/home/oracle/physt/control01.ctl’
sga_target=180m
pga_aggregate_target=20m
undo_management=auto
undo_tablespace=undotbs1
db_file_name_convert=’/home/oracle/prima’,’/home/oracle/physt’
log_file_name_convert=’/home/oracle/prima’,’/home/oracle/physt’
log_archive_config=’dg_config=(prima,physt,logst)’
log_archive_dest_1=’location=/home/oracle/physt/archive
valid_for=(all_logfiles,all_roles) db_unique_name=physt’
standby_archive_dest=’/home/oracle/physt/archive/’
standby_file_management=auto
processes=100
db_recovery_file_dest=’’
db_domain=’’
background_dump_dest=/home/oracle/physt/bdump
core_dump_dest=/home/oracle/physt/cdump
user_dump_dest=/home/oracle/physt/udump
remote_login_passwordfile=exclusive
!"#
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
LQLWORJVWRUD
compatible=10.2.0
db_block_size=8192
db_name=’prima’
db_unique_name=’logst’
instance_name=’logst’
control_files=’/home/oracle/logst/control01.ctl’
sga_target=180m
pga_aggregate_target=20m
undo_management=auto
undo_tablespace=undotbs1
undo_retention=3600
db_file_name_convert=’/home/oracle/prima’,’/home/oracle/logst’
log_file_name_convert=’/home/oracle/prima’,’/home/oracle/logst’
log_archive_config=’dg_config=(prima,physt,logst)’
log_archive_dest_1=’location=/home/oracle/logst/archive1
valid_for=(online_logfiles,all_roles) db_unique_name=logst’
log_archive_dest_2=’location=/home/oracle/logst/archive2
valid_for=(standby_logfiles,standby_role) db_unique_name=logst’
standby_archive_dest=’/home/oracle/logst/archive2/’
standby_file_management=auto
processes=100
db_recovery_file_dest=’’
db_domain=’’
background_dump_dest=/home/oracle/logst/bdump
core_dump_dest=/home/oracle/logst/cdump
user_dump_dest=/home/oracle/logst/udump
remote_login_passwordfile=exclusive
SK\VWVK
mkdir /home/oracle/physt
mkdir /home/oracle/physt/bdump
mkdir /home/oracle/physt/cdump
mkdir /home/oracle/physt/udump
mkdir /home/oracle/physt/archive
mkdir /home/oracle/physt/flashback
export ORACLE_SID=physt
rm /u01/app/oracle/product/10.2.0/db_1/dbs/orapwphyst
orapwd file=/u01/app/oracle/product/10.2.0/db_1/dbs/orapwphyst
password=oracle
sqlplus /nolog @phystcp.sql
SK\VWFSVTO
connect sys/oracle@prima as sysdba
startup force;
shutdown immediate;
host echo "Datendateien kopieren..."
host cp /home/oracle/prima/*.dbf /home/oracle/physt
startup
exit
K !"#
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
ORJVWVK
mkdir /home/oracle/logst
mkdir /home/oracle/logst/bdump
mkdir /home/oracle/logst/cdump
mkdir /home/oracle/logst/udump
mkdir /home/oracle/logst/archive
export ORACLE_SID=logst
rm /u01/app/oracle/product/10.2.0/db_1/dbs/orapwlogst
orapwd file=/u01/app/oracle/product/10.2.0/db_1/dbs/orapwlogst
password=oracle
GXSOLUFY
connect target sys/oracle@prima
configure channel device type disk format ’/home/oracle/backup/%U’;
backup database;
backup current controlfile for standby;
connect auxiliary sys/oracle@logst
duplicate target database for standby;
IODVKEDFNRQVTO
connect sys/oracle@prima as sysdba
alter system set db_recovery_file_dest_size=5g;
alter system set db_recovery_file_dest=’/home/oracle/prima/flashback’;
shutdown immediate
startup mount
alter database flashback on;
alter database open;
connect sys/oracle@logst as sysdba
alter system set db_recovery_file_dest_size=5g;
alter system set db_recovery_file_dest=’/home/oracle/logst/flashback’;
alter database stop logical standby apply;
shutdown immediate
startup mount
alter database flashback on;
alter database open;
alter database start logical standby apply immediate;
connect sys/oracle@physt as sysdba
alter system set db_recovery_file_dest_size=5g;
alter system set db_recovery_file_dest=’/home/oracle/physt/flashback’;
recover managed standby database cancel;
alter database flashback on;
recover managed standby database using current logfile disconnect;
!"#
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
OLVWHQHURUD
#Der HOST edd2r7p15 muss durch den jeweiligen Rechnernamen ersetzt werden
#GLOBAL_DBNAME=prima_DGMGRL ist erforderlich fuer den Data Guard Broker
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edd2r7p15)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = prima_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = prima)
)
(SID_DESC =
(GLOBAL_DBNAME = physt_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = physt)
)
(SID_DESC =
(GLOBAL_DBNAME = logst_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = logst)
)
)
!"#
ORACLE 10g Data Guard auf der Kommandozeile - Uwe Hesse (ORACLE University)
Herunterladen