Posts

Showing posts from September, 2025

Work find

pstestadmin /   850 ps!New 25

Oracle: to restore archive log

 SELECT thread#, process, pid, status, client_process, client_pid, sequence#, block#, active_agents, known_agents FROM gv$managed_standby  ORDER BY thread#, process; RMAN>  run {  set archivelog destination to '/usr/opt/app/oracle/admin/bfprod/arch';  allocate channel aux1 device type disk;  restore archivelog logseq 2777 thread 1;     <-- to restore one archive log ###  4> restore archivelog from logseq=36747 until logseq=36753 thread=1;   <-- to restore a range of archive logs release channel aux1;  }    3* where completion_time between to_date('SEP-28-2015 07:55:00','MON-DD-YYYY HH24:MI:SS') and to_date('SEP-28-2015 08:05:00','MON-DD-YYYY HH24:MI:SS') SQL> /  SEQUENCE# FIRST_TIM   FIRST_CHANGE# NEXT_TIME NEXT_CHANGE# ---------- --------- --------------- --------- ------------     299184 28-SEP-15     65484369404 28-SEP-15   6.5484E+10   ...

Oracle: To list Existing Backups of ArchiveLogs

  RMAN> LIST BACKUP OF ARCHIVELOG ALL;  RMAN> LIST BACKUP OF ARCHIVELOG FROM LOGSEQ=35641 UNTIL LOGSEQ=35740 THREAD=1; 

Oracle: To get Which Backup File has an Archived log

 MAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 12/12/2013 14:27:48 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script RMAN-06053: unable to perform media recovery because of missing log RMAN-06025: no backup of archived log for thread 1 with sequence 263960 and starting SCN of 34650648110 found to restore RMAN-06025: no backup of archived log for thread 1 with sequence 263959 and starting SCN of 34648105015 found to restore RMAN-06025: no backup of archived log for thread 1 with sequence 263958 and starting SCN of 34648101702 found to restore RMAN-06025: no backup of archived log for thread 1 with sequence 263957 and starting SCN of 34646674493 found to restore RMAN-06025: no backup of archived log for thread 1 with sequence 263956 and starting SCN of 34646668173 found to restore RM...

ADQuery

 Root access through dzdo: appansible, dr246, fg8, gm15, kn93, nessusscanner, pansible, nm297, pb184,  ssdirscan, st302, tr214, vk80, wf7 [root@psfsps601 ~]# date ; for i in $(adquery user | grep -v nologin| cut -d: -f1); do dzinfo -rc ${i} 2>/dev/null ; done > /tmp/adqueryresult.txt

Postgres: To kill a session

Image
  select * from pg_stat_activity; SELECT pg_cancel_backend(<PID>);   SELECT pg_terminate_backend(<PID>);

Unix: to parse var log messages

 [root@tbpromostgdb601 ~]# grep "^Sep  6" /var/log/messages-20250907 | grep -c 172.26.7.33 59823 [root@tbpromostgdb601 ~]# nslookup 172.26.7.33 33.7.26.172.in-addr.arpa        name = tmwappsol502.tmw.com.   Authoritative answers can be found from:   [root@tbpromostgdb601 ~]#   tmwappsol502, that normally that chatty to the server?

DB2: To test failover

Image
  File permissions and locations above If ACR turned off on the application, then the application will not follow the database: To switch to 602 from 601 , so On 602 /usr/opt/app/db2/admin/tst3ins3/tsa_tests/takeoverHADR.sh    failover command switchover command  [tst3ins3@dev602  tsa_tests] $ ls -lrt total 8 -rwxr--r-- 1 tst3ins3 db2iadm1 528 Oct 28 14:13 crashDB.sh -rwxr--r-- 1 tst3ins3 db2iadm1 134 Oct 28 14:14 takeoverHADR.sh [tst3ins3@dev602  tsa_tests] $ ./takeoverHADR.sh wctst3 2021-12-15-14.38.30.512458 DB20000I  The TAKEOVER HADR ON DATABASE command completed successfully. real    0m16.12s user    0m0.01s sys     0m0.01s --- ON 601 to switch back: $ ls -lrt total 8 -rwxr--r-- 1 tst3ins3 db2iadm1 528 Oct 28 14:13 crashDB.sh -rwxr--r-- 1 tst3ins3 db2iadm1 134 Oct 28 14:14 takeoverHADR.sh [tst3ins3@dev601  tsa_tests] $ ./takeoverHADR.sh wctst3 2021-12-15-14.40.35.785159 DB20000I  The TAKEOVER HADR ON D...

Oracle: restore recover on table from RMAN

 RMAN> recover table DBADMIN.PS_TTS_PROJECT_TMW recover table DBADMIN.PS_TTS_PROJECT_TMW 2> until time "to_date('2025-09-09 15:00:00','YYYY-MM-DD HH24:MI:SS')" until time "to_date('2025-09-09 15:00:00','YYYY-MM-DD HH24:MI:SS')" 3> remap table DBADMIN.PS_TTS_PROJECT_TMW:PS_TTS_PROJECT_TMW_old remap table DBADMIN.PS_TTS_PROJECT_TMW:PS_TTS_PROJECT_TMW_old 4> auxiliary destination '/usr/opt/app/dbdump/export' auxiliary destination '/usr/opt/app/dbdump/export' 5> ; ; Starting recover at 09-SEP-25 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=2667 device type=DISK Creating automatic instance, with SID='yzae' initialization parameters used for automatic instance: db_name=HRPROD db_unique_name=yzae_pitr_HRPROD compatible=19.0.0 db_block_size=8192 db_files=3000 diagnostic_dest=/usr/opt/app/oracle/admin _pdb_name_case_sensitive=false _system_trig_enabled=FALSE sga_target=65152M processes=200 db_cre...

Oracle: To turn off automated tuning tasks

  While you cannot directly turn off the   DBA_AUTOTASK_CLIENT_HISTORY   view, you can effectively stop it from being populated by disabling the automated maintenance tasks that write to it. The history is a record of these tasks running in their maintenance windows.   The standard automated tasks are: Auto Optimizer Statistics Collection : Gathers optimizer statistics for database objects automatically. Auto Space Advisor : Identifies space-related problems, like segments with growth potential. SQL Tuning Advisor : Automatically tunes high-load SQL statements.   How to disable automated tasks You can disable these tasks individually or all at once using the  DBMS_AUTO_TASK_ADMIN.DISABLE  PL/SQL procedure.   Before you begin First, check the current status of the automated tasks by running the following query in SQL*Plus as a user with  DBA  privileges (e.g.,  SYS  or  SYSTEM ): sql SELECT client_name, status FROM dba_au...