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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Export Sequences from a database

RE: Export Sequences from a database

From: Mosy Lo <mlo_at_JCICorp.com>
Date: Thu, 28 Sep 2000 14:58:54 -0400
Message-Id: <10633.118181@fatcity.com>


Thanks very very much for all your time. I got the sequences import to the new db with Raj's script.

-----Original Message-----
From: Jamadagni, Rajendra [mailto:rajendra.jamadagni_at_espn.com] Sent: Thursday, September 28, 2000 11:06 AM To: Multiple recipients of list ORACLE-L Subject: RE: Export Sequences from a database

Import Sequences with current value ...

SELECT 'DROP SEQUENCE ' || SEQUENCE_NAME || ' ;' from ALL_SEQUENCES
WHERE SEQUENCE_OWNER = <OWNER_NAME>
UNION ALL
select 'CREATE SEQUENCE ' || SEQUENCE_NAME ||
' INCREMENT BY ' || INCREMENT_BY ||
' START WITH ' || to_char(LAST_NUMBER+1) ||
' MINVALUE ' || to_char(MIN_VALUE) ||

Decode(LENGTH(TO_CHAR(MAX_VALUE)), 27, '', ' MAXVALUE ' || TO_CHAR(MAX_VALUE) ) ||

Decode(CYCLE_FLAG, 'N', ' NOCYCLE', 'Y', ' CYCLE' ) || 
Decode(CACHE_SIZE, 0, ' NOCACHE', ' CACHE ' || TO_CHAR(CACHE_SIZE) )  || 
Decode(ORDER_FLAG, 'N', ' NOORDER', 'Y', ' ORDER' ) || ';' 
from ALL_SEQUENCES
where SEQUENCE_OWNER = <OWNER_NAME>

Import Sequences with start value as 1
SELECT 'DROP SEQUENCE ' || SEQUENCE_NAME || ' ;' from ALL_SEQUENCES
WHERE SEQUENCE_OWNER = <OWNER_NAME>
UNION ALL
select 'CREATE SEQUENCE ' || SEQUENCE_NAME ||
' INCREMENT BY ' || INCREMENT_BY ||
' START WITH 1' ||

Decode(LENGTH(TO_CHAR(MAX_VALUE)), 27, '', ' MAXVALUE ' || TO_CHAR(MAX_VALUE) ) ||

Decode(CYCLE_FLAG, 'N', ' NOCYCLE', 'Y', ' CYCLE' ) || 
Decode(CACHE_SIZE, 0, ' NOCACHE', ' CACHE ' || TO_CHAR(CACHE_SIZE) )  || 
Decode(ORDER_FLAG, 'N', ' NOORDER', 'Y', ' ORDER' ) || ';' 
from ALL_SEQUENCES
where SEQUENCE_OWNER = <OWNER_NAME>

HTH
Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
QOTD: Any clod can have facts, but having an opinion is an art ! Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify ESPN at (860) 766-2000 and delete this e-mail message from your computer, Thank you.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jamadagni, Rajendra
  INET: rajendra.jamadagni_at_espn.com

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
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
Received on Thu Sep 28 2000 - 13:58:54 CDT

Original text of this message

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