Bonjours ,
je suis en misssion et le client souhaite avoir dans son script un test pour savoir si la base est demarrée comment faire .
Existe-t-il des instructions a executer sous unix à cet effet d'avance merci.
Version imprimable
Bonjours ,
je suis en misssion et le client souhaite avoir dans son script un test pour savoir si la base est demarrée comment faire .
Existe-t-il des instructions a executer sous unix à cet effet d'avance merci.
permet de trouver l'un des process de l'instance :)Code:ps -ef | grep ora_pmon_<SID>
:P ça fait quelques année que j'utilise ce little ProC pour cela et jusqu'à présent , quelque soit la version d'oracle , il ne ma jamais fait défaut. :roll:
Si cela peut aider :D
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 /**** -------------------------------------------------------------------- ****/ /* */ /* nom du prg : Test_ora.pc Machine */ /* ___________________________________________________ */ /* */ /* Role du prg : Test de connexion ORACLE */ /* */ /**** -------------------------------------------------------------------- ****/ /******************************************************************************/ /* ---- DECLARATION DES INCLUDES ---- */ /***** ------------------------------------------------------------------ *****/ #include <stdio.h> #include <signal.h> #include <errno.h> #include <fcntl.h> #include <pwd.h> /***** ---------------Fin De : DECLARATION DES INCLUDES------------------ *****/ /******************************************************************************/ /* ---- oprintf Oracle Printf ---- */ /* ---- oprintf (__D=(Var Oracle) __F(Format) __S(Source) ---- */ /***** ------------------------------------------------------------------ *****/ #define oprintf(__D,__F,__S)\ {(void) \ sprintf((char *)__D.arr,__F,__S); __D.len = strlen(__D.arr);\ } /***** -----------------------Fin De : oprintf ()------------------------ *****/ /***** --------- APPEL DU GESTIONNAIRE D ERREUR SQLCA ------------ *****/ EXEC SQL INCLUDE SQLCA; /***** ---------Fin De : APPEL DU GESTIONNAIRE D ERREUR SQLCA------------ *****/ /******************************************************************************/ /* ---- CONNECTE TOI A ---- */ /***** ------------------------------------------------------------------ *****/ main(argc,argv) int argc; char *argv[]; { EXEC SQL BEGIN DECLARE SECTION; VARCHAR uid[60]; EXEC SQL END DECLARE SECTION; oprintf(uid,"%s\0",argv[1]); EXEC SQL CONNECT :uid; if(sqlca.sqlcode == 0) {printf("OK\n"); exit(0);} printf("KO\n"); exit(1); } /***** --------------------Fin De : connecte toi a ()-------------------- *****/
ou en shell :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 echo "----------Test Connection sur la Base" >> tonlog.log $ORACLE_HOME/bin/sqlplus $USERPWDSYSTEM <<EOD2 >> tonlog.log set pause off select 'BASE OUVERTE '||lower(v.name) from v\$database v; disconnect exit EOD2 TEST_BASE=`grep "BASE OUVERTE $ORACLE_SID" tonlog.log` if [ "$TEST_BASE" = "BASE OUVERTE $ORACLE_SID" ] then echo "ok " else echo "*************************************************************" echo "*** PROBLEME CONNECTION BASE" $ORACLE_SID echo "*************************************************************" exit 9 fi