Upgrade Oracle 9i RAC to Oracle 10g RAC - Page 5January 31, 2006 by Vincent ChanStep 5: Migrate Database to ASM (Optional Step)You can continue running your RAC database on OCFS or migrate it to Automated Storage Management (ASM). ASM is the recommended shared storage solution for Oracle RAC database. It eliminates the complexity of managing database storage and its striping and mirroring capabilities provide storage performance and data-loss protection. In this section, we will provide a step-by-step procedure for migrating your database to ASM. 5a. Download ASM RPMsDownload the ASM RPMs for your kernel from http://www.oracle.com/technology/tech/linux/asmlib/index.html
5b. Install ASM RPMsInstall the ASM RPMs as the root user. [root@salmon1]# rpm -Uvh oracleasm-2.4.21-27.EL-1.0.4-2.i686.rpm \ oracleasmlib-2.0.0-1.i386.rpm \ oracleasm-support-2.0.0-1.i386.rpm 5c. Configure ASMConfigure the ASM Library driver as the root user. [root@salmon1]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
5d. Create ASM disksAs the root user on any node, execute the following commands to create the ASM disks. /etc/init.d/oracleasm createdisk VOL1 /dev/sdg5 /etc/init.d/oracleasm createdisk VOL2 /dev/sdg6 /etc/init.d/oracleasm createdisk VOL3 /dev/sdg7 /etc/init.d/oracleasm createdisk VOL4 /dev/sdg8 /etc/init.d/oracleasm createdisk VOL5 /dev/sdg9 /etc/init.d/oracleasm createdisk VOL6 /dev/sdg10 /etc/init.d/oracleasm createdisk VOL7 /dev/sdg11 /etc/init.d/oracleasm createdisk VOL8 /dev/sdg12 /etc/init.d/oracleasm createdisk VOL9 /dev/sdg13 /etc/init.d/oracleasm createdisk VOL10 /dev/sdg14 Verify that the ASM disks are visible from every node. [root@salmon1]# /etc/init.d/oracleasm listdisks VOL1 VOL2 VOL3 VOL4 VOL5 VOL6 VOL7 VOL8 VOL9 VOL10 [root@salmon1]# /etc/init.d/oracleasm scandisks Scanning system for ASM disks [ OK ] 5e. Create ASM init.oraOn the first node, create an init+ASM1A.ora file in $ORACLE_HOME/dbs with the following parameters: #asm_diskgroups='DG1', 'DG2', 'RECOVERYDEST' asm_diskstring='ORCL:VOL*' background_dump_dest=/u01/app/oracle/admin/+ASM/bdump core_dump_dest=/u01/app/oracle/admin/+ASM/cdump user_dump_dest=/u01/app/oracle/admin/+ASM/udump instance_type=asm large_pool_size=16M remote_login_passwordfile=exclusive +ASM1A.instance_number=1 +ASM1B.instance_number=2 5f. Create ASM password fileCreate the password files, orapw+ASM1A and orapw+ASM1B in $ORACLE_HOME/dbs on the first and second node respectively. [oracle@salmon1]$ cd $ORACLE_HOME/dbs [oracle@salmon1]$ orapwd file=orapw+ASM1A password=sys entries=5 [oracle@salmon2]$ cd $ORACLE_HOME/dbs [oracle@salmon2]$ orapwd file=orapw+ASM1B password=sys entries=5 5g. Create the first ASM instance[oracle@salmon1]$ mkdir -p /u01/app/oracle/admin/+ASM/bdump [oracle@salmon1]$ mkdir -p /u01/app/oracle/admin/+ASM/cdump [oracle@salmon1]$ mkdir -p /u01/app/oracle/admin/+ASM/udump [oracle@salmon1]$ export ORACLE_SID=+ASM1A [oracle@salmon1]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 1 04:07:17 2005 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ASM instance started Total System Global Area 96468992 bytes Fixed Size 1217908 bytes Variable Size 70085260 bytes ASM Cache 25165824 bytes ORA-15110: no diskgroups mounted 5h. Create the ASM instance spfileCreate a spfile and restart the ASM instance. Any newly created disk groups will automatically be added to the spfile. SQL> create spfile from pfile; File created. 5i. Create ASM disk groupsCreate three disk groups: DG1, DG2 and RECOVERYDEST. DG1 and DG2 will be used to store Oracle data files and redo logs. RECOVERYDEST will be used as the flash recovery area. SQL> create diskgroup dg1 normal redundancy 2 failgroup fg1a disk 3 'ORCL:VOL1','ORCL:VOL2' 4 failgroup fg1b disk 5 'ORCL:VOL3','ORCL:VOL4'; Diskgroup created. SQL> create diskgroup dg2 normal redundancy 2 failgroup fg2a disk 3 'ORCL:VOL5','ORCL:VOL6' 4 failgroup fg2b disk 5 'ORCL:VOL7','ORCL:VOL8'; Diskgroup created. SQL> create diskgroup recoverydest normal redundancy 2 failgroup fgrd1 disk 3 'ORCL:VOL9' 4 failgroup fgrd2 disk 5 'ORCL:VOL10'; Diskgroup created. NAME TYPE VALUE ------------------------------------ ----------- ---------------------------- asm_diskgroups string DG1, DG2, RECOVERYDEST SQL> select name,total_mb from v$asm_diskgroup; NAME TOTAL_MB -------------------- ------------- DG1 36864 DG2 36864 RECOVERYDEST 73728 SQL> select name,path,failgroup from v$asm_disk; NAME PATH FAILGROUP ---------- -------------- --------------- VOL1 ORCL:VOL1 FG1A VOL10 ORCL:VOL10 FGRD2 VOL2 ORCL:VOL2 FG1A VOL3 ORCL:VOL3 FG1B VOL4 ORCL:VOL4 FG1B VOL5 ORCL:VOL5 FG2A VOL6 ORCL:VOL6 FG2A VOL7 ORCL:VOL7 FG2B VOL8 ORCL:VOL8 FG2B VOL9 ORCL:VOL9 FGRD1 5j. Configure flash recovery areaSQL> connect sys/sys@prod1a as sysdba Connected. SQL> alter database disable block change tracking; alter database disable block change tracking * ERROR at line 1: ORA-19759: block change tracking is not enabled SQL> alter system set db_recovery_file_dest_size=72G; System altered. SQL> alter system set db_recovery_file_dest='+RECOVERYDEST'; System altered. 5k. Migrate data files to ASMYou must use RMAN to migrate the data files to ASM disk groups. All data files will be migrated to the newly created disk group, DG1. The redo logs and control files are created in DG1 and DG2. SQL> connect sys/sys@prod1a as sysdba Connected. SQL> alter system set db_create_file_dest='+DG1'; System altered. SQL> alter system set control_files='+DG1/cf1.dbf' scope=spfile; System altered. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options [oracle@salmon1 oracle]$ srvctl stop database -d prod1 [oracle@salmon1 oracle]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Mon Aug 1 04:47:55 2005 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database (not started) RMAN> startup nomount Oracle instance started Total System Global Area 528482304 bytes Fixed Size 1220360 bytes Variable Size 310378744 bytes Database Buffers 209715200 bytes Redo Buffers 7168000 bytes RMAN> restore controlfile from '/ocfs/prod1/control01.ctl'; Starting restore at 01-AUG-05 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=204 instance=prod1a devtype=DISK channel ORA_DISK_1: copied control file copy output filename=+DG1/cf1.dbf Finished restore at 01-AUG-05 RMAN> alter database mount; database mounted released channel: ORA_DISK_1 RMAN> backup as copy database format '+DG1'; Starting backup at 01-AUG-05 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=204 instance=prod1a devtype=DISK channel ORA_DISK_1: starting datafile copy input datafile fno=00001 name=/ocfs/prod1/system01.dbf output filename=+DG1/prod1/datafile/system.257.565159841 tag=TAG20050801T045038 recid=1 stamp=565159936 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:46 channel ORA_DISK_1: starting datafile copy input datafile fno=00002 name=/ocfs/prod1/undotbs1.dbf output filename=+DG1/prod1/datafile/undotbs1.258.565159949 tag=TAG20050801T045038 recid=2 stamp=565160001 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:56 channel ORA_DISK_1: starting datafile copy input datafile fno=00005 name=/ocfs/prod1/undotbs2.dbf output filename=+DG1/prod1/datafile/undotbs2.259.565160005 tag=TAG20050801T045038 recid=3 stamp=565160052 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:55 channel ORA_DISK_1: starting datafile copy input datafile fno=00007 name=/ocfs/prod1/sysaux01.dbf output filename=+DG1/prod1/datafile/sysaux.260.565160061 tag=TAG20050801T045038 recid=4 stamp=565160084 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting datafile copy copying current control file output filename=+DG1/prod1/controlfile/backup.261.565160095 tag=TAG20050801T045038 recid=5 stamp=565160101 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile fno=00003 name=/ocfs/prod1/users01.dbf output filename=+DG1/prod1/datafile/users.262.565160103 tag=TAG20050801T045038 recid=6 stamp=565160108 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08 channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=/ocfs/prod1/drsys01.dbf output filename=+DG1/prod1/datafile/drsys.263.565160111 tag=TAG20050801T045038 recid=7 stamp=565160115 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile fno=00006 name=/ocfs/prod1/apps_d01.dbf output filename=+DG1/prod1/datafile/apps_d.264.565160121 tag=TAG20050801T045038 recid=8 stamp=565160122 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 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 01-AUG-05 channel ORA_DISK_1: finished piece 1 at 01-AUG-05 piece handle=+DG1/prod1/backupset/2005_08_01/nnsnf0_tag20050801t045038_0.265.565160131 tag=TAG20050801T045038 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:17 Finished backup at 01-AUG-05 RMAN> switch database to copy; datafile 1 switched to datafile copy "+DG1/prod1/datafile/system.257.565159841" datafile 2 switched to datafile copy "+DG1/prod1/datafile/undotbs1.258.565159949" datafile 3 switched to datafile copy "+DG1/prod1/datafile/users.262.565160103" datafile 4 switched to datafile copy "+DG1/prod1/datafile/drsys.263.565160111" datafile 5 switched to datafile copy "+DG1/prod1/datafile/undotbs2.259.565160005" datafile 6 switched to datafile copy "+DG1/prod1/datafile/apps_d.264.565160121" datafile 7 switched to datafile copy "+DG1/prod1/datafile/sysaux.260.565160061" RMAN> alter database open; database opened RMAN> exit SQL> connect sys/sys@prod1a as sysdba Connected. SQL> select tablespace_name, file_name from dba_data_files; TABLESPACE_NAME FILE_NAME --------------- --------------------------------------------- SYSTEM +DG1/prod1/datafile/system.257.565159841 UNDOTBS1 +DG1/prod1/datafile/undotbs1.258.565159949 USERS +DG1/prod1/datafile/users.262.565160103 DRSYS +DG1/prod1/datafile/drsys.263.565160111 UNDOTBS2 +DG1/prod1/datafile/undotbs2.259.565160005 APPS_D +DG1/prod1/datafile/apps_d.264.565160121 SYSAUX +DG1/prod1/datafile/sysaux.260.565160061 7 rows selected. 5l. Migrate temp tablespace to ASMSQL> select file_name from dba_temp_files; FILE_NAME --------------------------------------------- /ocfs/prod1/temp01.dbf SQL> alter database tempfile '/ocfs/prod1/temp01.dbf' drop including datafiles; Database altered. SQL> alter tablespace temp add tempfile size 100M; Tablespace altered. SQL> select file_name from dba_temp_files; FILE_NAME --------------------------------------------- +DG1/prod1/tempfile/temp.266.565165327 |