设为首页 加入收藏

TOP

可传输表空间(三)
2015-07-24 11:58:07 来源: 作者: 【 】 浏览:22
Tags:传输 空间
TRANSPORT_SET_VIOLATIONS;
no rows selected

执行严格自包含检查(full_check=true):

SQL> exec dbms_tts.transport_set_check('EYGLE', TRUE, True);
PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;
VIOLATIONS
--------------------------------------------------------------------------------------
Index EYGLE.IND_ID in tablespace USERS points to table EYGLE.EYGLE in tablespace EYGLE

反过来对于USERS表空间来说,非严格检查也是无法通过的:

SQL> exec dbms_tts.transport_set_check('USERS', TRUE);
PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;
VIOLATIONS
----------------------------------------------------------------------------------------
Index EYGLE.IND_ID in tablespace USERS points to table EYGLE.EYGLE in tablespace EYGLE

但是可以对多个表空间同时传输,则一些自包含问题就可以得到解决:

SQL> exec dbms_tts.transport_set_check('USERS,EYGLE', TRUE, True);
PL/SQL procedure successfully completed.

SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;
no rows selected

表空间自包含确认之后,进行表空间传输就很方便了,一般包含如下几个步骤。
(1) 将表空间设置为只读:
alter tablespace users read only;
(2) 导出表空间。在操作系统提示符下执行:
exp username/passwd tablespaces=users transport_tablespace=y file=exp_users.dmp
此处的导出文件只包含元数据,所以导出文件很小,导出速度也会很快。
(3) 转移。将导出的元数据文件(此处是exp_users.dmp)和传输表空间的数据文件(此处是users表空间的数据文件user01.dbf)转移至目标主机(转移过程如果使用FTP方式,应该注意使用二进制方式)。
(4) 传输。在目标数据库将表空间插入到数据库中,完成表空间传输。在操作系统命令提示符下执行下面的语句:
imp username/passwd tablespaces=users transport_tablespace=y file=exp_users.dmp datafiles='users01.dbf'

了解了Oracle的可传输表空间技术后,来看一下example表空间的插入,以下脚本仍然来自mkplug.sql脚本:

--
-- Importing the metadata and plugging in the tablespace at the same
-- time, using the restored database file
--
DEFINE imp_logfile = &log_path.tts_example_imp.log

-- When importing use filename got after restore is finished
host imp "'sys/&&password_sys AS SYSDBA'" transport_tablespace=y file=&imp_file log=&imp_logfile datafiles='&datafile' tablespaces=EXAMPLE tts_owners=hr,oe,pm,ix,sh


完成plugging之后,这个表空间就被包含在了新建的数据库之中。
首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇MySQL ('root'@'%.. 下一篇CAPI函数描述(A-F)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何理解智能指针? (2025-12-24 12:48:26)
·c++是否应避免使用普 (2025-12-24 12:48:23)
·如何通俗易懂学会 C+ (2025-12-24 12:48:21)
·在 C 语言函数中,如 (2025-12-24 12:19:41)
·C盘里面的AppData文 (2025-12-24 12:19:38)