码迷,mamicode.com
首页 > 数据库 > 详细

数据库迁移(分享十一续集)

时间:2017-11-24 19:02:52      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:blink   查看   des   cluster   public   tab   ide   like   迁移   

       本章节继续介绍: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/oracle@orcl1 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 employees@hrlink;

6)迁移HR下所有表到备库

grant dba,connect,resource to hr indentified by oracle;

impdp hr network_link=hrlink schemas=hr cluster=N PARALLEL=2

数据库迁移(分享十一续集)

标签:blink   查看   des   cluster   public   tab   ide   like   迁移   

原文地址:http://www.cnblogs.com/zywu-king/p/7891697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!