Posts

Showing posts from March, 2025

PeopleSoft: Restore command for HRDVLP

 Run PT_CONFIG_TABLE_EXP.DMS to capture tools tables from target environment - hrdvlp From hrprod: >rman target / catalog hrprod19/bkup_123@rmprod auxiliary sys/cZQwV3EqQy9K_M@hrdvlp Recovery Manager: Release 12.1.0.2.0 - Production on Thu Sep 5 11:43:09 2019 Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved. connected to target database: HRPROD (DBID=3413199007) connected to recovery catalog database connected to auxiliary database (not started) RMAN> spool log to /usr/local/oracle/restorehrdvlpMarch26th.txt; RMAN> run { startup clone nomount; allocate auxiliary channel aux1 device type disk; set until scn 124671915310; DUPLICATE target database to hrdvlp  nofilenamecheck db_file_name_convert = ( 'hrprod','hrdvlp' ); } spool log off Not working. Need to get correct syntax. log_file_name_convert =('/usr/opt/app/oracle/admin/hrprod/redo01', '/usr/opt/app/oracle/admin/hrdvlp/redo01' '/usr/opt/app/oracle/admin/hrprod/...

Postgres: To set a schema

Prior to running a SQL, set your schema if the object names are not prefixed with schema name: SELECT   *  FROM   < schema >. "my_table" Or you can change your default schema SHOW search_path; SET  search_path  TO  my_schema; Check your table schema here SELECT  * FROM  information_schema.columns

Postgres: To find tablespace size

  SELECT pg_size_pretty ( pg_tablespace_size ( 'pg_default' ) ) size ;

Postgres: To Find size of index

  SELECT pg_size_pretty (pg_indexes_size( 'actor' )) size;

Post gres: To find size of each database

  SELECT     pg_database.datname,     pg_size_pretty(pg_database_size(pg_database.datname)) AS size FROM pg_database;

Postgres: To find database size

Image
 SELECT pg_size_pretty( pg_database_size('cfstag') );

Db2: Ember datageeK blog Amber

  DataGeek.blog – A hub for sharing relational database knowledge and experimentation https://datageek.blog/en/

Postgres: Create resource account

alter user paytbiadmin with nosuperuser ; #Detail: Only roles with the SUPERUSER attribute may change the SUPERUSER attribute. grant cloudsqladmin to pgpaytbiadmin; #Detail: Only roles with the SUPERUSER attribute may grant roles with the SUPERUSER attribute. alter user paytbiadmin with nocreaterole; alter user paytbiadmin with nocreatedb ; GRANT CONNECT ON DATABASE paytbitest TO paytbiadmin; GRANT usage ON SCHEMA paytbiadmin TO paytbiadmin; grant create on schema paytbiadmin to paytbiadmin;  grant select on all tables in schema paytbiadmin to paytbiadmin; grant all on schema paytbiadmin to paytbiadmin; ALTER DEFAULT PRIVILEGES FOR ROLE paytbiadmin IN SCHEMA paytbiadmin GRANT ALL ON TABLES TO paytbiadmin; ALTER DEFAULT PRIVILEGES FOR ROLE paytbiadmin IN SCHEMA paytbiadmin GRANT ALL ON SEQUENCES TO paytbiadmin; ALTER DEFAULT PRIVILEGES FOR ROLE paytbiadmin IN SCHEMA paytbiadmin GRANT EXECUTE ON FUNCTIONS TO paytbiadmin; ALTER DEFAULT PRIVILEGES FOR ROLE paytbiadmin IN SCHEMA paytbia...

Unix: Last time a user logged into Unix

 >last username eg $ last map96 map96    pts/0        172.27.100.76    Wed Feb  5 14:11 - 16:39  (02:27) map96    pts/0        172.27.100.116   Thu Jan 23 10:38 - 10:39  (00:01) map96    pts/0        172.27.100.81    Mon Jan 20 11:16 - 11:17  (00:00) map96    pts/0        172.27.100.76    Mon Dec 16 10:50 - 14:07  (03:16) map96    pts/0        172.27.100.44    Fri Dec 13 14:39 - 14:40  (00:01) map96    pts/2        172.27.100.64    Wed Dec 11 11:51 - 12:52  (01:01) map96    pts/3        172.27.100.112   Wed Dec 11 11:06 - 11:15  (00:09) For the last 100 days: $ lastlog -b 0 -t 100 Username         Port          ...

Unix: to get the last time cron was changed or edited

  ls -l /var/spool/cron

Cloud SQL inventory report

Image
  SELECT   name,resource.data.state, resource.data.databaseVersion, resource.data.settings.tier, resource.data.settings. availabilityType FROM   `sqladmin_googleapis_com_ Instance`   order by databaseVersion, resource.data.settings. availabilityType; (1) search for ASSET INVENTORY in the top search box (2) choose the tailoredbrands.com project (3) on the ASSET QUERY tab copy/paste query from above (4) export CSV file

DB2: to get databases status up / down

  -s Returns status of the specified member and the specified instance. The possible states are: Available : The specified member for the specified instance is available for processing. Operable : The instance is installed but not currently available. Not operable : The instance will be unable to be brought to available state. $ db2gcf -s DB2 State : Available

DB2: IDs / Users and the privileges

  select substr(authid,1,20) as authid             , authidtype , privilege , grantable , substr(objectschema,1,12) as objectschema , substr(objectname,1,30) as objectname , objecttype from sysibmadm.privileges where objectschema not like 'SYS%'

DB2: list of all IDs that have system or database authorities

  G stands for group, R stands for Role, and U stands for User. select substr(authid,1,20) as authid  , authidtype  from sysibmadm.authorizationids;

DB2: list of users in current database with few of their authorities.

 select authid as username,        case bindaddauth when 'Y' then 1 else 0 end as bindadd,        case connectauth  when 'Y' then 1 else 0 end as connect,        case createtabauth when 'Y' then 1 else 0 end as create_tab,        case dbadmauth when 'Y' then 1 else 0 end as dbadm,        case externalroutineauth  when 'Y' then 1 else 0 end as ext_routine,        case implschemaauth when 'Y' then 1 else 0 end as implschema,          case loadauth when 'Y' then 1 else 0 end as load,        case nofenceauth when 'Y' then 1 else 0 end as nofence,        case quiesceconnectauth when 'Y' then 1 else 0 end as quiesceconn,        case securityadmauth when 'Y' then 1 else 0 end as securityadm,        case sqladmauth when 'Y' then 1 else 0 end as sqladm, ...

DB2: explanation of monitoring scripts

 Tailored Brands Custom Monitoring Scripts November 8, 2022 304 South 8th Street, Suite 201, Colorado Springs, CO 80905 [Office] 888-685-3101 • [fax] 719-685-3400 www.XTIVIA.com www.Virtual-DBA.com © 2022 XTIVIA Confidential Page 2 of 23 Notices Copyright © 2022, XTIVIA Inc. This document contains information proprietary to XTIVIA and the Client for which it was produced. The information, whether in the form of text, schematics, tables, drawings or illustrations, business proposals, must not be copied, reproduced, stored, or transmitted in any form, without the prior written consent of XTIVIA. All material in this document is to be considered confidential to XTIVIA and must not be disclosed in any form without the prior written consent of XTIVIA. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopy, recording, or any information storage and retrieval system, without permission from ...

DB2: To see if DB is primary , or standby, or standard

 $ db2 get db cfg for wctst3 | grep -i role  HADR database role                                      = STANDARD

DB2: check if database is in HADR

$ db2pd -db wctst3 -hadr Database Member 0 -- Database WCTST3 -- Active -- Up 1 days 23:04:33 -- Date 2025-03-10-09.03.46.609802 HADR Information: HADR is not active. OR $ db2pd -db wctst10 -hadr Database Member 0 -- Database WCTST10 -- Standby -- Up 0 days 11:35:12 -- Date 2025-03-21-08.53.34.211061                             HADR_ROLE = STANDBY                           REPLAY_TYPE = PHYSICAL                         HADR_SYNCMODE = NEARSYNC                            STANDBY_ID = 0                         LOG_STREAM_ID = 0                            HADR_STATE = PEER         ...