Moving a single table from one database to another
Posted in 2011
A DBA on AIX with IDS 10.00.UC5 wanted to move one table from one database to another on the same server/dbspace, without enough space to hold two copies and without elaborate setup. Suggestions of ALTER FRAGMENT ... INIT were corrected: that moves tables between dbspaces, not databases. Options offered included unload/reload (via named pipes), archecker single-table restore, Art Kagel's ul.ec/dbcopy utilities, HPL, a synonym, or a hacky partnum swap. Art's trick: add a temporary dbspace, ALTER FRAGMENT the table into it, create the new table in the original dbspace, then INSERT ... SELECT across databases, avoiding any unload. External tables were noted as needing 11.50+. No confirmation from the original poster is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Storage & Space Management, Migration, Import/Export & Data Conversion, Platform-Specific Issues, Versions, Editions & End-of-Life
I have a table in a database that I would like to move to a different
database on the same dbspace. I know that I could unload the table or
use onunload/onload, but I was wondering if there was something else
that would be easier or faster. I don't have enough space on the
dbspace to make a copy and then drop the original table later. This
also looks like something we will be doing once, so I don't want any
elaborate set up. It seems like there is a "move table" command, but it
looks like it's only available in XPS.
=20
The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
=20
Thanks in advance.
=20
Keith Schleicher
IT Database Administrator
B2-253B-A
Office: 847-286-4027
Cell: 224-210-8358
Blackberry: 2242108358@messaging.sprintpcs.com
<mailto:2242108358@messaging.sprintpcs.com>=20
Page: 2242108358@sprint.skytel.com <mailto:2242108358@sprint.skytel.com>
This message, including any attachments, is the property of Sears Holdings =
Corporation and/or one of its subsidiaries. It is confidential and may cont=
ain proprietary or legally privileged information. If you are not the inten=
ded recipient, please delete it without reading the contents. Thank you.
Look at the
alter fragment for tableinit dbspace
Statement
Cheers
Paul
> I have a table in a database that I would like to move to a different
> database on the same dbspace. I know that I could unload the table or
> use onunload/onload, but I was wondering if there was something else
> that would be easier or faster. I don't have enough space on the
> dbspace to make a copy and then drop the original table later. This
> also looks like something we will be doing once, so I don't want any
> elaborate set up. It seems like there is a "move table" command, but it
> looks like it's only available in XPS.
>
> =20
>
> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>
> =20
>
> Thanks in advance.
>
> =20
>
> Keith Schleicher
>
> IT Database Administrator
>
> B2-253B-A
>
> Office: 847-286-4027
>
> Cell: 224-210-8358
>
> Blackberry: 2242108358@messaging.sprintpcs.com
> <mailto:2242108358@messaging.sprintpcs.com>=20
>
> Page: 2242108358@sprint.skytel.com <mailto:2242108358@sprint.skytel.com>
>
> This message, including any attachments, is the property of Sears Holdings
> =
> Corporation and/or one of its subsidiaries. It is confidential and may
> cont=
> ain proprietary or legally privileged information. If you are not the
> inten=
> ded recipient, please delete it without reading the contents. Thank you.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
Paul Watson
Tel: +1 913-674-0360
Mob: +1 913-387-7529
Web: www.oninit.com
www.advancedatatools.com
Failure is not as frightening as regret.
If you want to improve, be content to be thought foolish and stupid.
That's not going to work between databases ....
Peter Logan
Senior Database Administrator
Phone: 616/878-8309
From: "Paul Watson" <paul@oninit.com>
To: ids@iiug.org
Date: 08/31/2011 01:07 PM
Subject: Re: Moving a single table from one database to.... [24791]
Sent by: ids-bounces@iiug.org
Look at the
alter fragment for tableinit dbspace
Statement
Cheers
Paul
> I have a table in a database that I would like to move to a different
> database on the same dbspace. I know that I could unload the table or
> use onunload/onload, but I was wondering if there was something else
> that would be easier or faster. I don't have enough space on the
> dbspace to make a copy and then drop the original table later. This
> also looks like something we will be doing once, so I don't want any
> elaborate set up. It seems like there is a "move table" command, but it
> looks like it's only available in XPS.
>
> =20
>
> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>
> =20
>
> Thanks in advance.
>
> =20
>
> Keith Schleicher
>
> IT Database Administrator
>
> B2-253B-A
>
> Office: 847-286-4027
>
> Cell: 224-210-8358
>
> Blackberry: 2242108358@messaging.sprintpcs.com
> <mailto:2242108358@messaging.sprintpcs.com>=20
>
> Page: 2242108358@sprint.skytel.com <mailto:2242108358@sprint.skytel.com>
>
> This message, including any attachments, is the property of Sears
Holdings
> =
> Corporation and/or one of its subsidiaries. It is confidential and may
> cont=
> ain proprietary or legally privileged information. If you are not the
> inten=
> ded recipient, please delete it without reading the contents. Thank you.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
Paul Watson
Tel: +1 913-674-0360
Mob: +1 913-387-7529
Web: www.oninit.com
www.advancedatatools.com
Failure is not as frightening as regret.
If you want to improve, be content to be thought foolish and stupid.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Whoops - read the question :)
Sorry
Cheers
Paul
> That's not going to work between databases ....
>
> Peter Logan
> Senior Database Administrator
> Phone: 616/878-8309
>
> From: "Paul Watson" <paul@oninit.com>
> To: ids@iiug.org
> Date: 08/31/2011 01:07 PM
> Subject: Re: Moving a single table from one database to.... [24791]
> Sent by: ids-bounces@iiug.org
>
> Look at the
>
> alter fragment for table> init dbspace
>
> Statement
>
> Cheers
> Paul
>
>> I have a table in a database that I would like to move to a different
>> database on the same dbspace. I know that I could unload the table or
>> use onunload/onload, but I was wondering if there was something else
>> that would be easier or faster. I don't have enough space on the
>> dbspace to make a copy and then drop the original table later. This
>> also looks like something we will be doing once, so I don't want any
>> elaborate set up. It seems like there is a "move table" command, but it
>> looks like it's only available in XPS.
>>
>> =20
>>
>> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>>
>> =20
>>
>> Thanks in advance.
>>
>> =20
>>
>> Keith Schleicher
>>
>> IT Database Administrator
>>
>> B2-253B-A
>>
>> Office: 847-286-4027
>>
>> Cell: 224-210-8358
>>
>> Blackberry: 2242108358@messaging.sprintpcs.com
>> <mailto:2242108358@messaging.sprintpcs.com>=20
>>
>> Page: 2242108358@sprint.skytel.com <mailto:2242108358@sprint.skytel.com>
>
>>
>> This message, including any attachments, is the property of Sears
> Holdings
>> =
>> Corporation and/or one of its subsidiaries. It is confidential and may
>> cont=
>> ain proprietary or legally privileged information. If you are not the
>> inten=
>> ded recipient, please delete it without reading the contents. Thank you.
>
>>
>>
>>
>
>
*******************************************************************************
>
>> Forum Note: Use "Reply" to post a response in the discussion forum.
>>
>
> --
> Paul Watson
> Tel: +1 913-674-0360
> Mob: +1 913-387-7529
> Web: www.oninit.com
>
> www.advancedatatools.com
>
> Failure is not as frightening as regret.
> If you want to improve, be content to be thought foolish and stupid.
>
>
>
*******************************************************************************
>
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
Paul Watson
Tel: +1 913-674-0360
Mob: +1 913-387-7529
Web: www.oninit.com
www.advancedatatools.com
Failure is not as frightening as regret.
If you want to improve, be content to be thought foolish and stupid.
OK How about create a new table of the correct schema in the other
database and then just switch the partnums over - works but 100% not
supported :)
> Whoops - read the question :)
>
> Sorry
>
> Cheers
> Paul
>
>> That's not going to work between databases ....
>>
>> Peter Logan
>> Senior Database Administrator
>> Phone: 616/878-8309
>>
>> From: "Paul Watson" <paul@oninit.com>
>> To: ids@iiug.org
>> Date: 08/31/2011 01:07 PM
>> Subject: Re: Moving a single table from one database to.... [24791]
>> Sent by: ids-bounces@iiug.org
>>
>> Look at the
>>
>> alter fragment for table>> init dbspace
>>
>> Statement
>>
>> Cheers
>> Paul
>>
>>> I have a table in a database that I would like to move to a different
>>> database on the same dbspace. I know that I could unload the table or
>>> use onunload/onload, but I was wondering if there was something else
>>> that would be easier or faster. I don't have enough space on the
>>> dbspace to make a copy and then drop the original table later. This
>>> also looks like something we will be doing once, so I don't want any
>>> elaborate set up. It seems like there is a "move table" command, but it
>>> looks like it's only available in XPS.
>>>
>>> =20
>>>
>>> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>>>
>>> =20
>>>
>>> Thanks in advance.
>>>
>>> =20
>>>
>>> Keith Schleicher
>>>
>>> IT Database Administrator
>>>
>>> B2-253B-A
>>>
>>> Office: 847-286-4027
>>>
>>> Cell: 224-210-8358
>>>
>>> Blackberry: 2242108358@messaging.sprintpcs.com
>>> <mailto:2242108358@messaging.sprintpcs.com>=20
>>>
>>> Page: 2242108358@sprint.skytel.com
>>> <mailto:2242108358@sprint.skytel.com>
>>
>>>
>>> This message, including any attachments, is the property of Sears
>> Holdings
>>> =
>>> Corporation and/or one of its subsidiaries. It is confidential and may
>>> cont=
>>> ain proprietary or legally privileged information. If you are not the
>>> inten=
>>> ded recipient, please delete it without reading the contents. Thank
>>> you.
>>
>>>
>>>
>>>
>>
>>
>
*******************************************************************************
>>
>>> Forum Note: Use "Reply" to post a response in the discussion forum.
>>>
>>
>> --
>> Paul Watson
>> Tel: +1 913-674-0360
>> Mob: +1 913-387-7529
>> Web: www.oninit.com
>>
>> www.advancedatatools.com
>>
>> Failure is not as frightening as regret.
>> If you want to improve, be content to be thought foolish and stupid.
>>
>>
>>
>
*******************************************************************************
>>
>> Forum Note: Use "Reply" to post a response in the discussion forum.
>>
>>
>>
>
*******************************************************************************
>> Forum Note: Use "Reply" to post a response in the discussion forum.
>>
>
> --
> Paul Watson
> Tel: +1 913-674-0360
> Mob: +1 913-387-7529
> Web: www.oninit.com
>
> www.advancedatatools.com
>
> Failure is not as frightening as regret.
> If you want to improve, be content to be thought foolish and stupid.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
Paul Watson
Tel: +1 913-674-0360
Mob: +1 913-387-7529
Web: www.oninit.com
www.advancedatatools.com
Failure is not as frightening as regret.
If you want to improve, be content to be thought foolish and stupid.
On Wed, Aug 31, 2011 at 10:06, Paul Watson <paul@oninit.com> wrote:
> Look at the
>
> alter fragment for table> init dbspace
>
I fear that would only work within a single database; the goal is to move
the table from database A to database B within the server.
> Keith Schleicher asked:
>
> I have a table in a database that I would like to move to a different
> > database on the same dbspace. I know that I could unload the table or
> > use onunload/onload, but I was wondering if there was something else
> > that would be easier or faster. I don't have enough space on the
> > dbspace to make a copy and then drop the original table later. This
> > also looks like something we will be doing once, so I don't want any
> > elaborate set up. It seems like there is a "move table" command, but it
> > looks like it's only available in XPS.
> >
> > The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>
I don't think there are alternatives to 'unload' and 'reload' (with 'drop to
make enough space' in between); the exact tools used are largely up to you,
but given that you don't have the space for two copies of the table, I don't
see what alternative you have. Of course, there's the issue of where the
unloaded data will go...
Unless...
Have you considered a table restore using archecker? Take your routine
backup; drop the table from the old database (to make space); restore the
table to the new database.
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
--00151773db9af3cd1104abd06481
Would Art's IIUG scripts unload and load the tables quicker than unload/loa=
d or dbunload, onpload? I know that HPL is quick, but the setup may be lon=
ger.
Suggestions?
Thanks,
*******************************************************************
Ernie Knox
IT Database=A0Administrator Specialist
Sears Holdings - BU: I & T Group
3333 Beverly Rd.
Hoffman Estates, IL. 60179
Office: (847) 286-5735
Email: Ernest.Knox@searshc.com
Blackberry:=A02244650553@messaging.sprintpcs.com
Informix Email: ifmxdba@searshc.com and Team: InformixDBA@searshc.com
Informix Primary: INFORMIXDBAPrimaryPager@searshc.com
Informix Secondary: INFORMIXDBASecondaryPager@searshc.com
MySQL Email: MYSQLDBAe@searshc.com and Team: MySQLDBA2@searshc.com
MySQL Primary: MYSQLDBAPrimaryPager@searshc.com
MySQL Secondary: MYSQLDBASecondaryPager@searshc.com
" Yes we can make a Change! "
" It's always a great day to watch=A0Sports: "
" Lets GO Detroit: Lions, Tigers, Pistons, and Red Wings! "
" Lets GO Chicago: Bears, Cubs, White Sox, Bulls, and Black Hawks! "
GSU
*******************************************************************
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of Jonat=
han Leffler
Sent: Wednesday, August 31, 2011 1:24 PM
To: ids@iiug.org
Subject: Re: Moving a single table from one database to.... [24795]
On Wed, Aug 31, 2011 at 10:06, Paul Watson <paul@oninit.com> wrote:=20
> Look at the
>=20
> alter fragment for table> init dbspace
>=20
I fear that would only work within a single database; the goal is to move t=
he table from database A to database B within the server.=20
> Keith Schleicher asked:=20
>=20
> I have a table in a database that I would like to move to a different
> > database on the same dbspace. I know that I could unload the table=20
> > or use onunload/onload, but I was wondering if there was something=20
> > else that would be easier or faster. I don't have enough space on=20
> > the dbspace to make a copy and then drop the original table later.=20
> > This also looks like something we will be doing once, so I don't=20
> > want any elaborate set up. It seems like there is a "move table"=20
> > command, but it looks like it's only available in XPS.
> >=20
> > The server is running AIX 4.3.3.0 and IDS 10.00.UC5.=20
>=20
I don't think there are alternatives to 'unload' and 'reload' (with 'drop t=
o make enough space' in between); the exact tools used are largely up to yo=
u, but given that you don't have the space for two copies of the table, I d=
on't see what alternative you have. Of course, there's the issue of where t=
he unloaded data will go...=20
Unless...=20
Have you considered a table restore using archecker? Take your routine back=
up; drop the table from the old database (to make space); restore the table=
to the new database.=20
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guard=
ian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who=
can laugh at ourselves, for we shall never cease to be amused."=20
--00151773db9af3cd1104abd06481=20
***************************************************************************=
****
Forum Note: Use "Reply" to post a response in the discussion forum.=20
This message, including any attachments, is the property of Sears Holdings =
Corporation and/or one of its subsidiaries. It is confidential and may cont=
ain proprietary or legally privileged information. If you are not the inten=
ded recipient, please delete it without reading the contents. Thank you.
Nope. The ALTER can move the table between dbspaces but not between
databases.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Wed, Aug 31, 2011 at 1:06 PM, Paul Watson <paul@oninit.com> wrote:
> Look at the
>
> alter fragment for table> init dbspace
>
> Statement
>
> Cheers
> Paul
>
> > I have a table in a database that I would like to move to a different
> > database on the same dbspace. I know that I could unload the table or
> > use onunload/onload, but I was wondering if there was something else
> > that would be easier or faster. I don't have enough space on the
> > dbspace to make a copy and then drop the original table later. This
> > also looks like something we will be doing once, so I don't want any
> > elaborate set up. It seems like there is a "move table" command, but it
> > looks like it's only available in XPS.
> >
> > =20
> >
> > The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
> >
> > =20
> >
> > Thanks in advance.
> >
> > =20
> >
> > Keith Schleicher
> >
> > IT Database Administrator
> >
> > B2-253B-A
> >
> > Office: 847-286-4027
> >
> > Cell: 224-210-8358
> >
> > Blackberry: 2242108358@messaging.sprintpcs.com
> > <mailto:2242108358@messaging.sprintpcs.com>=20
> >
> > Page: 2242108358@sprint.skytel.com <mailto:2242108358@sprint.skytel.com>
> >
> > This message, including any attachments, is the property of Sears
> Holdings
> > =
> > Corporation and/or one of its subsidiaries. It is confidential and may
> > cont=
> > ain proprietary or legally privileged information. If you are not the
> > inten=
> > ded recipient, please delete it without reading the contents. Thank you.
> >
> >
> >
>
>
*******************************************************************************
> > Forum Note: Use "Reply" to post a response in the discussion forum.
> >
>
> --
> Paul Watson
> Tel: +1 913-674-0360
> Mob: +1 913-387-7529
> Web: www.oninit.com
>
> www.advancedatatools.com
>
> Failure is not as frightening as regret.
> If you want to improve, be content to be thought foolish and stupid.
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--90e6ba212393b0d26c04abd0da06
Informix 10.00, so no external tables which would be VERY fast. Hmm, if
there are no difficult data types in the table (ie BLOBs, SLOBs, etc.) you
can try to use my binary export/import utility ul.ec which is in package
utils2_ak in the IIUG Software Repository. It writes the data to a portable
binary format which tends to be more compact than text exports unless most
of the columns are character. In that case a simple export may be faster.
HPL is fast, but probably not worth the effort to learn if you don't already
use it extensively.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Wed, Aug 31, 2011 at 12:55 PM, Schleicher, Keith <
Keith.Schleicher@searshc.com> wrote:
> I have a table in a database that I would like to move to a different
> database on the same dbspace. I know that I could unload the table or
> use onunload/onload, but I was wondering if there was something else
> that would be easier or faster. I don't have enough space on the
> dbspace to make a copy and then drop the original table later. This
> also looks like something we will be doing once, so I don't want any
> elaborate set up. It seems like there is a "move table" command, but it
> looks like it's only available in XPS.
>
> =20
>
> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>
> =20
>
> Thanks in advance.
>
> =20
>
> Keith Schleicher
>
> IT Database Administrator
>
> B2-253B-A
>
> Office: 847-286-4027
>
> Cell: 224-210-8358
>
> Blackberry: 2242108358@messaging.sprintpcs.com
> <mailto:2242108358@messaging.sprintpcs.com>=20
>
> Page: 2242108358@sprint.skytel.com <mailto:2242108358@sprint.skytel.com>
>
> This message, including any attachments, is the property of Sears Holdings
> =
> Corporation and/or one of its subsidiaries. It is confidential and may
> cont=
> ain proprietary or legally privileged information. If you are not the
> inten=
> ded recipient, please delete it without reading the contents. Thank you.
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--90e6ba21241d8511fb04abd0e9bf
your problem is space... test this first on a small table to see how and if it
works out :
check and see if there is space ANYWHERE on the file system where you can
allocate it to the dbspace and just add it (u can use cooked file). Problem is
that the new table will go there.. so after you populate it you have drop the
original table , unload the new table, drop the new table and then
recreate/load which *in theory* should put the new table in the same chunks
the original resided in. This should empty out the new chunk so u can drop it
. No guarantee, depends on how the free extents look like in the dbspace. If
the largest extent in the dbspace after dropping the original table is say
128K make your extent size slightly smaller on the remake of the new table to
see if the engine takes the bait and places the table in that location. Make
sure you include 'in dbspace xxx" in your create table schema otherwise the
table gets created in the dbspace the database was created in. Then once done
make sure there is no data in the newly added chunk so you can drop it
(oncheck -pe <dbspace>
to speed things along with the first load/unload :
mkfifo table.unl
echo "unload to table.unl select * from table" | dbaccess db1
hit <enter key> to start unload
in another window :
echo "load from table.unl insert into table ;" | dbaccess db2
On 31/08/2011 18:06, Paul Watson wrote:
> Look at the
>
> alter fragment for table> init dbspace
>
> Statement
Read the question properly, you Scouse idiot. :o)
>> I have a table in a database that I would like to move to a different
>> database on the same dbspace. I know that I could unload the table or
>> use onunload/onload, but I was wondering if there was something else
>> that would be easier or faster. I don't have enough space on the
>> dbspace to make a copy and then drop the original table later. This
>> also looks like something we will be doing once, so I don't want any
>> elaborate set up. It seems like there is a "move table" command, but it
>> looks like it's only available in XPS.
--
Cheers,
Obnoxio The Clown
http://obotheclown.blogspot.com
I will now proceed to pleasure myself with this fish.
Scouse !!!!! ROFL
> On 31/08/2011 18:06, Paul Watson wrote:
>> Look at the
>>
>> alter fragment for table>> init dbspace
>>
>> Statement
>
> Read the question properly, you Scouse idiot. :o)
>
>>> I have a table in a database that I would like to move to a different
>>> database on the same dbspace. I know that I could unload the table or
>>> use onunload/onload, but I was wondering if there was something else
>>> that would be easier or faster. I don't have enough space on the
>>> dbspace to make a copy and then drop the original table later. This
>>> also looks like something we will be doing once, so I don't want any
>>> elaborate set up. It seems like there is a "move table" command, but it
>>> looks like it's only available in XPS.
>
> --
> Cheers,
> Obnoxio The Clown
>
> http://obotheclown.blogspot.com
> I will now proceed to pleasure myself with this fish.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
--
Paul Watson
Tel: +1 913-674-0360
Mob: +1 913-387-7529
Web: www.oninit.com
www.advancedatatools.com
Failure is not as frightening as regret.
If you want to improve, be content to be thought foolish and stupid.
Hmm, interesting idea, but the OP will not have to unload the data at all
this way. The steps would be:
1. Create a new dbspace.
2. ALTER FRAGMENT ON TABLE <tablename> INIT IN <new dbspace>;
3. Create the new table in the new database residing in the original
dbspace (set the FIRST EXTENT SIZE appropriately to minimize space
allocations during the copy).
4. INSERT INTO <new database>:<tablename> SELECT * FROM <tablename>;
If the logging modes of the databases are different (ie one logged and the
other not logged), which will prevent step 4 from working, you can use by
dbcopy utility (in utils2_ak) to copy between the tables. Between tables on
the same server it's not noticably faster than the INSERT in step 4 so I
didn't suggest using it there but it can work between databases with
incompatible logging modes.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Wed, Aug 31, 2011 at 2:31 PM, MARK JALKIEWICZ <
mark.jalkiewicz@verizon.net> wrote:
> your problem is space... test this first on a small table to see how and if
> it
> works out :
>
> check and see if there is space ANYWHERE on the file system where you can
> allocate it to the dbspace and just add it (u can use cooked file). Problem
> is
> that the new table will go there.. so after you populate it you have drop
> the
> original table , unload the new table, drop the new table and then
> recreate/load which *in theory* should put the new table in the same chunks
> the original resided in. This should empty out the new chunk so u can drop
> it
> .. No guarantee, depends on how the free extents look like in the dbspace.
> If
> the largest extent in the dbspace after dropping the original table is say
> 128K make your extent size slightly smaller on the remake of the new table
> to
> see if the engine takes the bait and places the table in that location.
> Make
> sure you include 'in dbspace xxx" in your create table schema otherwise the
> table gets created in the dbspace the database was created in. Then once
> done
> make sure there is no data in the newly added chunk so you can drop it
> (oncheck -pe <dbspace>
>
> to speed things along with the first load/unload :
>
> mkfifo table.unl
>
> echo "unload to table.unl select * from table" | dbaccess db1
>
> hit <enter key> to start unload
>
> in another window :
>
> echo "load from table.unl insert into table ;" | dbaccess db2
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--90e6ba21241d55988804abd170da
You can create a synonym to the table in the new database. But this will
force you keep the original database with that particular table. That
could become a technical database; not very elegant though.
Otherwise, I do not see any other way without either:
- creating a raw table and copying the initial table to the new raw
table and dropping the original table: fastest by needs disk space
while performing the operation.
- move it to another machine: not very fast but you can use the disk
space of the other machine
- onunload/onload but you already know this route
- external tables: needs disk space
- HPL: complicated for not much
- etc.
Khaled Bentebal
Email: khaled.bentebal@consult-ix.fr
Le 31/08/11 18:55, Schleicher, Keith a écrit :
> I have a table in a database that I would like to move to a different
> database on the same dbspace. I know that I could unload the table or
> use onunload/onload, but I was wondering if there was something else
> that would be easier or faster. I don't have enough space on the
> dbspace to make a copy and then drop the original table later. This
> also looks like something we will be doing once, so I don't want any
> elaborate set up. It seems like there is a "move table" command, but it
> looks like it's only available in XPS.
>
> =20
>
> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
>
> =20
>
> Thanks in advance.
>
> =20
>
> Keith Schleicher
>
> IT Database Administrator
>
> B2-253B-A
>
> Office: 847-286-4027
>
> Cell: 224-210-8358
>
> Blackberry: 2242108358@messaging.sprintpcs.com
> <mailto:2242108358@messaging.sprintpcs.com>=20
>
> Page: 2242108358@sprint.skytel.com<mailto:2242108358@sprint.skytel.com>
>
> This message, including any attachments, is the property of Sears Holdings =
> Corporation and/or one of its subsidiaries. It is confidential and may cont=
> ain proprietary or legally privileged information. If you are not the inten=
> ded recipient, please delete it without reading the contents. Thank you.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
On 31/08/2011 17:55, Schleicher, Keith wrote:
> I have a table in a database that I would like to move to a different
> database on the same dbspace. I know that I could unload the table or
> use onunload/onload, but I was wondering if there was something else
> that would be easier or faster. I don't have enough space on the
> dbspace to make a copy and then drop the original table later. This
> also looks like something we will be doing once, so I don't want any
> elaborate set up. It seems like there is a "move table" command, but it
> looks like it's only available in XPS.
>
> =20
>
> The server is running AIX 4.3.3.0 and IDS 10.00.UC5.
IDS 10 is either out of support or will be imminently. If you upgrade to
11.50 or later, you will have access to external tables.
--
Cheers,
Obnoxio The Clown
http://obotheclown.blogspot.com
I will now proceed to pleasure myself with this fish.