greenplum安装oracle函数过程日志

目录

1、查看是否已经安装了orafunc插件

2、安装oracle插件

3 查看greenplum安装的oracle函数

4 给函数付给其他的schema使用

5 使用oracle函数


1、查看是否已经安装了orafunc插件

# sudo find / -name orafunc*

/usr/local/greenplum-db-5.11.1/lib/postgresql/orafunc.so

/usr/local/greenplum-db-5.11.1/share/postgresql/contrib/orafunc.sql

/gpdb/app/lib/postgresql/orafunc.so

/gpdb/app/share/postgresql/contrib/orafunc.sql

以上标红的即可安装oracle函数的sql

2、安装oracle插件

[gpadmin@gp1 contrib]$ psql -d ***** -f /gpdb/app/share/postgresql/contrib/orafunc.sql
CREATE SCHEMA
SET
BEGIN
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
psql:/gpdb/app/share/postgresql/contrib/orafunc.sql:172: NOTICE:  aggregate oracompat.listagg(text) does not exist, skipping
DROP AGGREGATE
CREATE AGGREGATE
psql:/gpdb/app/share/postgresql/contrib/orafunc.sql:178: NOTICE:  aggregate oracompat.listagg(text,text) does not exist, skipping
DROP AGGREGATE
CREATE AGGREGATE
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
COMMIT

3 查看greenplum安装的oracle函数

[gpadmin@gp1 contrib]$ psql -d *****
psql (8.3.23)
Type "help" for help.

*****=# \df oracompat.*
                                                 List of functions
  Schema   |       Name       |     Result data type     |               Argument data types               |  Type  
-----------+------------------+--------------------------+-------------------------------------------------+--------
 oracompat | add_months       | date                     | day date, value integer                         | normal
 oracompat | bitand           | bigint                   | bigint, bigint                                  | normal
 oracompat | concat           | text                     | anyarray, anyarray                              | normal
 oracompat | concat           | text                     | anyarray, text                                  | normal
 oracompat | concat           | text                     | text, anyarray                                  | normal
 oracompat | concat           | text                     | text, text                                      | normal
 oracompat | dump             | character varying        | "any"                                           | normal
 oracompat | dump             | character varying        | "any", integer                                  | normal
 oracompat | instr            | integer                  | str text, patt text                             | normal
 oracompat | instr            | integer                  | str text, patt text, start integer              | normal
 oracompat | instr            | integer                  | str text, patt text, start integer, nth integer | normal
 oracompat | last_day         | date                     | value date                                      | normal
 oracompat | listagg          | text                     | text                                            | agg
 oracompat | listagg          | text                     | text, text                                      | agg
 oracompat | listagg1_transfn | text                     | text, text                                      | normal
 oracompat | listagg2_transfn | text                     | text, text, text                                | normal
 oracompat | lnnvl            | boolean                  | boolean                                         | normal
 oracompat | months_between   | numeric                  | date1 date, date2 date                          | normal
 oracompat | nanvl            | double precision         | double precision, double precision              | normal
 oracompat | nanvl            | numeric                  | numeric, numeric                                | normal
 oracompat | nanvl            | real                     | real, real                                      | normal
 oracompat | next_day         | date                     | value date, weekday integer                     | normal
 oracompat | next_day         | date                     | value date, weekday text                        | normal
 oracompat | nlssort          | bytea                    | text, text                                      | normal
 oracompat | nvl              | anyelement               | anyelement, anyelement                          | normal
 oracompat | nvl2             | anyelement               | anyelement, anyelement, anyelement              | normal
 oracompat | reverse          | text                     | str text                                        | normal
 oracompat | reverse          | text                     | str text, start integer                         | normal
 oracompat | reverse          | text                     | str text, start integer, _end integer           | normal
 oracompat | round            | date                     | value date                                      | normal
 oracompat | round            | date                     | value date, fmt text                            | normal
 oracompat | round            | timestamp with time zone | value timestamp with time zone                  | normal
 oracompat | round            | timestamp with time zone | value timestamp with time zone, fmt text        | normal
 oracompat | substr           | text                     | str text, start integer                         | normal
 oracompat | substr           | text                     | str text, start integer, len integer            | normal
 oracompat | trunc            | date                     | value date                                      | normal
 oracompat | trunc            | date                     | value date, fmt text                            | normal
 oracompat | trunc            | timestamp with time zone | value timestamp with time zone                  | normal
 oracompat | trunc            | timestamp with time zone | value timestamp with time zone, fmt text        | normal
(39 rows)

 

重新连接后便可以看到以下的函数,在oracompat的schema下

 

4 给函数付给其他的schema使用

Oracle的兼容函数都安装在oracompat的schema下面。为了访问这些Oracle函数,可以指定oracompat前缀或者修改数据库的搜索路径
 

# show search_path;
  search_path
----------------
 "$user",public
(1 row)

 

付给其他的schema使用

ALTER DATABASE ***** SET search_path = history, public, oracompat,ods;

5 使用oracle函数

以上付给schema后需要重新连接以下数据库即可

***** =# select nvl(null,8);
 nvl 
-----
   8
(1 row)

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

盒马coding

你的支持是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值