Well this was not supposed to be a post but it was asked over Forums.oracle.com that can we do the transport of the tablespace in the same database after some testing?So the answer is yes. Now I was originally going to post it over there only but thanks to new Jive software, I couldn’t so I had to post it here. Have a read,
C:\Documents and Settings\Administrator>sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Sep 17 09:31:00
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select name from V$database;
NAME
---------
MUMMYORA
SQL> create tablespace test_tt datafile 'd:\test.dbf' size 2m;
Tablespace created.
SQL> create user test identified by test default tablespace
test_tt
quota un
ted on test_tt;
User created.
SQL> grant create table ,create session to test;
Grant succeeded.
SQL> conn test/test
Connected.
SQL> create table tt_tab(a number);
Table created.
SQL> insert into tt_tab values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> conn / as sysdba
Connected.
SQL> alter tablespace test_tt read only;
Tablespace altered.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0
-
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
C:\Documents and Settings\Administrator>sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Sep 17 09:33:44
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> alter user sys identified by oracle;
User altered.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0
-
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
C:\Documents and Settings\Administrator>sqlplus "sys/oracle as
sysdba"
file=
est_tt.dmp tablespaces=TEST_TT TRANSPORT_TABLESPACE=y
Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
<logon> ::= <username>[/<password>][@<connect_string>] | /
|
/NOLOG
<start> ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
“-H” displays the SQL*Plus version banner and usage
syntax
“-V” displays the SQL*Plus version banner
“-L” attempts log on just once
“-M <o>” uses HTML markup options <o>
“-R <n>” uses restricted mode <n>
“-S” uses silent mode
C:\Documents and Settings\Administrator>exp “sys/oracle as
sysdba”
file=d:\t
tt.dmp tablespaces=TEST_TT TRANSPORT_TABLESPACE=y
LRM-00108: invalid positional parameter value ‘as’
EXP-00019: failed to process parameters, type ‘EXP HELP=Y’ for
help
EXP-00000: Export terminated unsuccessfully
C:\Documents and Settings\Administrator>exp ’sys/oracle as
sysdba’
file=d:\t
tt.dmp tablespaces=TEST_TT TRANSPORT_TABLESPACE=y
Export: Release 9.2.0.1.0 - Production on Wed Sep 17 09:35:09
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 -
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR
character set
Note: table data (rows) will not be exported
About to export transportable tablespace metadata…
For tablespace TEST_TT …
. exporting cluster definitions
. exporting table definitions
. . exporting table TT_TAB
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.
C:\Documents and Settings\Administrator>sqlplus “/ as sysdba”
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Sep 17 09:40:22
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0
-
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
C:\Documents and Settings\Administrator>d:
D:\>mkdir d:\bkup
D:\>copy TEST.DBF d:\bkup
1 file(s) copied.
D:\>sqlplus “/ as sysdba”
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Sep 17 09:40:50
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> alter tablespace test_tt read write;
Tablespace altered.
SQL> insert into test.tt_tab values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test.tt_tab;
A
———-
1
2
SQL> rem this was after export ;
SQL> drop tablespace test_tt including contents and datafiles;
Tablespace dropped.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0
-
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
D:\>imp ’sys/oracle as sysdba’ file=d:\test_tt.dmp
tablespaces=TEST_TT
TRANS
_TABLESPACE=y datafiles=’d:\test.dbf’
Import: Release 9.2.0.1.0 - Production on Wed Sep 17 09:43:03
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 -
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
About to import transportable tablespace(s) metadata…
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR
character set
. importing SYS’s objects into SYS
IMP-00017: following statement failed with ORACLE error 1565:
“BEGIN
sys.dbms_plugts.beginImpTablespace(’TEST_TT’,12,’SYS’,1,0,8192,1,3
“710620,1,2147483645,8,128,8,0,1,0,8,1151101578,1,1,35710182,NULL,0,0
,NULL,
“ULL); END;”
IMP-00003: ORACLE error 1565 encountered
ORA-01565: error in identifying file ‘d:\test.dbf’
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
ORA-06512: at “SYS.DBMS_PLUGTS”, line 1441
ORA-06512: at line 1
IMP-00000: Import terminated unsuccessfully
D:\>copy d:\bkup\TEST.DBF d:\
1 file(s) copied.
D:\>imp ’sys/oracle as sysdba’ file=d:\test_tt.dmp
tablespaces=TEST_TT
TRANS
_TABLESPACE=y datafiles=’d:\test.dbf’
Import: Release 9.2.0.1.0 - Production on Wed Sep 17 09:43:18
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 -
Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
About to import transportable tablespace(s) metadata…
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR
character set
. importing SYS’s objects into SYS
. importing TEST’s objects into TEST
. . importing table “TT_TAB”
Import terminated successfully without warnings.
D:\>sqlplus test/test
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Sep 17 09:43:26
2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights
reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select * from tt_tab;
A
———-
1
SQL>
What we have done is that we made a user Test owning a tablespace
Test_tt. We put one value in it(our original work) and we exported the ”good time” tablespace. We did some more work,inserted one more
value(can call it changes or testing) and once we finished,we dropped the
tablespace. We didn’t drop the user. We imported back the tablespace
and we were back to value 1 from where we started. More or less,same like tablespace attached and detached.
Aman….