In sweet memories of my ever loving brother "kutty thambi " ARUN KUMAR

Sunday, April 4, 2010

Automated Storage Management (ASM) Pocket Reference Guide

 Automated Storage Management (ASM) Pocket Reference Guide
 by charles kim

ASM Diskgroups
Create Diskgroup
CREATE DISKGROUP disk_group_1 NORMAL
REDUNDANCY
FAILGROUP failure_group_1 DISK
'/devices/diska1' NAME diska1,
'/devices/diska2' NAME diska2,
FAILGROUP failure_group_2 DISK
'/devices/diskb1' NAME diskb1,
'/devices/diskb2' NAME diskb2;

Drop disk groups
DROP DISKGROUP DATA INCLUDING CONTENTS;

Add disks
ALTER DISKGROUP DATA ADD DISK '/dev/sda3';

Drop a disk
ALTER DISKGROUP DATA DROP DISK DATA_0001;

Resize all disks in a disk group
ALTER DISKGROUP DATA RESIZE ALL SIZE 100G;

UNDROP DISKS clause of the ALTER DISKGROUP
ALTER DISKGROUP DATA UNDROP DISKS;

Rebalance diskgroup
ALTER DISKGROUP DATA REBALANCE POWER 5;

Check Diskgroup
ALTER DISKGROUP DATA CHECK;
ALTER DISKGROUP DATA CHECK NOREPAIR;

Diskgroup Metadata Backup
md_backup -b asm_backup.mdb.txt -g data,fra

ASM Specific Init.ora Parameters
*.cluster_database=true
*.asm_diskstring='/dev/sd*1'
*.instance_type=asm
*.shared_pool_size=100M
*.large_pool_size=80M
*.db_cache_size=60M
*.asm_diskgroups='DATA','FRA'

Initialize ASM for non-RAC
./localconfig add

Manually start CSSD (non-RAC)
/etc/init.d/init.cssd start

Manually stop CSSD ( non-RAC)
/etc/init.d/init.cssd stop

Resetting CSS to new Oracle Home
localconfig reset /apps/oracle/product/11.1.0/ASM

ASM Dictionary Views
v$asm_alias  ---list all aliases in all currently mounted diskgroups
v$asm_client ---list all the databases currently accessing the diskgroups
v$asm_disk ----lists all the disks discovered by the ASM instance.
v$asm_diskgroup ---Lists all the diskgroups discovered by the ASM instance.
v$asm_file ---Lists all files that belong to diskgroups mounted by the ASM instance.
v$asm_operation ---Reports information about current active operations. Rebalance activity is reported in this view.
v$asm_template ---Lists all the templates currently mounted by the ASM instance.
v$asm_diskgroup_stat ---same as v$asm_diskgroup but does discover new disgroups. Use this view instead of v$asm_diskgroup.
v$asm_disk_stat ---same as v$asm_disk but does not discover new disks. Use this view instead of v$asm_disk.

srvctl commands
ADD
srvctl add asm -n rac3 -i +ASM3 -o /opt/oracle/app/product/10.2.0/asm

ENABLE
srvctl enable asm -n rac3 -i +ASM3

DISABLE
srvctl disable asm -n rac3 -i +ASM3

START
srvctl start asm -n rac3

STOP
srvctl stop asm -n rac3

CONFIG
srvctl config asm -n rac1

REMOVE
srvctl remove asm -n rac1
STATUS
srvctl status asm
srvctl status asm -n rac1

MODIFY
srvctl modify asm -o -n rac1

ASMLIB commands ( as root)
/etc/init.d/oracleasm start
/etc/init.d/oracleasm stop
/etc/init.d/oracleasm restart
/etc/init.d/oracleasm configure
/etc/init.d/oracleasm status
/etc/init.d/oracleasm enable
/etc/init.d/oracleasm disable
/etc/init.d/oracleasm listdisks
/etc/init.d/oracleasm deletedisk
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm querydisk /dev/sdb1
/etc/init.d/oracleasm createdisk /dev/sdb1 VOL1
/etc/init.d/oracleasm renamedisk /dev/sdb1 VOL1

asmcmd Commands
cd -----changes the current directory to  the specified directory
du -----Displays the total disk space occupied by ASM files in the specified
           ASM directory and all its subdirectories, recursively.
find -----Lists the paths of all occurrences of the specified name ( with wildcards) under the specified directory.
ls +data/testdb ----Lists the contents of an ASM  director, the attributes of the specified file, or the names and attributes of all disk groups.
lsct -----Lists information about current ASM clients.
lsdg ----Lists all disk groups and their attributes
mkalias ----Creates an alias for a system generated filename.
mkdir -----Creates ASM directories.
pwd --------Displays the path of the current ASM directory.
rm        -------Deletes the specified ASM Files or directories.
rm -f       
rmalias ---------Deletes the specified alias, retaining the file that the alias points to
lsdsk ----------Lists disks visible to ASM.
md_backup ------Creates a backup of all of the mounted disk groups.
md_restore ------Restores disk groups from a backup.
remap ----repairs a range of physical blocks on a disk.
cp ------copies files into and out of ASM.
           **ASM diskgroup to OS file system.
           **OS file system to ASM diskgroup.
           **ASM diskgroup to another ASM diskgroup on the same server.
           **ASM disk group to ASM diskgroup on a remote server.

SYSASM Role (Starting in Oracle Database 11g)
SQL> Grant sysasm to sys; ---sysdba deprecated sqlplus / as sysasm

ASM Rolling Upgrades START
alter system start rolling migration to 11.2.0.2;

DISABLE
alter system stop rolling migration;

Database INIT parameters for ASM.
*.control_files='+DATA/orcl/controlfile/control1.ctl','+FRA/orcl/controlfile/control2.ctl'
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_recovery_file_dest='+DATA'
*.log_archive_dest_1='LOCATION=+DATA'
*.log_file_name_convert='+DATA/VISKDR','+DATA/VISK' ##added for DG

MIGRATE to ASM using RMAN
run
{
backup as copy database format '+DATA';
switch database to copy;
#For each logfile
sql "alter database rename '/data/oracle/VISK/redo1a.rdo' to '+DATA' ";
alter database open resetlogs;
#For each tempfile
sql "alter tablespace TEMP add tempfile" ;
}

Restore Database to ASM using SET NEWNAME 
run
{
allocate channel d1 type disk;
#For each datafile
set newname for datafile 1 to '+DATA';
restore database;
switch datafile all;
release channel d1;
}

source and reference:
http://www.dbaexpert.com



  

No comments:

free counters
 
Share/Bookmark