View running queries in postgreSQL:
SELECT * FROM pg_stat_activity;
The content includes guides, troubleshooting tips, and best practices for managing database environments, with an emphasis on Oracle and PostgreSQL systems. You can read the full analysis at Anuroop Challa's DBA Blog.
View running queries in postgreSQL:
SELECT * FROM pg_stat_activity;
Golden gate commands for ggsci:
$ ./ggsci
GGSCI>
info all - Displays status of all Extract, Replicat, and Manager processes.
Start / Stop Processes
• start extract <extract_name> --- Start Extract process
• stop extract <extract_name> --- Stop Extract process
• start replicat <replicat_name> --- Start Replicat process
• stop replicat <replicat_name> --- Stop Replicat process
check info about individual.
• info extract <extract_name>, detail -- Detailed info about Extract
• info replicat <replicat_name>, detail -- Detailed info about Replicat
• info mgr - Displays Manager process status
Check Lag
• lag extract <extract_name> -- Shows Extract lag
• lag replicat <replicat_name> -- Shows Replicat lag
View Statistics
• stats extract <extract_name> -- Displays Extract statistics
• stats replicat <replicat_name> -- Displays Replicat statistics\
Troubleshooting
• view report <extract_name> --- View Extract report
• view report <replicat_name> --- View Replicat report
• send extract <extract_name>, status --- Real-time Extract status
• send replicat <replicat_name>, status --- Real-time Replicat status
• kill extract <extract_name> --- Forcefully terminate Extract (use with caution)
• kill replicat <replicat_name> --- Forcefully terminate Replicat (use with caution)
How to check database and database owner information on psql:
You can check with \list command
example:
testsub=> \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+-----------+----------+-----------------+-----------------+--------------------------------
testdb | testuser | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
\conninfo
example:
testsub=> \conninfo
You are connected to database "testsub" as user "sub" on host "localhost" (address "127.0.0.1") at port "5432".
Extracting DDL of Objects in PostgreSQL(get table ddl in PostgreSQL)
===================================================
2 Ways to get DDL of objects in PostgreSQL
1. The utility pg_dump is used to dump the DDL.
2. Can get the DDL just by running \d.
1. The utility pg_dump is used to dump the DDL.
Table ddl for testtable from TESTDB
$ pg_dump -d TESTDB -s -t testtable
Table ddl for testtable from TESTDB written in to file ddl.sql
$ pg_dump -d TESTDB -s -T testtable -f ddl.sql
Table ddls for all ables from from TESTDB
$ pg_dump -d TESTDB -s
2. Can get the DDL just by running \d.
TESTDB=# \d+ testtable
Oracle how to get an object Id from the rowid
=================================
select dbms_rowid.rowid_object('<RowID>') from dual;
select data_object_id, object_name, object_type from dba_objects where data_object_id in ('<OBJECT_ID>');
Oracle how to save output of the script in xls or html:
=========================================
SET MARKUP HTML ON
SPOOL <file_name>.xls
SET MARKUP HTML ON
SPOOL <file_name>.html
View running queries in postgreSQL: SELECT * FROM pg_stat_activity;