Hi, everyone!
Today I’m going to introduce you Collecting OMS GaussDB Space Usage.
1. Log in to the active OMS node as user ommdba.
cd /opt/huawei/Bigdata/tmp
2. Save the following SQL statement to the check_database_size.sql file:
SELECT table_name, pg_size_pretty(table_size) AS table_size, pg_size_pretty(indexes_size) AS indexes_size, pg_size_pretty(total_size) AS total_size FROM ( SELECT table_name, pg_table_size(table_name) AS table_size, pg_indexes_size(table_name) AS indexes_size, pg_total_relation_size(table_name) AS total_size FROM ( SELECT ('"' || table_schema || '"."' || table_name || '"') AS table_name FROM information_schema.tables ) AS all_tables ORDER BY total_size DESC ) AS pretty_sizes;
3. Run the following command on the OMS node as user ommdba:
gsql -p 20015 -d OMM -U ommdba -W XXXXXXX -t -f /opt/huawei/Bigdata/tmp/check_database_size.sql > /opt/huawei/Bigdata/tmp/log_check_database_size.log &
4. Analyze the /opt/huawei/Bigdata/tmp/log_check_database_size.log file to check the space usage.
Hope you can learn from it,thank you!