!
!
!
!
!
!
!
!

DBA - Tablespace Transportable

 

 

Exemple débile de tablespace transportable en 8i

SQL> set echo on
SQL> --
SQL> 
SQL> drop tablespace ttbs_01 including contents cascade constraints;

Tablespace dropped.

SQL> drop tablespace ttbs_02 including contents cascade constraints;

Tablespace dropped.

SQL> create tablespace ttbs_01
2 datafile 'l:\db\idba\data\p2\ttbs_01.ora' size 1M reuse
3 AUTOEXTEND OFF
4 ONLINE
5 default storage
6 (initial 32 k next 32 k
7 minextents 2 maxextents unlimited
8 pctincrease 1);

Tablespace created.

SQL> create tablespace ttbs_02
2 datafile 'l:\db\idba\data\p2\ttbs_02.ora' size 1M reuse
3 AUTOEXTEND OFF
4 ONLINE
5 default storage
6 (initial 32 k next 32 k
7 minextents 2 maxextents unlimited
8 pctincrease 1) ;

Tablespace created.

SQL> create table surv.ttab_01 (col1 varchar2(45), col2 varchar2(45) )
2 tablespace ttbs_01;

Table created.

SQL> alter table surv.ttab_01 add
2 (constraint pk_ttab_01 primary key (col1)
3 USING INDEX TABLESPACE ttbs_02
4 );

Table altered.

SQL> insert into surv.ttab_01 values('A transporter','immediatement');

1 row created.

SQL> commit;

Commit complete.

SQL> 
SQL> execute DBMS_TTS.TRANSPORT_SET_CHECK ('ttbs_01',TRUE);

PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;

no rows selected

SQL> execute DBMS_TTS.TRANSPORT_SET_CHECK ('ttbs_02',TRUE);

PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;

VIOLATIONS 
--------------------------------------------------------------------------------
Index SURV.PK_TTAB_01 in tablespace TTBS_02 enforces primary constriants of tab
le SURV.TTAB_01 in tablespace TTBS_01 


SQL> 
SQL> create table surv.ttab_02
2 (col1 varchar2(45))
3 tablespace ttbs_02;

Table created.

SQL> alter table surv.ttab_02
2 add constraint fk_ttab01 foreign key (col1)
3 references surv.ttab_01(col1);

Table altered.

SQL> 
SQL> execute DBMS_TTS.TRANSPORT_SET_CHECK ('ttbs_01',TRUE);

PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;

no rows selected

SQL> execute DBMS_TTS.TRANSPORT_SET_CHECK ('ttbs_02',TRUE);

PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;

VIOLATIONS 
--------------------------------------------------------------------------------
Constraint FK_TTAB01 between table SURV.TTAB_01 in tablespace TTBS_01 and table 
SURV.TTAB_02 in tablespace TTBS_02 

Index SURV.PK_TTAB_01 in tablespace TTBS_02 enforces primary constriants of tab
le SURV.TTAB_01 in tablespace TTBS_01 


SQL> execute DBMS_TTS.TRANSPORT_SET_CHECK ('ttbs_01,ttbs_02',TRUE);

PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;

no rows selected

SQL> -- read only
SQL> alter tablespace ttbs_01 read only;

Tablespace altered.

SQL> alter tablespace ttbs_02 read only;

Tablespace altered.

SQL> host exp_transp_ts.cmd

SQL> spool off

Figure 1 Exporter un set de deux tablespaces

L'export:

 exp_transp_ts.cmd

echo on
exp parfile=exp_tranp_ts.par

exp_tranp_ts.par

userid = 'sys/sys@idba as sysdba'
TRANSPORT_TABLESPACE=y 
TABLESPACES=ttbs_01,ttbs_02 
TRIGGERS=y 
CONSTRAINTS=y 
GRANTS=y
rows=y
log=exp_transp_ts.lis

Importer dans l'autre base

import.cmd

echo on
imp parfile=imp_tranp_ts.par
pause

imp_tranp_ts.par

userid = 'sys/sys@monty as sysdba'
TRANSPORT_TABLESPACE=y 
DATAFILES=N:\Oradata\816\Monty\data\P5\TTBS_02.ORA, N:\Oradata\816\Monty\data\P5\TTBS_01.ORA
log=imp_transp_ts.lis

imp_transp_ts.lis
==========

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
About to import transportable tablespace(s) metadata...
import done in WE8ISO8859P1 character set and WE8ISO8859P1 NCHAR character set
. importing SYS's objects into SYS
. importing SURV's objects into SURV
. . importing table "TTAB_01"
. . importing table "TTAB_02"
About to enable constraints...
Import terminated successfully without warnings.

 

Figure 2 Import de la metadata.

Nous remarquons que même si dans l'export les lignes sont demandées, elles ne sont pas exportes. Remarquons également la manière dont on s'identifie as sysdba

 


Copyright © 1998-2002 Radu Caulea, TAFORA MAJ 20/04/2006 !
Commentaires et suggestions radu[CHEZ]tafora.fr