Check to see if there any database triggers doing additional activity.
..Ramani
>>> Ashish Shah <ar_shah_at_yahoo.com> 09/20/00 12:16PM >>>
One thing you can do is=20
truncate the table first before droping it.
You may want to do frequent commit if you are
inserting thousands of rows..
..Ashish
- Clinton Naude <clintonn_at_meb.co.za> wrote:
> Hi all...
>=20
> I am stumped with this one and its driving me mad!!!
>=20
> One of our developers is running a script that is
> slowing the database down
> drastically. It actually even hangs it.
> I have tried to change database parameters etc and
> with no luck.
>=20
> Here are my database parameters and the script he is
> running (its java),
> what am I doing wrong?
>=20
> The archive logs also seem to be switching over
> every 15 seconds when this
> scripts is running...
>=20
>=20
>=20
> import java.sql.DriverManager;
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.util.ArrayList;
> import java.util.Date;
>=20
> public class Tatanka {
>=20
> public static void main(String args[])=20
> {
>=20
> Connection con=3Dnull;
> PreparedStatement st=3Dnull;
> long tollerance =3D (long)1000;
> int number =3D 20000;
> try=20
> {
>=20
> =20
> Class.forName("oracle.jdbc.driver.OracleDriver");
> con =3D
>
DriverManager.getConnection("jdbc:oracle:thin:@10.6.5.211:1521:online","tes=
t
> user","sunos01");
>=20
> ArrayList drop =3D new ArrayList();
> ArrayList create =3D new ArrayList();
> ArrayList alter =3D new ArrayList();
> ArrayList insert =3D new ArrayList();
> ArrayList delete =3D new ArrayList();
>=20
> create.add(new String("create table
> csemployee" +
> " (username varchar2(40),"
> +
> " password varchar2(40),"
> +=20
> " firstname
> varchar2(40)," +=20
> " surname varchar2(40),"
> +
> " id varchar2(13))"));
> alter.add(new String("alter table csemployee "
> +
> " add constraint
> csemployee_pk primary key" +
> " (username)"));
>=20
>=20
> drop.add(new String("drop table csemployee"));
>=20
> for (int i =3D0 ; i < number ;i +=3D 1)
> {
> =20
> String todo =3D new String("insert into
> csemployee " +
> "values("
> + "'" + new
> String("pietieGets" + i)+ "'" + ","=20
> + "'" + new String(new
> StringBuffer("pietieGets"
> + i).reverse().toString())+ "'"+","
> + "'" + new
> String("Piet" + i)+ "'"+ ","
> + "'" + new
> String("Pompies"+ i)+ "'"+ ","
> + "'" + i+ "'"
> + ")");
> insert.add(todo);
> delete.add(new String("pietieGets" + i));
> if ((i % 1000) =3D=3D 0 )
> System.out.println("Created number: " + i
> + " ---- " + todo);
> =20
> }
>=20
> System.out.println("dropping table... ");
> // drop the tables
> for (int i =3D 0 ; i < drop.size() ; i +=3D 1 )
> {
> try
> { =20
> st =3D
> con.prepareStatement((String)drop.get(i));
> st.executeUpdate();
>=20
> System.out.println((String)drop.get(i) + "
> succeeded!");
> }=20
> catch (Exception e)
> {
> System.out.println("Could not drop table:
> "+e);
> }
>=20
> } =20
> System.out.println("droped table: ");
> =20
> // create the tables
> for (int i =3D 0 ; i < create.size() ; i +=3D 1 )
> {
> try
> { =20
> st =3D
> con.prepareStatement((String)create.get(i));
> st.executeUpdate();
>=20
> System.out.println((String)create.get(i) +
> " succeeded!");
> }=20
> catch (Exception e)
> {
> System.out.println("Could not create
> table: "+e);
> }
>=20
> } =20
> System.out.println("created table: ");
>=20
> // alter the tables
> for (int i =3D 0 ; i < alter.size() ; i +=3D 1 )
> {
> try
> { =20
> st =3D
> con.prepareStatement((String)alter.get(i));
> st.executeUpdate();
>=20
> System.out.println((String)alter.get(i) +
> " succeeded!");
> }=20
> catch (Exception e)
> {
> System.out.println("Could not alter table:
> "+e);
> }
>=20
> } =20
> System.out.println("altered table: ");
> =20
>=20
> // insert into the tables
> System.out.println("Going to do the
> insert...");
> for (int i =3D 0 ; i < insert.size() ; i +=3D 1 )
> {
> Date date_start;
> Date date_end;
> =20
> try
> { =20
> st =3D
> con.prepareStatement((String)insert.get(i));
> date_start =3D new Date();
> st.executeUpdate(); =20
> st.close();
> date_end =3D new Date();
> if ((i % 1000) =3D=3D 0)
> {
> System.out.println("Insert nr:" + i);
> //con.commit();
> }
> double diff =3D
>
(double)date_end.getTime()-(double)date_start.getTime();
> System.out.println("time pause (insert):
> time ms - " + diff +
> "--- item - " +i);
> }=20
> catch (Exception e)
> {
> System.out.println("Could not insert into
> table: "+e);
> }
> }
> System.out.println("insert complete.");
> =20
> System.out.println("Going to do the
> delete...");
>=20
> // delete from the tables
> for (int i =3D 0 ; i < delete.size() ; i +=3D 1 )
> {
>=20
=3D=3D=3D message truncated =3D=3D=3D
=3D=3D=3D=3D=3D
Ashish
Toronto, Canada
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/=20
--=20
Author: Ashish Shah
INET: ar_shah_at_yahoo.com=20
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
Received on Wed Sep 20 2000 - 12:50:11 CDT