zoukankan      html  css  js  c++  java
  • 表空间传输

    方法介绍:
    实现表空间的传输的条件:操作系统和数据库版本最好一致。
    表空间传输的速度就是复制文件的速度。
    表空间类的数据对象不可以跨越表空间。
     
    要求:
    表空间中的对象不能与其他表空间中的对象有关联关系。
     
    环境说明:               
    源头:机器A 表空间:TEST_DB
    目标:机器B 表空间:TEST_DB
     
    1 测试表空间是否可以传输。                                                                                                                                            
      execute dbms_tts.transport_set_check('TEST_DB', true);                                                                                                       
      若报过程dbms_tts.transport_set_check不存在,                                                                                                                        
      则用sys的数据库用户执行脚本"$ORACLE_HOME/rdbms/admin/dbmsplts.sql",进行创建。                                                                                         
     
    2 select * from transport_set_violations;                                                                                                                            
      SQL> select * from transport_set_violations;                                                                                                                       
      no rows selected                                                                                                                                                   
      --可以进行传输。                                                                                                                                                          
     
    3 设置表空间TEST_DB 为只读.                                                                                                                                          
      alter tablespace TEST_DB read only;    
                                                                                                                                
    4 表空间导出.                                                                                                                                                        
      exp \'sys/sys@A as sysdba\' transport_tablespace=y tablespaces=TEST_DB file=/home/oracle/test.dmp log=/home/oracle/test.log                                                                                                         
     
    5 复制源表空间的数据文件(注意文件要只读)                                                                                                                             
      cp /ora9/oracle/oradata/testdb2/TEST_DB.dbf TEST_DB.DBF                                                                                                      
     
      复制完成后把源表空间设置可读写。                                                                                                                                  
      alter tablespace TEST_DB read write;  
     
    6 把导出的dmp文件和数据文件,复制到目标数据库目录下。                                                                                                                  
      scp TEST_DB.DBF and test.dmp                                                                                                                                      
     
    7 目标数据库上建立一个和源表空间的相同的表空间,然后建立用户,指定表空间到TEST_DB。                                                                                    
      然后删除目标数据库上建立的表空间TEST_DB。                                                                                                                       
     
    8 复制源数据库的数据文件到目标目录下.                                                                                                                                
      cp TEST_DB.DBF /ora9/oracle/oradata/testdb1/TEST_DB.DBF                                                                                                            
     
    9 把导出的dmp和数据文件为基础,倒入数据到目标表空间下即可.                                                                                                            
      imp \'sys/szmeiton@B as sysdba\' transport_tablespace=y   tablespaces=TEST_DB file='test.dmp' datafiles='/ora9/oracle/oradata/testdb1/TEST_DB.DBF' tts_owners=test
     



  • 相关阅读:
    记一个python字典和json.dumps()的坑
    多态
    接口
    继承
    Python---进阶---文件操作---获取文件夹下所有文件的数量和大小
    Python---进阶---文件操作---按需求打印文件的内容
    Python---进阶---文件操作---比较文件不同
    Python---进阶---函数式编程---按照权重排序
    Python---进阶---函数式编程---lambda
    man clock
  • 原文地址:https://www.cnblogs.com/nolanchan/p/8016313.html
Copyright © 2011-2022 走看看