transport tbs example02 xp => rhel

2)transport tbs example02 xp => rhel
1@@@@XP(32bit,ZHS16GBK,O10g,tbs) => RHEL5.4(32bit,AL32UTF8,O10g,tbs)
  Note: ZHS16GBK > AL32UTF8,
  so it work without any characterset error.

@@@
@@@<1>check the characterset.
@@@
SQL> col PROPERTY_NAME format a32 trunc
SQL> col PROPERTY_VALUE format a32 trunc
SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties;
PROPERTY_NAME                    PROPERTY_VALUE
-------------------------------- --------------------------------
DEFAULT_TBS_TYPE                 SMALLFILE
NLS_LANGUAGE                     AMERICAN
NLS_TERRITORY                    AMERICA
NLS_DATE_FORMAT                  DD-MON-RR
NLS_TIME_FORMAT                  HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT             DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT               HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT          DD-MON-RR HH.MI.SSXFF AM TZR

@@@
@@@<2>expdp tablespace with x.dmp and x.dbf
@@@
@@@station61
@@@when you transport table remember could not exist sys.table
SQL> conn /as sysdba;
Connected.
SQL> create tablespace tbs datafile
     '/u01/app/oracle/oradata/orcl/tbs.dbf' size 100M;
SQL> create table hr.test_transport(a number) tablespace tbs;
SQL> insert into hr.test_transport values(9);
SQL> commit;
SQL> create directory dir61 as '/u01/app/oracle/directory/orcl/dir61';
SQL> grant read,write on directory dir61 to hr;
SQL> conn /as sysdba;
SQL> alter tablespace tbs read only;
Tablespace altered.

@@@
[oracle@station61 ~]$ expdp \'sys/oracle as sysdba\' directory=dir61
 dumpfile=tbs.dmp transport_tablespaces=tbs
Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 15:57:13

@@@
@@@if you want to transport to other os platform.
SQL> select PLATFORM_NAME from v$transportable_platform;
Linux IA (64-bit)
Microsoft Windows IA (64-bit)
IBM Power Based Linux
......................

@@@
@@@or directly copy,if you transport to the same platform.
RMAN> convert tablespace tbs to platform 'Linux IA (32-bit)'
      format '/u01/tbs.dbf';
@@@
@@@copy datafile and xxx.dmp to other os platform(assume).
@@@note the owner of files.
[oracle@station61 dir61]$ scp tbstransport.dmp
station60:/u01/app/oracle/directory/orcl/dir60/
[root@station61 orcl]# scp -rp  tbs.dbf
station60:/u01/app/oracle/oradata/orcl/

@@@
@@@<3>impdp tablespace with datafile
@@@
@@@station60:
@@@change owner of two files(x.dmp and x.dbf).
[root@station60 apple]# chown -R oracle:oinstall /u01/app/oracle/oradata/
[root@station60 apple]# chown -R oracle:oinstall /u01/app/oracle/directory/
[oracle@station60 ~]$ cd /u01/app/oracle/directory/orcl/dir60/
@@@
@@@this is "transport_datafiles" !!!!
[oracle@station60 dir60]$ impdp \'sys/oracle as sysdba\' directory=dir60
dumpfile=tbs.dmp transport_datafiles='/u01/app/oracle/oradata/orcl
/tbs.dbf'

@@@check
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
UNDOTBS1                       ONLINE
SYSAUX                         ONLINE
TEMP                           ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
TBS                            READ ONLY
SQL> alter tablespace tbs online;
Tablespace altered.
SQL> select * from hr.test_transport;
         A
----------
         1
@@@success.

@@@
@@@<4>summary
@@@
    This is a good example, before you use this techonology, you must know about
  it well first. In this case, these is no characterset error.

你可能感兴趣的:(tablespace,transport)