/*
|| Oracle 11gR2: Leveraging ACFS Snapshots and Cluster Infrastructure Listing
||
|| Contains code samples demonstrating how ASM and ACFS can be used in concert with
|| Oracle 11gR2 databases as part of the Oracle 11gR2 New Features article series.
||
|| Author: Jim Czuprynski
||
|| Usage Notes:
|| These examples are provided to demonstrate various Oracle 11gR2 ASM and ACFS
|| features, and they should be carefully proofread before being executed
|| against any existing Oracle database to avoid potential damage!
*/

/* 
|| Listing 4.1:
|| Adding Oracle database instances into Oracle 11gR2 Clusterware configuration
*/

$> srvctl add database -d orcl -o /u01/app/oracle/acfsmounts/acfs_db1 -p /u01/app/oracle/acfsmounts/acfs_db1/dbs/spfileorcl.ora -s open -t immediate -y AUTOMATIC

/*  
|| Listing 4.2:
|| Displaying ACFS File System Snapshots
*/


-----
-- Querying the ASM instance about any available ACFS snapshots
-----

SET PAGESIZE 1000
SET LINESIZE 110
TTITLE "Current ACFS Snapshots|(from V$ASM_ACFSSNAPSHOTS)"
COL fs_name		FORMAT A40	HEADING "ACFS File System" WRAP
COL vol_device	FORMAT A30	HEADING "Volume Device Name" WRAP
COL snap_name	FORMAT A15	HEADING "ACFS|Snapshot|Name" WRAP
COL create_dtm	FORMAT A11	HEADING "Snapshot|Creation|Date" WRAP
SELECT
     fs_name
    ,vol_device
    ,snap_name
    ,TO_CHAR(create_time, 'yyyy-mm-dd hh24:mi:ss') create_dtm
  FROM v$asm_acfssnapshots
 ORDER BY 1
;
TTITLE OFF
                                            Current ACFS Snapshots
                                          (from V$ASM_ACFSSNAPSHOTS)

                                                                        ACFS            Snapshot
                                                                        Snapshot        Creation
ACFS File System                         Volume Device Name             Name            Date
---------------------------------------- ------------------------------ --------------- -----------
/u01/app/oracle/acfsmounts/acfs_db1      /dev/asm/acfs_db1-152          orahome0        2010-05-09
                                                                                        17:04:00