Minggu, 12 Juli 2020

ORACLE-restore offline backup

Restore dari off line backup

Restore dari hasil offline backup adalah sangat sederhana, sesederhana backup-nya. Lihat offline backup di sini http://rohmad.net/…/off-line-backup-database-oracle/
Berikut ini step-step restore dengan memakai instance yang sama.
  1. Siapkan file-file yang akan direstore
    File-file tersebut adalah control, log, data, dan temp file
  2. Pastikan instance sudah mati
    SQL> shutdown immediate;
  3. Restore file-file backup ke directory asalnya
    $ cp /backup/ts/control01.ctl /oradata/ts/control01.ctl
    $ cp /backup/ts/control02.ctl /oradata/ts/control02.ctl
    $ cp /backup/ts/control03.ctl /oradata/ts/control03.ctl
    $ cp /backup/ts/redo04.log /oradata/ts/redo04.log
    $ cp /backup/ts/redo05.log /oradata/ts/redo05.log
    $ cp /backup/ts/redo06.log /oradata/ts/redo06.log
    $ cp /backup/ts/sysaux01.dbf /oradata/ts/sysaux01.dbf
    $ cp /backup/ts/system01.dbf /oradata/ts/system01.dbf
    $ cp /backup/ts/temp01.dbf /oradata/ts/temp01.dbf
    $ cp /backup/ts/undotbs01.dbf /oradata/ts/undotbs01.dbf
    $ cp /backup/ts/users01.dbf /oradata/ts/users01.dbf
  4. Nyalakan databaseSQL> startup;
Jika karena suatu hal, kita tidak bisa merestore ke direktori asalnya, maka kita bisa merestore ke tempat (direktori) lain. Step 1 dan 2 masih seperti yang di atas. Step 3 dan seterusnya adalah berikut ini:
  1. Restore ke directory baru
    Control file
    $ cp /backup/ts/control01.ctl /newdir/ts/control01.ctl
    $ cp /backup/ts/control02.ctl /newdir/ts/control02.ctl
    $ cp /backup/ts/control03.ctl /newdir/ts/control03.ctl
    Log file
    $ cp /backup/ts/redo04.log /newdir/ts/redo04.log
    $ cp /backup/ts/redo05.log /newdir/ts/redo05.log
    $ cp /backup/ts/redo06.log /newdir/ts/redo06.log
    Data file
    $ cp /backup/ts/sysaux01.dbf /newdir/ts/sysaux01.dbf
    $ cp /backup/ts/system01.dbf /newdir/ts/system01.dbf
    $ cp /backup/ts/undotbs01.dbf /newdir/ts/undotbs01.dbf
    $ cp /backup/ts/users01.dbf /newdir/ts/users01.dbf
    Temp file
    $ cp /backup/ts/temp01.dbf /newdir/ts/temp01.dbf
  2. Ubah konfigurasi control file. Edit init (instance parameter) file.
    Filenya di $ORACLE_HOME/dbs/init[NAMAINSTANCE].ora
    Ganti lokasi control file dari yang lama ke yang baru.
    Value yang lama:
    control_files='/oradata/ts/control01.ctl', '/oradata/ts/control02.ctl','/oradata/ts/control03.ctl'Value yang baru:
    control_files='/newdir/ts/control01.ctl', '/newdir/ts/control02.ctl','/newdir/ts/control03.ctl'
  3. Ubah konfigurasi file yang lainnya (log, data, dan temp file)
    SQL> startup mountSQL> alter database rename file '/oradata/ts/redo04.log' to '/newdir/ts/redo04.log';
    SQL> alter database rename file '/oradata/ts/sysaux01.dbf' to '/newdir/ts/sysaux01.dbf';
    SQL> alter database rename file '/oradata/ts/temp01.dbf' to '/newdir/ts/temp01.dbf';
    dan seterusnya ...
  4. Open database
    SQL> alter database open;
Error yang terkait
  1. Jika control file tidak ada, atau ada tapi direktorinya berubah dan init file belum diedit
    SQL> startup
    ORACLE instance started.
    Total System Global Area 1610612736 bytes
    Fixed Size 2177912 bytes
    Variable Size 396149896 bytes
    Database Buffers 1207959552 bytes
    Redo Buffers 4325376 bytes
    ORA-00205: error in identifying control file, check alert log for more info
  2. Jika ada data file yang kelewatan, atau ada tapi direktorinya berubah dan belum di-alter/rename
    SQL> startup
    ORACLE instance started.
    Total System Global Area 1610612736 bytes
    Fixed Size 2177912 bytes
    Variable Size 396149896 bytes
    Database Buffers 1207959552 bytes
    Redo Buffers 4325376 bytes
    Database mounted.
    ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
    ORA-01110: data file 4: '/oradata/ts/users01.dbf'

Tidak ada komentar:

Posting Komentar