DATABASE

Drop and recreate undo tablespace

Sometimes we may require to drop the existing tablespace undo and create a fresh one if the size of undo has increased a lot and we are unable to reclaim it. Below are the steps: 1. Check the existing UNDO details: SQL> show parameter undo NAME TYPE VALUE ———————————— ———– —————————— temp_undo_enabled boolean FALSE undo_management string […]

How to recover a dropped user using flashback oracle

                Using flashback method, we can restore an accidentally dropped users in oracle. Basically, we will flashback the database to past, when the user was available, Then take an export dump of the schema, and restore the database to same current state. Once db is up, we can import […]

How to Reload expdp and impdp utility in oracle

   In some cases the datapump utility gets corrupted .  To overcome it , we need to reload the expdp and impdp datapump utility in oracle.   Applicable from 11g onwards.  STEPS: 1.  start the database in upgrade mode: SQL> startup upgrade ORACLE instance started. Total System Global Area 1.4529E+10 bytes Fixed Size 7649368 bytes Variable […]

Tracing sessions in oracle

           There are multiple methods for enabling tracing for sessions in oracle. 1. Enabling tracing for all session of a user.              For this we need to create a trigger. CREATE OR REPLACE TRIGGER USER_TRACING_SESSION AFTER LOGON ON DATABASE BEGIN IF USER = ‘SIEBEL’THEN execute immediate […]

Disabling auto tasks from dba_autotask_client

                       Follow below steps for disabling auto tasks in oracle database. SQL> select client_name,status from dba_autotask_client; CLIENT_NAME STATUS —————————————————————- ——– auto space advisor ENABLED auto optimizer stats collection ENABLED sql tuning advisor ENABLED set lines 180 pages 1000 col client_name for a40 col attributes for […]

Purge AUD$ table using DBMS_AUDIT_MGMT

            Oracle 11gR2 introduced DBMS_AUDIT_MGMT for managing audit trails.  The growth of AUD$ can impact the performance of the database. So purging it regularly is the best practice followed by DBA’s and DBMS_AUDIT_MGMT makes it easier. Follow below steps for puring aud$ table. 1. Make sure AUD$ table is not […]

Interval Partitioning in oracle

        Interval Partitioning has been introduced in oracle 11g. With this method, we can automate the creation of range partition .While creating the partitioned table, we just need to define one partition. New partitions will be created automatically based on interval criteria when the data is inserted to the table. We don’t […]

How to move lob segment to another tablespace

Follow below steps from moving lob segment from one tablespace to another. SQL> ;   1*  select table_name,COLUMN_NAME,SEGMENT_NAME,TABLESPACE_NAME from dba_lobs where OWNER=’DBACLASS’ SQL> / TABLE_NAME     COLUMN_NAME  SEGMENT_NAME                       TABLESPACE_NAME ————– ———— ———————————- —————————— FD_BREL_AUDIT PAYLOAD      SYS_LOB0000100201C00011$$          WEBMDATA   SQL> alter table DBACLASS.FD_BREL_AUDIT move lob (PAYLOAD) store as SYS_LOB0000100201C00011$$ ( tablespace USERS); Table altered.   SQL>  select […]

ORA-01940: cannot drop a user that is currently connected

 While dropping a user in oracle database , you may face below error. ORA-01940 Problem: SQL> drop user SCOTT cascade 2 / drop user SCOTT cascade * ERROR at line 1: ORA-01940: cannot drop a user that is currently connected Solution: 1. Find the sessions running from this userid: SQL> SELECT SID,SERIAL#,STATUS from v$session where […]

How to change the oracle database name using nid utility

  Follow below steps for changing the oracle database name using nid utility. We will change the database name from P2PRMD2 to P1D2ST. 1. Mount the database SQL> STARTUP MOUNT ORACLE instance started. Total System Global Area 8754618368 bytes Fixed Size 4646288 bytes Variable Size 3556776560 bytes Database Buffers 5033164800 bytes Redo Buffers 160030720 bytes […]