Configuring Windows NT Disks for an ASM Instance


Figure 2.1.1 Listing Volumes Created via DISKPART.EXE commands (NT environment).


Figure 2.1.2 Using ASMTOOLG.EXE to label partitions created via DISKPART.EXE (NT environment).


Figure 2.1.3 Confirming the labels chosen before attaching them to their respective volumes.


Figure 2.1.4 Using ASMTOOLG.EXE to confirm assigned labels (NT environment).

Creating an ASM Instance Using Oracle 10g DBCA


Figure 2.2.1 Choosing Create Database Option.


Figure 2.2.2 Choosing Database Type.


Figure 2.2.3 Specifying ASM Instance service name.


Figure 2.2.4 Specifying ASM Instance management options.


Figure 2.2.5 Specifying ASM Instance credentials.


Figure 2.2.6 Specifying ASM Instance storage options.


Figure 2.2.7 Creating ASM Instance.


Figure 2.2.8 Creating ASM disk groups.


Figure 2.2.9 Selecting potential disks from candidate list (NT environment shown).


Figure 2.2.10 Confirming creation of ASM disk group.


Figure 2.3 Enterprise Manager (EM) reconfigured to permit ASM storage management.


----- 
-- Listing 2.1: Create simulated disks of 100MB each for storage of 
--              ASM disk groups and files in Red Hat Enterprise Linux 
-----

mkdir -p /u03
mkdir -p /u03/asmdisks
mkdir -p /u04
mkdir -p /u04/asmdisks

dd if=/dev/zero of=/u03/asmdisks/disk0 bs=1024k number=100
dd if=/dev/zero of=/u03/asmdisks/disk1 bs=1024k number=100
dd if=/dev/zero of=/u03/asmdisks/disk2 bs=1024k number=100
dd if=/dev/zero of=/u03/asmdisks/disk3 bs=1024k number=100

dd if=/dev/zero of=/u04/asmdisks/disk0 bs=1024k number=100
dd if=/dev/zero of=/u04/asmdisks/disk1 bs=1024k number=100
dd if=/dev/zero of=/u04/asmdisks/disk2 bs=1024k number=100
dd if=/dev/zero of=/u04/asmdisks/disk3 bs=1024k number=100

chown -R oracle:oinstall /u03
chown -R oracle:oinstall /u04
chmod -R 777 /u03
chown -R 777 /u04

----- 
-- Listing 2.2: Initialization parameter file (PFILE) for creating 
--              the example ASM instance. This file can be translated
--              into an SPFILE via the CREATE SPFILE AS PFILE; command
-----

# Standard ASM instance initialization parameters
*.asm_power_limit = 5 
*.db_unique_name = '+ASM'
*.instance_type = 'asm'
*.large_pool_size = 16M

# Background, core, and user trace file directories. These will need
# to exist before starting the instance and configured for the server's
# operating system as appropriate
*.background_dump_dest = '/u01/app/oracle/admin/+ASM/bdump'
*.core_dump_dest = '/u01/app/oracle/admin/+ASM/cdump'
*.user_dump_dest = '/u01/app/oracle/admin/+ASM/udump'

# This requires a password file for the ASM instance, needed by 
# Enterprise Manager for a connection as SYS:
REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE

# ASM candidate disk search string. It's not required, but it does help
# Oracle find the candidate disks more easily
*.asm_diskstring = '\\.\ORCLDISK*' # For Windows environment
*.asm_diskstring = '/u03/asmdisks/*', '/u04/asmdisks/*',# For Red Hat Linux environment

# ASM Mountable Disk Group(s). These can be activated after the ASM
# Instance has been created.
#asm_disk_groups='DGROUP1'




----- 
-- Listing 2.3: Issuing CREATE DISK GROUP statements to create the 
--              initial ASM Disk Group for the example ASM instance
-----

-- Create ASM disk group in NT environment
CREATE DISKGROUP dgroup1
    NORMAL REDUNDANCY
    FAILGROUP ctlr1
    DISK 
         '\\.\ORCLDISKDATA0'
        , '\\.\ORCLDISKDATA2'
    FAILGROUP ctlr2
    DISK 
         '\\.\ORCLDISKDATA1'
        ,'\\.\ORCLDISKDATA3'
;
    
-- Create ASM disk group in Linux environment
CREATE DISKGROUP dgroup1
    NORMAL REDUNDANCY
    FAILGROUP ctlr1
    DISK 
        '/u03/asmdisks/disk0'
       ,'/u04/asmdisks/disk2'
    FAILGROUP ctlr2
    DISK 
        '/u03/asmdisks/disk1'
       ,'/u04/asmdisks/disk3'
;

----- 
-- Listing 2.4: Migrating an existing tablespace to ASM storage
-----

-----
-- Create a new tablespace managed by the regular database instance
-----
SQL> CREATE TABLESPACE tbs_regular
  2      DATAFILE 'f:\oradata\orcl\orcl\tbs_regular01.dbf'
  3      SIZE 32M;

Tablespace created.

-----
-- Migrate the new tablespace to ASM storage
-----
C:\>rman nocatalog target /

Recovery Manager: Release 10.1.0.2.0 - Production

Copyright (c) 1995, 2004, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1099944437)
using target database controlfile instead of recovery catalog

RMAN> SQL "ALTER TABLESPACE tbs_regular OFFLINE";

sql statement: ALTER TABLESPACE tbs_regular OFFLINE 

RMAN> BACKUP AS COPY TABLESPACE tbs_regular FORMAT '+DGROUP1';

Starting backup at 14-DEC-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=127 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00014 name=F:\ORADATA\ORCL\ORCL\TBS_REGULAR01.DBF
output filename=+DGROUP1/orcl/datafile/tbs_regular.257.1 tag=TAG20051214T185816 recid=2 stamp=577047
501
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 14-DEC-05

RMAN> SWITCH TABLESPACE tbs_regular TO COPY;

datafile 14 switched to datafile copy "+DGROUP1/orcl/datafile/tbs_regular.257.1"

RMAN> SQL "ALTER TABLESPACE tbs_regular ONLINE";

sql statement: ALTER TABLESPACE tbs_regular ONLINE

RMAN> exit

Recovery Manager complete.

C:\>sqlplus "sys as sysdba"

SQL*Plus: Release 10.1.0.2.0 - Production on Wed Dec 14 19:00:34 2005
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> set pagesize 50
SQL> set linesize 100
SQL> col tablespace_name FORMAT A12 HEADING 'Tablespace'
SQL> col file_name FORMAT A60 HEADING 'File Name'
SQL> select tablespace_name, file_name from dba_data_files;

Tablespace   File Name
------------ ---------------------------------------------------------
USERS        F:\ORADATA\ORCL\ORCL\USERS01.DBF
SYSAUX       F:\ORADATA\ORCL\ORCL\SYSAUX01.DBF
UNDOTBS1     F:\ORADATA\ORCL\ORCL\UNDOTBS01.DBF
SYSTEM       F:\ORADATA\ORCL\ORCL\SYSTEM01.DBF
EXAMPLE      F:\ORADATA\ORCL\ORCL\EXAMPLE01.DBF
DATA1        F:\ORADATA\ORCL\ORCL\DATA1.DBF
DATA2        F:\ORADATA\ORCL\ORCL\DATA2.DBF
INDX1        F:\ORADATA\ORCL\ORCL\INDX1A.DBF
INDX1        F:\ORADATA\ORCL\ORCL\INDX1B.DBF
INDX1        F:\ORADATA\ORCL\ORCL\INDX1C.DBF
INDX2        F:\ORADATA\ORCL\ORCL\INDX2.DBF
LOB1         F:\ORADATA\ORCL\ORCL\LOB1.DBF
TBS_ASM1     +DGROUP1/orcl/datafile/tbs_asm1.256.5
TBS_REGULAR  +DGROUP1/orcl/datafile/tbs_regular.257.1

14 rows selected.

----- 
-- Listing 2.5: Reconfiguring Enterprise Manager (EM) for use with ASM:
--              1.) Shut down Database Console service
--              2.) Remove current EM configuration
--              3.) Recreate new EM configuration
--              4.) Restart Database Console service
-----
-----
-- Step 1. Stop the Database console
-----

C:\>emctl stop dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.1.0.2.0
Copyright (c) 1996, 2004 Oracle Corporation.  All rights reserved.
http://zdc-dbsrvr:5500/em/console/aboutApplication
The OracleDBConsoleorcl service is stopping..
The OracleDBConsoleorcl service was stopped successfully.

-----
-- Step 2. Remove the EM configuration for the ORCL database
-----

C:\>set oracle_sid=orcl
C:\>emca -x orcl

STARTED EMCA at Wed Dec 14 07:54:19 CST 2005
Dec 14, 2005 7:54:19 AM oracle.sysman.emcp.EMConfig stopOMS
INFO: Stopping the DBConsole ...
Enterprise Manager configuration is completed successfully
FINISHED EMCA at Wed Dec 14 07:54:20 CST 2005

-----
-- Step 3. Recreate the EM configuration for the ORCL database, 
--         but this time include the ASM instance information 
--         as well (-a). The -r directive tells EMCA not to 
--         recreate the existing EM repository on the ORCL database.
--         Note that except where indicated, simply accept the default 
--         settings for best results
-----


C:\>emca -r -a

STARTED EMCA at Wed Dec 14 07:57:47 CST 2005
Enter the following information about the database to be configured
Listener port number: 1521
Database SID: orcl
Service name: orcl.oracle.com
Email address for notification: << NULL is acceptable here
Email gateway for notification: << NULL is acceptable here
ASM ORACLE_HOME [ C:\oracle\product\10.1.0\db_1 ]: << accept default
ASM SID [ +ASM ]: << accept default
ASM port [ 1521 ]: << accept default
ASM user role [ SYSDBA ]: << accept default
ASM user name [ SYS ]: << accept default
ASM user password:   ********
Password for dbsnmp: ********
Password for sysman: ********
Password for sys:    ******** 

-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME .............. C:\oracle\product\10.1.0\db_1
Enterprise Manager ORACLE_HOME .... C:\oracle\product\10.1.0\db_1
Database host name ................ zdc-dbsrvr
Listener port number .............. 1521
Database SID ................ orcl
Service name ................ orcl.oracle.com
Email address for notification ...............
Email gateway for notification ...............
ASM ORACLE_HOME ................ C:\oracle\product\10.1.0\db_1
ASM SID ................ +ASM
ASM port ................ 1521
ASM user role ................ SYSDBA
ASM user name ................ SYS

-----------------------------------------------------------------
Do you wish to continue? [yes/no]: yes
Dec 14, 2005 7:58:33 AM oracle.sysman.emcp.EMConfig updateReposVars
INFO: Updating file C:\oracle\product\10.1.0\db_1\sysman\emdrep\config\repository.variables …
Dec 14, 2005 7:58:33 AM oracle.sysman.emcp.util.PortQuery findUsedPorts
INFO: Searching services file for used port
Dec 14, 2005 7:58:34 AM oracle.sysman.emcp.EMConfig addPortEntries
INFO: Updating file C:\oracle\product\10.1.0\db_1\install\portlist.ini …
Dec 14, 2005 7:58:34 AM oracle.sysman.emcp.EMConfig updateEmdProps
INFO: Updating file C:\oracle\product\10.1.0\db_1\sysman\config\emd.properties…
Dec 14, 2005 7:58:34 AM oracle.sysman.emcp.EMConfig updateConfigFiles
INFO: targets.xml file is updated successfully
Dec 14, 2005 7:58:34 AM oracle.sysman.emcp.EMConfig updateEmomsProps
INFO: Updating file C:\oracle\product\10.1.0\db_1\sysman\config\emoms.properties ...
Dec 14, 2005 7:58:34 AM oracle.sysman.emcp.EMConfig updateConfigFiles
INFO: emoms.properties file is updated successfully
Dec 14, 2005 7:58:36 AM oracle.sysman.emcp.EMConfig startOMS
INFO: Starting the DBConsole ...
Dec 14, 2005 8:00:16 AM oracle.sysman.emcp.EMConfig perform
INFO: DBConsole is started successfully
Dec 14, 2005 8:00:16 AM oracle.sysman.emcp.EMConfig perform
INFO: >>>>>>>>>>> The Enterprise Manager URL is http://zdc-dbsrvr:5500/em <<<<<<<<<<<
Enterprise Manager configuration is completed successfully
FINISHED EMCA at Wed Dec 14 08:00:16 CST 2005

----- 
-- Listing 2.6: Queries Against ASM Dynamic Views
-----

SET LINESIZE 100
SET PAGESIZE 60

-----
-- V$ASM_ALIAS
-- Shows every alias for every disk group mounted by the ASM instance
-----
TTITLE 'ASM Disk Group Aliases (From V$ASM_ALIAS)'
COL name                FORMAT A48              HEADING 'Disk Group Alias' 
COL group_number        FORMAT 99999            HEADING 'ASM|File #' 
COL file_number         FORMAT 99999            HEADING 'File #'
COL file_incarnation    FORMAT 99999            HEADING 'ASM|File|Inc#'
COL alias_index         FORMAT 99999            HEADING 'Alias|Index'
COL alias_incarnation   FORMAT 99999            HEADING 'Alias|Incn#'
COL parent_index        FORMAT 99999            HEADING 'Parent|Index'
COL reference_index     FORMAT 99999            HEADING 'Ref|Idx'
COL alias_directory     FORMAT A4               HEADING 'Ali|Dir?'
COL system_created      FORMAT A4               HEADING 'Sys|Crt?'
SELECT
     name
    ,group_number
    ,file_number
    ,file_incarnation
    ,alias_index
    ,alias_incarnation
    ,parent_index
    ,reference_index
    ,alias_directory
    ,system_created
  FROM v$asm_alias
;

-----
-- V$ASM_CLIENT
-- Shows which database instance(s) are using any ASM disk groups 
-- that are being mounted by this ASM instance
-----
TTITLE 'ASM Client Database Instances (From V$ASM_CLIENT)'
COL group_number    FORMAT 99999    HEADING 'ASM|File #' 
COL instance_name   FORMAT A32      HEADING 'Serviced Database Client' WRAP 
COL db_name         FORMAT A08      HEADING 'Database|Name'
COL status          FORMAT A12      HEADING 'Status'
SELECT
     group_number
    ,instance_name
    ,db_name
    ,status
  FROM v$asm_client
;

-----
-- V$ASM_DISK
-- Lists each disk discovered by the ASM instance, including disks 
-- that are not part of any ASM disk group
-----
TTITLE 'ASM Disks - General Information (From V$ASM_DISK)'
COL group_number        FORMAT 99999    HEADING 'ASM|Disk|Grp #' 
COL disk_number         FORMAT 99999    HEADING 'ASM|Disk|#'
COL name                FORMAT A32      HEADING 'ASM Disk Name' WRAP
COL total_mb            FORMAT 99999999 HEADING 'Total|Disk|Space(MB)'
COL compound_index      FORMAT 999      HEADING 'Cmp|Idx|#'
COL incarnation         FORMAT 999      HEADING 'In#'
COL mount_status        FORMAT A07      HEADING 'Mount|Status'
COL header_status       FORMAT A12      HEADING 'Header|Status'
COL mode_status         FORMAT A08      HEADING 'Mode|Status'
COL state               FORMAT A07      HEADING 'Disk|State'
COL redundancy          FORMAT A07      HEADING 'Redun-|dancy'
COL path                FORMAT A32      HEADING 'OS Disk Path Name' WRAP
SELECT
     group_number
    ,disk_number
    ,name
    ,total_mb
    ,compound_index
    ,incarnation
    ,mount_status
    ,header_status
    ,mode_status
    ,state
    ,redundancy
    ,path
  FROM v$asm_disk
;

TTITLE 'ASM Disks - I/O Status (From V$ASM_DISK)'
COL group_number        FORMAT 99999    HEADING 'ASM|Disk|Grp #' 
COL disk_number         FORMAT 99999    HEADING 'ASM|Disk|#'
COL mount_status        FORMAT A07      HEADING 'Mount|Status'
COL total_mb            FORMAT 999999   HEADING 'Total|Disk|Space(MB)'
COL free_mb             FORMAT 999999   HEADING 'Free|Disk|Space(MB)'
COL reads               FORMAT 999999   HEADING 'Disk|Reads'
COL mb_read             FORMAT 999999   HEADING 'Reads|(MB)'
COL read_time           FORMAT 999999   HEADING 'Read|Time'
COL read_errs           FORMAT 999999   HEADING 'Read|Errors'
COL writes              FORMAT 999999   HEADING 'Disk|Writes'
COL write_errs          FORMAT 999999   HEADING 'Write|Errors'
COL write_time          FORMAT 999999   HEADING 'Write|Time'
SELECT
     group_number
    ,disk_number
    ,mount_status
    ,total_mb
    ,free_mb
    ,reads
    ,(bytes_read / (1024*1024)) mb_read
    ,read_errs
    ,read_time
    ,writes
    ,write_errs
    ,write_time
  FROM v$asm_disk
;

-----
-- V$ASM_DISKGROUP
-- Describes information about ASM disk groups mounted by the ASM instance
-----
TTITLE 'ASM Disk Groups (From V$ASM_DISKGROUP)'
COL group_number        FORMAT 99999    HEADING 'ASM|Disk|Grp #' 
COL name                FORMAT A12      HEADING 'ASM Disk|Group Name' WRAP
COL sector_size         FORMAT 99999999 HEADING 'Sector|Size'
COL block_size          FORMAT 999999   HEADING 'Block|Size'
COL au_size             FORMAT 99999999 HEADING 'Alloc|Unit|Size'
COL state               FORMAT A11      HEADING 'Disk|Group|State'
COL type                FORMAT A06      HEADING 'Disk|Group|Type'
COL total_mb            FORMAT 999999   HEADING 'Total|Space(MB)'
COL free_mb             FORMAT 999999   HEADING 'Free|Space(MB)'
SELECT 
     group_number
    ,name
    ,sector_size
    ,block_size
    ,allocation_unit_size au_size
    ,state
    ,type
    ,total_mb
    ,free_mb
  FROM v$asm_diskgroup
;

-----
-- V$ASM_FILE
-- Lists each ASM file in every ASM disk group mounted by the ASM instance
-----
TTITLE 'ASM Files (From V$ASM_FILE)'
COL group_number        FORMAT 99999    HEADING 'ASM|File #' 
COL file_number         FORMAT 99999    HEADING 'File #'
COL compound_index      FORMAT 999      HEADING 'Cmp|Idx|#'
COL incarnation         FORMAT 999      HEADING 'In#'
COL block_size          FORMAT 999999   HEADING 'Block|Size'
COL blocks              FORMAT 999999   HEADING 'Blocks'
COL bytes_mb            FORMAT 999999   HEADING 'Size|(MB)'
COL space_alloc_mb      FORMAT 999999   HEADING 'Space|Alloc|(MB)'
COL type                FORMAT A32      HEADING 'ASM File Type' WRAP
COL redundancy          FORMAT A06      HEADING 'Redun-|dancy'
COL striped             FORMAT A07      HEADING 'Striped'
COL creation_date       FORMAT A12      HEADING 'Created On'
COL modification_date   FORMAT A12      HEADING 'Last|Modified'
SELECT
     group_number
    ,file_number
    ,compound_index
    ,incarnation
    ,block_size
    ,blocks
    ,(bytes / (1024*1024)) bytes_mb
    ,(space / (1024*1024)) space_alloc_mb
    ,type
    ,redundancy
    ,striped
    ,creation_date
    ,modification_date    
  FROM v$asm_file
;

-----
-- V$ASM_OPERATION 	
-- Like its counterpart, V$SESSION_LONGOPS, it shows each long-running 
-- ASM operation in the ASM instance
-----
TTITLE 'Long-Running ASM Operations (From V$ASM_OPERATIONS)'
COL group_number        FORMAT 99999    HEADING 'ASM|Disk|Grp #' 
COL operation           FORMAT A08      HEADING 'ASM|Oper-|ation' 
COL state               FORMAT A08      HEADING 'ASM|State'
COL power               FORMAT 999999   HEADING 'ASM|Power|Rqstd'
COL actual              FORMAT 999999   HEADING 'ASM|Power|Alloc'
COL est_work            FORMAT 999999   HEADING 'AUs|To Be|Moved'
COL sofar               FORMAT 999999   HEADING 'AUs|Moved|So Far'
COL est_rate            FORMAT 999999   HEADING 'AUs|Moved|PerMI'
COL est_minutes         FORMAT 999999   HEADING 'Est|Time|Until|Done|(MM)'
SELECT 
     group_number
    ,operation
    ,state
    ,power
    ,actual
    ,est_work
    ,sofar
    ,est_rate
    ,est_minutes  
  FROM v$asm_operation
;

-----
-- V$ASM_TEMPLATE
-- Lists each template present in every ASM disk group mounted 
-- by the ASM instance
-----
TTITLE 'ASM Templates (From V$ASM_TEMPLATE)'
COL group_number        FORMAT 99999    HEADING 'ASM|Disk|Grp #' 
COL entry_number        FORMAT 99999    HEADING 'ASM|Entry|#'
COL redundancy          FORMAT A06      HEADING 'Redun-|dancy'
COL stripe              FORMAT A06      HEADING 'Stripe'
COL system              FORMAT A03      HEADING 'Sys|?'
COL name                FORMAT A30      HEADING 'ASM Template Name' WRAP
SELECT
     group_number
    ,entry_number
    ,redundancy
    ,stripe
    ,system
    ,name
  FROM v$asm_template
;