Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Creating 100,000+ tables.

Re: Creating 100,000+ tables.

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Wed, 7 Dec 2005 21:50:33 -0800
Message-ID: <wradnWPqnZndVAreRVn-tA@comcast.com>

"DaLoverhino" <DaLoveRhino_at_hotmail.com> wrote in message news:1134000871.347711.225500_at_g43g2000cwa.googlegroups.com...
> Hello, for performance testing, I need to create over 100,000 tables in
> oracle.
> One problem is, creating that many tables takes a very long time, and
> I'm wondering if there was a way I can speed up the creation?
>
>
> here's the script that I have written:
>
> CREATE OR REPLACE PROCEDURE create_ttables( schema varchar2, fromX
> INTEGER, toY INTEGER)
> AS
> ncount INTEGER;
> ncreated INTEGER;
> basename VARCHAR2(20);
> tablename VARCHAR2(60);
> create_table_string VARCHAR2(1000);
> drop_table_string VARCHAR2(1000);
> BEGIN
>
> basename := 'ttable_';
> ncount := fromX;
> ncreated := 0;
>
> if fromX > toY
> then
> raise_application_error( -20000, 'fromX > toY');
> end if;
>
> FOR ncount IN fromX .. toY
> LOOP
> tablename := schema || '.' || basename || ncount;
>
> drop_table_string := 'DROP TABLE ' || tablename;
>
> BEGIN
> EXECUTE IMMEDIATE drop_table_string;
> EXCEPTION
> WHEN others then null;
> END;
>
> create_table_string := 'CREATE TABLE ' || tablename ||
> '( id integer, name varchar2(30))';
>
> ncreated := ncreated + 1;
>
> EXECUTE IMMEDIATE create_table_string;
>
> commit;
>
> --Print progress report, since creation may take a long time.
> -- if mod(ncreated, 100) = 0
> -- then
> -- DBMS_OUTPUT.PUT_LINE( 'Created ' || ncreated || 'tables.');
> -- end if;
>
> END LOOP;
> END;
> /
>
>
> I can't think of any way to speed this up. Perhaps there is a secret
> DBA tool that I can use to make it much faster? (I like to 'overkill'
> in performance testing, so I'm looking to make a half a million
> tables.)
>
> Thanks.
>

Why? I can't think of a reason for creating this many tables and dropping them. Are you creating temporary tables ala SQL Server? Jim Received on Wed Dec 07 2005 - 23:50:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US