重庆思庄Oracle、、PostgreSQL、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 175|回复: 0
打印 上一主题 下一主题

pg_profile 在pg_hba.conf中需要密码登录场景下创建AWR快照

[复制链接]
跳转到指定楼层
楼主
发表于 2025-4-26 17:54:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
按正常的配置,我们创建快照,使用以下命令即可:select * from profile.take_sample;

但如果我们登录PG,必须输入密码,这个时候,就需要把登录信息加到连接里面去,如下执行:

select profile.drop_server('local');

SELECT profile.create_server('local','host=x.x.x.x dbname=postgres port=5432  user=postgres password=xxxxxxx');


postgres=# select * from profile.show_servers();
server_name |                                      connstr                                      | enabled | max_sample_age | description
-------------+-----------------------------------------------------------------------------------+---------+----------------+-------------
local       | host=x.x.x.x dbname=postgres port=5432  user=postgres password=xxxxxx | t       |                |


之后,再去执行快照,就没有问题了。

postgres=# select profile.show_samples();
postgres-# ;
                 l                 
-----------------------------------
(1,"2025-04-23 15:45:08+08",t,,,)
(1 row)


当然,也可以创建其他SERVER_NAME,然后,执行快照时,带上这个server_name即可

比如

SELECT profile.create_server('sz','host=x.x.x.x dbname=postgres port=5432  user=postgres password=xxxxxxx');
select profile.show_samples('sz');
psql -Upostgres -h x.x.x.x -Aqtc "select profile.get_report('sz',begin_snapshot,end_snapshot)" -o awr_report_postgres_x_y.html




分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2025-5-7 21:48 , Processed in 0.081129 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表