Ø Create the
database in a regular file system with
name SRSPASM(archivelog and spfile)
Ø Prepare the database for migration
Before the database is migrated to
ASM, the below database information should be collected.
·
Store the DBID:
If
the database doesn’t have the recovery catalog, then the DBID may be used
during the control file restore while migration(we need to set the DBID when we
restore the controlfile).
SQL>SELECT
DBID FROM V$DATABASE;
DBID
---------- 2839631796 |
·
Make a note of the
datafiles:
Make a
note of the datafiles which may use in the future if the database is to be
reverted back to normal filesystem.
SQL>SELECT NAME FROM V$DATAFILE;
SQL>SELECT NAME FROM
V$CONTROLFILES;
|
Ø Switch the logfile.
SQL> ALTER
SYSTEM SWITCH LOGFILE;
|
Ø Connect to rman and backup the
database files to the ASM diskgroups.
[oracle@srspasm
~]$ rman target /
RMAN>
BACKUP AS COPY DATABASE FORMAT='+dg1';
RMAN>
BACKUP CURRENT CONTROLFILE FORMAT='/u01/oracle/srspasm/contbk.ctl';
RMAN>SHUT
IMMEDIATE;
|
Note: It is better to take the
backup when no users are connected to the database(Off hours). So there is no
need to recover the database. If the backup is done during the working hours
then the database has to be recovered after the migration.
Ø Modify the server parameter file:
change the control file parameter.
oracle@system8
~]$ vi /u01/oracle/product/10.2.0/db_1/dbs/initsrspasm.ora
modify the control file
control_files='+DG1',’+FRA’
|
Ø Shutdown the database, startup in nomount
state and restore the controlfile.
[oracle@system8
~]$ sqlplus / as sysdba
STARTUP
NOMOUNT
CONNECT TO RMAN
RMAN>
RESTORE CONTROLFILE FROM ‘/u01/oracle/srspasm/contbk.ctl';
RMAN>
ALTER DATABASE MOUNT;
RMAN>
SWITCH DATABASE TO COPY;
RMAN>
RECOVER DATABASE;
RMAN>
ALTER DATABASE OPEN RESETLOGS;
|
Ø Datafiles and control files are in
disk groups. Now convert log files and sp file and archive logs to disk groups.
·
spfile convertion:
SQL>
CREATE SPFILE='+DG1' FROM PFILE;
[oracle@system8
dbs]$ vi initsrspasm.ora
remove all parameters and set
spfile='+DG1/srspasm/parameterfile/spfile.273.685995011'
[oracle@system8
dbs]$ rm spfilesrspasm.ora
SQL>
shut immediate
SQL>
startup
ORACLE
instance started.
Database
opened.
|
·
Convert log files to disk groups:
SQL>
ALTER DATABASE ADD LOGFILE GROUP 3 ('+DG1') SIZE 10M, GROUP 4 ('+DG1') SIZE 10M,GROUP
5 ('+DG1') SIZE 10M;
DATABASE
ALTERED.
Drop the groups which are in non asm
diskgroups first make it inactive.
SQL>SELECT
GROUP#,STATUS FROM V$LOG;
SQL>
ALTER DATABASE DROP LOGFILE GROUP 1;
database
altered.
SQL>
ALTER DATABASE DROP LOGFILE GROUP 2;
database
altered.
SQL>
SELECT MEMBER FROM V$LOGFILE;
MEMBER
-----------------------------------------------------------------------
+DG1/srspasm/onlinelog/group_3.274.686047325
+DG1/srspasm/onlinelog/group_4.275.686047325
+DG1/srspasm/onlinelog/group_5.276.686047325
|
·
convert archive logfiles to disk
groups:
SQL>
SHO PARAMETER LOG_ARCHIVE_DEST_1
NAME TYPE VALUE
------------------------------------
----------- ------------------------------
log_archive_dest_1 string location=/u01/oracle/srspasm/a
rch
log_archive_dest_10 string
SQL>
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='location=+DG1';
System
altered.
SQL>
SHO PARAMETER LOG_ARCHIVE_DEST_1
NAME TYPE VALUE
------------------------------------
----------- ------------------------------
log_archive_dest_1 string location=+DG1
log_archive_dest_10 string
SQL>!
|
Ø Take a fresh full database backup using
RMAN
No comments:
Post a Comment