日期:2014-05-16  浏览次数:20363 次

GPDB管理员笔记(一)数据库对象
数据库对象管理
1、创建数据库 create database new_dbname;      createdb -h localhost -p 5432 mydb
2、克隆数据库 
3、查看数据
libo=# \l
                  List of databases
   Name    |  Owner  | Encoding |  Access privileges 
-----------+---------+----------+---------------------
libo      | gpadmin | UTF8     |
postgres  | gpadmin | UTF8     |
template0 | gpadmin | UTF8     | =c/gpadmin         
                                : gpadmin=CTc/gpadmin
template1 | gpadmin | UTF8     | =c/gpadmin         
                                : gpadmin=CTc/gpadmin
(4 rows)

select * from pg_database;

4、数据库属性变更
libo=# alter database libo owner to libo;
ALTER DATABASE
libo=# \l
                  List of databases
   Name    |  Owner  | Encoding |  Access privileges 
-----------+---------+----------+---------------------
libo      | libo    | UTF8     |
postgres  | gpadmin | UTF8     |
template0 | gpadmin | UTF8     | =c/gpadmin         
                                : gpadmin=CTc/gpadmin
template1 | gpadmin | UTF8     | =c/gpadmin         
                                : gpadmin=CTc/gpadmin
(4 rows)

5、使用gpfilespace创建文件系统
[gpadmin@mdw ~]$  gpfilespace -o gpfilespace_config
20140303:10:43:03:012223 gpfilespace:mdw:gpadmin-[INFO]:-
A tablespace requires a file system location to