PostgreSQL DBLink的使用
来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:51 点击:次
习惯了Oracle的Dblink带来的便捷,我们来看一下PostgreSQL的DBLINK,该工具需要编译安装一下使用,倒也不是很复杂。 DB版本:9.1.3 1.编译安装
[postgres@localhost dblink]$ pwd
/home/postgres/postgresql-9.1.3/contrib/dblink
[postgres@localhost dblink]$ make
make -C ../../src/interfaces/libpq all
make[1]: Entering directory `/home/postgres/postgresql-9.1.3/src/interfaces/libpq'
make[1]: Nothing to be done for `all'. www.2cto.com
make[1]: Leaving directory `/home/postgres/postgresql-9.1.3/src/interfaces/libpq'
[postgres@localhost dblink]$ make install
make -C ../../src/interfaces/libpq all
make[1]: Entering directory `/home/postgres/postgresql-9.1.3/src/interfaces/libpq'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/postgres/postgresql-9.1.3/src/interfaces/libpq'
/bin/mkdir -p '/home/postgres/lib'
/bin/mkdir -p '/home/postgres/share/extension'
/bin/sh ../../config/install-sh -c -m 755 dblink.so '/home/postgres/lib/dblink.so'
/bin/sh ../../config/install-sh -c -m 644 ./dblink.control '/home/postgres/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./dblink--1.0.sql ./dblink--unpackaged--1.0.sql '/home/postgres/share/extension/'
[postgres@localhost dblink]$ www.2cto.com
我们可以在$PGHOME/share/extension下看到3个dblink文件在$PGHOME/lib下也生成一个dblink.so的动态文件 2.创建DBLINK的扩展
[postgres@localhost dblink]$ psql -d test -U postgres
psql (8.4.9, server 9.1.3)
WARNING: psql version 8.4, server version 9.1.
Some psql features might not work.
Type "help" for help.
test=# create extension dblink;
CREATE EXTENSION
test=#
3.查看当前数据库里的扩展包
test=# select extname,extversion from pg_extension;
extname | extversion
-----------+------------
plpgsql | 1.0
tablefunc | 1.0
dblink | 1.0
(3 rows) www.2cto.com
4.工具栏中得体现
5.DBLINK使用 a.数据库中情况如下:
[postgres@localhost etc]$ psql
psql (8.4.9, server 9.1.3)
WARNING: psql version 8.4, server version 9.1.
Some psql features might not work.
Type "help" for help.
postgres=# \l
List of databases
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>