# 查看数据库用户名
psql -h localhost -p 4555 "dbname=mano_vnfm user=mano_admin password=CloudStudio__123" << EOF
> select usename from pg_user;
> EOF
# pg 查看 extension
\dx
# pg 查看数据库表占用的空间大小
\dt+
#清空大量数据表
truncate cn_pm_collect_his;
#静态容器:catalog数据库登陆
psql -h localhost -p4555 "dbname=catalog user=postgres password=CloudStudio__123"
#静态容器:MANO数据库登陆
psql -h localhost -p4555 "dbname=mano_vnfm user=mano_admin password=CloudStudio__123"
psql -h localhost -p4555 "dbname=mano_nfvo user=mano_admin password=CloudStudio__123"
psql -h localhost -p 4555 "dbname=mano_nfvo user=mano_admin password=CloudStudio__123" -t -c "select predefinedvm from nfinst where nfname='CG124_V6';"
#三节点环境登陆各数据库方法
001. kubectl -n zenap get pods | grep ${podname} #查看pod名称
kubectl -n zenap describe pod ${podname} #查看pod名称及数据库相关变量
002. kubectl -n opcs 进入pg库容器
su - postgres #切换到postgres用户
psql #进入sql命令模式
\c ${dbname} #进入对应数据库
#pg 库操作 大写表名要添加双引号
vcnem_pg_cache=# select * from ZENAP_FM_RULECACHE;
ERROR: relation "zenap_fm_rulecache" does not exist
第1行select * from ZENAP_FM_RULECACHE;
^
vcnem_pg_cache=# select * from "ZENAP_FM_RULECACHE";
vcnem_pg_cache=# select * from "ZENAP_FM_RULECACHE";
value
-------
(0 行记录)