

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 Quick Sight 中的 AWS Mainframe Modernization 和 Amazon Q 產生 Db2 z/OS 資料洞見
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight"></a>

*Shubham Roy、Roshna Razack 和 Santosh Kumar Singh，Amazon Web Services*

## 總結
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-summary"></a>

注意： AWS Mainframe Modernization 服務 （受管執行期環境體驗） 不再開放給新客戶。對於類似 AWS Mainframe Modernization Service （受管執行期環境體驗） 的功能，請探索 AWS Mainframe Modernization Service （自我管理體驗）。現有客戶可以繼續正常使用該服務。如需詳細資訊，請參閱[AWS Mainframe Modernization 可用性變更](https://docs.aws.amazon.com/m2/latest/userguide/mainframe-modernization-availability-change.html)。

如果您的組織在 IBM Db2 大型主機環境中託管業務關鍵資料，從該資料中獲得洞見對於推動成長和創新至關重要。透過解鎖大型主機資料，您可以建立更快、安全和可擴展的商業智慧，以加速 Amazon Web Services (AWS) 雲端中的資料驅動型決策、成長和創新。

此模式提供解決方案，用於產生商業洞見，並從適用於 z/OS 資料表的 IBM Db2 中大型主機資料建立可分割敘述。大型主機資料變更會使用[AWS Mainframe Modernization 資料複寫搭配 Precisely](https://docs.aws.amazon.com/m2/latest/userguide/precisely.html) 串流至 [Amazon Managed Streaming for Apache Kafka (Amazon MSK)](https://docs.aws.amazon.com/msk/latest/developerguide/what-is-msk.html) 主題。使用 [Amazon Redshift 串流擷取](https://docs.aws.amazon.com/redshift/latest/dg/materialized-view-streaming-ingestion.html)，Amazon MSK 主題資料會存放在 [Amazon Redshift Serverless](https://docs.aws.amazon.com/redshift/latest/mgmt/serverless-whatis.html) 資料倉儲資料表中，以在 Amazon Quick Sight 中進行分析。

在 Quick Sight 中提供資料後，您可以使用自然語言提示搭配 [Amazon Q in Quick Sight](https://docs.aws.amazon.com/quicksight/latest/user/quicksight-gen-bi.html) 來建立資料摘要、提出問題和產生資料案例。您不需要撰寫 SQL 查詢或學習商業智慧 (BI) 工具。

**商業內容**

此模式提供大型主機資料分析和資料洞察使用案例的解決方案。使用 模式，您可以為公司資料建立視覺化儀表板。為了示範解決方案，此模式使用提供醫療、牙科和視覺計劃給美國成員的醫療保健公司。在此範例中，成員人口統計特性和計劃資訊會存放在 z/OS 資料表的 IBM Db2 中。視覺化儀表板會顯示下列項目：
+ 區域的成員分佈
+ 依性別分配成員
+ 按年齡劃分的成員分佈
+ 依計劃類型分配成員
+ 尚未完成預防性預防預防接種的成員

如需依區域和尚未完成預防性預防預防接種的成員分發的範例，請參閱其他資訊一節。

建立儀表板後，您會產生一個資料案例，說明先前分析的洞見。資料案例提供建議，以增加已完成預防性預防接種的成員人數。

## 先決條件和限制
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-prereqs"></a>

**先決條件**
+ 作用中 AWS 帳戶。此解決方案是在 Amazon Elastic Compute Cloud (Amazon EC2) 上的 Amazon Linux 2 上建置和測試。
+ 具有子網路的虛擬私有雲端 (VPC)，可由您的大型主機系統存取。
+ 具有商業資料的大型主機資料庫。如需用於建置和測試此解決方案的範例資料，請參閱*附件*一節。
+ 在 Db2 z/OS 資料表上啟用變更資料擷取 (CDC)。若要在 Db2 z/OS 上啟用 CDC，請參閱 [IBM 文件](https://www.ibm.com/docs/en/daafz/7.5?topic=cdc-enabling-data-capture-changes)。
+ 在託管來源資料庫的 z/OS 系統上安裝的 z/OS 的精確連線 CDC。Precisely Connect CDC for z/OS 映像會以 zip 檔案的形式提供於 [AWS Mainframe Modernization - Data Replication for IBM z/OS](https://aws.amazon.com/marketplace/pp/prodview-doe2lroefogia?applicationId=AWSMPContessa&ref_=beagle&sr=0-1) Amazon Machine Image (AMI)。若要在大型主機上安裝適用於 z/OS 的 Precisely Connect CDC，請參閱 [Precisely 安裝文件](https://help.precisely.com/r/AWS-Mainframe-Modernization/Latest/en-US/AWS-Mainframe-Modernization-Data-Replication-for-IBM-z/OS/Install-Precisely-Connect-CDC-z/OS)。

**限制**
+ 您的大型主機 Db2 資料應該位於 Precisely Connect CDC 支援的資料類型中。如需支援的資料類型清單，請參閱 [Precisely Connect CDC 文件](https://help.precisely.com/r/AWS-Mainframe-Modernization/Latest/en-US/AWS-Mainframe-Modernization-Data-Replication-for-IBM-z/OS/Data-replication-overview/Supported-source-data-types)。
+ 您在 Amazon MSK 的資料應位於 Amazon Redshift 支援的資料類型中。如需支援的資料類型清單，請參閱 [Amazon Redshift 文件](https://docs.aws.amazon.com/redshift/latest/dg/c_Supported_data_types.html)。
+ Amazon Redshift 對不同的資料類型有不同的行為和大小限制。如需詳細資訊，請參閱 [Amazon Redshift 文件](https://docs.aws.amazon.com/redshift/latest/dg/materialized-view-streaming-ingestion.html#materialized-view-streaming-ingestion-limitations)。
+ Quick Sight 中近乎即時的資料取決於為 Amazon Redshift 資料庫設定的重新整理間隔。
+ 有些 AWS 服務 完全無法使用 AWS 區域。如需區域可用性，請參閱[AWS 服務 依區域](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/)。Amazon Q in Quick Sight 目前不適用於支援 Quick Sight 的每個區域。如需特定端點，請參閱[服務端點和配額](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html)頁面，然後選擇服務的連結。

**產品版本**
+ AWS Mainframe Modernization 使用精確的 4.1.44 版進行資料複寫
+ Python 3.6 版或更新版本
+ Apache Kafka ** **3.5.1 版

## Architecture
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-architecture"></a>

**目標架構**

下圖顯示使用[AWS Mainframe Modernization 資料複寫搭配 Precisely](https://aws.amazon.com/mainframe-modernization/capabilities/data-replication/) 和 Amazon Q in Quick Sight 從大型主機資料產生商業洞見的架構。

![\[從 z/OS 大型主機到 Amazon QuickSight 的七個步驟程序。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/cddb6d20-14ae-4276-90d8-14df435db824.png)


該圖顯示以下工作流程：

1. Precisely Log Reader Agent 會從 Db2 日誌讀取資料，並將資料寫入大型主機上 OMVS 檔案系統的暫時性儲存體。

1. 發佈者代理程式會從暫時性儲存讀取原始 Db2 日誌。

1. 內部部署控制器協助程式會驗證、授權、監控和管理操作。

1. Apply Agent 是使用預先設定的 AMI 部署在 Amazon EC2 上。它會使用 TCP/IP 透過控制器常駐程式與發佈者代理程式連線。Apply Agent 使用多個工作者將資料推送到 Amazon MSK 以進行高輸送量。

1. 工作者會以 JSON 格式將資料寫入 Amazon MSK 主題。作為複寫訊息的中繼目標，Amazon MSK 提供高可用性和自動化容錯移轉功能。

1. Amazon Redshift 串流擷取提供從 Amazon MSK 到 Amazon Redshift Serverless 資料庫的低延遲、高速資料擷取。Amazon Redshift 中的預存程序會對 Amazon Redshift 資料表執行大型主機變更資料 (insert/update/deletes) 調校。這些 Amazon Redshift 資料表做為 Quick Sight 的資料分析來源。

1. 使用者存取 Quick Sight 中的資料，以取得分析和洞見。您可以使用 Amazon Q in Quick Sight，透過自然語言提示與資料互動。

## 工具
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-tools"></a>

**AWS 服務**
+ [Amazon Elastic Compute Cloud (Amazon EC2)](https://docs.aws.amazon.com/ec2/) 在 AWS 雲端中提供可擴展的運算容量。您可以視需要啟動任意數量的虛擬伺服器，並快速將其向外擴展或向內擴展。
+ [AWS Key Management Service (AWS KMS)](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html) 可協助您建立和控制密碼編譯金鑰，以協助保護您的資料。
+ [Amazon Managed Streaming for Apache Kafka (Amazon MSK)](https://docs.aws.amazon.com/msk/latest/developerguide/what-is-msk.html) 是一種全受管服務，可協助您建置和執行使用 Apache Kafka 處理串流資料的應用程式。
+ [Amazon Quick Sight](https://docs.aws.amazon.com/quicksight/latest/user/welcome.html) 是一種雲端規模的商業智慧 (BI) 服務，可協助您在單一儀表板中視覺化、分析和報告您的資料。此模式使用 Quick Sight 中 Amazon Q 的生成式 BI 功能。
+ [Amazon Redshift Serverless](https://aws.amazon.com/redshift/redshift-serverless/) 是 Amazon Redshift 的無伺服器選項，可讓您在幾秒鐘內更有效率地執行和擴展分析，而無需設定和管理資料倉儲基礎設施。
+ [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html) 可協助您將程式碼中的硬式編碼憑證 (包括密碼) 取代為 Secrets Manager 的 API 呼叫，以便透過程式設計方法來擷取機密。

**其他工具**
+ [Precisely Connect CDC](https://support.precisely.com/products/connect-cdc-formerly-sqdata/) 會收集舊版系統的資料，並將其整合到雲端和資料平台。

**程式碼儲存庫**

此模式的程式碼可在 GitHub [Mainframe\$1DataInsights\$1change\$1data\$1reconciliation](https://github.com/aws-samples/Mainframe_DataInsights_change_data_reconcilition) 儲存庫中使用。此程式碼是 Amazon Redshift 中的預存程序。此預存程序會將大型主機資料變更 （插入、更新和刪除） 從 Amazon MSK 協調至 Amazon Redshift 資料表。這些 Amazon Redshift 資料表可做為 Quick Sight 的資料分析來源。

## 最佳實務
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-best-practices"></a>
+ 設定 Amazon MSK 叢集時，請遵循[最佳實務](https://docs.aws.amazon.com/msk/latest/developerguide/bestpractices.html)。
+ 遵循 Amazon Redshift [資料剖析最佳實務](https://docs.aws.amazon.com/redshift/latest/dg/materialized-view-streaming-ingestion.html#materialized-view-streaming-recommendations)來改善效能。
+ 當您為精確設定建立 AWS Identity and Access Management (IAM) 角色時，請遵循最低權限原則，並授予執行任務所需的最低許可。如需詳細資訊，請參閱 IAM 文件中的[授予最低權限](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#grant-least-priv)和[安全最佳實務](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。

## 史詩
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-epics"></a>

### 在 Amazon EC2 上使用精確設定 AWS Mainframe Modernization 資料複寫
<a name="set-up-m2long-data-replication-with-precisely-on-ec2"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 設定安全群組。 | 若要連線至控制器協助程式和 Amazon MSK 叢集，請為 EC2 執行個體[建立安全群組](https://docs.aws.amazon.com/vpc/latest/userguide/creating-security-groups.html)。新增下列傳入和傳出規則：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html)請記下安全群組的名稱。當您啟動 EC2 執行個體並設定 Amazon MSK 叢集時，將需要參考名稱。 | DevOps 工程師，AWS DevOps | 
| 建立 IAM 政策和 IAM 角色。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | DevOps 工程師、AWS 系統管理員 | 
| 佈建 EC2 執行個體。 | 若要佈建 EC2 執行個體來執行精確 CDC 並連線至 Amazon MSK，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | AWS 管理員、DevOps 工程師 | 

### 設定 Amazon MSK
<a name="set-up-msk"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 建立 Amazon MSK 叢集。 | 若要建立 Amazon MSK 叢集，請執行下列 ：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html)建立典型的佈建叢集最多需要 15 分鐘。建立叢集之後，其狀態會從**建立**變更為**作用中**。 | AWS DevOps，雲端管理員 | 
| 設定 SASL/SCRAM 身分驗證。 | 若要設定 Amazon MSK 叢集的 SASL/SCRAM 身分驗證，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 雲端架構師 | 
| 建立 Amazon MSK 主題。 | 若要建立 Amazon MSK 主題，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 雲端管理員 | 

### 在 Amazon EC2 上設定精確套用引擎
<a name="configure-the-precisely-apply-engine-on-ec2"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 設定精確指令碼以複寫資料變更。 | 若要設定 Precisely Connect CDC 指令碼，將已變更的資料從大型主機複寫至 Amazon MSK 主題，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html)如需範例 .ddl 檔案，請參閱[其他資訊](#generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-additional)一節。 | 應用程式開發人員、雲端架構師 | 
| 產生網路 ACL 金鑰。 | 若要產生網路存取控制清單 （網路 ACL) 金鑰，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 雲端架構師，AWS DevOps | 

### 準備大型主機來源環境
<a name="prepare-the-mainframe-source-environment"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 在 ISPF 畫面中設定預設值。 | 若要在互動式系統生產力設施 (ISPF) 中設定預設設定，請遵循[精確文件中](https://help.precisely.com/r/AWS-Mainframe-Modernization/Latest/en-US/AWS-Mainframe-Modernization-Data-Replication-for-IBM-z/OS/Install-Precisely-Connect-CDC-z/OS/Start-ISPF-Panel-Interface)的指示。 | 大型主機系統管理員 | 
| 設定控制器協助程式。 | 若要設定控制器協助程式，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 大型主機系統管理員 | 
| 設定發布者。 | 若要設定發佈者，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 大型主機系統管理員 | 
| 更新協助程式組態檔案。 | 若要更新控制器常駐程式組態檔案中的發佈者詳細資訊，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 大型主機系統管理員 | 
| 建立任務以啟動控制器協助程式。 | 若要建立任務，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 大型主機系統管理員 | 
| 產生擷取發佈者 JCL 檔案。 | 若要產生擷取發佈者 JCL 檔案，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 大型主機系統管理員 | 
| 檢查並更新 CDC。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 大型主機系統管理員 | 
| 提交 JCL 檔案。 | 提交您在先前步驟中設定的下列 JCL 檔案：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html)提交 JCL 檔案後，您可以在 EC2 執行個體上精確地啟動套用引擎。 | 大型主機系統管理員 | 

### 執行並驗證 CDC
<a name="run-and-validate-cdc"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 啟動套用引擎並驗證 CDC。 | 若要在 EC2 執行個體上啟動套用引擎並驗證 CDC，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 雲端架構師、應用程式開發人員 | 
| 驗證 Amazon MSK 主題上的記錄。 | 若要從 Kafka 主題讀取訊息，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 應用程式開發人員、雲端架構師 | 

### 將大型主機變更資料儲存在 Amazon Redshift Serverless 資料倉儲中
<a name="store-mainframe-change-data-in-an-rsslong-data-warehouse"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 設定 Amazon Redshift Serverless。 | 若要建立 Amazon Redshift Serverless 資料倉儲，請遵循 [AWS 文件](https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html)中的指示。在 Amazon Redshift Serverless 儀表板上，驗證命名空間和工作群組已建立且可供使用。在此範例模式中，程序可能需要 2-5 分鐘。 | 資料工程師 | 
| 設定串流擷取所需的 IAM 角色和信任政策。 | 若要從 Amazon MSK 設定 Amazon Redshift Serverless 串流擷取，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 資料工程師 | 
| 將 Amazon Redshift Serverless 連線至 Amazon MSK。 | 若要連線至 Amazon MSK 主題，請在 Amazon Redshift Serverless 中建立外部結構描述。在 Amazon Redshift 查詢編輯器 v2 中，執行下列 SQL 命令，`'iam_role_arn'`將 取代為您先前建立的角色，並將 `'MSK_cluster_arn`' 取代為您叢集的 ARN。<pre>CREATE EXTERNAL SCHEMA member_schema<br />FROM MSK<br />IAM_ROLE 'iam_role_arn'<br />AUTHENTICATION iam<br />URI 'MSK_cluster_arn';</pre> | 遷移工程師 | 
| 建立具體化視觀表。 | 若要使用 Amazon Redshift Serverless 中 Amazon MSK 主題的資料，請建立具體化檢視。在 Amazon Redshift 查詢編輯器 v2 中，執行下列 SQL 命令，`<MSK_Topic_name>`將 取代為 Amazon MSK 主題的名稱。<pre>CREATE MATERIALIZED VIEW member_view<br />AUTO REFRESH YES<br />AS SELECT<br />kafka_partition, <br />kafka_offset, <br />refresh_time, <br />json_parse(kafka_value) AS Data<br />FROM member_schema.<MSK_Topic_name><br />WHERE CAN_JSON_PARSE(kafka_value); <br /></pre> | 遷移工程師 | 
| 在 Amazon Redshift 中建立目標資料表。 | Amazon Redshift 資料表提供 Quick Sight 的輸入。此模式使用與大型主機上的來源 Db2 資料表`member_plans`相符的資料表 `member_dtls`和 。若要在 Amazon Redshift 中建立兩個資料表，請在 Amazon Redshift 查詢編輯器 v2 中執行下列 SQL 命令：<pre>-- Table 1: members_dtls<br />CREATE TABLE members_dtls (<br /> memberid INT ENCODE AZ64,<br /> member_name VARCHAR(100) ENCODE ZSTD,<br /> member_type VARCHAR(50) ENCODE ZSTD,<br /> age INT ENCODE AZ64,<br /> gender CHAR(1) ENCODE BYTEDICT,<br /> email VARCHAR(100) ENCODE ZSTD,<br /> region VARCHAR(50) ENCODE ZSTD<br />) DISTSTYLE AUTO;<br /><br />-- Table 2: member_plans<br />CREATE TABLE member_plans (<br /> memberid INT ENCODE AZ64,<br /> medical_plan CHAR(1) ENCODE BYTEDICT,<br /> dental_plan CHAR(1) ENCODE BYTEDICT,<br /> vision_plan CHAR(1) ENCODE BYTEDICT,<br /> preventive_immunization VARCHAR(50) ENCODE ZSTD<br />) DISTSTYLE AUTO;</pre> | 遷移工程師 | 
| 在 Amazon Redshift 中建立預存程序。 | 此模式使用預存程序，將變更資料 (`INSERT`、`UPDATE`、`DELETE`) 從來源大型主機同步到目標 Amazon Redshift 資料倉儲資料表，以便在 Quick Sight 中進行分析。若要在 Amazon Redshift 中建立預存程序，請使用查詢編輯器 v2 來執行 GitHub 儲存庫中的預存程序程式碼。 | 遷移工程師 | 
| 從串流具體化檢視讀取並載入目標資料表。 | 預存程序會從串流具體化檢視讀取資料變更，並將資料變更載入目標資料表。若要執行預存程序，請使用下列命令：<pre>call SP_Members_Load();</pre>您可以使用 [Amazon EventBridge](https://aws.amazon.com/eventbridge/) 來排程 Amazon Redshift 資料倉儲中的任務，以根據您的資料延遲需求呼叫此預存程序。EventBridge 會以固定間隔執行任務。若要監控先前對程序的呼叫是否已完成，您可能需要使用[AWS Step Functions](https://aws.amazon.com/step-functions/)狀態機器等機制。如需詳細資訊，請參閱下列資源：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html)另一個選項是使用 Amazon Redshift 查詢編輯器 v2 來排程重新整理。如需詳細資訊，請參閱[使用查詢編輯器 v2 排程查詢](https://docs.aws.amazon.com/redshift/latest/mgmt/query-editor-v2-schedule-query.html)。 | 遷移工程師 | 

### 將 Quick Sight 連線至 Amazon Redshift 中的資料
<a name="connect-quick-sight-to-data-in-rs"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 設定 Quick Sight。 | 若要設定 Quick Sight，請遵循 [AWS 文件](https://docs.aws.amazon.com/quicksight/latest/user/setting-up.html)中的指示。 | 遷移工程師 | 
| 設定 Quick Sight 和 Amazon Redshift 之間的安全連線。 | 若要設定 Quick Sight 與 Amazon Redshift 之間的連線，請執行下列動作[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 遷移工程師 | 
| 建立 Quick Sight 的資料集。 | 若要從 Amazon Redshift 建立 Quick Sight 的資料集，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 遷移工程師 | 
| 加入資料集。 | 若要在 Quick Sight 中建立分析，請依照[AWS 文件中](https://docs.aws.amazon.com/quicksight/latest/user/joining-data.html#create-a-join)的指示加入兩個資料表。在**聯結組態**窗格中，選擇**左**表示**聯結類型**。在**聯結子句**下，使用 `memberid from member_plans = memberid from members_details`。 | 遷移工程師 | 

### 使用 Quick Sight 中的 Amazon Q 從大型主機資料中取得商業洞見
<a name="get-business-insights-from-the-mainframe-data-by-using-qdev-in-quick-sight"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 在 Quick Sight 中設定 Amazon Q。 | 若要設定 Amazon Q in Quick Sight 生成式 BI 功能，請遵循[AWS 文件中](https://docs.aws.amazon.com/quicksight/latest/user/generative-bi-get-started.html)的指示。 | 遷移工程師 | 
| 分析大型主機資料並建置視覺化儀表板。 | 若要在 Quick Sight 中分析和視覺化您的資料，請執行下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html)完成後，您可以發佈儀表板，與組織中的其他人共用。如需範例，請參閱[其他資訊](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/generate-data-insights-by-using-aws-mainframe-modernization-and-amazon-q-in-quicksight.html#generate-data-insights-by-using-aws-mainframe-modernization-and-amazon-q-in-quicksight-additional)區段中的*大型主機視覺化儀表板*。 | 遷移工程師 | 

### 從大型主機資料使用 Quick Sight 中的 Amazon Q 建立資料案例
<a name="create-a-data-story-with-qdev-in-quick-sight-from-mainframe-data"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 建立資料案例。 | 建立資料案例來解釋先前分析的洞見，並產生建議，以增加成員的預防性預防預防接種：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 遷移工程師 | 
| 檢視產生的資料案例。 | 若要檢視產生的資料案例，請在資料案例頁面上選擇該**案例**。 | 遷移工程師 | 
| 編輯產生的資料案例。 | 若要變更資料案例中的格式、配置或視覺效果，請遵循[AWS 文件中](https://docs.aws.amazon.com/quicksight/latest/user/working-with-stories-edit.html)的指示。 | 遷移工程師 | 
| 分享資料案例。 | 若要分享資料案例，請遵循[AWS 文件中](https://docs.aws.amazon.com/quicksight/latest/user/working-with-stories-share.html)的指示。 | 遷移工程師 | 

## 疑難排解
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-troubleshooting"></a>


| 問題 | 解決方案 | 
| --- | --- | 
| 對於 Quick Sight 到 Amazon Redshift 資料集建立， `Validate Connection`已淡出。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 
| 嘗試在 EC2 執行個體上啟動套用引擎會傳回下列錯誤：`-bash: sqdeng: command not found` | 執行下列命令以匯出`sqdata`安裝路徑：<pre>export PATH=$PATH:/usr/sbin:/opt/precisely/di/sqdata/bin</pre> | 
| 嘗試啟動 Apply Engine 會傳回下列其中一個連線錯誤：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight.html) | 檢查大型主機集區，確認控制器協助程式任務正在執行。 | 

## 相關資源
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-resources"></a>
+ [使用 Quick Sight 中的 AWS Mainframe Modernization 和 Amazon Q 產生洞](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/generate-data-insights-by-using-aws-mainframe-modernization-and-amazon-q-in-quicksight.html?did=pg_card&trk=pg_card)見 （模式）
+ [使用 Quick Sight 中的 AWS Mainframe Modernization 和 Amazon Q 產生資料洞](https://youtu.be/F8b7l79p6TM?si=gASuQtFbMVuEm7IJ)見 （示範）
+ [AWS Mainframe Modernization - IBM z/OS 的資料複寫](https://aws.amazon.com/marketplace/pp/prodview-doe2lroefogia?sr=0-4&ref_=beagle&applicationId=AWSMPContessa)
+ [Amazon Redshift 串流擷取到具體化視觀表](https://docs.aws.amazon.com/redshift/latest/dg/materialized-view-streaming-ingestion.html)

## 其他資訊
<a name="generate-db2-zos-data-insights-aws-mainframe-modernization-amazon-q-in-quicksight-additional"></a>

**範例 .ddl 檔案**

*members\$1details.ddl*

```
CREATE TABLE MEMBER_DTLS (
memberid INTEGER NOT NULL,
member_name VARCHAR(50),
member_type VARCHAR(20),
age INTEGER,
gender CHAR(1),
email VARCHAR(100),
region VARCHAR(20)
);
```

*member\$1plans.ddl*

```
CREATE TABLE MEMBER_PLANS (
memberid INTEGER NOT NULL,
medical_plan CHAR(1),
dental_plan CHAR(1),
vision_plan CHAR(1),
preventive_immunization VARCHAR(20)
);
```

**範例 .sqd 檔案**

將 取代** **`<kafka topic name>`為您的 Amazon MSK 主題名稱。

*script.sqd*

```
-- Name: DB2ZTOMSK: DB2z To MSK JOBNAME DB2ZTOMSK;REPORT EVERY 1;OPTIONS CDCOP('I','U','D');-- Source Descriptions
JOBNAME DB2ZTOMSK;
REPORT EVERY 1;
OPTIONS CDCOP('I','U','D');

-- Source Descriptions 
BEGIN GROUP DB2_SOURCE; 
DESCRIPTION DB2SQL /var/precisely/di/sqdata/apply/DB2ZTOMSK/ddl/mem_details.ddl AS MEMBER_DTLS;
DESCRIPTION DB2SQL /var/precisely/di/sqdata/apply/DB2ZTOMSK/ddl/mem_plans.ddl AS MEMBER_PLANS; 
END GROUP;
-- Source Datastore 
DATASTORE cdc://<zos_host_name>/DB2ZTOMSK/DB2ZTOMSK
OF UTSCDC 
AS CDCIN 
DESCRIBED BY GROUP DB2_SOURCE ;
-- Target Datastore(s)
DATASTORE 'kafka:///<kafka topic name>/key'
OF JSON
AS TARGET
DESCRIBED BY GROUP DB2_SOURCE;
PROCESS INTO TARGET
SELECT
{
REPLICATE(TARGET)
}
FROM CDCIN;
```

**大型主機視覺化儀表板**

下列資料視覺效果是由 Amazon Q in Quick Sight 針對分析問題 所建立`show member distribution by region`*。*

![\[美國東北部和西南部有 8 個成員，西南部有 5 個成員，中西部有 4 個成員。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/b40a784c-c1fc-444b-b6df-8bd1f7a6abaa.png)


以下資料視覺效果是由 Amazon Q in Quick Sight 為問題 建立`show member distribution by Region who have not completed preventive immunization, in pie chart`。

![\[Southeast 顯示 6， Southwest 顯示 5，而 Midwest 顯示 4。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/8a95da3c-df4a-458b-9cfe-44e34f80a235.png)


**資料案例輸出**

下列螢幕擷取畫面顯示 Amazon Q in Quick Sight 為提示 建立的資料案例區段`Build a data story about Region with most numbers of members. Also show the member distribution by age, member distribution by gender. Recommend how to motivate members to complete immunization. Include 4 points of supporting data for this pattern`。

在簡介中，資料案例建議選擇擁有最多成員的區域，以從防盜工作中獲得最大的影響。

![\[根據成員基礎的地理、人口統計和年齡進行分析的簡介畫面。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/40f13957-2db4-42b7-b7a4-a0dd3dad6899.png)


資料案例提供四個區域的成員號碼分析。美國東北部、西南部和東南亞區域的成員最多。

![\[美國東部和西南部區域有 8 個成員，東南亞有 6 個成員，中西部有 4 個成員。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/fc6ed0a0-b79c-4397-95ac-a2fc4c87482a.png)


資料案例會呈現各年齡的成員分析。

![\[圖表顯示成員基礎偏向較年幼和中年成人。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/8c56f1ec-3a2e-47a6-bbc4-3631782aa333.png)


資料案例著重於中西部的預防工作。

![\[個人拓展行銷活動和區域挑戰的建議。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/84a647e8-c7d5-4637-94f0-03a611f899b3.png)


![\[繼續進行資料案例分析，以及預期成果和結論。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/18e72bcb-1b9a-406a-8220-83aca7743ad2/images/fc9094fc-2a20-485d-b238-e5e4ec70f1d3.png)


## 附件
<a name="attachments-18e72bcb-1b9a-406a-8220-83aca7743ad2"></a>

若要存取與本文件相關聯的其他內容，請解壓縮下列檔案： [attachment.zip](samples/p-attach/18e72bcb-1b9a-406a-8220-83aca7743ad2/attachments/attachment.zip)