Wednesday, 13 July 2016

Non ASM to ASM Conversion

Before Proceeding to process, please know what is ASM and how to use it.

1. Set the ASM environment and create diskgroup
oracle@AIX01]. oraenv
ORACLE_SID] +ASM1

sqlplus /as sysasm

sql> Create diskgroup DATA EXTERNAL REDUNDANCY DISK '/dev/rhdiskpower47','/dev/rhdiskpower48';

2. set the db environment and shutdown the database

oracle@AIX01]. oraenv
ORACLE_SID] ORCL

oracle@AIX01] sqlplus '/as sysdba'
sql> shu immediate

3. Make the database to nomount state through RMAN
$ Rman target /
RMAN>STARTUP NOMOUNT

4. move controlfile to asm through RMAN
RMAN> restore controlfile to ‘+DATA’ from ‘/oracledb/control1/ctrl_1.ctl’;

5. set the asm environment and find the controlfile from asm diskgroup
$ . oraenv
+ASM1
$ asmcmd
ASMCMD> find --type CONTROLFILE +DATA *
+DATA/ORCL/CONTROLFILE/current.256.734177857
ASMCMD>exit
--Copy the name and full path of controlfile

6. change the control_files parameter from non-asm to asm and restart the database post the db parameter changes.

SQL> alter system set control_files='+DATA/ORCL/CONTROLFILE/current.256.734727317' scope=spfile;
SQL>shutdown immediate;
SQL>startup mount;

7. Now check the control file
SQL> select name from v$controlfile;
+DATA/ORCL/CONTROLFILE/current.256.734727317

8. Now moving the Datafiles to ASM

. oraenv
ORCL

$ rman target /
RMAN>configure device type disk parallelism 4;
RMAN> backup as copy database format '+DATA';
RMAN>switch database to copy ;
RMAN> ALTER DATABASE OPEN;

9. Connect to sqlplus as sysdba and check for all data files

SQL> select file_name from dba_data_files;

10. Now move the Redo Log files to ASM

Please check for which logfile group is active and proceed with caution
NOTE :In this case Logfile group 6 is in active/current state so switching logfile so that it becomes inactive.
SQL> alter database drop logfile group 1;
SQL> alter database add logfile group 1 ('+DATA) size 300M;
SQL> alter database drop logfile group 2;
SQL> alter database add logfile group 2 ('+DATA') size 300M;
SQL> alter database drop logfile group 3;
SQL> alter database add logfile group 3 ('+DATA') size 300M;

11. Move SPfile to ASM
Connect to sqlplus as sysdba
Sqlplus “ / as sysdba”
SQL> create pfile='/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initpfile.ora' from spfile;
SQL> shutdown immediate;
Edit the pfile to change the data file creation place
*.db_create_file_dest=+DATA
SQL>startup pfile='/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initpfile.ora';
SQL> CREATE SPFILE='+DATA' FROM PFILE='/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initpfile.ora';

12. find the spfile and Modify the pfile point to spfile
. oraenv
+ASM1

$asmcmd
ASMCMD> find --type parameterfile +DATA *
+DATA/ORCL/PARAMETERFILE/spfile.354.734189649

.oraenv
ORCL

##remove all entries and add the spfile parameter
$cd $ORACLE_HOME/dbs
vi initpfile.ora
spfile='+DATA/ORCL/PARAMETERFILE/spfile.354.734189649'

13. startup with pfile
sqlplus '/as sysdba'
shu immediate
startup pfile=?/dbs/initpfile.ora

14. moving/creating temporary tablespace in ASM

Creating TEMPFILEs In ASM

SQL> select name, bytes from v$tempfile;
SQL> create temporary tablespace temp1 tempfile SIZE 100M extent management local uniform size 1M;
SQL> alter database default temporary tablespace temp1;
SQL> drop tablespace temp including contents;
SQL> create temporary tablespace temp tempfile SIZE 10120M extent management local uniform size 1M;
SQL> alter database default temporary tablespace temp;
SQL> drop tablespace temp1 including contents;
SQL> select name from v$tempfile;

No comments:

Post a Comment