piektdiena, 2017. gada 7. aprīlis

Recovery of Oracle 11 database to Windows 2012R2 server

Recovery of Oracle 11.2.0.3 database to Windows 2012R2 server from RMAN backup

This is case where original server is down and you have on hand rman backup only. Here is my plan.

  1. Install DB, HOME and FLASH recovery area exactly as they were on original server.
  2. Restore backups to FLASH RECOVERY from backup
  3. Start DB from CTL file unmounted
  4. Catalogyze bkp and log files
  5. Remove unnecesary backups
  6. Restore database
  7. Recover database until current sequence 


Write down location of Oracle home, database and flash recovery area, or get it from ORA file if your server is broken. In my case Oracle was installed on  D:\ORACLE
Create new database with the same instancename DBINSTANCENAME and in the same location as original server, where DBINSTANCENAME is Instance name of your Database.

In may case Data files located at  D:\ORACLE_DATA\ but you can have different place. I have Recovery area at E:\FLASH_RECOVERY_AREA\ so I point it during DB creation. Recovery size at least to times bigger than backup itself in my case 99000M

Unarchive and copy files to FLASH_RECOVERY_AREA from DBINSTANCENAME DB BACKUP it could be folder or tape. Add to catalog all log and bkp. files.
  RMAN> restore controlfile from "E:\FLASH_RECOVERY_AREA\DBINSTANCENAME\CONTROL02.CTL";
  Starting restore
  using target database control file instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: SID=129 device type=DISK
  channel ORA_DISK_1: copied control file copy
  output file name=D:\ORACLE_DATA\DBINSTANCENAME\CONTROL01.CTL
  output file name=E:\FLASH_RECOVERY_AREA\DBINSTANCENAME\CONTROL02.CTL
  Finished restore
  CATALOG RECOVERY AREA
  RMAN> alter database mount;
  database mounted
  released channel: ORA_DISK_1
  RMAN> restore database;
  Finished restore 
  SQL> select * from v$log;
  GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC
  ---------- ---------- ---------- ---------- ---------- ---------- ---
  STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
  ---------------- ------------- --------- ------------ ---------
       1          1     123953  104857600        512          2 YES
  INACTIVE            7995436537    7995439346 
       3          1     123955  104857600        512          2 NO
  CURRENT             7995441399    2.8147E+14
       2          1     123954  104857600        512          2 YES
  ACTIVE              7995439346    7995441399 
Check current sequence number, it is number until which DB has to be restored

TROUBLESHOOTING IN RECOVERY PROCESS

You can switch this chapter to last, if everything goes fine. Don't expect everything will go smoothly. I  kept open arcli log in another cmd window.
C:\Users\Administrator>adrci
ADRCI: Release 11.2.0.3.0 - Production 
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
ADR base = "D:\ORACLE"
adrci> set home diag\rdbms\DBINSTANCENAME\DBINSTANCENAME
adrci> show trace -tail -f
ADRCI will show you summon current logs

Delete expired log and backup files

In backup there was included archived logs, which must not be recovered, so before recovery they must be deleted. Ensure bkp files are found.
  RMAN> list expired archivelog all;
  RMAN> delete noprompt expired archivelog all;    
  RMAN> crosscheck backup    
  RMAN> delete expired backup;   
Check that only necessary log files appeared

ERRORS with UNDOTBS01.DBF file

DBINSTANCENAME database have errors in  UNDOTBS so it has to be removed. Seems to me undotbs.dbf is not restored, as soon restoration took place, Oracle waits UNDOTBS contains certain undo procedures so it has to be erased. First create another UNDOTBS, delete old one, then recreate first one.
  create undo tablespace UNDOTBS2 datafile 'D:\ORACLE_DATA\DBINSTANCENAME\UNDOTBS02.DBF' size 1008M;
  ALTER SYSTEM SET UNDO_TABLESPACE = UNDOTBS2 SCOPE = BOTH;
  DROP TABLESPACE UNDOTBS1 INCLUDING CONTENTS AND DATAFILES;
Delete file D:\ORACLE_DATA\DBINSTANCENAME\UNDOTBS01.DBF
Recreate UNDOTBS1
  create undo tablespace UNDOTBS1 datafile 'D:\ORACLE_DATA\DBINSTANCENAME\UNDOTBS01.DBF' size 1008M;
  ALTER SYSTEM SET UNDO_TABLESPACE = UNDOTBS1 SCOPE = BOTH;
  DROP TABLESPACE UNDOTBS2 INCLUDING CONTENTS AND DATAFILES;
Delete file D:\ORACLE_DATA\DBINSTANCENAME\UNDOTBS02.DBF

Errors with TEMP.DBF file

TEMP01.DBF can throw out errors as well, so it has to be recreated as well.
  SQL> create temporary tablespace temp1 tempfile 'D:\ORACLE_DATA\DBINSTANCENAME\TEMP02.DBF' size 21M autoextend on next 64M maxsize 1024M extent management local;
  Tablespace created.
  SQL> alter database default temporary tablespace temp1;
  Database altered.
  SQL> drop tablespace temp including contents and datafiles;
  Tablespace dropped.    
Delete file D:\ORACLE_DATA\DBINSTANCENAME\TEMP01.DBF
  SQL> create temporary tablespace temp tempfile 'D:\ORACLE_DATA\DBINSTANCENAME\TEMP01.DBF' size 21M autoextend on next 64M maxsize 1024M extent management local;
  Tablespace created.
  SQL> alter database default temporary tablespace temp;
  Database altered.
  SQL> drop tablespace temp1 including contents and datafiles;
  Tablespace dropped.
  

Restore database on CURRENT sequence

  RMAN> recover database until sequence 123955;
  Starting recover 
  using channel ORA_DISK_1
  starting media recovery
  media recovery complete, elapsed time: 00:00:03
  Finished recover 
  RMAN> alter database open resetlogs;
  database opened

Nav komentāru:

Ierakstīt komentāru