Firstly, let’s see what DDL and DML mean in oracle (as per oracle doc)
DDL statements: – These statements create, alter, maintain, and drop schema objects. DDL statements also include statements that permit a user to grant other users the privileges to access the database and specific objects within the database.
DML statements: – These statements manipulate data. For example, querying, inserting, updating, and deleting rows of a table are all DML operations. The most common SQL statement is the select statement, which retrieves data from the database. Locking a table or view and examining the execution plan of a SQL statement are also DML operations.
LAST DDL
16:31:46 anand@test_27 >sho user
USER is “ANAND”
16:31:50 anand@test_27 >
16:31:50 anand@test_27 >
16:31:50 anand@test_27 >select * from v$version;
BANNER
—————————————————————-
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – Prod
PL/SQL Release 10.2.0.4.0 – Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 – Production
NLSRTL Version 10.2.0.4.0 – Production
Elapsed: 00:00:00.00
16:32:08 anand@test_27 >create table abc (id number,name varchar(10));
Table created.
Elapsed: 00:00:00.00
16:32:54 anand@test_27 >col object_name for a10
16:34:07 anand@test_27 >col object_type for a10
16:35:22 anand@test_27 >col created for a20
16:35:34anand@test_27>select object_name,object_type,to_char(created,’DD-MM-YY HH24:MI:SS’)created,to_char(last_ddl_time,’DD-MM-YY HH24:MI:SS’)last_ddl from user_objects where object_name=’ABC’;
OBJECT_NAM OBJECT_TYPE CREATED LAST_DDL
———- ———- ——————– —————————————————————————
ABC TABLE 19-09-09 16:41:26 19-09-09 16:41:26
Elapsed: 00:00:00.00
16:35:35 anand@test_27 >
16:36:40 anand@test_27 >
16:36:40 anand@test_27 >REM LAST DDL TIME IS “19-09-09 16:41:26”
16:36:57 anand@test_27 >
16:36:57 anand@test_27 >REM NOW I ADD A COLUMN TO THE TABLE
16:37:09 anand@test_27 >alter table abc add (DOB date);
Table altered.
Elapsed: 00:00:00.00
16:37:28 anand@test_27 >
16:37:28anand@test_27>select object_name,object_type,to_char(created,’DD-MM-YY HH24:MI:SS’)created,to_char(last_ddl_time,’DD-MM-YY HH24:MI:SS’)last_ddl from user_objects where object_name=’ABC’;
OBJECT_NAM OBJECT_TYP CREATED LAST_DDL
———- ———- ——————– —————————————————————————
ABC TABLE 19-09-09 16:41:26 19-09-09 16:46:00
Elapsed: 00:00:00.00
16:37:39 anand@test_27 >
16:37:40 anand@test_27 >REM LAST DDL TIME NOW CHANGED TO “19-09-09 16:46:00”
16:37:54 anand@test_27 >desc abc
Name Null? Type
———————————————————————————————————————————————
ID NUMBER
NAME VARCHAR2(10)
DOB DATE
16:38:02 anand@test_27 >
16:40:44 anand@test_27 >alter table abc drop column dob;
Table altered.
Elapsed: 00:00:00.00
16:40:49 anand@test_27 >
16:40:49anand@test_27>select object_name,object_type,to_char(created,’DD-MM-YY HH24:MI:SS’)created,to_char(last_ddl_time,’DD-MM-YY HH24:MI:SS’)last_ddl from user_objects where object_name=’ABC’;
OBJECT_NAM OBJECT_TYP CREATED LAST_DDL
———- ———- ——————– —————————————————————————
ABC TABLE 19-09-09 16:41:26 19-09-09 16:49:21
Elapsed: 00:00:00.00
16:40:52 anand@test_27 >
16:40:52 anand@test_27 >
16:40:52 anand@test_27 >REM LAST DDL TIME NOW CHANGED TO “19-09-09 16:49:21”
NOTE:- The server time and the my pc’s time is different.
Comments
Post a Comment