LOCAL ARCHIVE WITH NFS

 

In this post, I will demonstrate the use of NFS to perform recovery when archivelogs are stored locally by each instance .

In a cluster database we can store archivelogs on
– shared location e.g. ASM OR
– local archive log destination for each instance

If archivelogs are locally stored and an instance is trying to perform recovery, it will need logs from all the instances. Hence, it is recommended that local archive log destinations be created for each instance with NFS-read mount points to all other instances. This is known as the local archive with network file system (NFS) scheme. During recovery, one instance may access the logs from any host without having to first copy them to the local destination.

– OVERVIEW –

– Enable local archiving on each of 3 nodes in the cluster
– Take example tablespace offline in immediate mode so that it will need recovery when it is brought online.
– Trigger a manual checkpoint.
– Switch logs on all the 3 nodes to generate archivelogs
– Try to bring the example tablespace online – will fail as it needs media recovery
– Try to recover example tablespace – fails as archivelogs from other instance are inaccessible.
– Mount the archivelogs from other nodes using NFS
– Try to recover example tablespace – succeeds as archivelogs from other instance are accessible.
– Try to bring the example tablespace online – will succeed as it has been recovered.

– IMPLEMENTATION –

– create folders to store archived logs on 3 nodes –

host01$mkdir /home/oracle/archive1
host02$mkdir /home/oracle/archive2
host03$mkdir /home/oracle/archive3

— Login to the database from any of the existing nodes (host01, host02). Say host01
– set the archive log destinations of three instances  to the folders created above.

SQL>set sqlprompt ORCL1>

ORCL1>sho parmeter db_recovery

      alter system set log_archive_dest_1 = ‘location=/home/oracle/archive1′ scope=both    sid=’orcl1′;
      alter system set log_archive_dest_1 = ‘location=/home/oracle/archive2′ scope=both      sid=’orcl2′;
      alter system set log_archive_dest_1 = ‘location=/home/oracle/archive3′ scope=both     sid=’orcl3′;

ORCL1>archive log list;

– Put the database in archivelog mode if not already

host01$srvctl stop database -d orcl
                srvctl start instance -d orcl -i orcl1 -o mount

ORCL1>alter database archivelog;
      archive log list;
      shu immediate;

host01$srvctl start database -d orcl
                  srvctl status database -d orcl

— On node1 , switch logs and verify that archive logs are generated in specified location –

ORCL1>archive log list;
      alter system switch logfile;
      /
      /
      select name from v$archived_log;


      ho ls /home/oracle/archive1/

— On node2 , switch logs and verify that archive logs are generated in specified location –

SQL>set sqlprompt ORCL2>


ORCL2>archive log list;
      alter system switch logfile;
      /
      /
      select name from v$archived_log;


      ho ls /home/oracle/archive2/

— On node3, switch logs and verify that archive logs are generated in specified location –

SQL>set sqlprompt ORCL3>

ORCL3>archive log list;
      alter system switch logfile;
      /
      /
      select name from v$archived_log;

      ho ls /home/oracle/archive3/

– Take example tablespace offline immediate
–  Trigger a checkpoint
—   Switch logs on all the 3 instances

ORCL1>alter tablespace example offline immediate;
      alter system checkpoint;
      alter system switch logfile;
      /
      /
      select name from v$archived_log;

      ho ls /home/oracle/archive1/

ORCL2>alter system switch logfile;
      /
      /

      select name from v$archived_log;

      ho ls /home/oracle/archive2/

ORCL2>alter system switch logfile;
      /
      /
      select name from v$archived_log;

      ho ls /home/oracle/archive3/

– Try to bring example tablespace online – Needs media recovery

ORCL1>alter tablespace example online;

– Try to recover example tablespace from node1 – fails as local archived logs from node2 and node3 are not accessible;

host01RMAN>recover tablespace example;

– Make the folders containing archived logs on node2 and node3 sharable and start portmap and nfs service

— node2 —
– Add following line to /etc/exports

/home/oracle/archive2 *(rw,sync)

host02#service portmap restart
       service nfs restart

— node3 —
– Add following line to /etc/exports

/home/oracle/archive3 *(rw,sync)

– start portmap and nfs service on node2

host02#service portmap restart
                 service nfs restart

– on node1, create folders where archivelog folders from node2 and node3 will be mounted

host01$mkdir /home/oracle/archive2
                 mkdir /home/oracle/archive3

– As root user on node1,
   – start portmap and nfs service
   – Mount the archive folders on node2 and node3

host01#service portmap restart
                  service nfs restart

host01#mount host02:/home/oracle/archive2 /home/oracle/archive2
                 mount host03:/home/oracle/archive2 /home/oracle/archive3

– check that archivelogs on node2 and node3 are accessible on node1 –

host01$ls /home/oracle/archive2
host01$ls /home/oracle/archive3

– Try to recover example tablespace from node1 – succeeds as local archived logs from node2 and node3 are accessible;

host01RMAN>recover tablespace example;

ORCL1>alter tablespace example online;

——————————————————————————————-
Related links:
HOME

11g R2 RAC : Add Instance Manually
11g R2 RAC : Autolocate Backups
11g  R2 RAC : Clone Database Home
11g  R2 RAC : NIC Bonding

 

————

Your comments and suggestions are welcome!