Thursday 24 November 2011

RMAN backup details require to restore a database

 When you have to restore a database from RMAN backup, last thing you want to do is to identify which backups, tapes and dates you need to use for database restore. There are few sql commands that can be very handy in order to extract those details.


column handle format a60
column media format a10
column tag format a20
column start_time format a20
column name format a10
set lines 200
    select d.name,    p.tag,   p.handle , p.media ,    s.incremental_level "LEVEL",
     to_char(s.start_time, 'DD-MON-YY HH24:MI') start_time,
     s.elapsed_seconds/60 "MINUTES",   p.backup_type
      from  RC_DATABASE d, RC_BACKUP_PIECE p, RC_BACKUP_SET s  
      where
        d.name='ELPM'  and
        d.db_key = p.db_key  and
        s.db_key = p.db_key     and
        p.bs_key = s.bs_key      and
       s.start_time between to_date('08-SEP-11 00:00','dd-MON-yy hh24:mi')
       and to_date('10-SEP-11 00:00','dd-MON-yy hh24:mi')
      Above script can give you backup details by providing database name and dates after connecting to RMAN repository.
      Another method is to connect to RMAN prompt using control file

      $>rman connect target / nocatalog

      RMAN> restore database preview summary;





      Changing VIP address in Oracle RAC 11g R1

      I just want to share my experience with changing ip addresses of running Oracle RAC.
      Before I go into details , let me explain my environment. This is real-life experience on a client site which was running 11G R1 ASM and CRS but databases are running on 10G R2 on Red Hat release 4 (RHEL4). So ip address changes require on CRS level.

      First of all I just go through the steps that I have taken according to the issue i was facing. Later I'll try to add other steps/command to cover as much as possible around this topic.


      This case was simple as only thing that was changed was ip address and subnet and LAN remain the same.

      1. Stop all databases on all RAC nodes by using this command
      srvctl stop database -d poem
      srvctl stop database -d poid
      srvctl stop database -d prman

      2.Stop all nodeapps on every node
      NODE 1

      srvctl stop nodeapps -n dbm1301

      NODE 2
      srvctl stop nodeapps -n dbm1401


      3. Make sure that ip addresses has been changed in dns for vip.
      ping dbm1301-vip

      checks that it return new ip address.

      4. Check that which bond this vip is using by runing ifconfig

      /sbin/ifconfig

      if it is using bond0:1 then in CRS configuration you have to specify bond0 which will create an alias of bond0:1. In my case bond0 is bonded with eth0 which is using production LAN.

      5. Run the following command just in case to enforce the new ip address

      /ora/product/11.1.0/crs/bin/srvctl modify nodeapps -n dbm1301 -A dbm1301-vip/255.255.255.0/bond0


      6. restart CRS to pick up new ip address
      crsctl stop crs

      crsctl start crs


      7. Restart listener so that it picks up new ip address too.
      srvctl stop listener -n dbm1301
      srvctl start listener -n dbm1301

      8. repeat the same steps on other node

      9. Start nodes apps and databases
      srvctl start nodeapps -n dbm1301

      srvctl start database -d poem
      srvctl start database -d prman
      srvctl start database -d poid

      10. check that all services are running
      srvctl status service -d poem
      if need to start it then use srvctl start service -d -s  

      This has changed ip address on a node which was running RAC successfully.



      Another brilliant article is here
      http://www.db-nemec.com/RAC_IP_Change.html