管理您的資料來源 - OracleManage your data source - Oracle

安裝內部部署資料閘道之後,您必須新增可搭配閘道使用的資料來源。Once you have installed the on-premises data gateway, you will need to add data sources that can be used with the gateway. 本文將探討如何使用閘道和資料來源。This article will look at how to work with gateways and data sources. 您可以針對已排程的重新整理或 DirectQuery,使用 Oracle 資料來源。You can use the Oracle data source either for scheduled refresh or for DirectQuery.

下載並安裝閘道Download and install the gateway

您可以從 Power BI 服務下載閘道。You can download the gateway from the Power BI service. 選取 [下載] > [資料閘道],或移至 gateway download page (閘道下載頁面)Select Downloads > Data Gateway, or by going to the gateway download page.


必須先安裝及設定 .Net 的 Oracle 資料提供者 (ODP.NET),才能使閘道連接至您的 Oracle 伺服器。In order for the gateway to be able to connect to your Oracle server, the Oracle Data Provider for .NET (ODP.NET) needs to be installed and configured. 這是 Oracle 資料存取元件 (ODAC) 的部分。This is part of the Oracle Data Access Components (ODAC). 如需如何下載 Oracle 提供者的詳細資訊,請參閱下方的安裝 Oracle 用戶端For more information on how to download the Oracle provider, see Installing the Oracle Client below.

安裝 Oracle 用戶端Installing the Oracle client

針對 32 位元版本的 Power BI Desktop,使用下列連結,下載並安裝 32 位元的 Oracle 用戶端︰For 32-bit versions of Power BI Desktop, use the following link to download and install the 32-bit Oracle client:

若是 64 位元版本的 Power BI Desktop 或是內部部署資料閘道,使用下列連結下載並安裝 64 位元 的 Oracle 用戶端︰For 64-bit versions of Power BI Desktop, or for the on-premises data gateway, use the following link to download and install the 64-bit Oracle client:

安裝後,您必須使用您資料庫的適當資訊設定 tnsnames.ora 檔案。Once that is installed, you will need to configure your tnsnames.ora file with the proper information for your database. Power BI Desktop 和閘道將會移開 tnsnames.ora 檔案中定義的 net_service_name。Power BI Desktop and the gateway will go off of the net_service_name defined in the tnsnames.ora file. 若未設定,您將無法連接。If it isn't configured, you will not be able to connect. tnsnames.ora 的預設路徑如下:[Oracle Home Directory]\Network\Admin\tnsnames.oraThe default path for tnsnames.ora is the following: [Oracle Home Directory]\Network\Admin\tnsnames.ora. 如需如何設定 tnsnames.ora 檔案的詳細資訊,請參閱 Oracle︰本機命名參數 (tnsnames.ora)For more information about how to configure tnsnames.ora files, see Oracle: Local Naming Parameters (tnsnames.ora).

範例 tnsnames.ora 檔案項目Example tnsnames.ora file entry

tnsname.ora 中的項目基本格式如下所示。The basic format of an entry in tnsname.ora is the following.


以下是填入的伺服器及連接埠資訊範例。Here is an example of the server and port information filled in.

    (ADDRESS = (PROTOCOL = TCP)(HOST = oracleserver.contoso.com)(PORT = 1521))

加入閘道Add a gateway

若要新增閘道,只要下載閘道並在您環境中的伺服器即可。To add a gateway, simply download and install the gateway on a server in your environment. 安裝閘道之後,它會顯示在 [管理閘道] 底下的閘道清單中。After you have installed the gateway, it will show in the lists of gateways under Manage gateways.


您必須是至少一個閘道的管理員,才會顯示 [管理閘道]。Manage gateways will not show up until you are the admin of at least one gateway. 當以管理員身分加入閘道時,或者當您安裝並設定閘道時,就會發生這種情況。This can happen either by being added as an admin or you installing and configuring a gateway.

移除閘道器Remove a gateway

移除閘道器的同時也會刪除該閘道器下的所有資料來源。Removing a gateway will also delete any data sources under that gateway. 這也會中斷依賴這些資料來源的任何儀表板和報表。This will also break any dashboards and reports that rely on those data sources.

  1. 選取右上角的齒輪圖示 > [管理閘道] 。Select the gear icon in the upper-right corner > Manage gateways.
  2. [閘道] > [移除]Gateway > Remove

加入資料來源Add a data source

您可以選取閘道並按一下 [加入資料來源],或移至 [閘道] > [加入資料來源] ,以加入資料來源。You can add a data source by either selecting a gateway and click Add data source, or go to Gateway > Add data source.

您可以接著從清單中選取 [資料來源類型] 。You can then select the Data Source Type from the list.

您接著需要填入資料來源的資訊,包括 伺服器資料庫You will then want to fill in the information for the data source which includes the Server and the Database.

您也需要選擇 [驗證方法] 。You will also need to choose an Authentication Method. 此方法可以是 [Windows] 或 [基本] 。This can either be Windows or Basic. 若您要使用在 Oracle 而非 Windows 驗證中所建立的帳戶,則需要選擇 [基本]。You would want to choose Basic if you are going to use an account that is created within Oracle instead of Windows Authentication. 然後輸入要用於這個資料來源的認證。Then enter the credentials that will be used for this data source.


資料來源的所有查詢都會使用這些認證來執行。All queries to the data source will run using these credentials. 如需詳細資訊,請參閱主要內部部署資料閘道文章,以深入了解認證的儲存方式。For more information, see the main on-premises data gateway article to learn more about how credentials are stored.

您可以在填入所有內容之後,按一下 [加入] 。You can click Add after you have everything filled in. 您現在可以使用此資料來源,針對內部部署的 Oracle 伺服器,用於已排程的重新整理或 DirectQuery。You can now use this data source for scheduled refresh, or DirectQuery, against an Oracle server that is on-premises. 如果成功,您會看到 [連接成功] 。You will see Connection Successful if it succeeded.

進階設定Advanced settings

您可以設定資料來源的隱私權等級,You can configure the privacy level for your data source. 如此可控制如何混搭資料。This controls how data can be mashed up. 這只能用於已排程的重新整理。This is only used for scheduled refresh. 不適用於 DirectQuery。It does not apply to DirectQuery. 深入了解Learn more

移除資料來源Remove a data source

移除資料來源的同時也會中斷依賴指定資料來源的所有儀表板或報表。Removing a data source will break any dashboards or reports that rely on the given data source.

若要移除資料來源,請前往 [資料來源] > [移除]。To remove a Data Source, go to the Data Source > Remove.

管理管理員Manage administrators

在閘道的 [管理員] 索引標籤上,您可以新增並移除可管理閘道的使用者 (或安全性群組)。On the Administrators tab for the gateway, you can add and remove users (or security groups) that can administer the gateway.

管理使用者Manage users

您可以在 [使用者] 索引標籤上,針對資料來源加入並移除可以使用這個資料來源的使用者或安全性群組。On the Users tab, for the data source, you can add, and remove, users, or security groups, that can use this data source.


使用者清單僅控制獲准發行報表的人員。The users list only controls who are allowed to publish reports. 報表擁有者可以建立儀表板或內容套件,並與其他使用者共用。The report owners can create dashboards, or content packs, and share those with other users. 使用報表或儀表板的使用者不需要出現在使用者清單中。Users that are consuming the report or dashboard do not need to be in the users list.

使用資料來源Using the data source

建立資料來源之後,您將可使用其中一個 DirectQuery 連接或透過已排程的重新整理,以取得資料來源。After you have created the data source, it will be available to use with either DirectQuery connections, or through scheduled refresh.


伺服器和資料庫名稱必須符合內部部署資料閘道內的 Power BI Desktop 和資料來源!Server and database name have to match between Power BI Desktop and the data source within the on-premises data gateway!

您的資料集和閘道內的資料來源是根據您的伺服器名稱和資料庫名稱以建立連結。The link between your dataset and the data source within the gateway is based on your server name and database name. 這些項目必須相符!These have to match! 例如,若您的伺服器名稱是 IP 位址,在 Power BI Desktop 內,您將必須使用該 IP 位址以取得閘道設定內的資料來源。For example, if you supply an IP Address for the server name, within Power BI Desktop, you will need to use the IP Address for the data source within the gateway configuration. 此名稱也必須符合 tnsnames.ora 檔案中定義的別名。This name also has to match an alias defined within the tnsnames.ora file. 如需 tnsnames.ora 檔案的詳細資訊,請參閱安裝 Oracle 用戶端For more information about the tnsnames.ora file, see Installing the Oracle Client.

這適用於 DirectQuery 和已排程的重新整理。This is the case for both DirectQuery and scheduled refresh.

使用 DirectQuery 連接來使用資料來源Using the data source with DirectQuery connections

您必須確定伺服器和資料庫名稱與 Power BI Desktop 及閘道已設定的資料來源相符。You will need to make sure the server and database name matches between Power BI Desktop and the configured data source for the gateway. 您也必須確定資料來源的 使用者 索引標籤已列出您的使用者,以便發行 DirectQuery 資料集。You will also need to make sure your user is listed in the Users tab of the data source in order to publish DirectQuery datasets. 當您第一次匯入資料時,Power BI Desktop 內會出現 DirectQuery 的選取項目。The selection, for DirectQuery, occurs within Power BI Desktop when you first import data. 深入了解Learn more

發行之後,您的報表會從 Power BI Desktop 或取得資料開始工作。After you publish, either from Power BI Desktop or Get Data, your reports should start working. 建立閘道內的資料來源之後,可能需要幾分鐘的時間才能使用連線。It may take several minutes, after creating the data source within the gateway, for the connection to be usable.

使用已排程的重新整理使用資料來源Using the data source with scheduled refresh

若閘道內設定資料來源的 [使用者] 索引標籤中列出您的使用者,而伺服器和資料庫名稱也相符,您就可以將閘道作為進行已排程重新整理的一個選項。If you are listed in the Users tab of the data source configured within the gateway, and the server and database name match, you will see the gateway as an option to use with scheduled refresh.


當命名語法不正確或未正確設定時,可能會遇到來自 Oracle 的多種錯誤。You may encounter serveral errors from Oracle when the naming syntax is either incorrect or not configured properly.

  • ORA-12154: TNS: 無法解析指定的連接識別碼ORA-12154: TNS: could not resolve the connect identifier specified
  • ORA-12514: TNS 接聽程式目前不了解連接描述元中要求的服務ORA-12514: TNS listener does not currently know of service requested in connect descriptor
  • ORA-12541: TNS: 沒有任何接聽程式ORA-12541: TNS: no listener
  • ORA-12170: 發生連接逾時ORA-12170: TNS:Connect timeout occurred
  • ORA-12504: TNS 接聽程式未得到 SERVICE_NAME CONNECT_DATAORA-12504: TNS listener was not given the SERVICE_NAME in CONNECT_DATA

若未安裝或未正確設定 Oracle 用戶端,可能會發生這些錯誤。These errors could occur if either the Oracle client is not installed, or if it is not configured properly. 若已安裝,建議您驗證 tnsnames.ora 檔案已正確設定,並使用適當的 net_service_name。If it is installed, you will want to verify the tnsnames.ora file is properly configured and you are using the proper net_service_name. 您也必須確定使用 Power BI Desktop 的電腦與執行閘道的電腦所使用的 net_service_name 相同。You will also need to make sure that the net_service_name is the same between the machine using Power BI Desktop and the machine that is running the gateway. 如需詳細資訊,請參閱安裝 Oracle 用戶端For more information, see Installing the Oracle Client.


您也可能因為 Oracle 伺服器版本與 Oracle 用戶端版本之間的相容性,而遭遇問題。You may also be hitting an issue due to compatability between the Oracle server version and the Oracle client version. 一般而言這些應當相符。Typically you want these to match.

如何與閘道相關的其他疑難排解資訊,請參閱為內部部署資料閘道疑難排解For additional troubleshooting information relating to the gateway, see Troubleshooting the on-premises data gateway.

後續步驟Next steps

內部部署資料閘道On-premises data gateway
內部部署資料閘道 - 深入資訊On-premises data gateway - in-depth
為內部部署資料閘道進行疑難排解Troubleshooting the on-premises data gateway
Power BI PremiumPower BI Premium

有其他問題嗎?More questions? 嘗試在 Power BI 社群提問Try asking the Power BI Community