发布网友 发布时间:2022-04-21 23:21
共4个回答
懂视网 时间:2022-05-02 03:22
expdp tvpay2/tvpay directory=dmp dumpfile=20170508.dmp include=table query="‘where rownum<=500‘"
备注:利用exp导入每表前几行有
exp tvpay2/tvpay file=t.dmp tables=(emp,emp1) query="‘where rownum<=100‘"
查询该用户下所有表
SELECT object_name||‘,‘ as user_object from user_objects where object_type=‘TABLE‘;
###该方法如果表多的话,比较浪费时间
SELECT * FROM dba_directories;
OWNER DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
SYS DMP
/u01/backup/dmp
SYS XMLDIR
/u01/app/oracle/product/11.2.0/db_1/rdbms/xml
SYS ORACLE_OCM_CONFIG_DIR
/u01/app/oracle/product/11.2.0/db_1/ccr/hosts/mt_pdb/state
OWNER DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
SYS DATA_PUMP_DIR
/u01/app/oracle/admin/sumapay/dpdump/
SYS ORACLE_OCM_CONFIG_DIR2
/u01/app/oracle/product/11.2.0/db_1/ccr/state
grant imp_full_database,exp_full_database to tvpay2;
impdp tvpay2/tvpay directory=DATA_PUMP_DIR dumpfile=20170508.dmp
###备注directory目录,以及dumpfile无目录
#使用数据泵导入、导出http://blog.csdn.net/xyz846/article/details/79950
#数据泵参数详解http://blog.csdn.net/jojo52013145/article/details/7966047
数据库同步方案
标签:rdb XML 同步 查看 href objects acl app type
热心网友 时间:2022-05-02 00:30
这个算是最基本的数据库操作了,方案有很多种,常见的如:etl工具或使用dblink,etl工具比较方便,开源的产品有kettle,pdi等,这些产品可以满足大多数的数据库操作,但是如果数据量级大,转换复杂的话,他们的性能有待考验,不过你说的只是简单的同步,这个很容易。使用dblink也是比较常见的,但是需要设置一定机制,避免安全隐患,首先需要再A地数据库上配置B地数据库的远程连接地址,在tnsnames.ora文件中配置即可,然后在A地数据库上建立一个dblink,如:create database link b_to_a_link connect to xxx(user) identified by fundo using xxx(上面建立的连接);然后就可以操作了。
热心网友 时间:2022-05-02 01:48
漳吊钩囟啥大中古
热心网友 时间:2022-05-02 03:23
sql同步使用dblink同步数据。
具体参考实例:
1、在win下创建linux的DBLINK
a.查看linux下的tnsnames.ora文件
[oracle@myrac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /s01/app/oracle/proct/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
HJJ =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myrac1.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hjj)
)
)
b.创建dblink
SQL> create database link win_lin_link connect to hjj identified by xxxx
2 using '(DESCRIPTION =
3 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.171)(PORT = 1521))
4 (CONNECT_DATA =
5 (SERVER = DEDICATED)
6 (SERVICE_NAME = hjj)
7 )
8 )'
9 /
Database link created.
2.在win下创建trigger
SQL> create or replace trigger trig_win_emp
2 after insert on emp
3 for each row
4 begin
5 insert into emp@win_lin_link values(:new.empno,:new.empname,:new.empsalary);
6 end;
7 /
Trigger created.
3.测试
4.结果
win下插入数据
SQL> insert into emp values('E001','LYN',2300);
1 row created.
SQL>COMMIT;
Commit complete.
SQL> select *from emp;
EMPNO EMPNAME EMPSALARY
---------------------------------------- ---------------------------------------- ----------
E001 LYN 2300
SQL> select * from emp@win_lin_link;
EMPNO EMPNAME EMPSALARY
---------------------------------------- ---------------------------------------- ----------
E001 LYN 2300
linux下查看数据
SQL> select * from emp;
EMPNO EMPNAME EMPSALARY
-------------------- -------------------- ----------
E001 LYN 2300