Tuesday, October 18, 2011

Backup and recovery concepts

RMAN environment


The RMAN environment consist of following components:

Required components:
  • RMAN client : The client application that manages the backup and recovery of target database.
  • target database: A database that RMAN backs up and restores

Optional components:

  • recovery catalogy database:
  • recovery catalog schema
  • physical standby database
  • duplicate database: a copy of the primary database that you can use for testing purposes
  • fast recovery area:
  • media manager:
  • media mangement catalog


RMAN channels


The RMAN client itself does not perform backup, restore or recovery opertations. When you connect the RMAN client to a target database, RMAN allocates server sessions on the target instance and directs them to perfom the operations.

The RMAN channel corresponds to a one database server session. It represents one stream of data to a device.

A channel establishes a connection from the RMAN client to a target or auxiallary database instance by starting a server session on the instance.

The RMAN supported device types are disk and SBT (system backup to tape). An SBT device is controlled by third party media manager.


The RMAN channels can be allocated either automatically or manually .

You can enable automatic channel allocation by using configure_channel command. . When you run a command that can use automatic channels, RMAN automatically allocates the channels with the options you specified in configure_channel command. RMAN determines the names for the automatic channels. RMAN comes preconfigured with DISK channel that you can use for backups to disk.

You can manually allocate channels as well. You give user defined names to manually created channels.

The number of channels available for use with a device determines whether RMAN reads from or write to this device in parallel or not. In parallelism, the back up of the file is performed by more than one channel. Each channel may back up more than one file but unless a multisection backup is performed, no file is backed up by more than one channel.

RMAN Backup Options


You can backup your database using "BACKUP" command. RMAN determines backup options based on RMAN environment and RMAN defaults.

This table summarizes the RMAN options and their default values:

Backup Option Default Value All possible values Example Note
Device type Value set in CONFIGURE_DEFAULT_DEVICE_TYPE Device type can be disk or SBT BACKUP Database
device type disk
(or) device type SBT

Backup type By default , RMAN creates backup sets Backup type can be backupset or image copy Backup as copy
(or) backup as backupset

File Format

format "/disk1/backup_%U" (file location)
(or) format 'tdgroup' (ASM group)

































Overview of RMAN backups

When you issue BACKUP command the following files are backed up:

  • Datafiles and control files
  • Server parameter files
  • Archived redo logs
  • RMAN backups
Network configuration files, password files , contents of Oracle home are not backed up with RMAN.

The backups created can either be consistent or in-consistent.

The entire database can be backup ed with "backup database" command. The database should either be mounted or open for backup to succeed.

Backing up tablespaces and datafiles:


If you want to backup only certain tablespaces or datafiles, you can issue BACKUP TABLESPACES or BACKUP DATAFILES command. When you specify tablespaces, RMAN translates the tablespace name internally into a list of datafiles.

RMAN automatically backs up control file and server parameter file when datafile 1 is included in the backup. If the control file autobackup is enabled , then RMAN writes the current control file and server parameter file to a seperate autobackup piece.

Backing up control files :

If the configure controlfile autobackup is set to ON, RMAN automatically backs up the control file and server parameter file after every backup and after database structural changes. The control file autobackup contains metadata about the previous backup, which is crucial for disaster recovery.

You can take manual backup of control file by

Running backup current controlfile command
Include a backup of control file within any backup by using include current controlfile option of the backup command
Backup datafile 1 (as it automoatically includes backup of control file and sp file)


Manual backup of control file is not the same as autobackup. Autoback contains metadata about the backup that just completed. Also, RMAN can automatically restore autobackups without the user of recovery catalog

Overview of Incremental backups


An incremental backup copies only datafile blocks that have changed since a specified previous backup.

An incremental backup is of two types:
  • Cumulative incremental backup
    • Backs up all blocks changed after the most recent incremental backup at level 0
  • Differential incremental backup
    • Backs up all blocks changes after the most recent incremental backup at level 1 or level 0
    • By default incremental backups are differntial.
  •  
    The contents of full backup and backup increment level 0 are the same. However, a full backup cannot be used as part of incremental strategy. Level 0 incremental backup is the basis of incremental strategy.

    A good rule of thump is to take new level 0 backup whenever 20% or more of the data has changed.

    In a data guard environment, you can offload incremental backups to a physical standby database. Incremental backups of a standby and primary database are interchangeable.

    To make differential incremental backup

    backup
    incremental level 0
    database ;

    To make cumulative incremental backup

    backup
    incremental level 1 cumulative
    database;

    To make incremental backups in the fast recovery area:
    backup
    incremental level 1
    from scn <look this up>



    Archival backups:


    You can use BACKUP ....KEEP to creat a backup that is both all-inclusive and exempt from the backup retention policy. The KEEP options also specifies that the backup should be exempt from the retention policy either forever or for a specified period of time (KEEP UNTIL TIME '01-JAN-08'.

    The characteristics of BACKUP ....KEEP command are as under:
    • It automatically backs up datafiles, control file (even if control file autobackup is disabled) and server parameter file.
    • It automatically generates an archived redo log backip to ensure that the database backup can be recovered to a consistent state.


    An Overview of Data Recovery Manager

    Data recovery manager is a tool to help reduce MTTS (Mean time to recover). The GUI of DRA is available in database control and grid control by selecting Perform Recovery in Availability tab. DRA has following commands:
    • LIST FAILURE
    • ADVISE FAILURE
    • REPAIR FAILURE
    • CHANGE FAILURE

    Advise failure comand is used to view repair options which typically include both automated and manual options. Repair failure command is used to repair the failure automatically. Once the failure is repaired, Repair failure command closes the relevant repaired failure. If you chose to repair failure manually, you should use change failure command to change the status of an open failure to closed. Change failure command is used to alter the status and priority of failure. You can change the status of the failure to closed or to priority high or priority low. You cannot set the status to open nor can you set the priority to critical with change failure command.


    To list all failures:
    • rman > list failure
    To list details of a particular failure
    • rman > list failure <failure id > detail
    List a subset of failure
    • rman > list failure low ( low is the failure priority; high and critical are the other two failure priority values)
    • rman > list failure close
    • rman > list failure exclude failure <failure id>
    To determine repair options for a subset of failure
    • rman > advice failure <failure id>
    To see what will be repaired if repair failure command is invoked
    • rman > repair failure preview

    Monday, October 10, 2011

    ILOM basics

    • Reset the server (poweroff and power on the server) 
      • reset /SYS
    • Start the console
    -> start /SP/console
    Are you sure you want to start /SP/console (y/n)? y
    Serial console is in use.

    -> stop /SP/console
    Are you sure you want to stop /SP/console (y/n)? y

    -> start /SP/console
    Are you sure you want to start /SP/console (y/n)? y

    Serial console started.  To stop, type ESC (


    • Log on to console
    telnet <hostts-m2> <portnum>




    When you start /sp/console, you get one of the following prompt.
    The prompt displayed on the terminal or shell tool tells you which channel you are accessing:
    • The # or % prompt indicates that you are at the system console and that the Solaris OS is running.
    • The ok prompt indicates that you are at the system console and that the server is running under OpenBoot firmware control.
    • The -> prompt indicates that you are at the service processor.
    • Additional Info:
    Command Cheat sheet:
    http://thegeekdiary.com/most-commonly-used-ilom-commands-cheat-sheet/

    http://www.fatmin.com/2008/04/sun-5220-consol.html

    http://blogs.oracle.com/merwick/entry/switching_between_alom_and_ilom

    Monday, October 3, 2011

    Naming Services essential

    • The naming and Directory services provided by Solaris are as under:
      • DNS 
      • NIS
      • LDAP
      • /etc files
      •  
      •  Modern network  uses two or more of these services in combination. When more than one service is used, the services are co-ordinated by nsswitch.conf file
      • Typically, NIS clients are configured with the nsswitch.conf file to use only NIS for machine name and address lookups. If this type of lookup fails, an NIS server can forward these lookups to DNS.ypcat, ypwhich and ypmatch commands are used for retrieving NIS maps
         
    • Solaris 10 Operating system ships with BIND 9.X DNS name server.
    • DNS service FMRL is svc:/network/dns/server:<instance> and svc:network/dns/client:<instance>
      • # svcs \*dns\*
        • STATE          STIME    FMRI
        • disabled       Sep_27   svc:/network/dns/server:default
        • online         Sep_27   svc:/network/dns/client:default
        • online         Sep_27   svc:/network/dns/multicast:default
    • The BIND 9.x configuration file in Solaris is : /etc/rndc.conf.
    • There are two extensions to DNS protocol. They are multicast DNS (mDNS) and DNS service discovery (DNS-SD)
      • mDNS extends the Domain Name service to operate over link-local multicast. Both Multicast DNS and Servic e Discovery are installed by default when installing the Solaris OS. In addition to being installed, mDNS must be enabled and must be included in /etc/nsswitch.conf
      • To enable mDNS, add mdns to hosts and ipnodes of /etc/nsswtich.conf (refer to /etc/nsswitch.dns for example)
      • The log file for mDNS can be found under /var/svc/log/network-dns-multicast:default.log
    • You can use dns-sd command as network diagnosis tool to browse and discover services.
    • To find out more about how DNS client resolver work in Solaris:
    • To  setup DNS server in Solaris
      • http://wikis.sun.com/display/tma/DNS+on+Solaris+11