英文:
The external connectivity feature of the PieCloudDB database
问题
PieCloudDB数据库提供直接从外部数据库加载数据的功能吗?
我可以连接到外部数据库,无需任何中间步骤或数据转换,将数据直接导入PieCloudDB数据库吗?
英文:
Does the PieCloudDB database provide the functionality to directly load data from external databases?
Can I connect to an external database without any intermediary steps or data transformations and import the data directly into the PieCloudDB database?
答案1
得分: 0
PieCloudDB数据库可以直接从外部数据库加载数据。以Oracle数据库为例:
-
在PieCloudDB上配置oracle_fdw依赖项。
-
上述文件应提取并放置在PieCloudDB的所有节点上的/home/openpie/instantclient_12_2/目录中。操作系统上的openpie用户的.bash_profile应配置以下环境变量,这些变量应在所有节点上设置。
vim ~/.bash_profile
export ORACLE_HOME=/opt/instantclient_21_9
export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
- 在PieCloudDB中创建fdw。
psql -p 6003 testdb
drop extension oracle_fdw cascade;
create extension oracle_fdw;
- 在PieCloudDB中创建外部服务。
psql -p 6003 testdb
create server ora_srv_test foreign data wrapper oracle_fdw options(dbserver'ip address:1521/testdb');
- 创建用户映射。
create user mapping for openpie server ora_srv_test options (user 'test_user', password 'test_user');
- 创建外部表。
create FOREIGN table test_tb_oracle(id integer,name varchar(100),age integer) server ora_srv_test options (schema 'TEST_USER',table 'TEST_TB');
- 通过PieCloudDB中的外部表查询Oracle中的表数据。
select * from test_tb_oracle;
英文:
PieCloudDB database can directly load data from external databases. Taking Oracle database as an example:
1.Configure the oracle_fdw dependency on PieCloudDB.
The above files should be extracted and placed in the /home/openpie/instantclient_12_2/ directory on all nodes of PieCloudDB. The openpie user's .bash_profile on the operating system should be configured with the following environment variables, which should be set on all nodes.
vim ~/.bash_profile
export ORACLE_HOME=/opt/instantclient_21_9
export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
2.Create fdw in PieCloudDB
psql -p 6003 testdb
drop extension oracle_fdw cascade;
create extension oracle_fdw;
3.Create an external service in PieCloudDB
psql -p 6003 testdb
create server ora_srv_test foreign data wrapper oracle_fdw options(dbserver'ip address:1521/testdb');
4.Create user mapping
create user mapping for openpie server ora_srv_test options (user 'test_user', password 'test_user');
5.Create foreign table
create FOREIGN table test_tb_oracle(id integer,name varchar(100),age integer) server ora_srv_test options (schema 'TEST_USER',table 'TEST_TB');
6.query table data in Oracle through a foreign table in PieCloudDB
select * from test_tb_oracle;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论