Home » RDBMS Server » Server Utilities » Exporting the database to text format
Exporting the database to text format [message #72228] Thu, 17 April 2003 06:58 Go to next message
Bala chander
Messages: 1
Registered: April 2003
Junior Member
Using the export command, I want to export all my database object in ASCII mode ( not in the binary mode)i.e. I want CREATE TABLE , CREATE PROCEDURE statement inside the dumb file as text format. Whether it is possible to do it using exp command or any other method to do it (without using any other GUI tools)

Thanks
Bala
Re: Exporting the database to text format [message #72229 is a reply to message #72228] Thu, 17 April 2003 07:07 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
C:>exp mag/mag owner=scott

Export: Release 8.1.6.0.0 - Production on Thu Apr 17 08:48:14 2003

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

Connected to: Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
Export done in WE8ISO8859P1 character set and WE8ISO8859P1 NCHAR character set

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table                        mytable          0 rows exported
. . exporting table                     privileges          6 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting snapshots
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.

C:>imp  mag/mag show=y fromuser=scott touser=scott

Import: Release 8.1.6.0.0 - Production on Thu Apr 17 08:48:20 2003

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

Connected to: Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production

Export file created by EXPORT:V08.01.06 via conventional path
import done in WE8ISO8859P1 character set and WE8ISO8859P1 NCHAR character set
. importing SCOTT's objects into SCOTT
 "ALTER SCHEMA = "SCOTT""
 "CREATE TABLE " mytable" ("ID" NUMBER)  PCTFREE 10 PCTUSED 40 INITRANS 1 MAX"
 "TRANS 255 LOGGING STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENTS "
 "2147483645 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT"
 ") TABLESPACE "SYSTEM""
. . skipping table " mytable"

 "CREATE TABLE "privileges" ("ID" NUMBER)  PCTFREE 10 PCTUSED 40 INITRANS 1 M"
 "AXTRANS 255 LOGGING STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENT"
 "S 2147483645 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAU"
 "LT) TABLESPACE "SYSTEM""
. . skipping table "privileges"

Import terminated successfully without warnings.

C:>

Re: Exporting the database to text format [message #72243 is a reply to message #72228] Tue, 22 April 2003 15:01 Go to previous messageGo to next message
Aaron Smith
Messages: 1
Registered: April 2003
Junior Member
Have you tried using the "INDEXFILE" option on the import utility to get the acutal CREATE TABLE, etc... statements??

C:>exp userid=evaldba/evaldba@eval file=c:owner.dmp tables=course, program, evaluation rows=n log=c:eval.log

Export: Release 9.2.0.2.1 - Production on Tue Apr 22 14:35:37 2003

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.2.1 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.2.0 - Production
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses US7ASCII character set (possible charset conversion)
Note: table data (rows) will not be exported

About to export specified tables via Conventional Path ...
. . exporting table COURSE
. . exporting table PROGRAM
. . exporting table EVALUATION
Export terminated successfully without warnings.

Now import the file using the INDEXFILE option

C:>imp evaldba/evaldba@eval file=c:owner.dmp indexfile=c:owner.sql tables= course, program, evaluation

Import: Release 9.2.0.2.1 - Production on Tue Apr 22 14:39:09 2003

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.2.1 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.2.0 - Production

Export file created by EXPORT:V09.02.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses US7ASCII character set (possible charset conversion)
Import terminated successfully without warnings.

Now when I open the file "owner.sql" that was created with the indexfile option I get the following:

REM CREATE TABLE "EVALDBA"."COURSE" ("COURSE_PK" NUMBER(9, 0),
REM "COURSE_NUM" VARCHAR2(10) CONSTRAINT "COURSE_NUM_NN" NOT NULL ENABLE,
REM "NAME" VARCHAR2(100) CONSTRAINT "COURSE_NAME_NN" NOT NULL ENABLE,
REM "PROG_ID" NUMBER(6, 0)) PCTFREE 10 PCTUSED 80 INITRANS 1 MAXTRANS 255
REM STORAGE(INITIAL 57344 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE
REM "DATA01" LOGGING NOCOMPRESS ;
CONNECT EVALDBA;
CREATE INDEX "EVALDBA"."COURSE_PK" ON "COURSE" ("COURSE_PK" ) PCTFREE 10
INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1 FREELIST GROUPS
1) TABLESPACE "INDX01" LOGGING ;
REM ALTER TABLE "EVALDBA"."COURSE" ADD CONSTRAINT "COURSE_PK" PRIMARY KEY
REM ("COURSE_PK") DEFERRABLE INITIALLY DEFERRED USING INDEX PCTFREE 10
REM INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1 FREELIST
REM GROUPS 1) TABLESPACE "INDX01" LOGGING ENABLE ;
REM CREATE TABLE "EVALDBA"."PROGRAM" ("PROG_ID" NUMBER(6, 0), "PROG_NAME"
REM VARCHAR2(100) CONSTRAINT "PROGRAM_NAME_NN" NOT NULL ENABLE, "ABBR"
REM VARCHAR2(10), "DEPT_ID" NUMBER(9, 0)) PCTFREE 10 PCTUSED 80 INITRANS
REM 1 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1 FREELIST GROUPS 1)
REM TABLESPACE "DATA01" LOGGING NOCOMPRESS ;
CREATE INDEX "EVALDBA"."PROGRAM_PROG_ID_PK" ON "PROGRAM" ("PROG_ID" )
PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1
FREELIST GROUPS 1) TABLESPACE "INDX01" LOGGING ;
REM ALTER TABLE "EVALDBA"."PROGRAM" ADD CONSTRAINT "PROGRAM_PROG_ID_PK"
REM PRIMARY KEY ("PROG_ID") DEFERRABLE INITIALLY DEFERRED USING INDEX
REM PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1
REM FREELIST GROUPS 1) TABLESPACE "INDX01" LOGGING ENABLE ;
REM CREATE TABLE "EVALDBA"."EVALUATION" ("EVAL_ID" NUMBER(9, 0),
REM "EVAL_DATE" DATE, "INSTRUCT_ID" NUMBER(9, 0), "COURSE_PK" NUMBER(9,
REM 0), "LOGINAME" VARCHAR2(10), "COURSEPASS" CHAR(8)) PCTFREE 10 PCTUSED
REM 80 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 57344 FREELISTS 1 FREELIST
REM GROUPS 1) TABLESPACE "DATA01" LOGGING NOCOMPRESS ;
CREATE INDEX "EVALDBA"."EVALUATION_ID_PK" ON "EVALUATION" ("EVAL_ID" )
PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1
FREELIST GROUPS 1) TABLESPACE "INDX01" LOGGING ;
REM ALTER TABLE "EVALDBA"."EVALUATION" ADD CONSTRAINT "EVALUATION_ID_PK"
REM PRIMARY KEY ("EVAL_ID") DEFERRABLE INITIALLY DEFERRED USING INDEX
REM PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 32768 FREELISTS 1
REM FREELIST GROUPS 1) TABLESPACE "INDX01" LOGGING ENABLE ;
REM ALTER TABLE "EVALDBA"."COURSE" ADD CONSTRAINT "COURSE_PROG_ID_FK"
REM FOREIGN KEY ("PROG_ID") REFERENCES "PROGRAM" ("PROG_ID") DEFERRABLE
REM INITIALLY DEFERRED ENABLE NOVALIDATE ;
REM ALTER TABLE "EVALDBA"."PROGRAM" ADD CONSTRAINT "PROGRAM_DEPT_ID_FK"
REM FOREIGN KEY ("DEPT_ID") REFERENCES "DEPARTMENT" ("DEPT_ID")
REM DEFERRABLE INITIALLY DEFERRED ENABLE NOVALIDATE ;
REM ALTER TABLE "EVALDBA"."EVALUATION" ADD CONSTRAINT
REM "EVAL_INSTRUCT_ID_FK" FOREIGN KEY ("INSTRUCT_ID") REFERENCES
REM "INSTRUCTOR" ("INSTRUCT_ID") DEFERRABLE INITIALLY DEFERRED ENABLE
REM NOVALIDATE ;
REM ALTER TABLE "EVALDBA"."EVALUATION" ADD CONSTRAINT "EVAL_COURSE_PK_FK"
REM FOREIGN KEY ("COURSE_PK") REFERENCES "COURSE" ("COURSE_PK")
REM DEFERRABLE INITIALLY DEFERRED ENABLE NOVALIDATE ;
REM ALTER TABLE "EVALDBA"."COURSE" ENABLE CONSTRAINT "COURSE_PROG_ID_FK" ;
REM ALTER TABLE "EVALDBA"."PROGRAM" ENABLE CONSTRAINT
REM "PROGRAM_DEPT_ID_FK" ;
REM ALTER TABLE "EVALDBA"."EVALUATION" ENABLE CONSTRAINT
REM "EVAL_INSTRUCT_ID_FK" ;
REM ALTER TABLE "EVALDBA"."EVALUATION" ENABLE CONSTRAINT
REM "EVAL_COURSE_PK_FK" ;

If you have to make any changes do so here and jsut run the file like a regular script in oracle.

I hope this helps
Aaron
Re: Exporting the database to text format [message #72272 is a reply to message #72229] Wed, 30 April 2003 00:05 Go to previous message
yaojp
Messages: 5
Registered: April 2003
Junior Member
you can use PLSQL Developer !!
Previous Topic: importing a databse
Next Topic: Very Urgent Help needed - Arabic support in Forms6i& reports6i
Goto Forum:
  


Current Time: Fri Nov 08 20:14:14 CST 2024