11gR2 ASM – Inside story – Partie 6 (Recréer le

Transcription

11gR2 ASM – Inside story – Partie 6 (Recréer le
11gR2 ASM – Inside story – Partie
6 (Recréer le service de haute
disponibilité et renommer un
groupe de disque)
Wissem EL KHLIFI
www.oracle-class.com
Introduction:
Dans l'article précédent de l'histoire de ASM, nous avons vu comment lire un fichier ASM depuis le
système opératif.
Dans cet article, nous allons voir comment recréer le service de haute disponibilité, comment register
les ressources et enfin, comment renommer un groupe de disques ASM.
Cette procédure est appliquée à une bases de données 11gR2, sous Oracle Enterprise Linux.
1- Recréer le service de haute disponibilité :
Problème et besoin:
Après le redémarrage du serveur de bases de données, les ressources de haute disponibilité ne se
redémarrent pas automatiquement. Il faut se rappeler que à partir de la version 11gR2, Oracle Restart
est responsable de redémarrage automatiques des ressources; ASM, instances de bases de données,
listeners, etc...
Voici l'erreur que j'ai reçu;
[sourcecode]
[oracle@localhost .oracle]$ srvctl status asm
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd
[oracle@localhost .oracle]$
[/sourcecode]
Maintenant, nous allons essayer de redémarrer les services de haute disponibilité manuellement;
[sourcecode]
[root@localhost bin]# ./crsctl start has
Failure at scls_scr_getval with code 1
Internal Error Information:
Category: -2
Operation: opendir
Location: scrsearch1
Other: cant open scr home dir scls_scr_getval
System Dependent Information: 2
CRS-4000: Command Start failed, or completed with errors.
[/sourcecode]
Wissem EL KHLIFI
www.oracle-class.com
Solution et démarche à suivre:
Pour résoudre le problème, j'aurais du modifier le contenu du fichier /etc/hosts.
Maintenant, j'ai supprimé le service de haute disponibilité, en utilisant l'option -force;
[sourcecode]
[root@localhost bin]# /u01/app/oracle/product/11.2.0/grid/perl/bin/perl -I
/u01/app/oracle/product/11.2.0/grid/perl/lib -I /u01/app/oracle/product/11.2.0/grid/crs/install
/u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl -delete -force
2011-07-30 14:04:54: Checking for super user privileges
2011-07-30 14:04:54: User has super user privileges
2011-07-30 14:04:54: Parsing the host name
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
Failure at scls_scr_getval with code 1
Internal Error Information:
Category: -2
Operation: opendir
Location: scrsearch1
Other: cant open scr home dir scls_scr_getval
System Dependent Information: 2
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
ACFS-9200: Supported
Successfully deconfigured Oracle Restart stack
[/sourcecode]
Maintenant, nous démarrons le service de haute disponibilité;
[sourcecode]
[root@localhost bin]# /u01/app/oracle/product/11.2.0/grid/perl/bin/perl -I
/u01/app/oracle/product/11.2.0/grid/perl/lib -I /u01/app/oracle/product/11.2.0/grid/crs/install
/u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl
2011-07-30 14:06:13: Checking for super user privileges
2011-07-30 14:06:13: User has super user privileges
2011-07-30 14:06:13: Parsing the host name
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Wissem EL KHLIFI
www.oracle-class.com
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
CRS-4664: Node 192 successfully pinned.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting
192 2011/07/30 14:07:28
/u01/app/oracle/product/11.2.0/grid/cdata/192/backup_20110730_140728.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
[root@localhost bin]#
[/sourcecode]
Vérifions, l'état des ressources;
[sourcecode]
[root@localhost bin]# ./crsctl status res
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE
[root@localhost bin]#
[/sourcecode]
Ajoutons ASM comme une ressource au service haute disponibilité
[sourcecode]
su - oracle
[oracle@localhost ~]$ srvctl status asm
PRCR-1001 : Resource ora.asm does not exist
[oracle@localhost ~]$ srvctl add asm
[oracle@localhost ~]$ srvctl status asm
ASM is not running.
[oracle@localhost ~]$
Wissem EL KHLIFI
www.oracle-class.com
[oracle@localhost ~]$ srvctl start asm
[oracle@localhost ~]$ srvctl status asm
ASM is running on 192
[oracle@localhost ~]$
[oracle@localhost ~]$ ps -edf | grep ASM
oracle 5162 1 0 14:12 ?
00:00:00 asm_pmon_+ASM
oracle 5164 1 0 14:12 ?
00:00:00 asm_vktm_+ASM
oracle 5168 1 0 14:12 ?
00:00:00 asm_gen0_+ASM
oracle 5170 1 0 14:12 ?
00:00:00 asm_diag_+ASM
oracle 5172 1 0 14:12 ?
00:00:00 asm_psp0_+ASM
oracle 5174 1 1 14:12 ?
00:00:00 asm_dia0_+ASM
oracle 5176 1 0 14:12 ?
00:00:00 asm_mman_+ASM
oracle 5178 1 0 14:12 ?
00:00:00 asm_dbw0_+ASM
oracle 5180 1 0 14:12 ?
00:00:00 asm_lgwr_+ASM
oracle 5182 1 0 14:12 ?
00:00:00 asm_ckpt_+ASM
oracle 5184 1 0 14:12 ?
00:00:00 asm_smon_+ASM
oracle 5186 1 0 14:12 ?
00:00:00 asm_rbal_+ASM
oracle 5188 1 0 14:12 ?
00:00:00 asm_gmon_+ASM
oracle 5190 1 1 14:12 ?
00:00:00 asm_mmon_+ASM
oracle 5192 1 1 14:12 ?
00:00:00 asm_mmnl_+ASM
oracle 5221 2910 0 14:12 pts/1 00:00:00 grep ASM
[oracle@localhost ~]$
[oracle@localhost ~]$ export ORACLE_HOME=$GRID_HOME
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 14:20:40 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option
SQL>
[/sourcecode]
Vérifions, l'état de l'instance de bases de données et ses ressources;
[sourcecode]
[oracle@localhost ~]$ srvctl status database -d ORAW
PRCD-1120 : The resource for database ORAW could not be found.
PRCR-1001 : Resource ora.oraw.db does not exist
Wissem EL KHLIFI
www.oracle-class.com
[oracle@localhost ~]$ srvctl add database -d ORAW -o $ORACLE_HOME
[oracle@localhost ~]$ srvctl status database -d ORAW
Database is not running.
[oracle@localhost ~]$
[/sourcecode]
Ok, maintenant, nous devons démarrer l'instance de bases de données.
[sourcecode]
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 14:19:45 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/ORAW/spfileORAW.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/ORAW/spfileORAW.ora
ORA-15056: additional error message
ORA-17503: ksfdopn:DGOpenFile05 Failed to open file +DATA/oraw/spfileoraw.ora
ORA-17503: ksfdopn:2 Failed to open file +DATA/oraw/spfileoraw.ora
ORA-15001: diskgroup "DATA" does not exist or is not mounted
ORA-06512: at line 4
SQL> exit
Disconnected
[/sourcecode]
Analyzons l'erreur, il faut monter le groupe de disques, DATA.
[sourcecode]
[oracle@localhost ~]$ asmcmd mount DATA
[oracle@localhost ~]$
[oracle@localhost ~]$ source /home/oracle/.bash_profile
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 14:23:35 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
Wissem EL KHLIFI
www.oracle-class.com
ORACLE instance started.
Total System Global Area 313860096 bytes
Fixed Size
1336232 bytes
Variable Size
268438616 bytes
Database Buffers
37748736 bytes
Redo Buffers
6336512 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '+DATA_RAC/oraw/datafile/data_rac_read.256.744964813'
SQL>
[/sourcecode]
Aussi, montons le groupe de disques, DATA_RAC.
[sourcecode]
[oracle@localhost ~]$ export ORACLE_HOME=$GRID_HOME
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ asmcmd mount DATA_RAC
[oracle@localhost ~]$ source /home/oracle/.bash_profile
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 14:25:40 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> alter database open;
Database altered.
SQL>
[/sourcecode]
Maintenant, nous avons la base de données démarrée, aussi bien que la infrastructure
Wissem EL KHLIFI
www.oracle-class.com
2- Renommer le groupe de disques ASM:
Après avoir migré ma base de données en RAC à une base de données d'instance unique; J'ai noté qu'il
y'¡a un groupe de disques nommé DATA_RAC. Ce nom de groupe de disques n'a plus de sens
maintenant dans un environnement d'instance unique. Donc, je vais le renommer en
DATA_REPORTING;
[sourcecode]
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@localhost ~]$
[/sourcecode]
On va vérifier les noms de groupes de disques;
[sourcecode]
[oracle@localhost ~]$ export ORACLE_HOME=$GRID_HOME
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 14:29:56 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option
SQL> SELECT NAME FROM V$ASM_DISKGROUP;
NAME
-----------------------------INDX
DATA_RAC
DATA
SQL>
Wissem EL KHLIFI
www.oracle-class.com
[/sourcecode]
On va démonter le groupe de disques, DATA_RAC;
[sourcecode]
[oracle@localhost ~]$ asmcmd umount DATA_RAC
[/sourcecode]
Le groupe de disque est bien démonté;
[sourcecode]
[oracle@localhost ~]$ asmcmd lsdg
State Type Rebal Hector Block
AU Total_MB Free_MB Req_mir_free_MB
Usable_file_MB Offline_disks Voting_files Name
MOUNTED NORMAL N
512 4096 1048576
4000
843
795
0
N DATA/
[oracle@localhost ~]$
[/sourcecode]
24
Changeons le nom de groupe de disques;
[sourcecode]
[oracle@localhost ~]$ renamedg phase=both dgname=DATA_RAC
newdgname=DATA_REPORTING verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name
: DATA_RAC
New DG name
: DATA_REPORTING
Phases
:
Phase 1
Phase 2
Discovery str
: (null)
Clean
: TRUE
Raw only
: TRUE
renamedg operation: phase=both dgname=DATA_RAC newdgname=DATA_REPORTING
verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk UFS:/dev/raw/raw5 with disk number:0 and timestamp (32951462 -1967443968)
Identified disk UFS:/dev/raw/raw6 with disk number:1 and timestamp (32951462 -1967443968)
Wissem EL KHLIFI
www.oracle-class.com
Checking for hearbeat...
Re-discovering the grupo
Performing discovery with string:
Identified disk UFS:/dev/raw/raw5 with disk number:0 and timestamp (32951462 -1967443968)
Identified disk UFS:/dev/raw/raw6 with disk number:1 and timestamp (32951462 -1967443968)
Checking if the diskgroup is mounted
Checking disk number:0
Checking disk number:1
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/raw/raw5
Modifying the header
Looking for /dev/raw/raw6
Modifying the header
Completed phase 2
Terminating kgfd context 0xb7e70050
[oracle@localhost ~]$
[/sourcecode]
On doit monter maintenant le groupe de diques;
[sourcecode]
[oracle@localhost ~]$ asmcmd mount DATA_REPORTING
[/sourcecode]
vérifions que le groupe renommé est bien monté;
[sourcecode]
[oracle@localhost ~]$ asmcmd lsdg
State Type Rebal Sector Block
AU Total_MB Free_MB Req_mir_free_MB
Usable_file_MB Offline_disks Voting_files Name
MOUNTED NORMAL N
512 4096 1048576
4000
843
795
0
N DATA/
MOUNTED NORMAL N
512 4096 1048576
2000 1692
0
0
N DATA_REPORTING/
[oracle@localhost ~]$
[/sourcecode]
24
846
Démarrons l'instance de bases de données;
[sourcecode]
Wissem EL KHLIFI
www.oracle-class.com
[oracle@localhost ~]$ source /home/oracle/.bash_profile
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 14:34:20 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 313860096 bytes
Fixed Size
1336232 bytes
Variable Size
268438616 bytes
Database Buffers
37748736 bytes
Redo Buffers
6336512 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '+DATA_RAC/oraw/datafile/data_rac_read.256.744964813'
[/sourcecode]
Il faudrait renommer les fichiers de données;
[sourcecode]
SQL> alter database rename file '+DATA_RAC/oraw/datafile/data_rac_read.256.744964813'
2 to
3 '+DATA_REPORTING/oraw/datafile/data_rac_read.256.744964813';
Database altered.
SQL> alter database open;
Database altered.
SQL>
[/sourcecode]
Miantenant, nous avons des groups de disques avec des noms plus cohérents et logique.
Wissem EL KHLIFI
www.oracle-class.com