Oracle DB: Add/Drop/Rename objects

Some sample commands for Add/Drop/Rename objects:--Dropping the primary key:ALTER TABLE "VAG"."TEST_TABLE" drop primary key;drop index "VAG"."TEST_TABLE_PK";--Adding primary key:CREATE UNIQUE INDEX "VAG"."TEST_TABLE_PK" ON "VAG"."TEST_TABLE" ("TEST_TABLE_ID");ALTER TABLE "VAG"."TEST_TABLE" ADD CONSTRAINT "TEST_TABLE_PK" PRIMARY…

Continue ReadingOracle DB: Add/Drop/Rename objects

Oracle PL/SQL: Autonomous Transaction for logging

Here is an example how to use autonomous_transaction for logging purposes.In case of rollback only the main transaction is affected.declare    l_categories_count      varchar2(100);    process_error            Exception;        procedure log(p_message varchar2) is        …

Continue ReadingOracle PL/SQL: Autonomous Transaction for logging

Oracle DB: Extract DDL without storage specifications

For exporting the DDL of data objects without the storage specifications, this is what we should do:EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);select DBMS_METADATA.GET_DDL('TABLE','PROJECTS') from DUAL;EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');

Continue ReadingOracle DB: Extract DDL without storage specifications