Posts

Showing posts from April, 2025

Postgres: To revoke redeveloper access from coupon database

  revoke select on cpnadmin.databasechangeloglock from gp120; revoke select on cpnadmin.databasechangelog from gp120; revoke select on cpnadmin.brands from gp120; revoke select on cpnadmin.coupon_types from gp120; revoke select on cpnadmin.channels from gp120; revoke select on cpnadmin.promotion_types from gp120; revoke select on cpnadmin.vendors from gp120; revoke select on cpnadmin.offers from gp120; revoke select on cpnadmin.coupons from gp120; revoke select on cpnadmin.customer_coupons from gp120; revoke select on cpnadmin.channels_vendors from gp120; revoke select on cpnadmin.users_audit from gp120; revoke select on cpnadmin.job_audit from gp120; revoke select on cpnadmin.last_offer_code from gp120; revoke select on cpnadmin.user_sessions from gp120; revoke select on cpnadmin.campaign_import_audit from gp120; revoke select on cpnadmin.offers_export from gp120; revoke select on cpnadmin.coupons_etl from gp120; revoke select on cpnadmin.historic_offers from gp120; revoke select ...

DB2: To see if a table exist

 db2 list tables for all | grep -i table_name

Oracle: Restore command for fsdvlp

  Run PT_CONFIG_TABLE_EXP.DMS to capture tools tables from target environment - fsdvlp From FSPROD: >rman target / catalog fsprod/bkup_123@rmprod auxiliary sys/Ysw8PTgJ@fsdvlp               <-- OLD - DO NOT USE >rman target / catalog fsprod19/bkup_123@rmprod auxiliary sys/Z_GC3HLU7ZfguQxgw@fsdvlp      <-- USE THIS  RMAN> spool log to /usr/local/oracle/restorefsdvlpApr16th.txt; RMAN> run { startup clone nomount; allocate auxiliary channel aux1 device type disk; set until scn 124791124359 ;   DUPLICATE target database to fsdvlp  nofilenamecheck db_file_name_convert = ('/usr/opt/app/oracle/admin/fsprod/data01', '/usr/opt/app/oracle/admin/fsdvlp/data01' '/usr/opt/app/oracle/admin/fsprod/ndx01', '/usr/opt/app/oracle/admin/fsdvlp/ndx01' '/usr/opt/app/oracle/admin/fsprod/flash01', '/usr/opt/app/oracle/admin/fsdvlp/flash01' '/usr/opt/app/oracle/admin/fsprod/red01', '/usr/opt/app/oracle/admin/f...

GCP: Supported GCP Postgres extensions

 https://cloud.google.com/sql/docs/postgres/extensions

GCP: To terminate or kill a session

 https://cloud.google.com/sql/docs/postgres/monitor-active-queries Terminate a process To terminate a process or long-running transaction in active queries, you must use Cloud SQL Enterprise Plus edition and enable both  Active query analysis  and  query insights for Cloud SQL Enterprise Plus edition . Long running operations can take longer to terminate. To terminate a query or transaction, complete the following steps: In the  Longest running transaction  table, select a query. In the  Action  column, click  Terminate connection . In the  Terminate connection  window, click  Confirm . If the system successfully terminates the query or transaction, then a success message appears. The system also performs a rollback if needed. Note:  If  Terminate  isn't available, then you might have insufficient IAM permissions. For more information, see  Before you begin .

GCP: Gemini for Google Cloud documentation

 https://cloud.google.com/gemini/docs

GCP: Database flags

 https://cloud.google.com/sql/docs/postgres/flags https://cloud.google.com/sql/docs/mysql/flags https://cloud.google.com/sql/docs/sqlserver/flags

GCP: Database version URL

 https://cloud.google.com/sql/docs/mysql/db-versions

Postgres: Truncate table(s)

  TRUNCATE TABLE table_name1, table_name2, ...;

DB2: Get database details

   db2 list db directory > dbdirectory_`date  '+%Y%m%d%H%M'`.txt    db2 list node directory > nodedirectory_`date  '+%Y%m%d%H%M'`.txt    db2 "attach to ${DB2INSTANCE}"    db2 "get dbm cfg show detail" > dbmcfg_`date  '+%Y%m%d%H%M'`.txt    db2 "get snapshot for all databases" > SnapAllDBs_`date  '+%Y%m%d%H%M'`.txt     db2set -all > db2set_`date  '+%Y%m%d%H%M'`.txt    db2cfexp cfexp_`date  '+%Y%m%d%H%M'`.txt backup    df -h > FSOutput_`date  '+%Y%m%d%H%M'`.txt    db2level > db2level_`date  '+%Y%m%d%H%M'`.txt    db2licm -l > DB2LICM_`date  '+%Y%m%d%H%M'`.out    crontab -l > Cron_`date  '+%Y%m%d%H%M'`.out    #db2 "list db directory" |egrep -i "Indirect|Database Name"|grep -i "Database Name" > DBNames.out    db2 "list db directory" |grep -i "Database Name" > DBNames.out   ...

DB2: To get schema GRANTs

db2look -d wctst9  -x -o  /tmp/wctst9_grants.sql

DB2: To get schema DDL

 db2look -d wctst9 -createdb -printdbcfg -e -a -x -o /tmp/wctst9_ddl.sql db2look -d wctst9  -x -o  /tmp/wctst9_grants.sql

Oracle: RMAN restore command for fstest

 Run PT_CONFIG_TABLE_EXP.DMS to capture tools tables from target environment - fstest From FSPROD: >rman target / catalog fsprod/bkup_123@rmprod auxiliary sys/Ysw8PTgJ@fstest >rman target / catalog fsprod19/bkup_123@rmprod auxiliary sys/Z_GC3HLU7ZfguQxgw@fstest <-- in post refresh scripts and in pwdfile >rman target / catalog fsprod19/bkup_123@rmprod auxiliary sys/v_YHk3vaC8bb2PCuJ@fstest  <-- do not USE THIS  RMAN> spool log to /usr/local/oracle/restoreApr9h.txt; RMAN> run { startup clone nomount; allocate auxiliary channel aux1 device type disk; set until scn 124754870893; DUPLICATE target database to fstest  nofilenamecheck db_file_name_convert = ('/usr/opt/app/oracle/admin/fsprod/data01', '/usr/opt/app/oracle/admin/fstest/data01' '/usr/opt/app/oracle/admin/fsprod/ndx01', '/usr/opt/app/oracle/admin/fstest/ndx01' '/usr/opt/app/oracle/admin/fsprod/flash01', '/usr/opt/app/oracle/admin/fstest/flash01' '/usr/opt/app...