数据库迁移(分享十一续集)
Posted 云无止境-king
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数据库迁移(分享十一续集)相关的知识,希望对你有一定的参考价值。
本章节继续介绍:impdp+dblink技术,特性是节省硬盘空间,减少传输时间。
1.试验以HR用户为测试
1)查看主机下HR用户下的信息(实际用户以数据库中用户为准)
select USERNAME,DEFAULT_TABLESPACE from dba_users where USERNAME like ‘HR‘;
select TABLESPACE_NAME,BYTES from dba_data_files where TABLESPACE_NAME like ‘EXAMPLE‘;
2)备库上的准备工作
在备库上创建HR用户以及相关表空间以及授权:
create tablespace example datafile ‘/u01/app/oracle/oradata/FRANK/example01.dbf‘ size 200m;
create user hr identified by hr default example
grant dba to hr;
3)配置备库上的tnsname.ora文件
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.27)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
orcl1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl1)
)
)
4)从备库上尝试连接主库
sqlplus sys/[email protected] as sysdba
5)在备库上创建dblink
create public database link hrlink using ‘orcl1‘;
create database link hrlink connect to hr identified by oracle;
select * from dba_db_links;
select count(*) from [email protected];
6)迁移HR下所有表到备库
grant dba,connect,resource to hr indentified by oracle;
impdp hr network_link=hrlink schemas=hr cluster=N PARALLEL=2
以上是关于数据库迁移(分享十一续集)的主要内容,如果未能解决你的问题,请参考以下文章