HOW TO MIGRATE NON-ASM FILES TO ASM IN WINDOWS






















21. Disk Groups are created now perform following steps.

22. SQL> select file_name from dba_data_files;

23. SQL> select MEMBER from v$logfile;

24. SQL> select name from v$controlfile;

25. SQL> SHUTDOWN IMMEDIATE

26. RMAN> STARTUP NOMOUNT

27. RMAN>restore controlfile to '+DG1' from  'C:\oracle\product\10.2.0\oradata\srbdb\CONTROL01.CTL';

28. C:\oracle\product\10.2.0\srbdb\BIN>SET ORACLE_HOME=C:\ORACLE\PRODUCT\10.2.0\SRBDB

29. C:\oracle\product\10.2.0\srbdb\BIN>SET ORACLE_SID=+asm

30. C:\oracle\product\10.2.0\srbdb\BIN>asmcmd

31. ASMCMD> find -t CONTROLFILE  +DG1 *

 Result:    +DG1/SRBDB/CONTROLFILE/backup.256.808492297

32. SQL> alter system set control_files='+DG1/SRBDB/CONTROLFILE/backup.256.808402379' SCOPE=SPFILE;

33. SQL> shutdown

34. SQL> startup mount.

35. SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DG1/srbdb/controlfile/backup.256.808492297


36. RMAN> BACKUP AS COPY DATABASE FORMAT '+DG1';

Starting backup at 27-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=152 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\SYST
EM01.DBF
output filename=+DG1/srbdb/datafile/system.257.808493019 tag=TAG20130227T132338
recid=2 stamp=808493079
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\SYSA
UX01.DBF
output filename=+DG1/srbdb/datafile/sysaux.258.808493083 tag=TAG20130227T132338
recid=3 stamp=808493107
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\EXAM
PLE01.DBF
output filename=+DG1/srbdb/datafile/example.259.808493109 tag=TAG20130227T132338
 recid=4 stamp=808493120
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\UNDO
TBS01.DBF
output filename=+DG1/srbdb/datafile/undotbs1.260.808493125 tag=TAG20130227T13233
8 recid=5 stamp=808493129
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\USER
S01.DBF
output filename=+DG1/srbdb/datafile/users.261.808493131 tag=TAG20130227T132338 r
ecid=6 stamp=808493131
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+DG1/srbdb/controlfile/backup.262.808493133 tag=TAG20130227T1323
38 recid=7 stamp=808493133
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 27-FEB-13
channel ORA_DISK_1: finished piece 1 at 27-FEB-13
piece handle=+DG1/srbdb/backupset/2013_02_27/nnsnf0_tag20130227t132338_0.263.808
493137 tag=TAG20130227T132338 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 27-FEB-13


37. RMAN> SWITCH DATABASE TO COPY;

datafile 1 switched to datafile copy "+DG1/srbdb/datafile/system.257.808493019"
datafile 2 switched to datafile copy "+DG1/srbdb/datafile/undotbs1.260.808493125
"
datafile 3 switched to datafile copy "+DG1/srbdb/datafile/sysaux.258.808493083"
datafile 4 switched to datafile copy "+DG1/srbdb/datafile/users.261.808493131"
datafile 5 switched to datafile copy "+DG1/srbdb/datafile/example.259.808493109"


38.  SQL> select file_name from dba_data_files;

FILE_NAME
----------------------------------------------
+DG1/srbdb/datafile/users.261.808493131
+DG1/srbdb/datafile/sysaux.258.808493083
+DG1/srbdb/datafile/undotbs1.260.808493125
+DG1/srbdb/datafile/system.257.808493019
+DG1/srbdb/datafile/example.259.808493109

39. SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         1          1          2   52428800          1 NO  CURRENT
       567971 27-FEB-13

         2          1          0   52428800          1 YES UNUSED
            0

         3          1          1   52428800          1 NO  INACTIVE
       534907 27-FEB-13


40. SQL> alter database drop logfile group 1;

ERROR alter database drop logfile group 1
*
ERROR at line 1:
ORA-01623: log 1 is current log for instance srbdb (thread 1) - cannot drop
ORA-00312: online log 1 thread 1:
'C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\REDO01.LOG'


41. SQL> alter system switch logfile;

System altered.


42. SQL>  alter database drop logfile group 1;

 ERROR: alter database drop logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of instance srbdb (thread 1)
ORA-00312: online log 1 thread 1:
'C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\REDO01.LOG'

43. SQL> shut immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  1250428 bytes
Variable Size             176163716 bytes
Database Buffers          427819008 bytes
Redo Buffers                7135232 bytes
Database mounted.
Database opened.

44. SQL> alter database drop logfile group 1;

Database altered.

45. SQL> alter database add logfile group 1 ('+DG1') size 100M;

Database altered.


46. SQL> alter database drop logfile group 2;

alter database drop logfile group 2
*
ERROR at line 1:
ORA-01623: log 2 is current log for instance srbdb (thread 1) - cannot drop
ORA-00312: online log 2 thread 1:
'C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\REDO02.LOG'


47. SQL> alter system switch logfile;

System altered.

48. SQL>  alter database drop logfile group 2;

 alter database drop logfile group 2
*
ERROR at line 1:
ORA-01624: log 2 needed for crash recovery of instance srbdb (thread 1)
ORA-00312: online log 2 thread 1:
'C:\ORACLE\ORACLE\PRODUCT\10.2.0\ORADATA\SRBDB\REDO02.LOG'


49. SQL> shut immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  1250428 bytes
Variable Size             180358020 bytes
Database Buffers          423624704 bytes
Redo Buffers                7135232 bytes
Database mounted.
Database opened.

50. SQL> alter database drop logfile group 2;

Database altered.

51. SQL> alter database add logfile group 2 ('+DG1') size 100M;

Database altered.

52. SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         1          1          4  104857600          1 NO  ACTIVE
       580018 27-FEB-13

         2          1          5  104857600          1 NO  CURRENT
       580786 27-FEB-13

         3          1          1   52428800          1 NO  INACTIVE
       534907 27-FEB-13


53. SQL> alter database drop logfile group 3;
   
 Database altered.


54. SQL> alter database add logfile group 3 ('+DG1') size 100M;

Database altered.

55. RMAN> BACKUP AS COPY SPFILE FORMAT '+DG1';

Starting backup at 27-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=134 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 27-FEB-13
channel ORA_DISK_1: finished piece 1 at 27-FEB-13
piece handle=+DG1/srbdb/backupset/2013_02_27/nnsnf0_tag20130227t134809_0.267.808
494491 tag=TAG20130227T134809 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 27-FEB-13.


56. ASMCMD> find -t CONTROLFILE  +DG1 *

+DG1/SRBDB/CONTROLFILE/Backup.262.808493133
+DG1/SRBDB/CONTROLFILE/backup.256.808492297


57. SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DG1/srbdb/datafile/users.261.808493131
+DG1/srbdb/datafile/sysaux.258.808493083
+DG1/srbdb/datafile/undotbs1.260.808493125
+DG1/srbdb/datafile/system.257.808493019
+DG1/srbdb/datafile/example.259.808493109

Comments