源端pdg用户,目标端hc用户
User created.
SQL> grant dba to pdg;
Grant succeeded.
Connected.
SQL> CREATE TABLE vendors
2 (
3 code NUMBER(5) PRIMARY KEY
4 , name VARCHAR2(40)
5 , street VARCHAR2(30)
6 , city VARCHAR2(20)
7 , state CHAR(2)
8 , zip NUMBER(5)
9 , phone CHAR(12)
10 );
Table created.
SQL> CREATE TABLE products
2 (
3 code NUMBER(5) PRIMARY KEY
4 , name VARCHAR2(50)
5 , price NUMBER(8,2)
6 , qty_oh NUMBER(6)
7 , vendor NUMBER(5)
8 , CONSTRAINT prod_vendor_fk FOREIGN KEY(vendor) REFERENCES vendors(code)
9 );
Table created.
SQL> INSERT INTO vendors VALUES (100, 'Acme Corp',
2 '10 Acorn St', 'Albany', 'AL',12345,'123-456-7890');
INSERT INTO vendors VALUES (200, 'Bank Inc',
'20 Brick St', 'Buffalo', 'NY',23456,'234-567-8901');
1 row created.
SQL> 2
1 row created.
SQL> INSERT INTO vendors VALUES (300, 'Whiz LLC',
2 '30 Walnut St','Washington','DC',34567,'345-678-9012');
1 row created.
SQL> INSERT INTO products VALUES (1000, 'wingnut', 0.50, 100, 200);
INSERT INTO products VALUES (1010, 'bushing', 0.40, 250, 100);
INSERT INTO products VALUES (1020, 'foobar', 1.00, 90, 100);
1 row created.
SQL>
1 row created.
S
源端操作:
1.创建用户
SQL> create user pdg identified by pdg;User created.
SQL> grant dba to pdg;
Grant succeeded.
2.创建表
SQL> conn pdg/pdgConnected.
SQL> CREATE TABLE vendors
2 (
3 code NUMBER(5) PRIMARY KEY
4 , name VARCHAR2(40)
5 , street VARCHAR2(30)
6 , city VARCHAR2(20)
7 , state CHAR(2)
8 , zip NUMBER(5)
9 , phone CHAR(12)
10 );
Table created.
SQL> CREATE TABLE products
2 (
3 code NUMBER(5) PRIMARY KEY
4 , name VARCHAR2(50)
5 , price NUMBER(8,2)
6 , qty_oh NUMBER(6)
7 , vendor NUMBER(5)
8 , CONSTRAINT prod_vendor_fk FOREIGN KEY(vendor) REFERENCES vendors(code)
9 );
Table created.
SQL> INSERT INTO vendors VALUES (100, 'Acme Corp',
2 '10 Acorn St', 'Albany', 'AL',12345,'123-456-7890');
INSERT INTO vendors VALUES (200, 'Bank Inc',
'20 Brick St', 'Buffalo', 'NY',23456,'234-567-8901');
1 row created.
SQL> 2
1 row created.
SQL> INSERT INTO vendors VALUES (300, 'Whiz LLC',
2 '30 Walnut St','Washington','DC',34567,'345-678-9012');
1 row created.
SQL> INSERT INTO products VALUES (1000, 'wingnut', 0.50, 100, 200);
INSERT INTO products VALUES (1010, 'bushing', 0.40, 250, 100);
INSERT INTO products VALUES (1020, 'foobar', 1.00, 90, 100);
1 row created.
SQL>
1 row created.
S