Quelques commandes pour déplacer les « undo » sur Oracle RAC 10gR2.
- Requête pour trouver les undo:
select FILE_NAME,TABLESPACE_NAME,BYTES/1024/1024,AUTOEXTENSIBLE,STATUS,USER_BYTES from dba_data_files where TABLESPACE_NAME like 'UNDO%';
- Créer les nouveaux undo :
create undo tablespace UNDOTBS3 datafile '/oradata/GFSTEUR1/group01/undotbs03_1.dbf' size 15G autoextend off;
create undo tablespace UNDOTBS4 datafile '/oradata/GFSTEUR1/group01/undotbs04_1.dbf' size 15G autoextend off;
- Pointer sur les nouveaux undo :
Attention : ne pas oublier le SID !!!
ALTER SYSTEM SET undo_tablespace = UNDOTBS3 SCOPE=BOTH SID='GFSTE1R1';
ALTER SYSTEM SET undo_tablespace = UNDOTBS4 SCOPE=BOTH SID='GFSTE2R1';
- Effacer les anciens undo :
DROP TABLESPACE UNDOTBS1 INCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE UNDOTBS2 INCLUDING CONTENTS AND DATAFILES;
Un petit script perl pour trouver les correspondances entre les luns UUIDs, special files, major numbers, minor numbers.
Dépendances :
evainfo –> outil client pour extraire les informations des EVA.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @evainfo=`evainfo -a`;
my @ioscan=`ioscan -m dsf`;
my %devmap;
my %devmap2;
my %lunmap;
my %sf;
my $dsf;
my $olddsf;
my $legacy;
# Create map : "legacy device" = "dsf device"
foreach(@ioscan){
if ( /\/dev/ ){
($dsf, $legacy)=split(/\s+/,$_);
if ( $dsf eq "" ){
$dsf=$olddsf;
}
$devmap{$legacy}=$dsf;
$olddsf=$dsf;
}
}
# Create map : "wwnn id" = "legacy device"
foreach(@evainfo){
if ( /\/dev/){
(my $legacy, undef, my $wwnn, my $size, my $ctrl)=split(/\s+/,$_);
$lunmap{$wwnn}=$legacy;
}
}
# Create map : "dsf device" = "major and minor"
%devmap2=%devmap; # values() modify the hash, so copy to a new one to avoid %devmap to be modified
foreach(values(%devmap2)){
open (SHELLCMD,"ll $_ |");
while (<SHELLCMD>){
(undef,undef,undef,undef,my $major, my $minor,undef,undef,undef,my $dev)=split(/\s+/,$_);
$sf{$dev}->{"major"}=$major;
$sf{$dev}->{"minor"}=$minor;
}
close (SHELLCMD)
}
# Debug purpose
#print Dumper(\%devmap);
#print Dumper(\%lunmap);
#print Dumper(\%sf);
# Print output
foreach(sort(keys(%lunmap))){
my $legacy=$lunmap{$_};
printf("%s %s %s %s\n",$_ ,$devmap{$legacy}, $sf{$devmap{$legacy}}->{"major"}, $sf{$devmap{$legacy}}->{"minor"});
}
Exemple d'usage :
root@hx000140: /root/home/root # perl eva_mapping.pl
6001-4380-05DE-C738-0000-6000-08B4-0000 /dev/oracle/asm_eva1 13 0x000019
6001-4380-05DE-C738-0000-6000-08B8-0000 /dev/oracle/asm_eva2 13 0x00001a
6001-4380-05DE-C738-0000-6000-08BC-0000 /dev/oracle/asm_eva3 13 0x00001b
6001-4380-05DE-C738-0000-6000-08C0-0000 /dev/oracle/asm_eva4 13 0x00001c
6001-4380-05DE-C738-0000-6000-08C4-0000 /dev/oracle.bak/asm_eva5 13 0x00001d
6001-4380-05DE-C738-0000-6000-08C8-0000 /dev/oracle.bak/asm_eva6 13 0x00001e
6001-4380-05DE-C738-0000-6000-08CC-0000 /dev/oracle.bak/asm_eva7 13 0x00001f
6001-4380-05DE-C738-0000-6000-08D0-0000 /dev/oracle.bak/asm_eva8 13 0x000020