Showing posts with label ASM. Show all posts
Showing posts with label ASM. Show all posts

Tuesday, May 29, 2012

ORA-12514 on +ASM , ASM & ORA-12514 , ASM tnsnames.ora

Environment was 3 Node RAC running on Grid Infrastructure. 11.2.0.1

I tried to connect to +ASM instances using sqlplus from same node using TNSnames but i got ORA-12514.

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 29 19:44:36 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name: 

Both Listener is running.
RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM $ps -ef | grep tns
oracle    9661     1  0 18:54 ?        00:00:00 /u00/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
oracle    9696     1  0 18:55 ?        00:00:00 /u00/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN2 -inherit

Below is my configuration.
RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM1 $vi listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))             # line added by Agent
LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))) # line added by Agent
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                                         # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON                                         # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON                                         # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON                                               # line added by Agent

RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM1 $vi endpoints_listener.ora
LISTENER_RACG1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG1-VIP)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.121)(PORT=1521)(IP=FIRST))))  # line added by Agent

Tnsentry.
+ASM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = RACG-SCAN)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = +ASM)
    )
  )

Here are services supported by from both listener.
RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM1 $lsnrctl services listener

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 29-MAY-2012 19:45:05

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "RACT.localdomain.com" has 1 instance(s).
  Instance "RACT1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:1 refused:0 state:ready
         LOCAL SERVER
Service "RACTXDB.localdomain.com" has 1 instance(s).
  Instance "RACT1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG1.localdomain.com)(PORT=54564))
The command completed successfully


RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM1 $lsnrctl services listener_scan2

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 29-MAY-2012 19:45:24

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
Services Summary...
Service "RACT.localdomain.com" has 3 instance(s).
  Instance "RACT1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:1 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG1-VIP)(PORT=1521)))
  Instance "RACT2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:1 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG2-VIP)(PORT=1521)))
  Instance "RACT3", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG3-VIP)(PORT=1521)))
Service "RACTXDB.localdomain.com" has 3 instance(s).
  Instance "RACT1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG1.localdomain.com)(PORT=54564))
  Instance "RACT2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG2.localdomain.com)(PORT=65286))
  Instance "RACT3", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG3.localdomain.com)(PORT=39505))
The command completed successfully

Here What we needed to do ....

RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM1 $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 29 19:46:21 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter remote

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string
remote_login_passwordfile            string      EXCLUSIVE
remote_os_authent                    boolean     FALSE
remote_os_roles                      boolean     FALSE

Just add REMOTE_LISTENER pointing to SCAN ip address.

SQL> ALTER SYSTEM SET remote_listener='RACG-SCAN:1521' scope=both;

System altered.

SQL> ALTER SYSTEM REGISTER;

System altered.


As you can see how it reflected in scan listener

RACG1@:/u00/app/11.2.0/grid/network/admin :+ASM1 $lsnrctl services listener_scan2

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 29-MAY-2012 19:48:42

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
Services Summary...
Service "+ASM" has 3 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:3 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG1-VIP)(PORT=1521)))
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG2-VIP)(PORT=1521)))
  Instance "+ASM3", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG3-VIP)(PORT=1521)))
Service "RACT.localdomain.com" has 3 instance(s).
  Instance "RACT1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:1 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG1-VIP)(PORT=1521)))
  Instance "RACT2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:1 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG2-VIP)(PORT=1521)))
  Instance "RACT3", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RACG3-VIP)(PORT=1521)))
Service "RACTXDB.localdomain.com" has 3 instance(s).
  Instance "RACT1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG1.localdomain.com)(PORT=54564))
  Instance "RACT2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG2.localdomain.com)(PORT=65286))
  Instance "RACT3", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER 
         (ADDRESS=(PROTOCOL=tcp)(HOST=RACG3.localdomain.com)(PORT=39505))
The command completed successfully

Tuesday, April 17, 2012

Rename Diskgroup.


1) Unmount Diskgroup on All Nodes.

RACG1@:/home/oracle :+ASM1 $asmcmd -p
ASMCMD [+] > umount RACG

RACG2@:/home/oracle :+ASM2 $asmcmd -p
ASMCMD [+] > umount RACG

2) Check on Diskgroup is not mounted.

RACG1@:/dev/oracleasm/disks :+ASM1 $crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               ONLINE  ONLINE       racg1
               ONLINE  ONLINE       racg2
ora.LISTENER.lsnr
               ONLINE  ONLINE       racg1
               ONLINE  ONLINE       racg2
ora.RACG.dg
               OFFLINE OFFLINE      racg1
               OFFLINE OFFLINE      racg2
ora.asm
               ONLINE  ONLINE       racg1                    Started
               ONLINE  ONLINE       racg2                    Started
ora.eons
               ONLINE  ONLINE       racg1
               ONLINE  ONLINE       racg2
ora.gsd
               OFFLINE OFFLINE      racg1
               OFFLINE OFFLINE      racg2
ora.net1.network
               ONLINE  ONLINE       racg1
               ONLINE  ONLINE       racg2
ora.ons
               ONLINE  ONLINE       racg1
               ONLINE  ONLINE       racg2
ora.registry.acfs
               ONLINE  ONLINE       racg1
               ONLINE  ONLINE       racg2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       racg2
ora.oc4j
      1        OFFLINE OFFLINE
ora.racg1.vip
      1        ONLINE  ONLINE       racg1
ora.racg2.vip
      1        ONLINE  ONLINE       racg2
ora.scan1.vip
      1        ONLINE  ONLINE       racg2

3) Now lets rename Diskgroup from +RACG to +RACD

RACG1@:/dev/oracleasm/disks :+ASM1 $renamedg phase=both dgname=RACG newdgname=RACD verbose=true
NOTE: No asm libraries found in the system

Parsing parameters..

Parameters in effect:

         Old DG name       : RACG
         New DG name          : RACD
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : (null)
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: phase=both dgname=RACG newdgname=RACD verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
KFNDG-00407: file not found; arguments: []

Terminating kgfd context 0x2ba7587250a0

- it failed with KFNDG-00407: file not found; arguments: []
-Lets try again , Add asm_diskstring='/dev/oracleasm/disks/*' to command.

RACG1@:/dev/oracleasm/disks :+ASM1 $renamedg phase=both dgname=RACG newdgname=RACD verbose=true asm_diskstring='/dev/oracleasm/disks/*'
NOTE: No asm libraries found in the system

Parsing parameters..

Parameters in effect:

         Old DG name       : RACG
         New DG name          : RACD
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : /dev/oracleasm/disks/*
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: phase=both dgname=RACG newdgname=RACD verbose=true asm_diskstring=/dev/oracleasm/disks/*
Executing phase 1
Discovering the group
Performing discovery with string:/dev/oracleasm/disks/*
Identified disk UFS:/dev/oracleasm/disks/DISK2 with disk number:0 and timestamp (32969226 -1320570880)
Identified disk UFS:/dev/oracleasm/disks/DISK3 with disk number:1 and timestamp (32969226 -1320570880)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/oracleasm/disks/*
Identified disk UFS:/dev/oracleasm/disks/DISK2 with disk number:0 and timestamp (32969226 -1320570880)
Identified disk UFS:/dev/oracleasm/disks/DISK3 with disk number:1 and timestamp (32969226 -1320570880)
Checking if the diskgroup is mounted
Checking disk number:0
Checking disk number:1
Checking if diskgroup is used by CSS
Generating configuration file..
KFNDG-00305: file not found

Terminating kgfd context 0x2b03e7d4d0a0

-Again it failed with KFNDG-00305: file not found
-This time Add confirm=true config=/tmp/renamedg to command.

RACG1@:/dev/oracleasm/disks :+ASM1 $renamedg phase=both dgname=RACG newdgname=RACD confirm=true config=/tmp/renamedg verbose=true asm_diskstring='/dev/oracleasm/disks/*'
NOTE: No asm libraries found in the system

Parsing parameters..

Parameters in effect:

         Old DG name       : RACG
         New DG name          : RACD
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : /dev/oracleasm/disks/*
         Confirm            : TRUE
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: phase=both dgname=RACG newdgname=RACD confirm=true config=/tmp/renamedg verbose=true asm_diskstring=/dev/oracleasm/disks/*
Executing phase 1
Discovering the group
Performing discovery with string:/dev/oracleasm/disks/*
Identified disk UFS:/dev/oracleasm/disks/DISK2 with disk number:0 and timestamp (32969226 -1320570880)
Identified disk UFS:/dev/oracleasm/disks/DISK3 with disk number:1 and timestamp (32969226 -1320570880)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/oracleasm/disks/*
Identified disk UFS:/dev/oracleasm/disks/DISK2 with disk number:0 and timestamp (32969226 -1320570880)
Identified disk UFS:/dev/oracleasm/disks/DISK3 with disk number:1 and timestamp (32969226 -1320570880)
Checking if the diskgroup is mounted
Checking disk number:0
Checking disk number:1
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/oracleasm/disks/DISK2
Modifying the header
Looking for /dev/oracleasm/disks/DISK3
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b2b6ce750a0

And it successfully Renamed.

4) Mount Renamed Diskgroup +RACD on All Nodes.

RACG1@:/home/oracle :+ASM1 $asmcmd mount RACD
RACG2@:/home/oracle :+ASM2 $asmcmd mount RACD

5) Confirm on All Nodes.

RACG1@:/home/oracle :+ASM1 $asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      1019      623                0             623              0             N  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576      2038     1941                0            1941              0             N  RACD/

RACG2@:/home/oracle :+ASM2 $asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      1019      623                0             623              0             N  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576      2038     1941                0            1941              0             N  RACD/

Sunday, April 1, 2012

ASM disks are not visible at Installation


Hi
While installation of 11gR2,  ASM disk was not visible. 


permission were not given on ASMDISKS. 

ls -lart /dev/sd*
brw-r----- 1 root disk     8,  17 Apr  1 12:53 sdb1
brw-r----- 1 root disk     8,  33 Apr  1 12:53 sdc1
brw-r----- 1 root disk     8,  49 Apr  1 12:53 sdd1
brw-r----- 1 root disk     8,  65 Apr  1 12:53 sde1
brw-r----- 1 root disk     8,  81 Apr  1 12:53 sdf1
brw-r----- 1 root disk     8,  97 Apr  1 12:53 sdg1


Later on I remind myself that I forget to add below lines in /etc/rc.d/rc.local

chown oracle:dba /dev/sdb1

chown oracle:dba /dev/sdc1
chown oracle:dba /dev/sdd1
chown oracle:dba /dev/sde1       
chown oracle:dba /dev/sdf1      
chown oracle:dba /dev/sdg1       
chmod 660 /dev/sdb1
chmod 660 /dev/sdc1
chmod 660 /dev/sdd1
chmod 660 /dev/sde1
chmod 660 /dev/sdf1
chmod 660 /dev/sdg1


Define the Scanorder in /etc/sysconfig/oracleasm config file. For example, if the used multipathing device is /dev/md1, you have to force the ASMlib to scan the /dev/md* paths before the /dev/sd* paths


vi /etc/sysconfig/oracleasm

ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER="md sd"



Saturday, October 9, 2010

Golden Gate on ASM

I  also wrote latest post  Goldengate on ASM / RAC  , which is step by step configuration of GG on Grid Infrastructure.


Create the parameter file for the Primary Extract group

Its setup for 2 Node RAC , THREADS will be 2.
ggsci>>ADD EXTRACT E_X, TRANLOG, THREADS 2, BEGIN NOW
ggsci>>ADD EXTTRAIL /u01/ggate/TRAIL/ts, EXTRACT E_X

ggsci>>edit params ./GLOBALS
GGSCHEMA GGS
CHECKPOINTTABLE GGS.CKPT

ggsci>>DBLOGIN USERID ggs, PASSWORD test
ADD CHECKPOINTTABLE GGS.CKPT

sqlplus / as sysdba
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER SYSTEM SWITCH LOGFILE;

Configure tnsentry as +ASM alias and password file.

ggsci>>edit params E_X
SETENV (ORACLE_SID=abc)
USERID ggsuser, PASSWORD ggs_tmp1
EXTTRAIL /u01/ggate/TRAIL/ts
DISCARDFILE ./dirout/E_X.dsc, APPEND, MEGABYTES 10
TRANLOGOPTIONS ASMUSER SYS@+ASM, ASMPASSWORD system
--GETTRUNCATES
DYNAMICRESOLUTION
--TRANLOGOPTIONS FETCHCHAINEDUPDATES
ddl include mapped objname xxx.*;
TABLE xxx.*;
TABLEEXCLUDE xxx.USER_ACTIVITY_TRACE;

Create the parameter file for the Data pump group

ggsci>>ADD EXTRACT P_x,EXTTRAILSOURCE /u01/ggate/TRAIL/ts
ggsci>>ADD RMTTRAIL /u01/ggate/TRAIL/rs, EXTRACT P_x

ggsci>>edit params p_x
userid ggs, password test
rmthost 192.168.1.72, mgrport 7809
rmttrail /u01/ggate/TRAIL/rs
PASSTHRU
--GETTRUNCATES
DYNAMICRESOLUTION
ddl include mapped objname xxx.*;
TABLE xxx.*;

===================================================
ON TARGET SYSTEM
===================================================
Create the parameter file for the replicate group

ggsci>>EDIT PARAMS ./GLOBALS
GGSCHEMA GGS
CHECKPOINTTABLE GGS.CKPT

ggsci>>DBLOGIN USERID ggs, PASSWORD test
ADD CHECKPOINTTABLE GGS.CKPT

sqlplus / as sysdba

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER SYSTEM SWITCH LOGFILE;

ggsci>>ADD REPLICAT R_x,EXTTRAIL /u01/ggate/TRAIL/rs, CHECKPOINTTABLE GGS.CKPT

ggsci>>EDIT PARAMS r_x
REPLICAT R_x
ASSUMETARGETDEFS
userid ggs, password test
DDL
MAP xxx.*, TARGET xxx.*;


ON SOURCE
START EXTRACT E_X
START EXTRACT P_x

ggsci>>info all

make sure every process is running

ON TARGET SYSTEM

START REPLICAT R_x
STATUS REPLICAT R_x

make sure every process is running

---------------------
The best Drill down
---------------------

tail -f ggserr.log

Monday, August 16, 2010

ASM CLONING

------ON HOST

==================================================================================================
ENABLE BLOCK CHANGE TRACKING
===================================================================================================

ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;

==================================================================================================
CHECK EACH LOCATION OF FILE ON HOST (PRODASM)
===================================================================================================

select MEMBER from v$logfile;
select NAME from v$datafile;
select NAME from v$tempfile;

+DG1/prodasm/datafile/users.259.727034915
+DG1/prodasm/datafile/sysaux.257.727034911
+DG1/prodasm/datafile/undotbs1.258.727034913
+DG1/prodasm/datafile/system.256.727034907
+DG1/prodasm/controlfile/current.260.727035019

==================================================================================================
PUT DATABASE IN BEGIN BACKUPMODE
===================================================================================================

SQL> alter database begin backup;

Database altered.

==================================================================================================
ON HOST (PRODASM) CONVERT ALL DBFILE + CONTROLFILE ASM FILE TO FILESYSTEMS ( DONT CONVERT TEMPFILE)
===================================================================================================

----------- CAN NOT CONVERT TEMPFILE......

run {
copy current controlfile to '/u01/copy/controlfile.ctl';
convert datafile '+DG1/prodasm/datafile/users.259.727034915' format '/u01/copy/users.dbf';
convert datafile '+DG1/prodasm/datafile/sysaux.257.727034911' format '/u01/copy/sysaux.dbf';
convert datafile '+DG1/prodasm/datafile/undotbs1.258.727034913' format '/u01/copy/undotbs1.dbf';
convert datafile '+DG1/prodasm/datafile/system.256.727034907' format '/u01/copy/system.dbf';
convert datafile '+DG1/DG1/prodasm/tempfile/temp.264.727035059' format '/u01/copy/tempfile.dbf';
}

----------------------OUTPUT--------------------------------
run {
copy current controlfile to '/u01/copy/controlfile.ctl';
convert datafile '+DG1/prodasm/datafile/users.259.727034915' format '/u01/copy/users.dbf';
RMAN> 2> 3> 4> convert datafile '+DG1/prodasm/datafile/sysaux.257.727034911' format '/u01/copy/sysaux.dbf';
5> convert datafile '+DG1/prodasm/datafile/undotbs1.258.727034913' format '/u01/copy/undotbs1.dbf';
convert datafile '+DG1/prodasm/datafile/system.256.727034907' format '/u01/copy/system.dbf';
6> 7> }

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=/u01/copy/controlfile.ctl tag=TAG20100815T204830 recid=26 stamp=727130911
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=+DG1/prodasm/datafile/users.259.727034915
converted datafile=/u01/copy/users.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:01:10
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=+DG1/prodasm/datafile/sysaux.257.727034911
converted datafile=/u01/copy/sysaux.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:16
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=+DG1/prodasm/datafile/undotbs1.258.727034913
converted datafile=/u01/copy/undotbs1.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:04
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=+DG1/prodasm/datafile/system.256.727034907
converted datafile=/u01/copy/system.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:26
Finished backup at 15-AUG-10

RMAN> exit


===================================================================================
COPY EACH CONVERTEDFILE + INITFILE TO REMOTE SERVER FILESYSTEM OF PRODASM
===================================================================================
---ON HOST
copy each file to remote destination plus initfile

scp * DEVASM:/u01/copy

PRDASM-> scp * DEVASM:/u01/copy
controlfile.ctl 100% 7088KB 3.5MB/s 00:02
sysaux.dbf 100% 230MB 4.3MB/s 00:53
system.dbf 100% 480MB 4.7MB/s 01:42
undotbs1.dbf 100% 25MB 5.0MB/s 00:05
users.dbf 100% 5128KB 5.0MB/s 00:01


===================================================================================
ON REMOTE SERVER(DEVASM) CHANGE INIT FILE AND GIVE CONTROLFILE LOCATION THERE..
===================================================================================

PRODASM.__db_cache_size=121634816
PRODASM.__java_pool_size=4194304
PRODASM.__large_pool_size=4194304
PRODASM.__shared_pool_size=54525952
PRODASM.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/PRODASM/adump'
*.background_dump_dest='/u01/app/oracle/admin/PRODASM/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/copy/controlfile.ctl' ---------------> changed
*.core_dump_dest='/u01/app/oracle/admin/PRODASM/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DG2'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='+DG1','+DG2'
*.db_name='PRODASM'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODASMXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='location=+DG2/DEVASM/ARCH'
*.open_cursors=300
*.pga_aggregate_target=62914560
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=188743680
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/PRODASM/udump'

=======================================================================================
ON REMOTE SERVER(DEVASM) STARTUP DATABASE IN NOMOUNT MODE WITH HELP OF PROD INITFILE
=======================================================================================

DEVASM-> echo $ORACLE_SID
DEVASM
DEVASM->

SQL> startup mount pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initPRODASM.ora';
ORACLE instance started.

Total System Global Area 188743680 bytes
Fixed Size 1218436 bytes
Variable Size 62916732 bytes
Database Buffers 121634816 bytes
Redo Buffers 2973696 bytes
Database mounted.

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

=======================================================================================
ON REMOTE SERVER(DEVASM) : CONVERT FILE AGAIN BACK TO REMOTE ASM (DEVASM)
=======================================================================================
devasm
run {
convert datafile '/u01/copy/undotbs1.dbf' format '+DG2';
convert datafile '/u01/copy/system.dbf' format '+DG2';
convert datafile '/u01/copy/users.dbf' format '+DG2';
convert datafile '/u01/copy/sysaux.dbf' format '+DG2';
}

--------------------------OUTPUT------------------------------------------
DEVASM-> rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Aug 15 20:59:20 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: PRODASM (DBID=3528672201, not open)

RMAN> run {
convert datafile '/u01/copy/undotbs1.dbf' format '+DG2';
convert datafile '/u01/copy/system.dbf' format '+DG2';
convert datafile '/u01/copy/users.dbf' format '+DG2';
convert datafile '/u01/copy/sysaux.dbf' format '+DG2';
}2> 3> 4> 5> 6>

Starting backup at 15-AUG-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/copy/undotbs1.dbf
converted datafile=+DG2/prodasm/datafile/undotbs1.273.727131573
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:09
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/copy/system.dbf
converted datafile=+DG2/prodasm/datafile/system.274.727131575
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:02:12
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/copy/users.dbf
converted datafile=+DG2/prodasm/datafile/users.275.727131711
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:08
Finished backup at 15-AUG-10

Starting backup at 15-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/copy/sysaux.dbf
converted datafile=+DG2/prodasm/datafile/sysaux.276.727131715
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
Finished backup at 15-AUG-10

=======================================================================================
ON REMOTE SERVER(DEVASM) : CHANGE NAME OF DATAFILES IN CONTROLFILE
=======================================================================================

SQL> select MEMBER from v$logfile;
SQL> select NAME from v$datafile;
SQL> select NAME from v$tempfile;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;

ALTER DATABASE RENAME FILE '+DG1/prodasm/datafile/users.259.727034915' to '+DG2/prodasm/datafile/users.275.727131711';
ALTER DATABASE RENAME FILE '+DG1/prodasm/datafile/sysaux.257.727034911' to '+DG2/prodasm/datafile/sysaux.276.727131715';
ALTER DATABASE RENAME FILE '+DG1/prodasm/datafile/undotbs1.258.727034913' to '+DG2/prodasm/datafile/undotbs1.273.727131573';
ALTER DATABASE RENAME FILE '+DG1/prodasm/datafile/system.256.727034907' to '+DG2/prodasm/datafile/system.274.727131575';


SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

System altered.

=======================================================================================
ON REMOTE SERVER(DEVASM) : DISABLE BLOCK CHANGE TRACKING
=======================================================================================

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-19751: could not create the change tracking file
ORA-19750: change tracking file:
'+DG1/prodasm/changetracking/ctf.267.727101715'
ORA-17502: ksfdcre:1 Failed to create file
+DG1/prodasm/changetracking/ctf.267.727101715
ORA-17501: logical block size 4294967295 is invalid
ORA-17503: ksfdopn:2 Failed to open file
+DG1/prodasm/changetracking/ctf.267.727101715
ORA-15001: diskgroup "DG1" does not exist or is not mounted
ORA-15001: diskgroup "DG1" does not exist or is not mounted


SQL> alter database disable block change tracking;

Database altered.

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+DG2/prodasm/datafile/system.274.727131575'

=======================================================================================
ON REMOTE SERVER(DEVASM) : SHUTDOWN IMMEDIATE;
=======================================================================================

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

=======================================================================================
ON REMOTE SERVER(DEVASM) : MOUNT DATABASE AND OPEN IT NORMALLY
=======================================================================================

SQL> startup mount;
ORACLE instance started.

Total System Global Area 188743680 bytes
Fixed Size 1218436 bytes
Variable Size 62916732 bytes
Database Buffers 121634816 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open;

Database altered.

=======================================================================================
ON REMOTE SERVER(DEVASM) : CONTROLFILE AND SPFILE CREATED AUTOMATICALLY
=======================================================================================

SQL> show parameter CONTROL


NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DG2/devasm/controlfile/current.260.727044801
SQL> show parameter spfile;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DG2/devasm/spfiledevasm.ora

Wednesday, June 2, 2010

ASM commands

===============================================
CREATE
===============================================
---CREATE DISKGROUP

CREATE DISKGROUP disk_group_1 NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK
'/devices/diska1' NAME diska1,
'/devices/diska2' NAME diska2,
FAILGROUP failure_group_2 DISK
'/devices/diskb1' NAME diskb1,
'/devices/diskb2' NAME diskb2;

---create tablespace
CREATE TABLESPACE DATA1 DATAFILE '+' SIZE 100M AUTOEXTEND ON;

•NORMAL REDUNDANCY - Two-way mirroring, requiring two failure groups.
•HIGH REDUNDANCY - Three-way mirroring, requiring three failure groups.
•EXTERNAL REDUNDANCY - No mirroring for disks that are already protected using hardware mirroring or RAID.

-- Add disks.
ALTER DISKGROUP disk_group_1 ADD DISK
'/devices/disk*3',
'/devices/disk*4';

SQL> alter diskgroup DATA1 add directory '+DATA1/oradata/orcl;
#Now create the alias
SQL> alter diskgroup DATA1 add alias '+DATA1/oradata/orcl/nitin01.dbf' for
+DATA1/orcl/datafile/nitin.263.3;

-- Create a directory.
ALTER DISKGROUP disk_group_1 ADD DIRECTORY '+disk_group_1/my_dir';

-- Rename a directory.
ALTER DISKGROUP disk_group_1 RENAME DIRECTORY '+disk_group_1/my_dir' TO '+disk_group_1/my_dir_2';

-- Delete a directory and all its contents.
ALTER DISKGROUP disk_group_1 DROP DIRECTORY '+disk_group_1/my_dir_2' FORCE;

==============================================
DROP
==============================================
DROP DISKGROUP disk_group_1 INCLUDING CONTENTS;
-- Drop a disk.
ALTER DISKGROUP disk_group_1 DROP DISK diska2;

-- Drop file using an alias.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/my_dir/my_file.dbf';

-- Drop file using a numeric form filename.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1.342.3';

-- Drop file using a fully qualified filename.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/mydb/datafile/my_ts.342.3';

==============================================
RESIZE
==============================================
-- Resize a specific disk.
ALTER DISKGROUP disk_group_1
RESIZE DISK diska1 SIZE 100G;

-- Resize all disks in a failure group.
ALTER DISKGROUP disk_group_1
RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 100G;

-- Resize all disks in a disk group.
ALTER DISKGROUP disk_group_1
RESIZE ALL SIZE 100G;
ALTER DISKGROUP disk_group_1 REBALANCE POWER 5;
ALTER DISKGROUP ALL DISMOUNT;
ALTER DISKGROUP ALL MOUNT;
ALTER DISKGROUP disk_group_1 DISMOUNT;
ALTER DISKGROUP disk_group_1 MOUNT;

-- Check metadata for a specific file.
ALTER DISKGROUP disk_group_1 CHECK FILE '+disk_group_1/my_dir/my_file.dbf'

-- Check metadata for a specific failure group in the disk group.
ALTER DISKGROUP disk_group_1 CHECK FAILGROUP failure_group_1;

==============================================================================
MIGRATION TO ASM USING RMAN
===============================================================================

1> Disable change tracking (only available in Enterprise Edition) if it is currently being used.

SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;•Shutdown the database.

SQL> SHUTDOWN IMMEDIATE

2>•Modify the parameter file of the target database as follows:

set the DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n parameters to the relevant ASM disk groups.
Remove the CONTROL_FILES parameter from the spfile so the control files will be moved to the DB_CREATE_* destination and the spfile gets updated automatically.
If you are using a pfile the CONTROL_FILES parameter must be set to the appropriate ASM files or aliases.

3>•Start the database in nomount mode.

RMAN> STARTUP NOMOUNT

4>Restore the controlfile into the new location from the old location.

RMAN> RESTORE CONTROLFILE FROM 'old_control_file_name';

5>Mount the database.

RMAN> ALTER DATABASE MOUNT;

6>Copy the database into the ASM disk group.

RMAN> BACKUP AS COPY DATABASE FORMAT '+disk_group';

7>Switch all datafile to the new ASM location.

RMAN> SWITCH DATABASE TO COPY;

8>Open the database.

RMAN> ALTER DATABASE OPEN;

9>Create new redo logs in ASM and delete the old ones.

10>Enable change tracking if it was being used.

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;



=================================================================
11g NEW FEATURE
=================================================================
Oracle 11g ASM includes two new compatibility attributes that determine the version of the ASM
and database software that can use specific disk groups:

--------------------------------------------------------------------
The compatibility versions of a disk group can only be */increased/*

•COMPATIBLE.ASM - The minimum version of the ASM software that can access the disk group.
In 11g, the default setting is 10.1.
•COMPATIBLE.RDBMS - The minimum COMPATIBLE database initialization parameter setting for any database
instance that uses the disk group. In 11g, the default setting is 10.1.

CREATE DISKGROUP DATA1 DISK '/dev/raw/*'
ATTRIBUTE 'compatible.asm' = '11.1';
CREATE DISKGROUP DATA1 DISK '/dev/raw/*'
ATTRIBUTE 'compatible.rdbms' = '11.1', 'compatible.asm' = '11.1';

ALTER DISKGROUP DATA1 SET ATTRIBUTE 'compatible.asm' = '11.1';
ALTER DISKGROUP DATA1 SET ATTRIBUTE 'compatible.rdbms' = '11.1';
---------------------------------------------------------------------
Fast Mirror Resync
ASM keeps track of the changed extents that need to be applied to the offline disk.
*/Once the disk is available, only the changed extents are written to resynchronize the disk, /*
rather than overwriting the contents of the entire disk.
This can speed up the resynchronization process considerably

-- Set using the hours unit of time.
ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '4.5h';

-- Set using the minutes unit of time.
ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '300m';
---------------------------------------------------------------------
ROLLING MIGRATION

ALTER SYSTEM START ROLLING MIGRATION TO 11.2.0.0.0;

-----CAN BE DONE ONLY
•Mount and dismount of the disk groups.
•Open, close, resize, and delete of database files.
•Access to local fixed views and fixed packages

-----CURRENT STATUS
SELECT SYS_CONTEXT('sys_cluster_properties', 'cluster_state') FROM dual;
If a disk goes offline during a rolling upgrade, the timer is not started until after the rolling upgrade is complete.
--------------------------------------------------------------------------------
UPGRADE
Clustered ASM instances for 11g onwards can be upgraded using a rolling upgrade.
The ASM cluster is placed in rolling upgrade mode by
issuing the following command from one of the nodes.

ALTER SYSTEM START ROLLING MIGRATION TO 11.2.0.0.0;

Once the cluster is in rolling upgrade mode each node in turn can be shutdown, upgraded and started.
The cluster runs in a mixed version environment until the upgrade is complete.
In this state, the cluster is limited to the following operations:

•Mount and dismount of the disk groups.
•Open, close, resize, and delete of database files.
•Access to local fixed views and fixed packages.
The current status of the ASM cluster can be determined using the following query.

SELECT SYS_CONTEXT('sys_cluster_properties', 'cluster_state') FROM dual;

Once the last node is upgraded, the rolling upgrade is stopped by issuing the following command,
which checks all ASM instances are at the appropriate version,
turns off rolling upgrade mode and restarts any pending rebalance operations.

ALTER SYSTEM STOP ROLLING MIGRATION;

Restrictions and miscellaneous points about the rolling upgrade process include:

•The Oracle clusterware must be fully patched before an ASM rolling upgrade is started.
•Rolling upgrades are only available from 11g onwards,
so this method is not suitable for 10g to 11g upgrades.
•This method can be used to rollback to the previous version if the rolling upgrade fails before completion.
•If the upgrade fails, any rebalancing operations must complete before a new upgrade can be attempted.
•New instances joining the cluster during a rolling upgrade are automatically placed in rolling upgrade mode.
•If all instances in a cluster are stopped during a rolling upgrade,
once the instances restart they will no longer be in rolling upgrade mode. The upgrade must be initiated as if it were a new process.

The "ALTER DISKGROUP ... MOUNT" statement allows disk groups to be mounted in restricted mode.

======================================================================
ALLOCATION_UNIT AU_SIZE
======================================================================
When the disk group compatibility attributes are set to 11.1 or higher,
the extent size will automatically grow as the file grows.
The first 20,000 extents match the allocation unit size (1*AU).
The next 20,000 extents are made up of 8 allocation units (8*AU).
Beyond that point, the extent size becomes 64 allocation units (64*AU).

CREATE DISKGROUP disk_group_2
EXTERNAL REDUNDANCY
DISK '/dev/sde1'
ATRRIBUTE 'au_size' = '32M';

----------------------------------------------------------------------------
SYSASM Privilege and OSASM OS Group
$ sqlplus / as sysasm

---------------------------END OF 11G FEATURE--------------------------------
=============================================================================
V$VIEWS
=============================================================================

View ASM Instance DB Instance
V$ASM_ALIAS Displays a row for each alias present in every disk group mounted by the ASM instance.
Returns no rows
V$ASM_CLIENT Displays a row for each database instance using a disk group managed by the ASM instance.
Displays a row for the ASM instance if the database has open ASM files.
V$ASM_DISK Displays a row for each disk discovered by the ASM instance, including disks which are not part of any disk group.
Displays a row for each disk in disk groups in use by the database instance.
V$ASM_DISKGROUP Displays a row for each disk group discovered by the ASM instance. Displays a row for each disk group mounted by the local ASM instance.
V$ASM_FILE Displays a row for each file for each disk group mounted by the ASM instance.
Displays no rows.
V$ASM_OPERATION Displays a row for each file for each long running operation executing in the ASM instance. Displays no rows.
V$ASM_TEMPLATE Displays a row for each template present in each disk group mounted by the ASM instance. Displays a row for each template present in each disk group mounted by the ASM instance with which the database instance communicates.

select name, state, type, total_mb, free_mb from v$asm_diskgroup;

NAME STATE TYPE TOTAL_MB FREE_MB
------------------------------ ----------- ------ ---------- ----------
DATA1 MOUNTED EXTERN 34512 34101

select name, path, mode_status, state, disk_number from v$asm_disk

NAME PATH MODE_ST STATE DISK_NUMBER
------------ ---------------------- ------- -------- -----------
DATA_0000 /dev/rdsk/c3t19d5s4 ONLINE NORMAL 0
DATA_0001 /dev/rdsk/c3t19d16s4 ONLINE NORMAL 1
DATA_0002 /dev/rdsk/c3t19d17s4 ONLINE NORMAL 2
DATA_0003 /dev/rdsk/c3t19d18s4 ONLINE NORMAL 3

SQL> select INSTANCE,NAME,STATUS,SOFTWARE_VERSION,COMPATIBLE_VERSION from v$asm_client;

------- ------------ ------------ ------------
cubs1 CONNECTED 10.2.0.1.0 10.2.0.1.0

FROM +ASM (ASM instance)
select file_number , sum(bytes)/(1024*1024) from v$asm_file group by
file_number


FROM ORCL (database instance)
SQL> select name from v$datafile
NAME
----------------------------------------
+DATA1/orcl/datafile/sysaux.256.3

SQL> select member from v$logfile;
MEMBER
-------------------------------------------------------------------------------
-
+DATA1/orcl/onlinelog/group_3.264.3

To show the hierarchical tree of files stored in the diskgroup

SELECT concat('+'||gname, sys_connect_by_path(aname, '/')) full_alias_path FROM
(SELECT g.name gname, a.parent_index pindex, a.name aname,
a.reference_index rindex FROM v$asm_alias a, v$asm_diskgroup g
WHERE a.group_number = g.group_number)
START WITH (mod(pindex, power(2, 24))) = 0
CONNECT BY PRIOR rindex = pindex;



==============================================================
ASMCMD
==============================================================

he lsdsk command lists information about ASM disks from the V$ASM_DISK_STAT and V$ASM_DISK views
lsdsk [-ksptcgHI] [-d ] [pattern]

cp [-ifr] <[\@connect_identifier:]src> <[\@connect_identifier:]tgt>

md_restore -b [-li]
[-t (full)|nodg|newdg] [-f ]
[-g ',,...']
[-o ':,...']


lsdg dgroup2 Lists all disk groups and their attributes.
lsct dgroup1 LIST ABOUT CLIENTS ACCESS
lsdsk -kspt '/dev/sdb6'


===============================================================
INIT+ASM.ORA
===============================================================
SQL> select instance_name from v$instance
INSTANCE_NAME
----------------
+ASM
ASM init.ora parameters
*.background_dump_dest='/opt/app/admin/+ASM/bdump'
*.core_dump_dest='/opt/app/admin/+ASM/cdump'
*.instance_type=asm
*.asm_diskgroups=+DATA1
*.large_pool_size=12M
*.asm_diskstring='/dev/rdsk/c3t19d*s4'
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/opt/app/admin/+ASM/udump'

==================================================================
KNOWLEDGEBASE
==================================================================
ASMLIB
Oracle has developed a storage management interface called the ASMLIB API. ASMLIB is not required to
run ASM; it is simply an add-on module that simplifies the management and discovery of ASM disks. The
ASMLIB provides an alternative, to the standard operating system interface, for ASM to identify and
access block devices. The ASMLIB API provides storage and operating system vendors the opportunity to
supply extended storage-related features and exploit the capabilities and strengths of vendors‘ storage
array.
The ASMLIB API provides two major feature enhancements over standard interfaces:
• Disk discovery | Providing more information about the storage attributes to the Database and the DBA
• I/O processing | To enable more efficient I/O
Oracle is providing an ASMLIB, called the Oracle ASMLIB, for the Linux platform (current version as of
this writing is 2.0).

Friday, May 28, 2010

prepare ASM disk, create ASM instance & diskgroups from scratch

login as root user

[root@TEST6 ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 83 Linux
/dev/sda2 638 2167 12289725 83 Linux
/dev/sda3 2168 2418 2016157+ 83 Linux
/dev/sda4 2419 2610 1542240 5 Extended
/dev/sda5 2419 2609 1534176 82 Linux swap

Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

FIRST PARTITION

[root@TEST6 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): 125

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@TEST6 ~]#

SECOND PARTITION

[root@TEST6 ~]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (126-391, default 126): 126
Last cylinder or +size or +sizeM or +sizeK (126-391, default 391): 275

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

THIRD PARTITION

[root@TEST6 ~]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (276-391, default 276):
Using default value 276
Last cylinder or +size or +sizeM or +sizeK (276-391, default 391):
Using default value 391

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


WHICH PARTITION ARE UNBOUND
[root@TEST6 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 5036284 3456608 1323844 73% /
none 375068 0 375068 0% /dev/shm
/dev/sda2 12096756 1662808 9819464 15% /u00
/dev/sda3 1984428 35784 1847840 2% /u01
/dev/hdc 116020 116020 0 100% /media/cdrom

[root@TEST6 ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 83 Linux
/dev/sda2 638 2167 12289725 83 Linux
/dev/sda3 2168 2418 2016157+ 83 Linux
/dev/sda4 2419 2610 1542240 5 Extended
/dev/sda5 2419 2609 1534176 82 Linux swap

Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 125 1004031 83 Linux ------> CANT FIND IN df -k
/dev/sdb2 126 275 1204875 83 Linux ------> CANT FIND IN df -k
/dev/sdb3 276 391 931770 83 Linux-------> CANT FIND IN df -k

[root@TEST6 ~]# vi /etc/sysconfig/rawdevices
edit
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
/dev/raw/raw3 /dev/sdb3
~
[root@TEST6 ~]# service rawdevices restart
Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2 --> /dev/sdb2
/dev/raw/raw2: bound to major 8, minor 18
/dev/raw/raw3 --> /dev/sdb3
/dev/raw/raw3: bound to major 8, minor 19
done
[root@TEST6 ~]#

[root@TEST6 ~]# chown oracle:dba /dev/raw/raw1
[root@TEST6 ~]# chown oracle:dba /dev/raw/raw2
[root@TEST6 ~]# chown oracle:dba /dev/raw/raw3
[root@TEST6 ~]# chown 660 /dev/raw/raw[1-3]
[root@TEST6 ~]# ls -lart /dev/raw/raw*
crw-rw---- 1 oracle dba 162, 1 May 28 15:43 /dev/raw/raw1
crw-rw---- 1 oracle dba 162, 2 May 28 15:43 /dev/raw/raw2
crw-rw---- 1 oracle dba 162, 3 May 28 15:43 /dev/raw/raw3

loging as oracle
[root@TEST6 ~]#su - oracle
AS ORACLE USER

test6-> mkdir -p /u00/oradata/test/asmdisk1
test6-> mkdir -p /u00/oradata/test/asmdisk2
test6-> mkdir -p /u00/oradata/test/asmdisk4
test6-> ln -sf /dev/raw/raw1 /u00/oradata/test/asmdisk1
test6-> ln -sf /dev/raw/raw2 /u00/oradata/test/asmdisk2
test6-> ln -sf /dev/raw/raw3 /u00/oradata/test/asmdisk3

[root@TEST6 ~]# vi /etc/udev/permissions.d/50-udev.permissions
# raw devices
ram*:root:disk:0660
raw/*:oracle:dba:0660

[root@TEST6 ~]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
[root@TEST6 ~]#

[root@TEST6 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk: [ OK ]
[root@TEST6 ~]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdb2
Marking disk "/dev/sdb2" as an ASM disk: [ OK ]
[root@TEST6 ~]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdb3
Marking disk "/dev/sdb3" as an ASM disk: [ OK ]
[root@TEST6 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
[root@TEST6 ~]#

AS ORACLE USER

test6-> mkdir -p $ORACLE_BASE/admin/+ASM/bdump
test6-> mkdir -p $ORACLE_BASE/admin/+ASM/cdump
test6-> mkdir -p $ORACLE_BASE/admin/+ASM/hdump
test6-> mkdir -p $ORACLE_BASE/admin/+ASM/pfile
test6-> mkdir -p $ORACLE_BASE/admin/+ASM/udump

INITFILE OF ASM

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

###########################################
# Automatic Storage Management
###########################################
###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=/u00/app/oracle/admin/+ASM/bdump
core_dump_dest=/u00/app/oracle/admin/+ASM/cdump
user_dump_dest=/u00/app/oracle/admin/+ASM/udump

###########################################
# Miscellaneous
###########################################
instance_type=ASM
compatible=10.1.0.4.0

###########################################
# Pools
###########################################
large_pool_size=12M

###########################################
# Security and Auditing
###########################################
remote_login_passwordfile=exclusive

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


vi /u00/app/oracle/admin/+ASM/pfile/init.ora
ln -s $ORACLE_BASE/admin/+ASM/pfile/init.ora $ORACLE_HOME/dbs/init+ASM.ora

AS ROOT USER GO TO $ORACLE_HOME/bin

[root@TEST6 bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
test6
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)



test6-> ORACLE_SID=+ASM; export ORACLE_SID
test6-> sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 28 16:43:22 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted

SQL> create spfile from pfile;

File created.

SQL> alter system set asm_diskstring = '/dev/raw/raw*';

System altered.

SQL> create diskgroup DATA1 external redundancy disk '/dev/raw/raw1';

Diskgroup created.