Hallo DBA’s,
hier hatte ich mich schon mal zum kopieren von Oracle DB’s verlustiert. Allerdings setzt diese Art des Kopierens vorraus, das die Quelle herunter gefahren werden muss (cold copy). Das ist natürlich weder immer möglich, noch nötig. Also skizziere ich diesmal das Vervielfältigen mittles RMAN duplicate database.
Man kann die Quell DB (target) zum aktuellen Stand kopieren, oder auch mit Hilfe des Backups auf ältere Stände (“until time”) zurückgreifen. Das Beispiel hier setzt TSM/TDPO vorraus.
Vorraussetzungen:
- orapwd muss für neue DB (auxiliary) vorhanden sein
- ein pfile für die auxiliary brauchen wir auch
- für target (Quelle) und auxiliary (Kopie) muss ein Listener konfiguriert sein und laufen
- für beide müssen jeweils tnsnames Einträge vorhanden sein
Die DB’s können sowohl lokal auf der selben Maschine, als auch auf verschiedenen Systemen laufen.
Ein Beispiel PFILE mit konvertierten File Locations:
ora11@dwptcae1> less initDUPLICATEDB.ora
# init only for the function duplicate database
# Minimum Requirement!
DB_NAME=WSSD600B
control_files=’/oradata/WSSD600B/control01.ctl’,'/oradata/WSSD600B/control02.ctl
‘
# Convert file names to allow for different directory structure.
DB_FILE_NAME_CONVERT=(/opt/oracle/oradata/WSSP600/,/oradata/WSSD600B/)
LOG_FILE_NAME_CONVERT=(/opt/oracle/oradata/WSSP600/,/oradata/WSSD600B/)
# make sure block_size and compatible parameters
# match if you are not using the default.
DB_BLOCK_SIZE=8192
remote_login_passwordfile = exclusive
compatible=’11.1.0.0′
Die auxiliary DB heisst hier WSSD600B und die target DB WSSP600. Für “active database” auszuführen auf der auxiliary Seite mit entsprechendem Environment:
sqlplus “/ as sysdba”
SQL>startup nomount pfile=’/opt/oracle/dbs/initDUPLICATEDB.ora’;
rman
RMAN>connect target sys@WSSP600
RMAN>connect auxiliary sys@WSSD600B
RMAN>duplicate target database to WSSD600A from active database
Hier dann das Vorgehen bei “until time” mit TSM/TDPO. Dabei unterscheidet sich nur der RMAN Teil und natürlich muss TDPO konfiguriert sein (ist ne hübsche Idee für einen neuen Blogbeitrag
):
rman target sys@WSSP600 auxiliary /
RMAN> run {
allocate auxiliary channel t1 type ‘sbt_tape’ parms ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/duplicate_db.opt)’;
allocate auxiliary channel t2 type ‘sbt_tape’ parms ‘ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/duplicate_db.opt)’;
duplicate target database to WSSD600B until time “to_date(’2010-02-23 19:00:00′,’YYYY-MM-DD HH24:MI:SS’)”;
}
Wie schnell der ganze Spaß geht, hängt natürlich von der Größe der DB und auch von den Netz- und Backup- Laufzeiten ab.
Viele Grüße
Michael