一、gp常用命令:
1、在服务器上常用命令
(1)连接一个库:
psql -U username -h 10.247.33.84 -d password
(2)psql -U 用户名 -h 主机名 -d 数据库名
(3)查看所有的用户名和库名:\l
(4)在一个库中切换到别的库: \c citic_25cb439825825e9c9729a5aaeccc6185;
(5)\d:查看该库中的表
(6)\du:只查看所有的用户
(7)\q:退出该会话框
2、gp中生成表数据(测用量时可以使用):
create table tmp_monthmapping as select cast(to_char(onday,'yyyy-mm')||'-01' as char(10)) monthid,onday from (select cast('2001-01-01 00:00:00' as timestamp) + (c ||' day')::interval as onday from generate_series(0,1000000) as tab(c)) tb;
3、gp中授权命令:
grant select on table table3 to rrrr1111;
grant insert on table table3 to rrrr1111;
GRANT select ON SCHEMA PUBLIC TO rrrr1111;
4、查询数据库中的数据大小
select pg_size_pretty(pg_relation_size('znn_test'));
二、oracle
建用户:
create user test identified by test;
改密码:
alter user test identified by 123456;
授权角色:
grant connect, resource to test;