-
Finding out Last DML Activity on a Table
create a function for the DML logging create or replace function scn_to_timestamp_safe(p integer) return timestamp is e_too_old_scn exception; pragma exception_init(e_too_old_scn,-8181);begin return case when p is not null then scn_to_timestamp(p) else null end;exception when e_too_old_scn then return null;end;/ now querying the last DML (insert,update,delete) for table and this cant say…
-
Find all tables without primarykey in Database
As a DBA we need to make sure that all the tables in your database are have their uniquesness so that the rows are not duplicate and we avoid the redundant data in our databases. below is the simple sql that can give you list of tables that don’t have any primary key: SELECT OWNER, table_nameFROM…
-
Easiest way to switch between schemas just with a click of button using sqqldeveloper
Easiest way to switch between schemas just with a click of button in sqldeveloper 3.2 or lower versions.This doesnt work with sqldev 4 or higher General : The Schema Select extension for Oracle SQL Developer provides a convenient drop-down list which lets you choose the current schema in a sql worksheet. It also allows you…
-
adding primary key to already existing table in oracle
lets assume that there was a table ABC that was already existing in the database and you want to add an additional column with unique primary key values. sql to create table abc : CREATE TABLE “ABC” ( “USERNAME” VARCHAR2(30 BYTE) NOT NULL ENABLE, “USER_ID” NUMBER NOT NULL ENABLE, “CREATED” DATE…
-
Performance – AWR report
Performance – AWR Display a list of snapshots Produce a report To see the snapshot interval and retention period Change the snapshot interval Change the retention period Manually take a snapshot List all baselines Create a baseline Remove a baseline Enable/Disable automatic snapshots Time model queries Produce an Active Session History (ASH) report Display a…






