Oracle Grid Infrastructure 11g インストール

うまくいかない・・・・


/u01/app/grid/product/11.2.0/grid/root.sh
↑ OUIで指示された後の実行でこける。。。


「libcap.so.1: cannot open shared object file: No such file or directory」


だったので


# wget ftp://ftp.pbone.net/mirror/www.startcom.org/AS-6.0.0/os/i686/Packages/compat-libcap1-1.10-1.i686.rpm
# rpm -ivh compat-libcap1-1.10-1.i686.rpm


で、root.shを再実行。


その後、再実行。
「ohasd failed to start: デバイスに対する不適切なioctlです
ohasd failed to start: デバイスに対する不適切なioctlです at /u01/app/grid/product/11.2.0/grid/crs/install/roothas.pl line 296.」



# vi /etc/init.d/ohasd
79、80行目の間に
「/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1 &」
を追加。


その後、再実行。
「Please deconfigure before proceeding with the configuration of new home. 」


って出たので
別ターミナルで
# /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1
してから、
# /u01/app/grid/product/11.2.0/grid/crs/install/rootcrs.pl -deconfig -force
を実行。


「cvuqdiskがインストールされていません」って出たので
# cd /u01/src/grid/rpm
# rpm -ivh cvuqdisk-1.0.7-1.rpm


もう一回「rootcrs.pl」を実行。


なんかsuccessfullyが出たので「root.sh」を実行。


cvuqdiskを入れなおして「root.sh」を実行。
(なんかdeconfigすると消えるみたいだったので一応)


「Please deconfigure before proceeding with the configuration of new home. 」


が出た・・・・なんかループしてる気がする。。。


もうやだ・・・
とりあえず、何かしら設定はできてるってことだよね?


無視して次にいこう。。。


OUIに戻って続きをやって終了。


で、よく分からないまま、databaseをインストール・・・


うーん・・・CentOS6.xはダメなのかな。。
なんか、どこかで「not supported」とか出てたしな・・・


最悪、別OSをインストールしなおして入れればいいか。

SIPサーバ

JavaSIPサーバを一から作ってみました。

とりあえずは、iPhoneSIPクライアントのアプリをダウンロードしてPCにソフトフォンを入れてテストしてみました。

実際に通話出来ました!!!

かなり面倒でした……

基本接続しか対応してませんが。。。。

とりあえずは、通話も出来たので一旦、作成は終わりにします。

会社絡みでOracle Goldの資格を取らないといけなくなったので。


ソースとか見たい人いるのかな?

C言語の勉強3 Oracleデータベース接続

C言語の勉強というタイトルですが微妙に違うような。。。

C言語Oracleデータベースに接続ってどうやるのか気になったので調べてみました。

環境
 IDE : Visual Stdio 2010
 Oracle : Oracle Database11gR2
      Oracle Client


設定
 ■Visual Stdio 2010
  1. 対象のプロジェクトを右クリック→「参照」→「構成プロパティ」→「VC++ディレクトリ」→「インクルードディレクトリ」
   「Oracle Clientインストールディレクトリ/oci/includes」追加。
  2. 対象のプロジェクトを右クリック→「参照」→「構成プロパティ」→「VC++ディレクトリ」→「ライブラリディレクトリ」
    「Oracle Clientインストールディレクトリ/oci/lib/msvc」追加。
  3. 対象のプロジェクトを右クリック→「参照」→「構成プロパティ」→「リンカ」→「コマンドライン
    追加オプションに「oci.lib」を追加。


 ■Oracle Client
  tnsnames.oraにサービス名を追加。
   (前に設定してあったのでスキップ)


ソース


#include
#include
#include


int main( int argc, char* argv[] )
{
sword status = OCI_SUCCESS;
OCIEnv* envhp;
OCIError* errhp;
OCISvcCtx* svchp;
OCIStmt* stmtp;
//OCIBind* bindp;
OCIDefine* dfnp;
char* username = "study";
char* password = "study";
char* dbname = "orcl";
char* stmt = "SELECT 'Hello, OCI World!' AS Message FROM DUAL";
char message[64];

status = OCIEnvCreate(&envhp, OCI_DEFAULT, 0, 0, 0, 0, 0, 0);
if(status != OCI_SUCCESS) {
printf("OCIEnvCreate - error : %d.\n", status);
return -1;
}

status = OCIHandleAlloc(envhp, (dvoid **)&errhp, OCI_HTYPE_ERROR, 0, 0);
if(status != OCI_SUCCESS) {
printf("OCIHandleAlloc - error : %d.\n", status);
return -1;
}

status = OCILogon(envhp, errhp, &svchp, (OraText*)username, strlen(username),
(OraText*)password, strlen(password), (OraText*)dbname, strlen(dbname));
if(status != OCI_SUCCESS) {
printf("OCILogon - error : %d.\n", status);
return -1;
}

status = OCIHandleAlloc(envhp, (dvoid **)&stmtp, OCI_HTYPE_STMT, 0, 0);
if(status != OCI_SUCCESS) {
printf("OCIHandleAlloc - error : %d.\n", status);
return -1;
}

status = OCIStmtPrepare(stmtp, errhp, (OraText*)stmt, strlen(stmt), OCI_NTV_SYNTAX, OCI_DEFAULT);
if(status != OCI_SUCCESS) {
printf("OCIStmtPrepare - error : %d.\n", status);
return -1;
}

status = OCIDefineByPos(stmtp, &dfnp, errhp, 1, message, sizeof(message), SQLT_STR, 0, 0, 0, OCI_DEFAULT);
if(status != OCI_SUCCESS) {
printf("OCIDefineByPos - error : %d.\n", status);
return -1;
}

status = OCIStmtExecute(svchp, stmtp, errhp, 1, 0, NULL, NULL, OCI_DEFAULT);
if(status != OCI_SUCCESS) {
printf("OCIStmtExecute - error : %d.\n", status);
return -1;
}

while ( status == OCI_SUCCESS ) {
printf("%sn", message);
status = OCIStmtFetch2(stmtp, errhp, 1, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
}

/** 解放 */
OCIHandleFree(stmtp, OCI_HTYPE_STMT);
OCILogoff(svchp, errhp);
OCIHandleFree(errhp, OCI_HTYPE_ERROR);

return 0;
}


かなり時間が掛かりました
Javaなら数分で出来るのになぁ・・・


■追記
 これはWindowsでのコンパイル・接続するための方法です。

Oracle Master Gold 11g

最近は時間がある場合は、C言語の勉強しかしてませんでした。

いい加減、Oracleの勉強を開始しないと。。。
Oracle Databaseは好きだし、完全にSilverの内容を忘れたくないしね


家のOracleサーバもエラーで止まっていましたが
直してバックアップも取得したしこれで壊れてもリカバリ出来るし頑張ろう!

C言語の勉強2


#include

int main() {
char str[] = "xxx";
char c1[4] = "abc";
char* p;
char *str_p;

str_p = str;
p = c1;

printf("c1(c) = %c\n", *p);
printf("c1(s) = %s\n", p);
printf("str = %s\n", str_p);

return 0;
}

出力結果***

c1(c) = a
c1(s) = abc
str = xxx

print関数で*pとすると配列の先頭アドレスが入るから%cで先頭文字だけ出力して、pとするとポインタのアドレスが入るから%sで全ての文字を出力する??

C言語の勉強


#include

int main(int argc, char** argv) {

// 実体
int i = 10;
char c0 = 'a';
int nums[4] = {1,2,3,4};
char c1[4] = "abc";

// アドレス格納変数 = ポインタ
char* p = c1;
int* p1 = nums;

printf("i = %d\n", i);
printf("c0 = %c\n", c0);
printf("c1 = %s\n", c1);

printf("c1 = %c\n", c1[0]);
printf("c1 = %c\n", c1[1]);
printf("c1 = %c\n", c1[2]);

printf("nums = %d\n", nums[0]);
printf("nums = %d\n", nums[1]);
printf("nums = %d\n", nums[2]);
printf("nums = %d\n", nums[3]);

// ポインタで表示
printf("c1 = %c\n", *p);
printf("c1 = %c\n", *(p+1));
printf("c1 = %c\n", *(p+2));

printf("nums = %d\n", *p1);
printf("nums = %d\n", *(p1+1));
printf("nums = %d\n", *(p1+2));
printf("nums = %d\n", *(p1+3));

}

出力結果***

i = 10
c0 = a
c1 = abc
nums = 1
nums = 2
nums = 3
nums = 4
c1 = a
c1 = b
c1 = c
nums = 1
nums = 2
nums = 3
nums = 4


ポインタなんだから「char* p = &c1」でアドレスを格納するべきでは??
でも、「char* p = &c1」ってやると
initialization from incompatible pointer type
が出力される。。。。

なんで???


追記
配列変数の場合は、「&」を付けない状態が配列の先頭アドレスになるから。