1. Create pfile from spfile; 2. Back up the data files to the Oracle ASM disk group. RUN { ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; ALLOCATE CHANNEL dev2 DEVICE TYPE DISK; ALLOCATE CHANNEL dev3 DEVICE TYPE DISK; ALLOCATE CHANNEL dev4 DEVICE TYPE DISK; BACKUP AS COPY INCREMENTAL LEVEL 0 DATABASE FORMAT '+DATA' TAG 'ORA_ASM_MIGRATION'; } 3. Archive online log RMAN> SQL "ALTER SYSTEM ARCHIVE LOG CURRENT"; 4. Backup spfile RMAN> BACKUP AS BACKUPSET SPFILE; 5. Restore spfile in ASM RMAN> SHUTDOWN IMMEDIATE; RMAN> STARTUP MOUNT; RMAN> RESTORE SPFILE TO '+DATA/spfilesid.ora'; RMAN> SHUTDOWN IMMEDIATE; 6. Set Oracle Managed Files initialization parameters to Oracle ASM locations. SQL> STARTUP FORCE NOMOUNT; SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST='+DATA' SID='*'; SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=100G SID='*'; SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='+FLASH' SID='*'; 7. Set the CONTROL_FILES initialization parameter to Oracle ASM locations. SQL> STARTUP FORCE NOMOUNT; SQL> ALTER SYSTEM SET CONTROL_FILES='+DATA','+FLASH' SCOPE=SPFILE SID='*'; 8. Migrate the control file to Oracle ASM and mount the control file. RMAN> STARTUP FORCE NOMOUNT; RMAN> RESTORE CONTROLFILE FROM 'original_cf_name'; RMAN> ALTER DATABASE MOUNT; 9. Migrate the data files to Oracle ASM. SWITCH DATABASE TO COPY; RUN { ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; ALLOCATE CHANNEL dev2 DEVICE TYPE DISK; ALLOCATE CHANNEL dev3 DEVICE TYPE DISK; ALLOCATE CHANNEL dev4 DEVICE TYPE DISK; RECOVER DATABASE; } 10. Drop the tempfiles and re-create them in Oracle ASM. If you get following error, bounce the database and redo it. ORA-25152: TEMPFILE cannot be dropped at this time SQL> ALTER DATABASE TEMPFILE 'tempfile_name' DROP; SQL> ALTER TABLESPACE temp_tbs_name ADD TEMPFILE; 11. Migrate the online redo log files. SET SERVEROUTPUT ON; DECLARE CURSOR rlc IS SELECT GROUP# GRP, THREAD# THR, BYTES, 'NO' SRL FROM V$LOG UNION SELECT GROUP# GRP, THREAD# THR, BYTES, 'YES' SRL FROM V$STANDBY_LOG ORDER BY 1; stmt VARCHAR2(2048); BEGIN FOR rlcRec IN rlc LOOP IF (rlcRec.srl = 'YES') THEN stmt := 'ALTER DATABASE ADD STANDBY LOGFILE THREAD ' || rlcRec.thr || ' SIZE ' || rlcRec.bytes; EXECUTE IMMEDIATE stmt; stmt := 'ALTER DATABASE DROP STANDBY LOGFILE GROUP ' || rlcRec.grp; EXECUTE IMMEDIATE stmt; ELSE stmt := 'ALTER DATABASE ADD LOGFILE THREAD ' || rlcRec.thr || ' SIZE ' || rlcRec.bytes; EXECUTE IMMEDIATE stmt; BEGIN stmt := 'ALTER DATABASE DROP LOGFILE GROUP ' || rlcRec.grp; DBMS_OUTPUT.PUT_LINE(stmt); EXECUTE IMMEDIATE stmt; EXCEPTION WHEN OTHERS THEN EXECUTE IMMEDIATE 'ALTER SYSTEM SWITCH LOGFILE'; EXECUTE IMMEDIATE 'ALTER SYSTEM CHECKPOINT GLOBAL'; EXECUTE IMMEDIATE stmt; END; END IF; END LOOP; END; / Reference : http://docs.oracle.com/cd/E11882_01/server.112/e18951/asm_rman.htm#BABJAFIF
Showing posts with label ASM. Show all posts
Showing posts with label ASM. Show all posts
Friday, June 14, 2013
migrate oracle database to ASM using RMAN
Thursday, June 6, 2013
Re-create corrupted ASM disks
Problem description: Following 3 disks can see via OS but not ASM: OCRVOTED01 OCRVOTED02 OCRVOTED03 # multipath -l|grep OCR shared_asm_OCRVOTED01 (1HITACHI_770140123364) dm-24 HITACHI,DF600F shared_asm_OCRVOTED02 (1HITACHI_770140123365) dm-25 HITACHI,DF600F shared_asm_OCRVOTED03 (1HITACHI_770140123366) dm-26 HITACHI,DF600F shared_asm_OCRVOTED04 (1HITACHI_770140123367) dm-27 HITACHI,DF600F shared_asm_OCRVOTED05 (1HITACHI_770140123368) dm-28 HITACHI,DF600F # /etc/init.d/oracleasm listdisks |grep OCR OCRVOTED04 OCRVOTED05 Cause: Disks are corrupted Action Plan: 1. Try to recreate asm disk /etc/init.d/oracleasm createdisk OCRVOTED01 /dev/mapper/shared_asm_OCRVOTED01 Marking disk "OCRVOTED01" as an ASM disk: [FAILED] found following message from /var/log/oracleasm Device "/dev/mapper/shared_asm_OCRVOTED01" is already labeled for ASM disk "" 2. Overwrite the ASM header information on the disk. This can be achieved with the UNIX command dd. The following command will write 100x1024b blocks to the specified raw device: dd if=/dev/zero of=/dev/mapper/shared_asm_OCRVOTED01 bs=1024 count=100 dd if=/dev/zero of=/dev/mapper/shared_asm_OCRVOTED02 bs=1024 count=100 dd if=/dev/zero of=/dev/mapper/shared_asm_OCRVOTED03 bs=1024 count=100 3. Recreate asm disks /etc/init.d/oracleasm createdisk OCRVOTED01 /dev/mapper/shared_asm_OCRVOTED01 /etc/init.d/oracleasm createdisk OCRVOTED02 /dev/mapper/shared_asm_OCRVOTED02 /etc/init.d/oracleasm createdisk OCRVOTED03 /dev/mapper/shared_asm_OCRVOTED03 4. Run oracleasm scandisks on both nodes /etc/init.d/oracleasm scandisks 5. Verify # /etc/init.d/oracleasm listdisks |grep OCR OCRVOTED01 OCRVOTED02 OCRVOTED03 OCRVOTED04 OCRVOTED05
Find mapping of ASM disks to Physical Devices
Query asmdisk to get the major - minor numbers $ /etc/init.d/oracleasm querydisk -d OCRVOTED04 Disk "OCRVOTED04" is a valid ASM disk on device [253, 27] Match the number to physical device $ ls -l /dev|grep 253|grep 27 brw-rw---- 1 root root 253, 27 Jun 2 00:50 dm-27
Thursday, May 30, 2013
How to setup ACFS manually
You can use ASMCA to setup ACFS, below are the steps to setup it manually: Create Diskgroups 1 CREATE DISKGROUP ACFS_DATA EXTERNAL REDUNDANCY 2 DISK 'ORCL:ACFSVOL1' NAME ACFSVOL1 3 ATTRIBUTE 'au_size'='1M', 4 'compatible.asm' = '11.2', 5 'compatible.rdbms' = '11.2', 6 'compatible.advm' = '11.2'; Load ACFS Drivers Validate ACFS drivers, #lsmod |grep oracle oracleacfs 1734520 0 oracleadvm 242048 0 oracleoks 295248 2 oracleacfs,oracleadvm oracleasm 84136 1 If you don't see oracleacfs, oracleadvm and oracleoks, load the ACFS Driver: $GRID_HOME/bin/acfsload start –s Create the Dynamic volume on ACFS 1 sqlplus / as sysasm 2 alter diskgroup ACFS_DATA add volume acfsvol_01 size 100G; 3 4 select VOLUME_NAME, VOLUME_DEVICE from v$asm_volume; 5 6 VOLUME_NAME VOLUME_DEVICE 7 ------------------------------ ------------------------------ 8 ACFSVOL_01 /dev/asm/acfsvol_01-335 Create Filesystem for ACFS Volume Device As root user, to create a filesystem on linux for the ACFS volume device mkfs -t acfs -b 4k /dev/asm/acfsvol_01-335 mkfs.acfs: version = 11.2.0.1.0.0 mkfs.acfs: on-disk version = 39.0 mkfs.acfs: volume = /dev/asm/acfsvol_01-335 mkfs.acfs: volume size = 268435456 Mount ACFS Filesystem mkdir -p /datapump mount -t acfs /dev/asm/acfsvol_01-335 /datapump chown oracle:oinstall /datapump df -h to verify. Oracle ACFS Mount Registry Register ACFS mount point to automatic startup ACFS mount devices acfsutil registry -a /dev/asm/acfsvol_01-335 /datapump
Tuesday, May 28, 2013
Dynamical sql to drop all disks from an ASM disk group
set pagesize 0 select 'ALTER DISKGROUP '|| dg.name || ' DROP DISK '|| d.name || ';' from v$asm_disk d join v$asm_diskgroup dg on (d.group_number = dg.group_number) where dg.name = '&diskgroup_name';
Monday, May 20, 2013
Add a new node, Run root.sh failed with " Configuration of ASM ... failed "
problem description Adding 3rd nodes on a 2 node cluster, execute root.sh on 3rd nodes. $ sudo /u01/app/crs/11.2.0.3/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/crs/11.2.0.3 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/crs/11.2.0.3/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation OLR initialization - successful Adding Clusterware entries to inittab CRS-2672: Attempting to start 'ora.mdnsd' on 'rac3-lnx' CRS-2676: Start of 'ora.mdnsd' on 'rac3-lnx' succeeded CRS-2672: Attempting to start 'ora.gpnpd' on 'rac3-lnx' CRS-2676: Start of 'ora.gpnpd' on 'rac3-lnx' succeeded CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac3-lnx' CRS-2672: Attempting to start 'ora.gipcd' on 'rac3-lnx' CRS-2676: Start of 'ora.cssdmonitor' on 'rac3-lnx' succeeded CRS-2676: Start of 'ora.gipcd' on 'rac3-lnx' succeeded CRS-2672: Attempting to start 'ora.cssd' on 'rac3-lnx' CRS-2672: Attempting to start 'ora.diskmon' on 'rac3-lnx' CRS-2676: Start of 'ora.diskmon' on 'rac3-lnx' succeeded CRS-2676: Start of 'ora.cssd' on 'rac3-lnx' succeeded Symptoms found following error in ocssd.log 2013-05-20 18:28:17.654: [ SKGFD][1098938688]ERROR: -15(asmlib ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so op asm_open error Operation not permitted ) 2013-05-20 18:28:17.654: [ SKGFD][1098938688]ERROR: -15(asmlib ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so op asm_open error Operation not permitted ) 2013-05-20 18:28:17.654: [ SKGFD][1098938688]ERROR: -15(asmlib ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so op asm_open error Operation not permitted ) 2013-05-20 18:28:17.654: [ SKGFD][1098938688]ERROR: -15(asmlib ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so op asm_open error Operation not permitted ) 2013-05-20 18:28:17.654: [ CSSD][1098938688]clssnmvDiskVerify: Successful discovery of 0 disks 2013-05-20 18:28:17.655: [ CSSD][1098938688]clssnmCompleteInitVFDiscovery: Completing initial voting file discovery 2013-05-20 18:28:17.655: [ CSSD][1098938688]clssnmvFindInitialConfigs: No voting files found 2013-05-20 18:28:17.655: [ CSSD][1098938688](:CSSNM00070:)clssnmCompleteInitVFDiscovery: Voting file not found. Retrying discovery in 15 seconds Cause By default, Oracle Database ASM instance parameter 'ASM_DISKSTRING' is unset and therefore uses a default value of '*'. This means that the ASM instance scans both/dev/raw/and/dev/oracleasm/disks/directories when searching for oracle ASM disks. When using a combination of oracleasm disks (/dev/oracleasm/disks/*) with raw devices (/dev/raw/*), in particular where some raw devices are not owned by or accessible to the oracle user) as well as ASM instance parameter 'ASM_DISKSTRING' with an unspecified value, error ORA-15186 is likely to occur. Solution 1. either edit the file /etc/sysconfig/oracleasm-_dev_oracleasm and change the lines: ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" to ORACLEASM_SCANORDER="dm" ORACLEASM_SCANEXCLUDE="sd" or alternatively run the following command (as user root) /usr/sbin/oracleasm configure -i -e -u user -g group -o "dm" -x "sd" 2. stop & restart ASMLIB as user root using: /usr/sbin/oracleasm exit /usr/sbin/oracleasm init 3. restart CRS or reboot node The above steps need to be executed on all nodes
Wednesday, October 17, 2012
acfsutil size: ACFS-03008: The volume could not be resized.
Error: $ /sbin/acfsutil size +100G /datapump acfsutil size: ACFS-03008: The volume could not be resized. Either the volume expansion's limit has been reached or ASM could not expand the storage. Cause: acfs volume can only be resize 5 times Solution: 1. /bin/umount -t acfs /datapump 2. /sbin/fsck -a -v -y -t acfs /dev/asm/datapumpvol-23 3. /bin/mount -t acfs /dev/asm/datapumpvol-23 /datapump
Monday, July 30, 2012
Verify ASMLIB configuration
Usually System Admin will install ASMLIB and create ASM disks
Here are a few useful command to verify ASMLIB was configured properly
1 Verfiy rpm installation rpm -qa|grep oracleasm 2. ASM mount point creation df -ha|grep oracleasm oracleasmfs 0 0 0 - /dev/oracleasm 3 Query and liks ASM disk /etc/init.d/oracleasm listdisks /etc/init.d/oracleasm querydisk4. Discover asm disks using string 'ORCL:*' /usr/sbin/oracleasm-discover 'ORCL:*' 5. Simulate the disk discovery from the operating system level, using tool kfod. ($ORACLE_HOME/bin). $ORACLE_HOME/bin/kfod asm_diskstring='ORCL:*' disks=all
Subscribe to:
Posts (Atom)