当前位置:Gxlcms > 数据库问题 > 数据库迁移(分享十一续集)

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

时间:2021-07-01 10:21:17 帮助过:4人阅读

       本章节继续介绍: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   迁移   

人气教程排行