dblink

dblink can't update a table on the same database in an after UPDATE trigger

这一生的挚爱 提交于 2019-12-02 14:36:10
问题 I am working on a database replicated using slony and trying to create a trigger which will be triggered after an INSERT operation on a table. In this trigger I am trying to update another table of THE SAME database using dblink. But I am getting an error saying that the value I just inserted in the first table does not exist when I am trying to update the second table. I am using dblink because if I update the second table with a regular UPDATE statement, slony synchronization is not

dblink can't update a table on the same database in an after UPDATE trigger

主宰稳场 提交于 2019-12-02 10:14:29
I am working on a database replicated using slony and trying to create a trigger which will be triggered after an INSERT operation on a table. In this trigger I am trying to update another table of THE SAME database using dblink. But I am getting an error saying that the value I just inserted in the first table does not exist when I am trying to update the second table. I am using dblink because if I update the second table with a regular UPDATE statement, slony synchronization is not triggered. First table: CREATE TABLE "COFFRETS" ( "NUM_SERIE" character varying NOT NULL, "DATE_CREATION"

Moving XML over a DBLink

送分小仙女□ 提交于 2019-12-02 03:44:34
问题 I am trying to move some data over a dblink and one of the columns is an XMLType column. The code looks like this: begin delete from some_schema.some_remote_tab@src_2_trg_dblink; INSERT INTO some_schema.some_remote_tab@src_2_trg_dblink(id, code, gen_date, xml_data) SELECT id, code, gen_date, xml_data FROM local_table; end; Oracle returns these errors: ORA-02055: distributed update operation failed; rollback required ORA-22804: remote operations not permitted on object tables or user-defined

Moving XML over a DBLink

孤街浪徒 提交于 2019-12-02 01:25:15
I am trying to move some data over a dblink and one of the columns is an XMLType column. The code looks like this: begin delete from some_schema.some_remote_tab@src_2_trg_dblink; INSERT INTO some_schema.some_remote_tab@src_2_trg_dblink(id, code, gen_date, xml_data) SELECT id, code, gen_date, xml_data FROM local_table; end; Oracle returns these errors: ORA-02055: distributed update operation failed; rollback required ORA-22804: remote operations not permitted on object tables or user-defined type columns Some research on ORA-22804 shows that I am probably getting this error because of the

MySQL equivalent of PostgreSQL's dblink module?

感情迁移 提交于 2019-12-01 23:17:21
问题 PostgreSQL's dblink module allows for SQL statements to be written that execute other SQL statements against a remote PostgreSQL database. Is there an equivalent to PostgreSQL's dblink for MySQL? 回答1: Not exactly. There is, however the FEDERATED storage engine (available since 5.0.3), which can be used in certain situations to emulate this behaviour. It is, (put very simply) a VIEW for a remote table. There is an in-depth explanation, along with examples on its MySQL manual page(s). 回答2: You

MySQL equivalent of PostgreSQL's dblink module?

空扰寡人 提交于 2019-12-01 21:28:45
PostgreSQL's dblink module allows for SQL statements to be written that execute other SQL statements against a remote PostgreSQL database. Is there an equivalent to PostgreSQL's dblink for MySQL? Not exactly. There is, however the FEDERATED storage engine (available since 5.0.3), which can be used in certain situations to emulate this behaviour. It is, (put very simply) a VIEW for a remote table. There is an in-depth explanation, along with examples on its MySQL manual page(s) . You might want to look into MySQL Proxy . This doesn't match the architecture of dblink, but you can probably solve

Drop or create database from stored procedure in PostgreSQL

╄→尐↘猪︶ㄣ 提交于 2019-12-01 20:45:43
I have a function that looks like this: BEGIN DROP DATABASE IF EXISTS db_1; END; I'm getting the following error: ERROR: DROP DATABASE cannot be executed from a function or multi-command string. Is it not possible to drop a database from a stored procedure in PostgreSQL? I'm using plpgsql. Erwin Brandstetter The error message is just a s clear as the manual on this: DROP DATABASE cannot be executed inside a transaction block. A plgpsql function is surrounded by a transaction block automatically. The long and the short of it: you cannot do that - directly. Is there a particular reason you can't

ORA-02070: database does not support in this context

情到浓时终转凉″ 提交于 2019-12-01 19:34:27
I have a query like INSERT INTO sid_rem@dev_db (sid) select sid from v$session Now, when i execute this query i get ORA-02070: database does not support in this context This error happens only when I insert data from v$session into some remote db. Its working fine for any other table. Anyone know why this issue and any workaround for this? Works using gv$session instead of v$session : INSERT INTO sid_rem@dev_db(sid) select sid from gv$session; gv$ views are global views, that is, they are not restricted to one node(instance), but see the entire database(RAC). v$ views are subviews of gv$.

ORA-02070: database does not support in this context

*爱你&永不变心* 提交于 2019-12-01 19:21:35
问题 I have a query like INSERT INTO sid_rem@dev_db (sid) select sid from v$session Now, when i execute this query i get ORA-02070: database does not support in this context This error happens only when I insert data from v$session into some remote db. Its working fine for any other table. Anyone know why this issue and any workaround for this? 回答1: Works using gv$session instead of v$session : INSERT INTO sid_rem@dev_db(sid) select sid from gv$session; gv$ views are global views, that is, they

How to create a DB link between two oracle instances

蹲街弑〆低调 提交于 2019-12-01 14:58:59
How to create a DB link between two Oracle instances. Let's say A and B are two instances. I want to access the data in instance B from the instance A. as a simple example: CREATE DATABASE LINK _dblink_name_ CONNECT TO _username_ IDENTIFIED BY _passwd_ USING '$_ORACLE_SID_' for more info: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm If you want to access the data in instance B from the instance A. Then this is the query, you can edit your respective credential. CREATE DATABASE LINK dblink_passport CONNECT TO xxusernamexx IDENTIFIED BY xxpasswordxx USING '