Translate

Monday, 22 October 2012

ASM Diskgroup rename

Use the below Steps in RAC environmet to RENAME your exisiting ASM Diskgroup (11.2.0.3)

Steps need to follow:

Old Diskgroup Name will be: oldDGNAME

New Diskgroup Name will be: newDGNAME


1)      Use the script to get the filename with new diskgroup name:
Datafile Rename:
select 'alter database rename file '''||name||''' to ''+newDG_name'||substr(name,instr(name,'/',1,1))||''';' from V$DATAFILE;
LOG FILE Rename
select 'alter database rename file '''||member||''' to ''+newlogDG_name'||substr(member,instr(member,'/',1,1))||''';' from V$logfile;

        1.a) create pfile='/tmp/param.txt' from spfile;

2)      Stop the Instances in all the nodes
srvctl stop database -d <dbname>
In GRID OS USER (11.2.0.3), Execute the below Command to RENAME the NewDiskgroup Name
            
      3)  asmcmd umount oldDGNAME (in all the nodes)

4)      renamedg phase=both dgname=oldDGNAME newdgname=newDGNAME confirm=true config=/tmp/rename_olddgname verbose=true asm_diskstring='/dev/oracleasm/disk/*'

5)      asmcmd mount newDGNAME (in all the nodes)

        6)      edit the pfile for the new diskgroup location  

7)      startup nomount pfile='/tmp/param.txt'

8)      alter database mount;

9)      execute the above script output to rename the dbfiles and logfiles with rename the new diskgroup name


9.a) Crete spfile from pfile;

9.b)  srvctl stop database -d <dbname>



10)   Changes in Cluster configuration:

10.a) DISKGROUP  Configuration change
 srvctl modify database -d <dbname> -o <db_home_path> -a "newDGNAME"
10.b)  SPFILE location change
 srvctl modify database -d <dbname> -o <db_home_path> -p "+newDGNAME/dbname/spfiledbname.ora"
 10.c) srvctl start database -d <dbname> (cluster will start the database using the new diskgroup information)
10.d) Finally if all the checking completed, remove the old Diskgroup from the Cluster configuration:
crsctl delete resource ora. oldDGNAME.dg -f







11G RAC Conversion from Standalone Database

Converting a Single Instance Database to RAC Manually
Tested in 11.2.0.3

Note: First we can try this to setup in two node instances
Step 1) Create a new pfile from single instance and the add following parameters (/tmp/initmyrac1.ora)
            *.cluster_database = TRUE
            *.cluster_database_instances = 2
            #*.undo_management=AUTO
            *)myrac1.undo_tablespace=UNDOTBS1
           *)myrac1.instance_name=myrac1
            *)myrac1.instance_number=1
            *)myrac1.thread=1
           *)myrac1.local_listener=listener_MYRAC1
            *)myrac2.instance_name=myrac2
   *)myrac2.instance_number=2
   *)myrac2.local_listener=listener_MYRAC2
   *)myrac2.thread=2
   *)myrac2.undo_tablespace=UNDOTBS2

*) Remove the db_create_online_log_dest
Step 2) cross check the controlfile location in the above pfile (/tmp/initmyrac1.ora), for the OMF Controlfile naming conversion.
Step 3) Creating the Spfile from pfile (/tmp/initmyrac1.ora)
             CREATE SPFILE='+DATA01/MYRAC/spfileMYRAC.ora' from pfile='/tmp/initmyrac1.ora';
==> more $ORACLE_HOME/dbs/initMYRAC1.ora
 SPFILE='+DATA01/MYRAC/spfileMYRAC.ora'
(like this copy the file in 2nd node and rename like initmyrac2.ora)
Step 4) Creating new password file for myrac1 instance under $ORACLE_HOME/dbs
              ORAPWMYRAC1
Step 5) Start database in mount stage
    Export ORACLE_SID=MYRAC1
    SQL> startup mount pfile=initmyrac1.ora
Step 6) Add second thread to database which will be for instance 2
   SQL> alter database add logfile thread 2
                      group 4 ('+DATA01') size 50M,
                      group 5 ('+DATA01') size 50M,
                      group 6 ('+DATA01') size 50M;
   set line 200
   col member for a55
   set pages 100
   select s.GROUP#,p.THREAD#,s.MEMBER from v$logfile s, v$log p where s.GROUP# = p.GROUP#;

SQL> ALTER DATABASE OPEN;

Database altered.

SQL> alter database enable public thread 2;

Database altered.

Step 7) Create undo tablespace for instance 2
SQL> CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA01' size 25M;

Step 8) Run $ORACLE_HOME/rdbms/admin/catclust.sql to create cluster database specific views within the existing instance 1
SQL> @?/rdbms/admin/catclust.sql

Step 9) Add the database and instance in cluster

==> srvctl add database -d myrac -o /mynode/oracle/product/db/10.2.0.2 -p '+DATA01/myrac/spfilemyrac.ora'
==> srvctl add instance -d myrac -i myrac1 -n NODE1
==> srvctl add instance -d myrac -i myrac2 -n NODE2
==> srvctl add instance -d myrac -i myrac3 -n NODE3
==> . .profile_crs
==> cd $ORACLE_HOME/bin
==> ./crs_stat -p ora.myrac.myrac1.inst | grep REQ
REQUIRED_RESOURCES=ora.NODE1.vip
==> srvctl modify instance -d myrac -i myrac1 -s +ASM1
==> ./crs_stat -p ora.myrac.myrac1.inst | grep REQ
REQUIRED_RESOURCES=ora.NODE1.vip ora.NODE1.ASM1.asm
==> srvctl modify instance -d myrac -i myrac2 -s +ASM2
==> srvctl modify instance -d myrac -i myrac3 -s +ASM3

==> for CHECKING Purpose
==>  srvctl stop database myrac
==>  srvctl start database myrac (it should come up with all the instances)

 
==> srvctl config database -d myrac

Step 10) change the ldap entry
Step 12) Add the local & remote listener
alter system set remote_listener='SCAN-IP.domain.org:1120' scope=both;
Step 13) check the tnsping



Fastest method to upgrade/Migrate 10G to 11G from one server to another server

I will update my blog soon