Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Remote » チュートリアル:SQL Remote システムの作成

 

レッスン 8:リモートデータベースから統合データベースへのデータの送信

Interactive SQL を使用して、リモートデータベース (field) から統合データベース (hq) にデータをレプリケートします。

前提条件

SYS_REPLICATION_ADMIN_ROLE システムロールが必要です。

内容と備考

次のとおりです。

 ♦ タスク
  1. 現在リモートデータベース (field) に接続していない場合は、次のコマンドを実行します。

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\field.db"
  2. 次の文を実行し、リモートデータベース (field) でローを挿入します。

    INSERT INTO Customers ( cust_key, name, rep_key )
    VALUES ( 'cust5', 'North Land Trading', 'rep1' );
    COMMIT;
  3. c:\tutorial ディレクトリから、リモートデータベース (field) に対して dbremote ユーティリティを実行します。

    dbremote -c "UID=DBA;PWD=sql;SERVER=server_field;DBF=c:\tutorial\field.db"

    c:\tutorial\hq ディレクトリに、ファイル field.1 が表示されます。

  4. 現在、統合データベース (hq) に接続されていない場合は、次のコマンドを実行します。

    dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db
    
  5. 統合データベース (hq) で、c:\tutorial ディレクトリから Message Agent を実行します。

    dbremote -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db"
  6. [Message Agent] ウィンドウに「実行が完了しました。」と表示されたら、[シャットダウン] をクリックします。

  7. c:\tutorial\field を参照します。

    hq.1 ファイルは hq.2 というファイルに置き換えられました。hq.2 ファイルは受信確認を含みます。

  8. 次の文を実行して、統合データベース (hq) 内の Customers テーブルのデータを表示します。

    SELECT * FROM Customers;

    このクエリは、次の結果を返します。

    cust_key name rep_key
    cust1 Ocean Sports rep1
    cust2 Sports Plus rep2
    cust3 Land Sports rep1
    cust4 Air Plus rep2
    cust5 North Landing Trading rep1

結果

リモートデータベースから統合データベースにデータがレプリケートされます。

次の手順

なし。