
3 nmse=#createextensionoracle_fdwwithschemapublic;
4 CREATEEXTENSION
5
6 nmse=#selectoracle_diag();
7 oracle_diag
8 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
9 oracle_fdw2.2.0,PostgreSQL12.0,Oracleclient11.2.0.4.0
10 (1row)
11
12 ‐‐赋予数据普通用户jswy使用oracle_fdw的权限
13 nmse=#grantUSAGEonFOREIGNdatawrapperoracle_fdwtojswy;
14 GRANT
15
16 nmse=#\q
5.普通用户创建server,配置oracle的连接参数
1 $psql‐Ujswynmse
2
3 nmse=>createserverserver_oraforeigndatawrapperoracle_fdwoptions(d
bserver'ip:port/sid');
4 CREATESERVER
6.普通用户创建pg和oracle之间的用户映射usermapping
1 nmse=>createusermappingforjswyserverserver_oraoptions(user'scot
t',password'tigger');
2 CREATEUSERMAPPING
options里的user可以使用小写,插件做了小写转oracle大写的处理
7.创建外部表
1 $psql‐Ujswynmse
2
3 CREATEFOREIGNTABLEpublic.f_oracle_test(
4 idint,
5 infocharactervarying
6 )
7 SERVERserver_ora
8 OPTIONS(
9 schema'scott',
10 "table"'AA'
评论