Viscosity ASM Pocket Guide 11g - Database Experts

0 downloads 102 Views 281KB Size Report
Data Warehousing and Business Intelligence. •. Enterprise Database Security. •. Upgrades and implementations of Orac
  Viscosity North America Oracle RAC and Virtualization Leaders Oracle Certified RAC Experts OVOVMVMware Certified Professionals

 

 

SQL> alter diskgroup redundancy="external"> $ asmcmd mkdg 11.2 ORACLE_BASE="/apps/oracle" ORACLE_HOME_NAME="OraASM11g_home"

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

11.2+

Clone non-RAC (Non-Clustered) Grid Infrastructure Home export ORACLE_HOME=/apps/oracle/product/11.2.0/grid sudo chmod 770 $ORACLE_HOME cd $ORACLE_HOME/clone/bin $ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE="/apps/oracle" ORACLE_HOME="/apps/oracle/product/11.2.0/grid" OSDBA_GROUP=oinstall OSOPER_GROUP=oinstall ORACLE_HOME_NAME=Ora11g_gridinfrahome1 INVENTORY_LOCATION=/apps/oraInventory # /apps/oraInventory/orainstRoot.sh # /apps/oracle/product/11.2.0/grid/root.sh # /apps/oracle/product/11.2.0/grid/perl/bin/perl I/apps/oracle/product/11.2.0/grid/perl/lib I/apps/oracle/product/11.2.0/grid/crs/install /apps/oracle/product/11.2.0/grid/crs/install/roothas.pl

$ $ $ $ $ $

sudo chmod 750 $ORACLE_HOME crsctl stop has srvctl add listener srvctl add asm -d 'ORCL:*' srvctl start listener srvctl start asm

Lists  all  aliases  in  all  currently  m ounted  diskgroups   Lists  all  the   # For Device Mapper # ORACLEASM_SCANORDER="emcpower" # For EMC Powerpath # ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan ORACLEASM_SCANEXCLUDE="sd"

Volume Management Create   Resize   Enable   Disable   Set   Attributes   Info   Delete  

volcreate -G DBA_PD101 -s 32g dba_vol volresize -G DBA_PD101 -s 64g dba_vol volenable -G DBA_PD101 -a voldisable -G DBA_PD101 dba_vol voldisable -G DBA_PD101 -a volset -G DBA_PD101 --usagestring 'No files' dba_vol volinfo -G DATA01 vol_dba voldelete -G DBA_PD101 dba_vol

SQL Method SQL> alter SQL> alter SQL> alter SQL> alter SQL> alter

diskgroup diskgroup diskgroup diskgroup diskgroup

data add volume vol_dba size 12g; data resize volume vol_dba size 16g; data disable volume vol_dba; data enable volume vol_dba; all disable volume all;

ASMCMD ASMCMD ASMCMD ASMCMD

ACFS File System First, create the ASM Volume ASMCMD [+] > volcreate -G DATA01 -s 128g vol_dba ASMCMD [+] > volinfo -G DATA01 vol_dba

ASM Rolling Upgrades

Or you can create an EXT3 file system

Start   Disable  

mkfs -t ext3 /dev/asm/vol_dba-255 rmfs size tune registry

*.control_files='+DATA/visk/controlfile/control1.ctl','+FRA/visk/con trolfile/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

/dev/asm/vol_dba-255 /dba

Create Tablespace

Mount the ACFS File System /bin/mount -t acfs

alter system start rolling migration to 11.2.0.2; alter system stop rolling migration;

Database Initialization Parameters for ASM

Register with OCR (Cluster-wide fstab) /sbin/acfsutil registry -f -a

shutdown --immediate shutdown --abort startup --nomount --pfile initASM.ora startup –-mount

SQL> grant sysasm to sys; -- sysdba deprecated sqlplus / as sysasm

/sbin/mkfs -t acfs -n "DBA FS" /dev/asm/vol_dba-255

acfsutil acfsutil acfsutil acfsutil

> > > >

Connecting with SYSASM Role (Starting in Oracle Database 11g)

mkfs on the ASM Volume

Remove  an  ACFS  File  system   Resize  an  ACFS  File  system   View/Modify  ACFS  Tune-­‐ables   Register  with  ACFS  Registry   (Cluster-­‐wide  fstab)  

[+] [+] [+] [+]

create tablespace indx datafile ‘+data’ size 32000m;

/dev/asm/vol_dba-255 /dba

alter tablespace indx add datafile ‘+DATA’ size 32000m;

acfsutil info fs /dba/acfsdata/vol_dba

  fsck fsck -t acfs /dev/asm/vol_dba-255   ACFS Snapshots Create  ACFS  Snapshots   Delete  ACFS  Snapshots   acfsutil snap delete mysnap_1 /dba/acfsdata/vol_dba

 

ACFS Dictionary Views v$asm_acfs_encryption_info   v$asm_acfs_security_info   v$asm_acfsvolumes   v$asm_volume   v$asm_volume_stat   v$asm_acfsvolumes   v$asm_filesystem  

Encryption  information  for  each  Oracle  ACFS  file  system   Security  realm  information  for  each  Oracle  ACFS  file   system   Info  about  m ounted  Oracle  ACFS  volumes  correlated  with   V$ASM_FILESYSTEM   ADVM  volume  information  that  is  a  part  of  an  Oracle  ASM   instance   Info  about  m ounted  Oracle  ACFS  volumes  correlated  with   V$ASM_FILESYSTEM   Display  information  for  every  m ounted  Oracle  ACFS  file   system  

restore controlfile to '+data01/DBATOOLS/controlfile/control01.ctl' from '/u21/oradata/DBATOOLS/control01.ctl';

cd   du   find   ls  +data/testdb   lsct   lsdg   lsdsk  -­‐k   mkalias   mkdir   pwd   rm   rm  -­‐f   rmalias   lsdsk   md_backup   md_restore   mkalias   remap   cp  

lsop  

Deletes  the  specified  alias,  retaining  the  file  that  the  alias  points  to   Lists  disks  visible  to  ASM   Creates  a  backup  of  all  of  the  m ounted  disk  groups   Restores  disk  groups  from  a  backup   Creates  an  alias  for  system-­‐generated  filenames   Repairs  a  range  of  physical  blocks  on  a  disk   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   Displays  one  row  for  every  active  long-­‐running  operation  executing  in   the  ASM  instance  from  V$ASM_OPERATION  

export ORACLE_SID=+ASM # -- Non-RAC export ORACLE_SID=+ASM1 # -- RAC $ asmcmd ASMCMD [+] > shutdown

Partition alignment of OCR / Vote Disks with 1MB offset "2048,," | sfdisk -uS /dev/emcpowera "2048,," | sfdisk -uS /dev/emcpowerb "2048,," | sfdisk -uS /dev/emcpowerc

# -echo echo echo echo echo

Partition alignment of Data / FRA disks with 4MB offset "8192,," | sfdisk -uS /dev/emcpowerd "8192,," | sfdisk -uS /dev/emcpowere "8192,," | sfdisk -uS /dev/emcpowerf "8192,," | sfdisk -uS /dev/emcpowerg "8192,," | sfdisk -uS /dev/emcpowerh

dd if=/dev/zero of=/dev/emcpowera1 bs=1M count=100

dd if=$HOME/ocr_disk1.txt of=/dev/emcpowera1 bs=512 count=1 conv=sync

Read a text file

ASM Diskgroup and Disk Free Information Shell Script

run { allocate channel d1 type disk; # For each datafile set newname for datafile 1 to '+DATA'; set newname for datafile 2 to '+DATA'; restore database; switch datafile all; release channel d1; }

alter database add logfile thread 2 group 21 ('+data01','+fra01') size 1000m;

Create Database in ASM with dbca (Silent Mode) \ \ \ \ \

Calibrate I/O to determine IOP Potential SET SERVEROUTPUT ON DECLARE lat INTEGER; iops INTEGER; mbps INTEGER; BEGIN -- DBMS_RESOURCE_MANAGER.CALIBRATE_IO (, , iops, mbps, lat); DBMS_RESOURCE_MANAGER.CALIBRATE_IO (48, 10, iops, mbps, lat); DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops); DBMS_OUTPUT.PUT_LINE ('latency = ' || lat); DBMS_OUTPUT.PUT_LINE ('max_mbps = ' || mbps); END; /

OCR and Vote Disk Restore

# -echo echo echo

dd if=/dev/emcpowera1 bs=512 count=1 |od –a

Restore Database to ASM using SET NEWNAME

dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName DBATOOLS -sid DBATOOLS -SysPassword dba123 \ -SystemPassword dba123 \ -emConfiguration NONE \ -redoLogFileSize 300 \ -recoveryAreaDestination FRA01 \ -storageType ASM \ -asmSysPassword asmadm12 \ -diskGroupName DATA01 \ -characterSet AL32UTF8 \ -nationalCharacterSet AL16UTF16 \ -totalMemory 3600 \ -databaseType MULTIPURPOSE \ -nodelist rac01,rac02,rac03,rac04

Prepare block devices for ASM Partition Alignment with sfdisk

Read ASM Disk Header

Add Redo Groups Changes  the  current  directory  to  the  specified  directory Displays  the  total  disk  space  occupied  by  ASM  files  in  the  specified  ASM  directory   and  all  its  subdirectories,  recursively   Lists  the  paths  of  all  occurrences  of  the  specified  name  (with  wildcards)  under  the   specified  directory   Lists  the  contents  of  an  ASM  directory,  the  attributes  of  the  specified  file,  or  the   names  and  attributes  of  all  disk  groups   Lists  information  about  current  ASM  clients   Lists  all  disk  groups  and  their  attributes   To  see  V$ASM_DISK  information  in  preformatted  columns  w ithout  having  to  w rite   SQL  statement   Creates  an  alias  for  a  system-­‐generated  filename   Creates  ASM  directories   Displays  the  path  of  the  current  ASM  directory   Deletes  the  specified  ASM  files  or  directories  

-- Replace OCR from last good backup -- May need to check $GI_HOME/logs/$HOST/client/ocrcheck* ./ocrconfig -restore backup00.ocr ./crsctl replace votedisk +OV

dd if=/dev/emcpowera1 bs=512 count=1 conv=sync

run { allocate channel d1 type disk; backup as copy database format '+DATA'; switch database to copy; release channel d1; }

 

asmcmd Commands

# # # #

Write a text file to a block device

Restore Controlfile (RMAN)

Migrate to ASM using RMAN

acfsutil snap create mysnap_1 /dba/acfsdata/vol_dba

SQL> create diskgroup OV normal redundancy disk 'ORCL:PV101_DISK1', 'ORCL:PV101_DISK2', 'ORCL:PV101_DISK3' attribute = '11.2';

Erase  ASM  disk  to  clear  and  prepare  block  devices  

Add a Datafile to a Tablespace

ACFS  Info

# cd $GI_HOME # ./crsctl start crs -excl –nocrs

export DB=$(ps -ef |grep +ASM |grep -i pmon |awk {'print $8'} |sed -e 's/asm_pmon_//g') export ORACLE_SID=${DB} export ORAENV_ASK=NO . oraenv sqlplus -s / as sysasm 1; !!

Reverse Engineer ASMLIB Disks to Device Names with kfed #!/bin/bash for asmlibdisk in `ls /dev/oracleasm/disks/*` do echo "ASMLIB disk name: $asmlibdisk" asmdisk=`kfed read $asmlibdisk | grep dskname | tr -s ' '| cut -f2 -d' '` echo "ASM disk name: $asmdisk" majorminor=`ls -l $asmlibdisk | tr -s ' ' | cut -f5,6 -d' '` device=`ls -l /dev | tr -s ' ' | grep "$majorminor" | cut -f10 -d' '` echo "Device path: /dev/$device" done Copyright © 2012 This material may not be reproduced without the expressed consent of a Viscosity North America officer

Suggest Documents