Vous êtes sur la page 1sur 2

ASM Diskgroups (Continued)

Mount and Umount Disk Group


ASM Dictionary Views
v$asm_alias Lists all aliases in all currently m ounted diskgroups
Viscosity North America SQL> alter diskgroup DATA mount; v$asm_client Lists all the databases currently accessing the
SQL> alter diskgroup DATA dismount; diskgroups
Oracle RAC and Virtualization Leaders Or v$asm_disk Lists all the disks discovered by the ASM instance
asmcmd> mount DATA
v$asm_diskgroup Lists all the diskgroups discovered by the ASM
asmcmd> umount DATA
instance
Oracle Certified RAC Experts v$asm_file Lists all files that belong to diskgroups m ounted by
Drop Disk Group
OVOVMVMware Certified Professionals DROP DISKGROUP DATA INCLUDING CONTENTS;
the ASM instance


v$asm_operation Reports information about current active operations.



Rebalance activity is reported in this view
Drop a Disk v$asm_template Lists all the templates currently m ounted by the ASM
alter diskgroup data drop disk
Automatic Storage Management (ASM) Pocket Reference Guide 'DATA_0001', instance
'DATA_0002' v$asm_diskgroup_stat Same as v$asm_diskgroup but does discover new
rebalance power 11 wait; diskgroups. Use this view instead of
Viscosity professionals are experts in the areas of:
v$asm_diskgroup
Core competency is Oracle RAC and End to End Oracle stack v$asm_disk_stat Same as v$asm_disk but does not discover new
Resize All Disks in a Disk Group
Exadata Implementations and Migrations from AIX/Solaris/HP-UX to Exadata ALTER DISKGROUP DATA RESIZE ALL SIZE 100G; disks. Use this view instead of v$asm_disk
Data synchronization and near zero-downtime database migration and upgrades with a zero
risk value proposition with Shareplex and GoldenGate Undrop Disks Clause of the Alter Disk Group srvctl commands
Provide infrastructure assessment of your RAC ecosystem and data center ALTER DISKGROUP DATA UNDROP DISKS; Add srvctl add asm -n rac3 -i +ASM3 -o
/opt/oracle/app/product/10.2/asm
Grid Infrastructure / Real Application Clusters (RAC) Versions all the way to 11g Release 2
Rebalance Disk Group Enable ASM srvctl enable asm -n rac3 -i +ASM3
E-Business Suite Implementation and Upgrades (11i and R12) with RAC ALTER DISKGROUP DATA REBALANCE POWER 5; Disable ASM srvctl disable asm -n rac3 -i +ASM3
Oracle Cloud Virtualization on VMware and Oracle VM (OVM) Start ASM srvctl start asm -n rac3
Red Hat and Oracle Linux Infrastructure and Best Practices Check Disk Group Stop ASM srvctl stop asm -n rac3
Disaster Recovery Planning and Implementation alter diskgroup data check; Config srvctl config asm n rac1
Data Warehousing and Business Intelligence alter diskgroup data check norepair; Remove ASM srvctl remove asm n rac1
Status ASM srvctl status asm
Enterprise Database Security srvctl status asm n rac1
Disk Group Metadata Backup
Upgrades and implementations of Oracle OEM 12c Cloud Control md_backup -b asm_backup.mdb.txt -g data,fra Modify srvctl modify asm o -n rac1
Enterprise Systems Management (ITIL and ITSM) Status DG srvctl status diskgroup -g data
By: Charles Kim, Oracle ACE Director Email: sales@ViscosityNA.com Clone ASM Oracle Home or Grid Infrastructure Home (NON-RAC) Remove DG srvctl remove diskgroup -g <current_dg>
Nitin Vengurlekar, Author of Oracle ASM Book, Oracle Press Pre ./runInstaller -clone -silent Enable/Disable srvctl enable diskgroup g DATA
ORACLE_HOME="/apps/oracle/product/11.1.0/asm" DG srvctl disable diskgroup g DATA
URL: http://www.ViscosityNA.com Phone: 214.509.8599 11.2 ORACLE_BASE="/apps/oracle" ORACLE_HOME_NAME="OraASM11g_home" Start DG srvctl start diskgroup g DATA
"CLUSTER_NODES={rac01,rac02,rac03}" -local Stop DG srvctl stop diskgroup g DATA
ASM Specific Initialization
Parameters Initialize ASM for non-RAC Rename Diskgroup
*.cluster_database= true ./localconfig add $ srvctl stop diskgroup -g DATA
*.asm_diskstring = $ crsctl stat res -t
/dev/emcpower*
$ renamedg phase=both dgname=DATA newdgname=DATA_EMC verbose=true
*.instance_type=asm Manually start CSSD (non-RAC)
*.shared_pool_size=160M /etc/init.d/init.cssd start
*.db_cache_size=64M ASMLIB commands (most as root)
/etc/init.d/oracleasm start
*.processes=300 Manually stop CSSD (non-RAC) /etc/init.d/oracleasm stop
*.asm_diskgroups = /etc/init.d/init.cssd stop
DATA,FRA /etc/init.d/oracleasm restart
*.memory_target=350M
/etc/init.d/oracleasm configure
Resetting CSS to new Oracle Home /etc/init.d/oracleasm status
Notes: localconfig reset /apps/oracle/product/11.1.0/ASM /etc/init.d/oracleasm enable
shared_pool_size: For external redundancy, every 100 GB of space needs 1 M B of extra shared pool plus 2 M B /etc/init.d/oracleasm disable
processes: 50 + 50*n
11.2+ Clone non-RAC (Non-Clustered) Grid Infrastructure Home /etc/init.d/oracleasm deletedisk
export ORACLE_HOME=/apps/oracle/product/11.2.0/grid
sudo chmod 770 $ORACLE_HOME
ASM Diskgroups /etc/init.d/oracleasm createdisk DATA_DISK1 /dev/mapper/data_disk1p1
Create diskgroup cd $ORACLE_HOME/clone/bin
/etc/init.d/oracleasm querydisk /dev/emcpowerb1
$ORACLE_HOME/perl/bin/perl clone.pl
External Redundancy (SQL Method) ORACLE_BASE="/apps/oracle"
/etc/init.d/oracleasm querydisk DATA_DISK1
create diskgroup DATA01 external redundancy disk
ORACLE_HOME="/apps/oracle/product/11.2.0/grid"
'ORCL:DATA01_DISK1', /etc/init.d/oracleasm renamedisk /dev/sdb1 VOL1
OSDBA_GROUP=oinstall OSOPER_GROUP=oinstall
'ORCL:DATA01_DISK2', /etc/init.d/oracleasm force-renamedisk DATA_DISK1 NEW_DATA_DISK1
ORACLE_HOME_NAME=Ora11g_gridinfrahome1
'ORCL:DATA01_DISK3',
INVENTORY_LOCATION=/apps/oraInventory
'ORCL:DATA01_DISK4' /etc/init.d/oracleasm scandisks
ATTRIBUTE 'au_size' = '4M', /etc/init.d/oracleasm listdisks
# /apps/oraInventory/orainstRoot.sh
'compatible.rdbms' = '11.2',
# /apps/oracle/product/11.2.0/grid/root.sh
'compatible.asm' = '11.2'; Multi-Path Configuration with ASMLIB
# /apps/oracle/product/11.2.0/grid/perl/bin/perl -
I/apps/oracle/product/11.2.0/grid/perl/lib - Modify /etc/sysconfig/oracleasm (on each node) as root:
External Redundancy (XML Method) I/apps/oracle/product/11.2.0/grid/crs/install # ORACLEASM_SCANORDER: Matching patterns to order disk scanning
data01.xml /apps/oracle/product/11.2.0/grid/crs/install/roothas.pl ORACLEASM_SCANORDER="dm-" # For Device Mapper
<dg name="DATA01" redundancy="external"> # ORACLEASM_SCANORDER="emcpower" # For EMC Powerpath
<dsk string="ORCL:DATA01_DISK1" /> # ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
<dsk string="ORCL:DATA01_DISK2" />
$ sudo chmod 750 $ORACLE_HOME
ORACLEASM_SCANEXCLUDE="sd"
<dsk string="ORCL:DATA01_DISK3" /> $ crsctl stop has
<dsk string="ORCL:DATA01_DISK4" /> $ srvctl add listener Volume Management
<a name="compatible.asm" value="11.2"/> $ srvctl add asm -d 'ORCL:*' Create volcreate -G DBA_PD101 -s 32g dba_vol
<a name="compatible.rdbms" value="11.2"/> $ srvctl start listener
<a name="compatible.advm" value="11.2"/> Resize volresize -G DBA_PD101 -s 64g dba_vol
<a name="au_size" value="4M"/>
$ srvctl start asm Enable volenable -G DBA_PD101 -a
</dg> Disable voldisable -G DBA_PD101 dba_vol
$ asmcmd mkdg data01.xml voldisable -G DBA_PD101 -a
Set volset -G DBA_PD101 --usagestring 'No files'
Normal Redundancy (SQL Method) Attributes dba_vol
CREATE DISKGROUP disk_group_1 NORMAL REDUNDANCY Info volinfo -G DATA01 vol_dba
FAILGROUP failure_group_1 DISK Delete voldelete -G DBA_PD101 dba_vol
'/devices/diska1' NAME diska1,
'/devices/diska2' NAME diska2,
FAILGROUP failure_group_2 DISK SQL Method
'/devices/diskb1' NAME diskb1, SQL> alter diskgroup data add volume vol_dba size 12g;
'/devices/diskb2' NAME diskb2; SQL> alter diskgroup data resize volume vol_dba size 16g;
SQL> alter diskgroup data disable volume vol_dba;
Add Disks SQL> alter diskgroup data enable volume vol_dba;
ALTER DISKGROUP DATA ADD DISK ORCL:DATA05 SQL> alter diskgroup all disable volume all;
rebalance power 11 wait;
ASMCMD [+] > shutdown --immediate # cd $GI_HOME
ASMCMD [+] > shutdown --abort # ./crsctl start crs -excl nocrs
ACFS File System ASMCMD [+] > startup --nomount --pfile initASM.ora
First, create the ASM Volume ASMCMD [+] > startup -mount SQL> create diskgroup OV normal redundancy disk
ASMCMD [+] > volcreate -G DATA01 -s 128g vol_dba 'ORCL:PV101_DISK1', 'ORCL:PV101_DISK2',
ASMCMD [+] > volinfo -G DATA01 vol_dba 'ORCL:PV101_DISK3' attribute = '11.2';
Connecting with SYSASM Role (Starting in Oracle Database 11g)
SQL> grant sysasm to sys; -- sysdba deprecated
mkfs on the ASM Volume # -- Replace OCR from last good backup
sqlplus / as sysasm
/sbin/mkfs -t acfs -n "DBA FS" /dev/asm/vol_dba-255 # -- May need to check $GI_HOME/logs/$HOST/client/ocrcheck*
# ./ocrconfig -restore backup00.ocr
ASM Rolling Upgrades # ./crsctl replace votedisk +OV
Or you can create an EXT3 file system Start alter system start rolling migration to 11.2.0.2;
mkfs -t ext3 /dev/asm/vol_dba-255
Disable alter system stop rolling migration; Prepare block devices for ASM
Remove an ACFS File system acfsutil rmfs Partition Alignment with sfdisk
Resize an ACFS File system acfsutil size Database Initialization Parameters for ASM # -- Partition alignment of OCR / Vote Disks with 1MB offset
*.control_files='+DATA/visk/controlfile/control1.ctl','+FRA/visk/con echo "2048,," | sfdisk -uS /dev/emcpowera
View/Modify ACFS Tune-ables acfsutil tune
trolfile/control2.ctl' echo "2048,," | sfdisk -uS /dev/emcpowerb
Register with ACFS Registry acfsutil registry *.db_create_file_dest='+DATA' echo "2048,," | sfdisk -uS /dev/emcpowerc
(Cluster-wide fstab) *.db_create_online_log_dest_1='+DATA'
*.db_recovery_file_dest='+DATA # -- Partition alignment of Data / FRA disks with 4MB offset
*.log_archive_dest_1='LOCATION=+DATA echo "8192,," | sfdisk -uS /dev/emcpowerd
Register with OCR (Cluster-wide fstab) echo "8192,," | sfdisk -uS /dev/emcpowere
*.log_file_name_convert='+DATA/VISKDR','+DATA/VISK' ## added for DG
/sbin/acfsutil registry -f -a /dev/asm/vol_dba-255 /dba echo "8192,," | sfdisk -uS /dev/emcpowerf
echo "8192,," | sfdisk -uS /dev/emcpowerg
Mount the ACFS File System Create Tablespace echo "8192,," | sfdisk -uS /dev/emcpowerh
/bin/mount -t acfs /dev/asm/vol_dba-255 /dba create tablespace indx datafile +data size 32000m;

Erase ASM disk to clear and prepare block devices


ACFS Info Add a Datafile to a Tablespace dd if=/dev/zero of=/dev/emcpowera1 bs=1M count=100
acfsutil info fs /dba/acfsdata/vol_dba alter tablespace indx add datafile +DATA size 32000m;
Write a text file to a block device
fsck Restore Controlfile (RMAN) dd if=$HOME/ocr_disk1.txt of=/dev/emcpowera1 bs=512 count=1 conv=sync
restore controlfile to '+data01/DBATOOLS/controlfile/control01.ctl'
fsck -t acfs /dev/asm/vol_dba-255 from '/u21/oradata/DBATOOLS/control01.ctl';
Read a text file
dd if=/dev/emcpowera1 bs=512 count=1 conv=sync
ACFS Snapshots Migrate to ASM using RMAN
Create ACFS Snapshots run
acfsutil snap create mysnap_1 /dba/acfsdata/vol_dba { Read ASM Disk Header
allocate channel d1 type disk; dd if=/dev/emcpowera1 bs=512 count=1 |od a
backup as copy database format '+DATA';
Delete ACFS Snapshots switch database to copy;
acfsutil snap delete mysnap_1 /dba/acfsdata/vol_dba release channel d1;
ASM Diskgroup and Disk Free Information Shell Script
export DB=$(ps -ef |grep +ASM |grep -i pmon |awk {'print $8'} |sed -e
}
's/asm_pmon_//g')
ACFS Dictionary Views export ORACLE_SID=${DB}
v$asm_acfs_encryption_info Encryption information for each Oracle ACFS file system export ORAENV_ASK=NO
v$asm_acfs_security_info Security realm information for each Oracle ACFS file Restore Database to ASM using SET NEWNAME . oraenv
system run sqlplus -s / as sysasm <<!!
{ col name for a15
v$asm_acfsvolumes Info about m ounted Oracle ACFS volumes correlated with allocate channel d1 type disk;
V$ASM_FILESYSTEM col path for a20
# For each datafile set lines 122 pages 66
v$asm_volume ADVM volume information that is a part of an Oracle ASM set newname for datafile 1 to '+DATA'; col AU for 9 hea 'AU|MB'
v$asm_volume_stat instance set newname for datafile 2 to '+DATA'; col state for a12
v$asm_acfsvolumes Info about m ounted Oracle ACFS volumes correlated with restore database; col compatibility for a10 hea 'ASM|Compat'
V$ASM_FILESYSTEM switch datafile all; col database_compatibility for a10 hea 'Database|Compat'
v$asm_filesystem Display information for every m ounted Oracle ACFS file release channel d1; col pct_Free for 99.99 head 'Pct|Free'
}
system col block_size for 99,999 head 'Block|Size'
col Total_GB for 999,999.99 head 'Total|GB'

Add Redo Groups col Free_GB for 999,999.99 head 'Free|GB'


asmcmd Commands alter database add logfile thread 2
cd Changes the current directory to the specified directory group 21 ('+data01','+fra01') size 1000m; col pct_free for 999 hea 'Pct|Free'
du Displays the total disk space occupied by ASM files in the specified ASM directory select name, path, total_mb, free_mb,
and all its subdirectories, recursively Create Database in ASM with dbca (Silent Mode) round(free_mb/total_mb*100,2) pct_Free
find Lists the paths of all occurrences of the specified name (with wildcards) under the dbca -silent \ from v\$asm_disk
specified directory -createDatabase \ where total_mb >1
-templateName General_Purpose.dbc \ order by name;
ls +data/testdb Lists the contents of an ASM directory, the attributes of the specified file, or the
-gdbName DBATOOLS \
names and attributes of all disk groups select name, state, round(total_mb/1024,2) Total_GB, round(free_mb/1024,2)
-sid DBATOOLS \
lsct Lists information about current ASM clients -SysPassword dba123 \ Free_GB,
lsdg Lists all disk groups and their attributes -SystemPassword dba123 \ round(free_mb/total_mb*100,2) pct_Free,
lsdsk -k To see V$ASM_DISK information in preformatted columns w ithout having to w rite -emConfiguration NONE \ allocation_unit_size/1024/1024 AU, compatibility,
SQL statement -redoLogFileSize 300 \ database_compatibility
mkalias Creates an alias for a system-generated filename -recoveryAreaDestination FRA01 \ from v\$asm_diskgroup
-storageType ASM \ where total_mb > 1;
mkdir Creates ASM directories
-asmSysPassword asmadm12 \ !!
pwd Displays the path of the current ASM directory
-diskGroupName DATA01 \
rm Deletes the specified ASM files or directories -characterSet AL32UTF8 \ Reverse Engineer ASMLIB Disks to Device Names with kfed
rm -f -nationalCharacterSet AL16UTF16 \ #!/bin/bash
rmalias Deletes the specified alias, retaining the file that the alias points to -totalMemory 3600 \ for asmlibdisk in `ls /dev/oracleasm/disks/*`
lsdsk Lists disks visible to ASM -databaseType MULTIPURPOSE \ do
md_backup Creates a backup of all of the m ounted disk groups -nodelist rac01,rac02,rac03,rac04 echo "ASMLIB disk name: $asmlibdisk"
md_restore Restores disk groups from a backup asmdisk=`kfed read $asmlibdisk | grep dskname | tr -s ' '| cut -f2 -d' '`
mkalias Creates an alias for system-generated filenames Calibrate I/O to determine IOP Potential echo "ASM disk name: $asmdisk"
SET SERVEROUTPUT ON majorminor=`ls -l $asmlibdisk | tr -s ' ' | cut -f5,6 -d' '`
remap Repairs a range of physical blocks on a disk device=`ls -l /dev | tr -s ' ' | grep "$majorminor" | cut -f10 -d' '`
DECLARE
cp Copies files into and out of ASM: lat INTEGER; echo "Device path: /dev/$device"
ASM diskgroup to OS file system iops INTEGER; done
OS file system to ASM diskgroup mbps INTEGER;
ASM diskgroup to another ASM diskgroup on the same server BEGIN Copyright 2012 This material may not be reproduced without the
ASM disk group to ASM diskgroup on a remote server -- DBMS_RESOURCE_MANAGER.CALIBRATE_IO (<DISKS>, <MAX_LATENCY>, iops, expressed consent of a Viscosity North America officer
lsop Displays one row for every active long-running operation executing in mbps, lat);
the ASM instance from V$ASM_OPERATION DBMS_RESOURCE_MANAGER.CALIBRATE_IO (48, 10, iops, mbps, lat);

DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);


export ORACLE_SID=+ASM # -- Non-RAC
export ORACLE_SID=+ASM1 # -- RAC DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);
DBMS_OUTPUT.PUT_LINE ('max_mbps = ' || mbps);
$ asmcmd END;
ASMCMD [+] > shutdown /

OCR and Vote Disk Restore

Vous aimerez peut-être aussi