oracle传输表空间
https://blog.csdn.net/ch7543658/article/details/39271135/
1、查看操作系统endianness格式
col platform_name for a40
SELECT *
FROM V$TRANSPORTABLE_PLATFORM
ORDER BY PLATFORM_ID;
源端与目标端都查询下面语句,看一样不一样
SELECT d.PLATFORM_NAME,
ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d
WHERE tp.PLATFORM_NAME =d.PLATFORM_NAME;
2、在source端创建测试表空间
--在target端(暂时只先创建用户)
create user target_test
identified by oracle
temporary tablespace TEMPTS1;
User created.
grant connect,resource to target_test;
这个用户还要指定默认表空间,否则后面将是users表空间
3、在source端和target端创建 backup 的目录,其实都不用创建这个,用默认的data_pump_dir就可以了
4、检查表空间自包含(就是该表空间里的数据没有和其他表空间数据有关联,如果有关联会报错)
作用:用于检查表空间集合是否是自包含的。
语法:dbms_tts.transport_set_check(ts_list in varchar2,incl_constraints in boolean default,full_closure in boolean default false);
其中ts_list指定表空间列表,如果要指定多个表空间则使用逗号隔开,incl_constraints指定是否要检查完整性约束,full_closure指定是否要进行完全或部分相关性检查。
例子:
exec sys.dbms_tts.transport_set_check('users1,users2');
select * from sys.transport_set_violations;
在查询临时表transport_set_violations时,如果返回信息,则会显示违反自包含表空间规则的原因,如果没有返回则表示表空间时自包含的。
SQL> execute dbms_tts.transport_set_check('TSET', TRUE);
PL/SQL procedure successfully completed.
--查看自包含验证结果:
SQL> select * from transport_set_violations;
no rows selected
--没有记录说明没有错
27-JUN-19 SYS@tdb> execute dbms_tts.transport_set_check('KYC_FRE', TRUE);
PL/SQL procedure successfully completed.
27-JUN-19 SYS@tdb> select * from transport_set_violations;
no rows selected
5、将表空间KYC_FRE设置成read-only
alter tablespace TSET read only;
select tablespace_name,status
from dba_tablespaces;
待将数据文件复制到target完成后,再修改为read write.
6、生成:Transportable Tablespace Set
Transportable Tablespace Set有两部分:
1)expdp 导出的表空间的metadata
2)还有就是表空间对应的数据文件
expdp dumpfile=test01.dmp directory=backup transport_tablespaces=TSET transport_full_check=y logfile=TSET.log
7、将Transportable Tablespace set 传送到Target端
1)将表空间test 对应的数据文件copy到Target 对应的ORADATA目录下。
2)将expdp 导出的表空间metadta 数据copy 到Target 端的backup 目录下
8、在Target 系统上Import 表空间的metadata(使用target_test用户,需要用到remap_schema)
impdp directory=backup dumpfile=test01.dmp transport_datafiles=/u01/app/oracle/oradata/normal/test01.dbf remap_schema=source_test:target_test logfile=test.log
9、查看并修改源表空间状态
alter tablespace TSET read write;
10、target端验证
target目标库
只需要以下5步
create user kyc_acc identified by "123456" temporary tablespace kyc_temp;
grant create session,create view,create job to resource;
grant read,write on directory data_pump_dir to resource;
grant resource to kyc_acc;
impdp system/123456 directory=data_pump_dir dumpfile=tts_expdp_acc.dmp logfile=tts_impdp_acc.log remap_tablespace=kyc_acc:kyc_acc transport_datafiles=/u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf
alter user kyc_acc default tablespace kyc_acc;
alter tablespace KYC_ACC read write;
下面是一些过程详情 --create tablespace kyc_acc;
--drop tablespace kyc_acc including contents and datafiles; create temporary tablespace kyc_temp;
create user kyc_acc identified by "" default tablespace kyc_acc temporary tablespace kyc_temp;
create user kyc_acc identified by "" temporary tablespace kyc_temp;
drop user kyc_acc cascade; select tablespace_name,status from dba_tablespaces; grant create session,create view,create job to resource;
grant read,write on directory data_pump_dir to resource;
grant resource to kyc_acc; select * from ROLE_SYS_PRIVS
where ROLE like 'RES%';
select * from ROLE_TAB_PRIVS
where ROLE like 'RES%';
select * from dba_sys_PRIVS
where grantee like 'KYC%'; 只创建用户,不指定默认表空间,导入时remap一下,自动创建acc1表空间,数据在acc1表空间中,但是默认表空间还是users。(加这个参数的效果remap_tablespace=kyc_acc:kyc_acc1)
create user kyc_acc identified by "" temporary tablespace kyc_temp;
impdp system/ directory=data_pump_dir dumpfile=tts_expdp_acc.dmp logfile=tts_impdp_acc.log remap_tablespace=kyc_acc:kyc_acc1 transport_datafiles=/u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf 这样就可以了remap_tablespace=kyc_acc:kyc_acc,同名就可以了,要的就是这个效果
create user kyc_acc identified by "" temporary tablespace kyc_temp;
impdp system/ directory=data_pump_dir dumpfile=tts_expdp_acc.dmp logfile=tts_impdp_acc.log remap_tablespace=kyc_acc:kyc_acc transport_datafiles=/u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf
alter user kyc_acc default tablespace kyc_acc;
alter tablespace KYC_ACC read write; =============================================================
source源库
只需要5步
alter tablespace KYC_ACC read only;
expdp system/123456 directory=data_pump_dir dumpfile=tts_expdp_acc.dmp logfile=tts_expdp_acc.log transport_tablespaces=KYC_ACC transport_full_check=y
scp /u01/app/oracle/admin/tdb/dpdump/tts_expdp_acc.dmp 192.168.8.151:/u01/app/oracle/admin/pdb/dpdump/
scp /u01/app/oracle/oradata/TDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf 192.168.8.151:/u01/app/oracle/oradata/PDB/datafile/
alter tablespace KYC_ACC read write;
下面是一些过程详情 alter tablespace KYC_ACC read only;
select tablespace_name,status from dba_tablespaces; SELECT *
FROM V$TRANSPORTABLE_PLATFORM
ORDER BY PLATFORM_ID; exec sys.dbms_tts.transport_set_check('KYC_ACC');
select * from sys.transport_set_violations; execute dbms_tts.transport_set_check('KYC_ACC', TRUE);
select * from sys.transport_set_violations; grant read,write on directory data_pump_dir to kyc_acc;
expdp system/123456 directory=data_pump_dir dumpfile=tts_expdp_acc.dmp logfile=tts_expdp_acc.log transport_tablespaces=KYC_ACC transport_full_check=y rm -rf /u01/app/oracle/admin/tdb/dpdump/acc.* scp /u01/app/oracle/admin/tdb/dpdump/tts_expdp_acc.dmp 192.168.8.151:/u01/app/oracle/admin/pdb/dpdump/
scp /u01/app/oracle/oradata/TDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf 192.168.8.151:/u01/app/oracle/oradata/PDB/datafile/ alter tablespace KYC_ACC read write; ============================================================= 遇到的问题 问题1
ORA-: invalid operation
ORA-: import mode TRANSPORTABLE conflicts with export mode SCHEMA 原因是导出时是普通的schema mode,acc.dmp文件scp错了,这个错可以避免,是大意了 这是相同的问题
create user kyc_acc identified by "" temporary tablespace kyc_temp;
impdp system/ directory=data_pump_dir dumpfile=tts_expdp_acc.dmp logfile=tts_impdp_acc.log tablespace=kyc_acc transport_datafiles=/u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf 加这个参数是错的tablespaces=kyc_acc
ORA-: invalid operation
ORA-: import mode TABLESPACE conflicts with export mode TRANSPORTABLE 问题2
source只读,要等待scp完成之后再修改成读写,否则会报下面的错
http://www.itkeyword.com/doc/9256610597391385750 Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** directory=data_pump_dir dumpfile=acc.dmp transport_datafiles=/u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf logfile=acc.log
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-19722: datafile /u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf is an incorrect version 问题3
在target提前创建用户与默认表空间与临时表空间,否则报下面的错 Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** directory=data_pump_dir dumpfile=acc.dmp transport_datafiles=/u01/app/oracle/oradata/PDB/datafile/o1_mf_kyc_acc_gfn4lb38_.dbf logfile=acc.log
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-29342: user KYC_ACC does not exist in the database 查看所属表空间
select * from user_tables where table_name='ACCT_ACCOUNT'; 据目前所了解,正长情况下需要修改表的空间和表的索引的空间,如果涉及到BOLB字段的表,修改的方式又不一样了!
否则就得移动表空间,从users到kyc_acc
把原来的移动到新修改的表空间中了
select 'alter table '|| table_name ||' move tablespace kyc_acc;' from user_tables;
select 'alter index '|| index_name ||' rebuild tablespace kyc_acc;' from user_indexes;
后来的就自动放在新修改的表空间中了
alter user kyc_acc default tablespace kyc_acc;
oracle传输表空间的更多相关文章
- Oracle传输表空间介绍
传输表空间通过拷贝数据文件的方式,实现可跨平台的数据迁移,效率远超expdp/impdp, exp/imp等工具.还可以应用跨平台&数据库版本迁移表数据.归档历史数据和实现表空间级时间点数据恢 ...
- oracle传输表空间功能测试(含详细过程)
最近做数据迁移,之前有一篇迁移思路思考的文章,这里继续做具体的测试,主题问表空间传输. 一.源服务器上导出表空间 源服务器: 10.1.122.55 目标服务器:10.1.122.54 0.设置字 ...
- oracle传输表空间相关
1.convert tablespaceconvert tablespace源端库执行:convert tablespace 'TPS_DATA' to platform 'AIX-Based Sys ...
- 【TTS】传输表空间AIX asm -> linux asm
[TTS]传输表空间AIX asm -> linux asm 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读和注意事项 各位技术爱好者,看完本文后,你可以掌 ...
- 【TTS】传输表空间Linux asm -> AIX asm
[TTS]传输表空间Linux asm -> AIX asm 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读和注意事项 各位技术爱好者,看完本文后,你可以掌 ...
- Oracle使用SQL传输表空间
源环境:RHEL 6.4 + Oracle 11.2.0.4 目的环境:RHEL 6.4 + Oracle 11.2.0.4 DG双机 要求:使用SQL传输表空间DBS_D_JINGYU从源环境到目的 ...
- oracle操作之传输表空间
一.传输表空间概述 什么是传输表空间,传输表空间技术始于oracle9i,不论是数据字典管理的表空间还是本地管理的表空间,都可以使用传输表空间技术:传输表空间不需要在源数据库和目标数据库之间具有同样的 ...
- 转 Oracle Transportable TableSpace(TTS) 传输表空间 说明
############1 迁移数据库的集中方法 三.相关技术 迁移方式 优势 不足1 Export and import • 对数据库版本,以及系统平台没有要求 • 不支持并发,速度慢• 停机时 ...
- oracle expdp/impdp/可传输表空间
oracle expdp/impdp/可传输表空间/及一些参数 Oracle data pump 导出操作能够将表.索引.约束.权限.PLSQL包.同义词等对象从数据库导出,并将它们保存在一种非文本格 ...
随机推荐
- 为什么JAVA线程中没有Running状态?
面试官问:为什么 Java 线程没有 Running 状态?我懵了 —— 转 芋道源码 什么是 RUNNABLE? 与传统的ready状态的区别 与传统的running状态的区别 当I/O阻塞时 如 ...
- 【Mysql MHA】CentOS7.6+Mysql8.0.16 入坑
1.防火墙 firewall-cmd --add-port=/tcp --permanent firewall-cmd --reload 2.SELINUX sed -i 's/SELINUX=enf ...
- Python查看模块函数,查看函数方法的详细信息
Python查看方法的详情 1.通用的帮助函数help() 使用help()函数来查看函数的帮助信息. 如: import requests help(requests) 会有类似如下输出: 2.查询 ...
- maven jar 包不在项目中
maven update project maven build
- Codeforces 348 D - Turtles
D - Turtles 思路: LGV 定理 (Lindström–Gessel–Viennot lemma) 从{\(a_1\),\(a_2\),...,\(a_n\)} 到 {\(b_1\),\( ...
- Python3+Appium学习笔记08-元素定位
appium整合了不同的自动化测试驱动程序.而新版本appium desktop 中安卓是使用UI Automator2来作为驱动程序的.以前版本是使用UI Automator1或 Selendroi ...
- Nginx防盗链模块ngx_http_referer_module
ngx_http_referer_module⽤用来阻⽌止Referer⾸首部⽆无有效值的请求访问,可防⽌止盗链指令:12.1 valid_referers定义 referer ⾸首部的合法可⽤用值, ...
- python_面向对象——对象间的组合关系
# 由一堆组件构成一个完整的实体,组建本身独立,但又不能自己运行,必须跟宿主组合在一起,运行. class Dog: #狗 def __init__(self,name,dog_type,attack ...
- Lua 学习之基础篇五<Lua OS 库>
lua os库提供了简单的跟操作系统有关的功能 1.os.clock() 返回程序所运行使用的时间 local nowTime = os.clock() print("now time is ...
- 【翻译】PATH究竟是什么?
最近,我试图向一个朋友解释他电脑上PATH变量是用来做什么的.我在我们所交流的平台‘the Slack group"写了一篇比较长的消息之后,我意识到这个主题可以写成一个很好的博客,所以开始 ...