测试同步HELLOWORLD

一、测试校验

校验源数据库与备库的数据是否具有一致性,首先确定源数据库与备库中都不存在表名为scott.test_hello的表。

使用sqlplus命令descscott.test_hello

SQL>descscott.test_hello;

如显示ERROR:

ORA-04043:objectscott.test_hellodoesnotexist

则表示数据库中不存在该表,否则则有。

二、数据准备

测试源数据库名为tt,备库名为orcl

数据库版本:ORACLE11.2.0.1.0

操作系统:UBUNTU12.0464

需用到的SQL语句:

descscott.test_hello;

createtablescott.test_hello(strvarchar2(20));

insertintoscott.test_hellovalues('helloworld');

三、使用过程

A.在源数据库中产生helloworld

使用sqlplus在源数据库tt中先创建一张表:

SQL>createtablescott.test_hello(strvarchar2(20));

Tablecreated.

向表中添加数据:

SQL>insertintoscott.test_hellovalues('helloworld');

1rowcreated.

B.在备库中查看helloworld

使用sqlplus在备octl中查看是否有scott.test_hello表,然后查看表中是否有helloworld数据。

SQL>selectowner,table_namefromall_tableswhereowner='SCOTT'andtable_name='TEST_HELLO';

OWNERTABLE_NAME

------------------------------------------------------------

SCOTTTEST_HELLO

C.备库中存在表scott.test_hello

操作描述

sqlplus显示

结果

查看源库scott.test_hello的表结构:

SQL>descscott.test_hello;

NameNull?Type

-----------------------------------------------------------------------------

STRVARCHAR2(20)

说明目标数据库与源库中的表结构一致。

查看备库scott.test_hello的表结构:

SQL>descscott.test_hello;

NameNull?Type

-----------------------------------------------------------------------------

STRVARCHAR2(20)

查看源库scott.test_hello表数据

SQL>select*fromscott.test_hello;

STR

--------------------

helloworld

说明源库与备库的数据一致。

查看备库scott.test_hello表数据

SQL>select*fromscott.test_hello;

STR

--------------------

helloworld

四、源库、备库同步

从上述结果可以看出在源库tt中所做的操作,全部同步到了备库orcl上。Sota系统完成了数据库的同步。

如果有疑问请咨询沃信科技公司的技术人员,有兴趣着请登录沃信科技网站了解相关的内容。