Posts

Oracle: RMAN restore command for fscnv1

 From fsprod: >rman target / catalog fsprod19/bkup_123@rmprod auxiliary sys/Z_GC3HLU7ZfguQxgw@fscnv1 RMAN> spool log to /usr/local/oracle/restorefscnv1Oct6th.txt; RMAN> run { startup clone nomount; allocate auxiliary channel aux1 device type disk; set until scn 127546791093; DUPLICATE target database to fscnv1  nofilenamecheck db_file_name_convert = ( 'fsprod','fscnv1' ); } spool log off; It is preferred that you use 'set until . . . ' else rman will look for most recent archive logs if you don't use that clause, and you can get these errors while restoring: RMAN-06053 and RMAN-06025 on FSPROD: oracle-psfsdb602.tmw.com:fsprod:/usr/opt/app/oracle/admin/fsprod>rman target / catalog fsprod19/bkup_123@rmprod Recovery Manager: Release 19.0.0.0.0 - Production on Tue Oct 6 09:40:03 2026 Version 19.32.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved. connected to target database: FSPROD (DBID=2773054092) connected to rec...

DB2: To get list of tables a role has access to

  SELECT TABSCHEMA, TABNAME, SELECTAUTH, INSERTAUTH, UPDATEAUTH, DELETEAUTH FROM SYSCAT.TABAUTH WHERE GRANTEE = 'YOUR_ROLE_NAME' AND GRANTEETYPE = 'R' ; SELECT      TABSCHEMA,      TABNAME,      SELECTAUTH,      INSERTAUTH,      UPDATEAUTH,      DELETEAUTH FROM SYSCAT.TABAUTH WHERE GRANTEE = 'YOUR_ROLE_NAME'    AND GRANTEETYPE = 'R';

Unix: To check status of a password of local account

  [root@tmwuvdb01 ~]# passwd -S wcadmin wcadmin LK 2011-02-10 0 99999 7 -1 (Password locked.)

MySQL: To show GRANTs on a trigger

  SELECT      TRIGGER_SCHEMA,      TRIGGER_NAME,      EVENT_OBJECT_TABLE AS 'TABLE_NAME',      DEFINER  FROM information_schema.TRIGGERS  WHERE TRIGGER_NAME = 'after_mao_inventory_insert'; SELECT      TRIGGER_SCHEMA,      TRIGGER_NAME,      DEFINER  FROM information_schema.TRIGGERS  WHERE TRIGGER_NAME = 'after_mao_inventory_insert';

MySQL: To show GRANTs for a table

 SELECT GRANTEE, TABLE_SCHEMA, TABLE_NAME, PRIVILEGE_TYPE  FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES  WHERE TABLE_NAME = 'MAO_INVENTORY_TRACKING';

WIN: To check AD group of a user

 > net user /domain username   H:\>net user /domain gm15 The request will be processed at a domain controller for domain tmw.com. User name                    GM15 Full Name                    Murugappan, Gillian  (GM15) Comment User's comment Country/region code          000 (System Default) Account active               Yes Account expires              Never Password last set            5/25/2026 7:27:09 PM Password expires             8/23/2026 7:27:09 PM Password changeable          5/26/2026 7:27:09 PM Password required            Yes User may change password     Yes Workstations allowed         All Logon scr...

MySQL: to find largest tables

Image
  select table_schema as database_name,        table_name,        round( (data_length + index_length) / 1024 / 1024, 2)  as total_size,        round( (data_length) / 1024 / 1024, 2)  as data_size,        round( (index_length) / 1024 / 1024, 2)  as index_size from information_schema.tables where table_schema not in ('information_schema', 'mysql',                            'performance_schema' ,'sys')       and table_type = 'BASE TABLE'       -- and table_schema = 'your database name' order by total_size desc limit 10;