Manually migrate to ASM with minimal downtime

select * from v$version;
select log_mode from v$database;
select name from v$datafile UNION select name from v$tempfile;
select name from v$controlfile;
select member from v$logfile;

RMAN> backup incremental level 0 as copy database tag ‘ASM_Migration’ format ‘+DATADG’;

SQL> alter system set db_create_file_dest=’+DATADG’;
SQL> alter system set db_recovery_file_dest_size=10G;
SQL> alter system set db_recovery_file_dest=’+DATADG’;
SQL> alter database enable block change tracking;

SQL> create spfile=’+DATADG/spfilemydb.ora’ from memory;

SQL> ho vi /oraapp/oracle/product/11.2.0.3/dbhome_1/dbs/initmydb.ora
spfile=’+DATADG/spfilemydb.ora’

SQL> alter system archive log current;
SQL> alter system archive log current;

RMAN> backup incremental level 1 for recover of copy with tag ‘ASM_Migration’ database;
RMAN> recover copy of database with tag ‘ASM_Migration’;

Now we shutdown the database

SQL> startup force nomount;
SQL> show parameter control
SQL> alter system set control_files=’+DATADG’ scope=spfile;
SQL> startup force nomount;

RMAN> restore controlfile from ‘/oradata/mydb/control01.ctl’;
RMAN> alter database mount;
RMAN> switch database to copy;
RMAN> recover database;
RMAN> alter database open;

# recreate temp files
SQL> alter database tempfile ‘/oradata/mydb/temp01.dbf’ drop;
SQL> alter tablespace temp add tempfile size 50M autoextend on;

# recreate online logs
alter database add logfile size 50M;
alter database add logfile size 50M;
alter database add logfile size 50M;

alter system switch logfile;
alter system checkpoint;
select group#, status from v$log; — wait until 1,2,3 INACTIVE
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s