We help IT Professionals succeed at work.
Get Started

Best way to rerun DDL in oracle database within shell script on linux

177 Views
Last Modified: 2016-08-11
Hi,
we have a set of DDL which I execute every time as part of a process on oracle database.

1. First time when we execute, it creates and alter tables.
2. On all the subsequent executions it will throw an error which I ignore safely. Since they already exist in the database.
3. I agree this is not the best way to re-execute. I should have some kind of check before re-executing each ddl.
4. Recently it is taking time between 20 mins to 50 mins to even throw error depends on the environments

Pls help what is the best way to check if column/index already exist and skip this.

thanks in advance

Below are the sample script with only few ddl and their error msg and elapsed time.

alter table SAMPLE.EIM_GROUP
  add "REL_SEQ_FLG" VARCHAR2(1 CHAR); 

  ERROR at line 2:
ORA-01430: column being added already exists in table


Elapsed: 00:00:00.01

alter table SAMPLE.EIM_GROUP
  add "SCORE" NUMBER(10,0);
ERROR at line 2:
ORA-01430: column being added already exists in table


Elapsed: 00:00:00.01

CREATE INDEX SAMPLE.CHILD_X1_X ON SAMPLE.CON_CHILD (ATTRIB_07,UCM_TYPE_CD,OBJECT_TYPE,OBJECT_TABLE,CREATED) TABLESPACE USER_TBLSPACE;
ERROR at line 1:
ORA-01652: unable to extend temp segment by 128 in tablespace TEMP


Elapsed: 00:07:21.57

Open in new window

Comment
Watch Question
Database Engineer
CERTIFIED EXPERT
Top Expert 2016
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE