Monday, 21 November 2011

ASM/RAC Reff


ASM Disk create in OS level

ASM Instance creating :

1.       Pfile
Instance type = asm ASM or RDBMS

Root user log in


# $ ORACLE_HOME /bin/localconfig all or reset or set

It will start the cluster synchronization service.

$ mkdir-p $ORACLE_BASE/admin/+ASM /bdump or /cdumb or /bdumb / udumb

$ export ORACLE_SIDm = + ASM
$ orapwd file = $ ORACLE_HOME / dbs/orapw+psm
                                                                                Password = sys
$ vi $ ORACLE_HOME/dbs/init + ASM.ora

-asm-allow-only-raw-disks = false

asm_diskgroups= ‘TESTDB-DATA1’   / group name /

asm_diskstring = ‘ORCL: VOL *’    / os level file of vol1 /

background_dump_desk = /uo1/app/oracle/admin/+asm/bdump

coure_dump_desk = /uo1/app/oracle/admin/+asm/cdump

user_dump = /uo1/app/oracle/admin/+asm/udump

instance_type = asm

db_unique_name = +ASM

remote login = EX

ASM_POWER_LIMIT = 5 

compatible = 10.2.0.0.0

larger_pool_size = 12 m

$ sqlplus “/ as sysdba”

Ø  start up
ASM instance started

0 – 15110 to diskgroups mounted

Ø  create spfile  from pfile
Ø  shutdown
Ø  startup No mount
Ø  create diskgroup testdb-data1 normal

failgroup fg1 disk ‘ ORCL : VOL1’ , ‘ORCL:VOL2’

failgroup fg2  disk ‘ ORCL : VOL3’ , ‘ORCL:VOL4

Ø  shutdown immediate
Ø  start up
Started
No Mount
Mount
ASM Background Process
SQL > Drop diskgroup disk_group1
Ø  alter diskgroup disk_group1 Resize disk in
Failgroup fg1 sie 100G
Ø  alter diskgroup disk_group_1 Resize All size 100 G
Ø  alter diskgroup disk_group_1 Rebalance power 5;
Ø  alter diskgroup All dismount;
Ø  alter diskgroup All mount;
Ø  alter diskgroup disk_group_1 dismount;
Ø  alter diskgroup disk_group_1 mount;
Ø  alter diskgroup disk_group_1
Add directory ‘f disk_group_’ /my_dir;
Ø  alter diskgroup disk_group_1  Rename

directory ‘ + disk_group_1 / my dir’
To ‘ + disk_group_1 / my dir_z’;

Ø  alter diskgroup disk_group_I Drop;
Ø  select name from v$datafile;
Drop directory

Ø  alter diskgroup disk_group_1 
directory ‘ + disk_group_1 / my dir-2 / force’

Ø  alter diskgroup disk_group_1 Add
Alias  ‘ + disk_group_1 / my dir / my file.dbf’
                Force  + disk_group_1 /mydb / datafile/ my_ts.342.5’;

Ø  alter diskgroup disk_group_1  rename
Alias  ‘ + disk_group_1 / my_ dir / my_ file.dbf’

To   ‘ + disk_group_1 / my_dir / my _file2.dbf’;

Ø  alter diskgroup disk_group_1  delete
Alias  ‘ + disk_group_1 / my_ dir / my_ file.dbf’

Ø  select group_number , name , total_mb,
free-mb from v$asm_diskgroup;
Ø  select group_number , disk_number, mount_status,path,tail group from v$ asm_disk;
Ø  create tablespace my_ts datafile ‘diskgroup’ size 100 m auto extend on;
Migrating
Ø  alter database disable block change tracking;
Ø  shu immediate
Ø  exit
$ vi ORACLE/HOME/dbs/Init prod.ora
DB_CREATE_FILE_DEST = ‘+disk_group’
DB_create_online_log_dest1 = ‘ +disk_group1’
control_files = ‘ +disk_group1’
$ sqlplus ‘ / as sysdba’;
Ø  startup nomount pfile =’ initpord.ora’
Ø  create spfile from pfile
Ø  shutdown immediate
Ø  rman targe  /
rman > startup nomount
rman > restore controlfile from 1 ….. part ‘;
                rman > alter database mount;
                rman > backup as copy databse format ='disk_group_1';
                rman > switch databse to copy;
                rman > Alter database open;
                rman > alter database Enable block change Tracking;
Ø  alter databse  add logfile  group4;
Ø  alter databse  add logfile  group5;
Ø  alter databse  add logfile  group6;


Ø  alter system switch logfile;
New temporary table space create:

Ø  create temporary tablespace temp1 tempfiles size 2048m;
Ø  default tablespace temp2
and then drop old temp file

RAC Installation
# lastname
Linux1
# ifconfig –a
Eth0
Eth0 :Link encp internet hwaddr oo:1c:c4:BF:c5:A4 inet.address 192.168.1.100 breast 192.168.225.0
Eth1:


Oracle Interface Configuration
$ oifcfg iflist 
$ oifcfg iflist –p
                etho 192.168.1.100    unknown
                etho 192.168.2.100    private

$ oifcfg iflist –p –n
etho 192.168.1.100    255.255.255.0
                etho 192.168.2.100    255.255

$ oifcfg getif
                etho 192         / global public
                etho 192         / global cluster
$ oifcfg getif  -if etho
$ oifcfg getif – global eth2/192.168.110 : public

$ oifcfg getif
                etho 192.168.1.100     \ global public
                etho 192.168.2.100     \ global cluster-interconnect
                etho 192.168.1.110     \ global public

To remove
$ oifcfg delif  -global eth2
$ oifcfg getif
                etho 192.168.1.100   \ global public
                etho 192.168.2.100   \ cluster interconnect

Administering Oracle Clusterware
CRSCTL
CRS-STAT
OCRCONFIG
OCRCHECK
OCRDUMP
CRSCTL (Cluster Ready Service Control Utility)
$ ORA-CRS-HOME /bin

# crsctl check crs
# crsctl check cssd            \css  appears healthy
# crsctl check crsd            \crs  appears healthy
# crsctl check evmd         \evm  appears healthy
# crsctl start crs
# crsctl stop crs
# crsctl disable crs
# crsctl enable crs
/etc/oracle/scls-scr/<node>/root/crsstart
Managing Voting disk
# crsctl query  css votedisk
# crsctl add css votedisk    / u03/oradata/orcl/cssfile2
# crsctl stop crs
# crsctl add css votedisk / u03/oradata/orcl/cssfile2
# crsctl dtart crs
# crsctl query css votedisk
 0                             0                              /u02/tradent /css file1
1                              1                              /u03 /tradent /css file1
# crsctl delete css votedisk          /u03/oradata/orcl/cssfile2
# crsctl stop crs
# crsctl delete css votedisk    /u03/oradata/orcl/cssfile2 – force
# crsctl start crs
# crsctl query css votedisk
0              0              /uo2/oradata/orcl/cssfile1
# crsctl query crs software version
$ crs –start-t
OCRCONFIG
Add/remove/backup/recover/rebier
-sl ORA-CRS-HOM/log/ <node>/client/ocrconfig- <pid>log
-show backup
# export ORA-CRS-HOME= /u01/app/orcle/product/10.2.0/crs
# export path = $PATH:$ORA-CRS-HOME/ bin
Backup  OCR
$ ORA-CRS-HOME /crs/cdata/ <cluster-name>
# ocrconfig – showbackup
Linux1  | 2010/11/04  11:15:29 | /u01/ap1/oracl/product/16.2.0/crs/cdata/crs
 # ls –l $ ORA-CRS-HOME / CRS/Cdata / CRS
# ocrconfig –backuploc/backup/oradata/orc
Restore
# ocrconfig  - showbackup
# crsctl stop crs
# ocrconfig  -restore $ ORA-CRS-HOME / Cdatra/crs/backup oo.ocr
#clurfy comp ocr –n
# crsctl start crs
# ocrconfig  -showbackup
# crsctl stop crs
# vi /etc/oracle/ocr.loc
# ocrconfig –restore $ ORA-CRS-HOME/ cdata /crs/backup 00.ocr
# cluvfy comp ocr –n all
# crsctl start crs
Manual Backup
# crsctl stop crs
# ocrconfig  -export
# crsctl start crs
Import the OCR

# crsctl stop crs
#ocrconfig  -import  /tmp/ocrfile
# clarfy comp ocr
# crsctl start crs
Adding in OCR file
# ocrconfig  -replace  ocr/u03/oradata/urcl/ocrfile1
# ocrconfig –replace ocrmirror /u03/oradata/oracle/ocrfile2

Replacing OCR file
# orcconfig  -replace ocr/u04/oradata/oracle/ocrfile1
# orcconfig –replace ocrmirror
Deleting OCR file
# ocrconfig –replace ocr
# ocrconfig –replace ocrmirror
Repairing the OCR configuration
# crsctl stop crs
# ocrconfig –repair ocr
# cluvfy comp ocr –n all
# crsctl start crs
#OCR check
$ ORA-CRS-Home /log/ <node> / client/ocrcheck_ <pid>.log
OCRDUMP
$ ORA-CRS-HOME/log/<NOD>/…………..
# ocrdump
#ocrdump  /tmp/ocr_cluster1
Backup voting disks
# crsctl stop crs
# dd if = /u02/oradata/orcl/cssfiles /backup/oradata/orcl/cssfiles-bk
Corrupted for voting disk
# crsctl stop crs
# dd 15 = /backup /oradata/orcl/cssfiles of = /u02/oradata/orcl/cssfiles
# crsctl start crs
$ ORA-CRS-HOME /log/<node>/client

Crs à $ ORA-CRS-HOME/log/ <node> / crsd /crsd/log
CSS à $ ORA-CRS-HOME/log/ <node> / crsd/ocssd/log
EVM à $ ORA-CRS-HOME/log/ <node> / crsd/evmd.log
Vip/ons step  $ ORA-CRS-HOME/log/<nod>/racg
# ORA-CRS-HOM/bin/diagcollection.p/
# export ORA-CS-HOME /u01/app/oracle/product/10.2.0/crs
# export oracle_HOME = /u01/app/oracle/product/10.2.0/db-1
# $ORA-CRS-HOME/bin/diagcollection.p –collect
# $RA-CRS-HOME/bin/diagcollection.p –collect –crs
# $RA-CRS-HOME/bin/diagcollection.p –collect oh $ORACLE_HOME
# $RA-CRS-HOME/bin/diagcollection.p –collect – ob $ ORACLE_BASE
# $RA-CRS-HOME/bin/diagcollection.p –collect –all
# $RA-CRS-HOME/bin/diagcollection.p –collect –coreanalysiz
# $RA-CRS-HOME/bin/diagcollection.p –collect –clean
# O/S Nods –p –n –E
Cluster verification Utility
# cluvfy comp ssa  -n all-verbose
# cluvfy comp ssa  -n all- s/dev/sda
# cluvfy comp –list
# cluvfy comp space –n all – l /u01 -2
Cluster verification utility connectivity verifications
# cluvfy comp noderreach –n linux2, linux3
# cluvfy comp nodecon – n linux2,linux3 –I eth0 –verbose
# cluvfy comp nodecon –n linux2,linux3 – verbose

Cluster verification utility installation verification
#  cluvfy stage –pre crsinst –n linux1,linux2
# cluvfy stage –post crsinst –n linux1,linux2
# cluvfy stage –pre dbinst  –n linux1,linux2
# cluvfy comp crs –n all –verbose
# cluvfy comp ocr –n all –verbose
Workload Management
Client side conn load balancing
RAC = (DESCRIPTION = (ADDRESS = (PROTOCOL =TCP) (HOST =linux1) (port =1521))
                                            (ADDRESS = (PROTOCOL =TCP) (HOST =linux2) (port =1521))
                                                (LOAD-BALANCE=ON)
                                                (FAILOVER = ON)
(CONNECT _DATA = (SERVICE_NAME =RAC)
(FAILOVER_MODE = (TYPE=SELECT)(METHOD=BASIC))
Serverside.connection load balancing
Sql > EXECUTE dbms_service.create_service
                (service_name => ‘service1’
                network_name=> ‘service1’,
goal => DBMS_SERVICE.GOAL_SERVICE_TIME,
clb_goal => DBMS_SERVICE.CLB_GOAL_SHORT);
Service modify
Sql> EXECUTE dbms_service_modify_service
                (service_name => ‘service1’
                network_name=> ‘service1’,
goal => DBMS_SERVICE.GOAL_SERVICE_TIME,
clb_goal => DBMS_SERVICE.CLB_GOAL_LONG);
sql >select name,goal,clb_goal from dba_services;
sql >                                       v$ services;
sql >                                       $ ACTIVE_SERVICES;
SRVCTL
$ srvctl add service –d  orcl
                -s rac  -r orcl1  -a orcl2

TAF services

sevice1=
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP) (HOST=linux1-VIP) (PORT =1521))
(ADDRESS = (PROTOCOL=TCP) (HOST=linux1-VIP) (PORT =1521))
(LOAD_BALANCE =YES)
(CONNECT_DATA =
(SERVER_NAME =SERVICE1)
(FAILOVER_MODE=
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
 )
 )
)
RAC        ADMINISTRATION USING (SRVCTL)
ð  database
ð  instance
ð  service
ð  node application
ð  asm
ð  listener
$ srvctl –help
Command
enable / diable / start / stop / relocate / status/add/remove / modify/ config
objects : database / instance/service/nodeapps/asm/listener
srvctl <commqne> <object> -h

-d  <name> unique name for the database
-0 <stgart-option> options to startup command (e.g open , mount (or ) no mount)
-c <connstr> connect string (default : / as sysdba)
usage : srvctl start database –d<nam> [-o <start=options]
$ srvctl –v -> display the srvctl version
Administering database
srvctl start database –d <name> [-0 <start-options>] [-c <connect _str)]
$ srvctl start database –d ORCL
Srvctl stop database –d <name>  [-0 <start-options>] [-c <connect _str)]

$ srvctl stop database –d ORCL
$ srvctl config database   à display all database
$ srvctl config database   -d ORCL à display all instance and location
linux1 ORCL 1    /u01/app/oracle/product/10.2.0/db_1
linux2 ORCL
$ srvctl status database –d ORCL
Check the instance running.
Instance ORCL1 is running on node linux1
Instance ORCL2 is running on node linux2
$ srvctl add database –d TEST
 -0 $ ORACLE_HOME
$ srvctl modify  database –d TEST
                                -p   /u03/oradata/ORCL/spfiletest.ora
$ srvctl remove  database –d TEST
$ srvctl disable database –d ORCL
$ srvctl enable database –d ORCL
Administrating Instance
$ srvctl start instance –d ORCL –i ORCL1
$ srvctl start instance –d ORCL –i “ORCL1,  ORCL2”
$ srvctl stop instance –d ORCL –i ORCL1
$ srvctl stop instance –d ORCL –i “ORCL1,  ORCL2”
$ srvctl status instance –d ORCL –i ORCL1
$ srvctl status instance –d ORCL –i “ORCL1,  ORCL2”

$ srvctl add instance –d ORCL –i ORCL3
                                                                -n linux3

$ srvctl modify instance –d ORCL –i ORCL3
                                                                -n linux4
$ srvctl remove  instance –d ORCL –i ORCL3
$ srvctl disable  instance –d ORCL –i ORCL3
$ srvctl enable  instance –d ORCL –i ORCL3
Administering node application
$ srvctl start nodeapps –n linux1
$ srvctl stop nodeapps –n linux1
$ srvctl config  nodeapps –n linux1
                linux1 ORCL1/uo1/app/oracle/product/10.2.0/db/
$ srvctl config  nodeapps –n linux  -a
VIP exists : linux1-vip/ 147.43.1.201/ 22.225.0.0/eth o
$ srvctl config  nodeapps –n linux  -g
$ srvctl config  nodeapps –n linux  -s

Listener Exists
$ srvctl status nodeapps  -n linux1
                VIP is running on mode linux1
GSD is running on mode linux1
Listener is running on mode linux1
ONS is running on node linux1

$ srvctl add nodeapps –n linux3
                                -0 $ ORACLE_HOME
                                -A linux3 –vip / 255.255.0.0/ eth 0
$ srvctl modify nodeapps –n linux3
                                -0 $ ORACLE_HOME
                                -A linux3 –vip / 255.255.0.0/ eth 0
$ srvctl remove nodeapps –n linux3
Administering Listener
$ srvctl config listener –n linux1
$ srvctl start listener –n linux1
$ srvctl start listener –n linux1 –l LISTENER
$ srvctl stop listener –n linux1
ASM Admin
$ srvctl add asm –n linux3
                                -i+ASM3  -0 $ ORACLE_HOME

$ srvctl stop  asm –n linux3 -i+ASM3
$ srvctl start  asm –n linux3 -i+ASM3
$ srvctl remove  asm –n linux3 -i+ASM3
$ srvctl disable  asm –n linux3 -i+ASM3
$ srvctl enable  asm –n linux3 -i+ASM3
$ srvctl status  asm –n linux1
$ srvctl config asm –n linux1
                +ASM/u03/app/oracle/product/10.2.0/db-1

No comments:

Post a Comment