Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How do you migrate oracle database from ASM to Non ASM

 In this tutorial  we  explained step by step  Migration from ASM oracle database to NON ASM oracle database 
Simple Steps of database migration From ASM to Non ASM:

  • backup the database and archivelog with controlfile using rman utility
  • SET THE control_files and db_create_file_dest
  • shutdown the database
  • startup the nomount mode and Restore the control file
  • mount the database
  • create the directory for datafile
  • Backup Database Into FILE SYSTEM
  • Switch All Disk Datafile To The New File System Location
  • recover the database
  • open the database using resetlogs
--check the asm disk state
SQL>  select name, path, mode_status, state, disk_number from v$asm_disk;

NAME                 PATH                           MODE_ST STATE    DISK_NUMBER
-------------------- ------------------------------ ------- -------- -----------
                     ORCL:DISK1                     ONLINE  NORMAL             4
                     ORCL:DISK2                     ONLINE  NORMAL             5
                     ORCL:DISK3                     ONLINE  NORMAL             6
                     ORCL:DISK4                     ONLINE  NORMAL             7
DG1_0000             /dev/raw/raw1                  ONLINE  NORMAL             0
DG1_0001             /dev/raw/raw2                  ONLINE  NORMAL             1
FG12_0001            /dev/raw/raw4                  ONLINE  NORMAL             1
FG12_0000            /dev/raw/raw3                  ONLINE  NORMAL             0
STEP 1. SET THE control_files and db_create_file_dest PARAMETER BEFORE BACKUP IF NOT SET  IN  ASM DATABASE AND ALSO ENABLE ARCHIVELOG MODE
SQL>
alter system set control_files='+DG1/kfc/controlfile/Current.276.918365369' scope=spfile;
alter system set db_create_file_dest='+DG1' scope=spfile;
alter database close;
--The ALTER DATABASE ARCHIVELOG command can only be performed if the database in mounted  mode.
alter database archivelog;
create spfile from pfile;
-- BACKUP THE UPDATED pfile 
create pfile from spfile;
startup force;

SQL>  sho parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/10.2.0
                                                 /db_1/dbs/spfilekfc.ora
SQL>  sho parameter pfile 

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/10.2.0
                                                 /db_1/dbs/spfilekfc.ora

STEP 2.BACKUP THE DATABASE WITH ARCHIVELOG  USING RAMAN BEFORE  TAKING BACKUP ENABLE THE CONTROLFILE AUTOBACKUP ON.
RMAN>
rman target /
CONFIGURE CONTROLFILE AUTOBACKUP on;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/rman_control%F';
backup database plus archivelog;

STEP 3.SET THE DB_control_files and db_create_file_dest PARAMETERS TO THE  RELEVENT FILE.
SQL>
alter system set control_files='/home/oracle/kfc/oradata/control/control01.ctl' scope=spfile;
alter system set db_create_file_dest='/home/oracle/kfc/oradata/data/' scope=spfile;
STEP 3.SHUT DOWN THE TARGET DATABASE AND STARTUP THE DATABASE UNTIL NOMOUNT STAGE THEN CONNECT TO RMAN UTILITY.
shut immediate;
startup nomount;
[oracle@teng dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 28 09:14:08 2016
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: kfc (not mounted)
STEP 4.RESTORE THE CONTROLFILE FROM RMAN CONTROL FILE BACKUP LOCATION('/home/oracle/rman_control%F';)
RMAN>restore controlfile from '/home/oracle/rman_controlc-1039361779-20160728-06';

Starting restore at 28-JUL-16
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output filename=/home/oracle/kfc/oradata/control/control01.ctl
Finished restore at 28-JUL-16

STEP 5.MOUNT THE DATABASE USING RESTORED CONTROLFILE(DATABASE WOULD NOT BE MOUNT IF NO CONTROLFILE)
RMAN> alter database mount;
 database mounted
 released channel: ORA_DISK_1
STEP 6.CREATE DIRECTORY FOR DATAFILE WHERE YOU WANT TO STORE YOUR DATAFILE THEN BACKUP DATABASE INTO DUMMY DIRECTORY
RMAN>backup as copy database format '/home/oracle/dummy/%u.dbf';
Starting backup at 28-JUL-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=35 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DG1/kfc/datafile/system.279.918365379
output filename=/home/oracle/dummy/0rrbqn03.dbf tag=TAG20160728T092523 recid=1 stamp=918379601
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:21
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=+DG1/kfc/datafile/sysaux.280.918365471
output filename=/home/oracle/dummy/0srbqn2k.dbf tag=TAG20160728T092523 recid=2 stamp=918379654
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:54
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=+DG1/kfc/datafile/tbs.281.918377435
output filename=/home/oracle/dummy/0trbqn4a.dbf tag=TAG20160728T092523 recid=3 stamp=918379676
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:19
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+DG1/kfc/datafile/tbs1.282.918377735
output filename=/home/oracle/dummy/0urbqn4t.dbf tag=TAG20160728T092523 recid=4 stamp=918379690
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:18
Finished backup at 28-JUL-16

RMAN-06497: WARNING: control file is not current, control file autobackup skipped
STEP 7.SWITCH ALL DISK DATAFILE TO THE NEW FILE SYSTEM LOCATION
RMAN> switch database to copy;
datafile 1 switched to datafile copy "/home/oracle/dummy/0rrbqn03.dbf"
datafile 2 switched to datafile copy "/home/oracle/dummy/0srbqn2k.dbf"
datafile 3 switched to datafile copy "/home/oracle/dummy/0trbqn4a.dbf"
datafile 4 switched to datafile copy "/home/oracle/dummy/0urbqn4t.dbf"
STEP 8.RECOVER THE ORACLE DATABASE USING "recover database" COMMAND
RMAN> recover database;
Starting recover at 28-JUL-16
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 52 is already on disk as file +DG1/kfc/onlinelog/group_2.278.918365375
archive log filename=+DG1/kfc/onlinelog/group_2.278.918365375 thread=1 sequence=52
media recovery complete, elapsed time: 00:00:02
Finished recover at 28-JUL-16
STEP 9.OPEN DATABASE USING RESETLOGS
[oracle@teng dbs]$ export ORACLE_SID=kfc
[oracle@teng dbs]$ sqlplus / as sysdba
SQL> alter database open RESETLOGS;

SQL>  select open_mode,name from v$database;
OPEN_MODE  NAME
---------- ---------
READ WRITE KFC

SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/home/oracle/dummy/0rrbqn03.dbf
/home/oracle/dummy/0srbqn2k.dbf
/home/oracle/dummy/0trbqn4a.dbf
/home/oracle/dummy/0urbqn4t.dbf
SQL> select a.TABLESPACE_NAME,b.name from dba_tablespaces a,v$datafile b;
TABLESPACE NAME
---------- -----------------------------------
SYSTEM     /home/oracle/dummy/0rrbqn03.dbf
SYSAUX     /home/oracle/dummy/0rrbqn03.dbf
TBS        /home/oracle/dummy/0rrbqn03.dbf
TBS1       /home/oracle/dummy/0rrbqn03.dbf
SYSTEM     /home/oracle/dummy/0srbqn2k.dbf
SYSAUX     /home/oracle/dummy/0srbqn2k.dbf
TBS        /home/oracle/dummy/0srbqn2k.dbf
TBS1       /home/oracle/dummy/0srbqn2k.dbf
SYSTEM     /home/oracle/dummy/0trbqn4a.dbf
SYSAUX     /home/oracle/dummy/0trbqn4a.dbf
TBS        /home/oracle/dummy/0trbqn4a.dbf

TABLESPACE NAME
---------- -----------------------------------
TBS1       /home/oracle/dummy/0trbqn4a.dbf
SYSTEM     /home/oracle/dummy/0urbqn4t.dbf
SYSAUX     /home/oracle/dummy/0urbqn4t.dbf
TBS        /home/oracle/dummy/0urbqn4t.dbf
TBS1       /home/oracle/dummy/0urbqn4t.dbf

16 rows selected.
WHEN YOU MIGRATION ORACLE ASM TO NON ASM YOU MAY GET SOME FOLLOWING ERRORS:-
SQL> startup
ORA-01261: Parameter db_create_file_dest destination string cannot be translated
ORA-01262: Stat failed on a file destination directory
Linux Error: 2: No such file or directory
solution:-
SQL>create pfile from spfile;
[oracle@teng dbs]$ vi initkfc.ora
change parameter like below.....
    db_create_file_dest='+DG1'

shut immediate;
startup;
alter system set control_files='+DG1/kfc/controlfile/current.276.918365369' scope=spfile; ........TAKE from ASMCMD
-------------------------------------------------------------------------------------------------

STEP 6)SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- ----------
KFC       READ WRITE

SQL> show parameter control_files;
control_files                        string      +DG1/kfc/controlfile/current.2
                                                 76.918365369


SQL> alter system set control_files='+DG1/kfc/controlfile/current.276.918365369' scope=spfile;
alter system set control_files='+DG1/kfc/controlfile/current.276.918365369' scope=spfile
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE specified at startup

solution:-
create spfile from pfile='/home/oracle/kfc/admin/pfile/initkfc.ora';
create pfile from spfile;
create spfile from pfile;
shut immediate;
startup;
ORACLE instance started.
Total System Global Area  629145600 bytes
Fixed Size                  1220964 bytes
Variable Size             171970204 bytes
Database Buffers          452984832 bytes
Redo Buffers                2969600 bytes
ORA-00205: error in identifying control file, check alert log for more info

SQL>alter system set control_files='+DG1/kfc/controlfile/current.276.918365369' scope=spfile;

SQL> startup force;
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size                  1220964 bytes
Variable Size             171970204 bytes
Database Buffers          452984832 bytess
Redo Buffers                2969600 bytes
Database mounted.
Database opened.





THEN BACKUP DATABASE USING RMANs

Comments

Popular posts from this blog

PostgreSQL Pgbadger Installation On Linux

PostgreSQL pgBadger

How to configure Replication Manager (repmgr) ?

7 Steps to configure BDR replication in postgresql

PostgreSQL Sequence