Skip to content

Instantly share code, notes, and snippets.

View sebawebber's full-sized avatar
🏠
Working from home

Sebastian Webber sebawebber

🏠
Working from home
View GitHub Profile
@sebawebber
sebawebber / show-locks.sql
Last active May 8, 2023 12:44
Show locked tables in postgreSQL
-- tested in PostgreSQL 8.4.4
DROP VIEW IF EXISTS vw_all_table_locks CASCADE;
CREATE VIEW vw_all_table_locks AS
SELECT
pg_namespace.nspname as schemaname,
pg_class.relname as tablename,
pg_locks.mode as lock_type,
age(now(),pg_stat_activity.query_start) AS time_running
FROM pg_class
JOIN pg_locks on pg_locks.relation = pg_class.oid
@sebawebber
sebawebber / apagar-banco.sh
Created January 29, 2015 13:51
Lab 3.1 - Curso de PostgreSQL - Administração
dropdb -U postgres -d lab3
@sebawebber
sebawebber / pgsql
Created March 1, 2015 12:48
PostgreSQL LogRotate configuration file
/var/log/pgsql/pgsql.log {
missingok
rotate 7
nomail
sharedscripts
daily
dateext
create 0660 root root
postrotate
@sebawebber
sebawebber / wildfly.service -.ini
Last active August 29, 2015 14:16 — forked from marekjelen/gist:8568448
Wildfly Domain Controller Service for SystemD systems
[Unit]
Description=WildFly Domain Controller
After=network.target
[Service]
Type=simple
User=jboss
Group=jboss
ExecStart=/opt/wildfly-8.2.0.Final/bin/domain.sh -bmanagement=0.0.0.0
@sebawebber
sebawebber / list-user-permission-by-table.sql
Last active August 29, 2015 14:21
List USER permissions by table on PostgreSQL
-- Tested on PostgreSQL 9.4
-- More details on http://www.postgresql.org/docs/9.4/static/functions-info.html
-- and http://www.postgresql.org/docs/9.4/static/view-pg-tables.html
-- and http://www.postgresql.org/docs/9.4/static/view-pg-roles.html
SELECT
schemaname,
tablename,
rolname,
has_table_privilege(rolname, tablename, 'SELECT') as can_select,
@sebawebber
sebawebber / pgsql-ssl.md
Last active June 24, 2021 14:38
Habilitar SSL no PostgreSQL

Habilitar SSL no PostgreSQL

Execute os procedimentos abaixo para habilitar SSL no seu servidor PostgreSQL.

  1. Crie um diretório para armazenar as configurações (opcional)
mkdir certificados
cd certificados
@sebawebber
sebawebber / create-drop.sql
Created June 27, 2015 23:01
Trabalhando com Constraints - PostgreSQL
SELECT
'ALTER TABLE ' ||
schema.nspname || '.' || class.relname
|| ' DROP CONSTRAINT IF EXISTS ' ||
cons.conname || ';'
FROM pg_constraint AS cons
JOIN pg_class AS class on class.oid = cons.conrelid
JOIN pg_namespace AS schema on schema.oid = cons.connamespace
WHERE schema.nspname = 'schema'
AND class.relname = 'tabela';
[Unit]
Description=RHQ Storage Node
After=network.target
PartOf=rhq-server.service
[Service]
Type=forking
ExecStart=/opt/rhq-server-4.13.1/bin/rhqctl start --storage
@sebawebber
sebawebber / rhq-server.service
Last active August 29, 2015 14:25 — forked from rafaeltuelho/rhq-server.service
JON/RHQ Server Unit Service for Systemd bases systems (tested with JON 3.3.0.GA-Update2 on RHEL 7)
[Unit]
Description=RHQ Server
Requires=rhq-storage.service
After=rhq-storage.service
[Service]
Type=forking
PIDFile=/opt/rhq-server-4.13.1/bin/internal/rhq-server.pid
[Unit]
Description=RHQ Agent
After=network.target
[Service]
Type=forking
PIDFile=/opt/rhq-agent/bin/rhq-agent.pid
ExecStart=/opt/rhq-server-4.13.1/bin/rhqctl start --agent