Posts by Venkatesh GK

Query to Identify Initial and Latest Login Sessions in Oracle Database

Please use the query below to identify and provide the SID and Serial#.   col first_seen for a30 col last_seen for a30 SELECT MIN(sample_time) AS first_seen, MAX(sample_time) AS last_seen FROM…

Read More

Steps to Renew Default OHS Keystore Wallet in Oracle Enterprise Manager (OEM)

Please follow the below steps.   Prerequisites   Take a backup of the existing wallet. Ensure you have appropriate Oracle user privileges. Verify OMS is healthy before making changes.  …

Read More

Query to get the output for object privileges, roles, system privileges with details

Please use the below query to get the output.   set echo on; SELECT COUNT(*) AS object_priv_count FROM dba_tab_privs WHERE grantee = ‘A’; set echo on; SELECT COUNT(*) AS role_grant_count…

Read More

Script to create trace at database schema level by enabling trigger model.

Please execute the below and change the username accordingly. After the trace drop the trigger.   CREATE OR REPLACE TRIGGER “1234_TMP_LOGGINGTRIG” AFTER LOGON ON DATABASE begin if ora_login_user = ‘1234’…

Read More

Script to enable Unified Auditing at Db level

Please find the below steps to enable the same.   create audit policy audit_all actions all only toplevel; audit policy audit_all by user1,user2,user3; audit policy audit_all by sys,system; CONNECT /…

Read More

Query to check identity columns in a table and enable/disable options.

Please run the below query to get the output. SELECT owner, table_name, column_name, generation_type, identity_options FROM dba_tab_identity_cols ORDER BY owner, table_name;   Generation type is below. GENERATED ALWAYS AS IDENTITY…

Read More

Dynamic Query Script to create public synonym and private synonym in database

Please use the below query to generate the script and run accordingly.   Public Synonym: ——————– select ‘create or replace public synonym ‘||table_name||’ for ‘||owner||’.’||table_name||’;’ from dba_tables where owner=’QA’;  …

Read More

Script to fix export issue while it hangs during Statistics, Marker, Type

Please run the below and do the export again. create index SYS.IMPDP_STATS_1 ON SYS.IMPDP_STATS (c5,type,c1,c2,c3,c4,statid,version);    

Read More

Steps to delete the Inactive Patches in Oracle Database

Please follow the below steps to delete the same.   cd $ORACLE_HOME/OPatch ./opatch util listorderedinactivepatches -silent ./opatch util deleteinactivepatches -silent ./opatch util listorderedinactivepatches -silent

Read More

Steps to Fix Export Issues with expdp full=y Not Exporting All Tables

If a point-in-time recovery is not an option, follow the steps below: Backup the Database as sys user. We will have to patch fed$apps and obj$. startup restrict; Create backup…

Read More