Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Friday, 25 January 2013

Plan A: Renovate old Apps Server Hardware

If our goal is to perform a Test run of our disaster recovery procedures, or to permanently move a database to a new host, then we can use the Restore & Recovery Procedure.
If we use Restore & Recovery procedure, then the DBID for the restored database will be the same as the DBID for the original database, so after the restore & recovery procedure is completed, if we connect to the Test database and the recovery catalog DB, the recovery catalog will be updated with information about the Test DB that can interfere with RMAN's ability to restore and recover the source database (due to same DBID)
If our goal is to create a new copy of our target database for ongoing use on a new host, then use the RMAN DUPLICATE command instead of Restore & Recovery procedure. The DUPLICATE command assigns a new DBID to the database it creates and enabling it to be registered in the same recovery catalog as the original database.
Caution:
If we are performing recovery only for TEST purpose, then make sure RMAN is NOT connected to the recovery catalog, otherwise RMAN records information about resorted database in recovery catalog. Thus you are not able to Restore and recover the original database in future with this RMAN.
Scenario:
This scenario assumes that we have two networked Windows 2003 hosts, DBSERVER and DBSERVER1. A target database named SADHAN is on DBSERVER and is registered in Recovery catalog RMAN. You want to TEST the Restore & Recovery of SADHAN on DBSERVER1, while keeping database SADHAN up and running on DBSERVER. Same version of Oracle Product needs to be installed with which the RMAN Backup was taken.
Steps:
  1. Install Oracle software only with all its patched on destination folder.
  2. Taking RMAN FULL hotbackup including Datafile, Controlfile, Archivelog and Spfile backup.
  3. Copy the backup on other host on the same location as per the DBserver.
  4. Create PFILE from current server and Copy the Destination server location.
  5. Testing and Validating Listener and RMAN Repository Connection.
  6. Create Oracle Service for windows on destination server.
  7. Create password file for new server database.
  8. Start the database on new host with the pfile and Restore the spfile first.
  9. Restore Controlfile
  10. Restore  and Recover the whole database
  11. Validate the Restore & Recovery procedure Correctness

Consider you have copied entire required backup and file on to the destination server and also you have configured the tnsname and listener configuration of new db and rman successfully.
5. Create oracle service for windows
C:\>oradim -new -sid SADHAN -intpwd sadhan
cmd> oradim -new -sid SADHAN -intpwd sys -startmode manual
6. Create relevant folder on destination host.
D:\oracle\admin\SADHAN\bdump, cdump, udump, pfile
D:\oracle\oradata\SADHAN
E:\oracle\Archive
7. Create password for new server database.
CMD>ORAPWD FILE=D:\oracle\ora92\database\PWDsadhan.ora PASSWORD=oracle entries=5
Now Configure the ORACLE_SID ON destination Host and try to connect RMAN without catalog.
C:\>SET ORACLE_SID = SADHAN
C:\SQLPLUS /NOLOG
SQL> CONNECT / AS SYSDBA
Connected to an idle instance.
8. Set the DBID and start the database instance using PFILE and restore the spfile.
SQL>STARTUP FORCE NOMOUNT PFILE='D:\oracle\ora92\dbs\sadhan.sql';
RMAN> CONNECT TARGET / NOCATALOG
RMAN:\>SET DBID 63198018;
RMAN> RESTORE SPFILE FROM AUTOBACKUP;
-or- optional method
RMAN> RESTORE spfile from "H:\oraback\C-1103102985-20100216-02";
RMAN> restore controlfile from "H:\ORABACK\C-1103102985-20100216-02";
You must bounce back the database to make sure spfile is restored.
RMAN> SHUTDOWN IMMEDIATE;  
RMAN> STARTUP NOMOUNT;
9. Restore the Controlfile from autobackup and then Mount the database.
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
RMAN> ALTER DATABASE MOUNT;

10. Restore and Recover the database with the full backup.
You must store the backup on the same location as on DBSERVER otherwise you have to catalog the new backup location with CATALOG START WITH 'H:\oraback' command.
RMAN> RESTORE DATABASE;  
If archive log is not available (in case of Cold Backup) change the command as:
RMAN> RECOVER DATABASE NOREDO;
Restore the database in case of hotbackup to perform media recovery.
RMAN> RECOVER DATABASE;
Note: Do not panic if recovery fail askig for current redolog files, as you have full backup, no problem just exit RMAN relogin and open the database with resetlogs option.
RMAN> ALTER DATABASE OPEN;
-OR- ALTER DATABASE OPEN RESETLOGS;
RMAN> sql 'alter database open resetlogs';

Verify the Database:
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            E:\oracle
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence           1

SQL> select name,dbid from v$database;
NAME            DBID
--------- ----------
SADHAN       63198018

Connect Identifier of Database:
Ping this connect identifier before performing actual restore and recovery process. You can validate it manually and can use Net Manager for the same. Later we can add the other database information in the tnsname.ora. This is just for security purpose not to connect any other database by mistake.
tnsname.ora:
RMAN.AL-SADHAN.COM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rmanbackup)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = RMAN)
    )
  )
SADHAN.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS =
        (PROTOCOL = TCP)
        (HOST = 192.168.14.222)
        (PORT = 1521)
      )
    )
    (CONNECT_DATA =
      (SID = sadhan)
    )
  )
Listener.ora:
# TNSNAMES.ORA Network Configuration File: D:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
SADHAN.AL-SADHAN.COM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.14.222)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = SADHAN.WORLD)
    )
  )
Sqlnet.ora:
# SQLNET.ORA Network Configuration File: D:\oracle\ora92\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DEFAULT_DOMAIN = al-sadhan.com
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)

3 comments:

  1. Looking for the Ultimate Dating Website? Join to find your perfect date.

    ReplyDelete
  2. BlueHost is the best website hosting company for any hosting plans you might require.

    ReplyDelete
  3. QUANTUM BINARY SIGNALS

    Get professional trading signals delivered to your cell phone every day.

    Follow our signals right now and gain up to 270% per day.

    ReplyDelete