I work in my company with 0Racle 10g installed on an IBM and I have another Oracle in a Linux machine. As in IBM Oracle has very large traffic, and I only use five tables that are there, I saved these tables in Oracle that is on Linux. Until okay, so I'd like this process to be automatic and these tables were updated diaramette. Someone has any script example or some external program that makes this maintenance.
Update some tables on another server
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother follows a tip:
Steps:
1) Create a PL / SQL procedure, comdblinhks, which check the difference of the tables and make their "merge".
2) Create a job, which processes this procedure from time to time.
About the creation of procedure with Merge, and Job, take a sought here in the forum, which will find interesting topics.
Anything, send it there.
Steps:
1) Create a PL / SQL procedure, comdblinhks, which check the difference of the tables and make their "merge".
2) Create a job, which processes this procedure from time to time.
About the creation of procedure with Merge, and Job, take a sought here in the forum, which will find interesting topics.
Anything, send it there.
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
Friend,
I made this SQL with MERGE, but this error.
ORA-00969 In line 2 column 14 missing the ON
I to with the Oracle manual here and the syntax seems correct.
Here goes the script if you can help me in this case.
I made this SQL with MERGE, but this error.
ORA-00969 In line 2 column 14 missing the ON
I to with the Oracle manual here and the syntax seems correct.
Here goes the script if you can help me in this case.
Merge
INTO sisesgoto.stc_agua_tratada d USING stc.stc_agua.tratada s ON(s.cod_us = d.cod_us
AND s.cod_eta = d.cod_eta
AND s.dt_agua_trat = d.dt_agua_trat)
WHEN matched THEN
UPDATE
SET d.cod_us = s.cod_us,
d.cod_eta = s.cod_eta,
d.dt_agua_trat = s.dt_agua_trat,
d.vol_agua_tratada = s.vol_agua_tratada,
d.qtd_filtros_servico = s.qtd_filtros_servico,
d.nro_filtro_analisado = s.nro_filtro_analisado,
d.cons_agua_lavagem = s.cons_agua_lavagem,
d.pe_cons_agua_lavagem = s.pe_cons_agua_lavagem,
d.dt_inclusao = s.dt_inclusao,
d.dt_alteracao = s.dt_alteracao,
d.usuario = s.usuario,
d.evento = s.evento,
d.hrs_recalque_hhh = s.hrs_recalque_hhh,
d.hrs_recalque_mm = s.hrs_recalque_mm,
d.carreira_md_filtros_lavado_hhh = s.carreira_md_filtros_lavado_hhh,
d.carreira_md_filtros_lavado_mm = s.carreira_md_filtros_lavado_mm
WHEN NOT matched THEN
INSERT
VALUES(s.cod_us, s.cod_eta, s.dt_agua_trat, s.vol_agua_tratada, s.qtd_filtros_servico, s.nro_filtro_analisado, s.cons_agua_lavagem, s.pe_cons_agua_lavagem, s.dt_inclusao, s.dt_alteracao, s.usuario, s.evento, s.hrs_recalque_hhh, s.hrs_recalque_mm, s.carreira_md_filtros_lavado_hhh, s.carreira_md_filtros_lavado_mm);
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother,
follows an example of the merge:
really the on was not in the syntax that passed me.
follows an example of the merge:
MERGE INTO bonuses D
USING (SELECT employee_id, salary, department_id FROM employees
WHERE department_id = 80) S
ON (D.employee_id = S.employee_id)
WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
VALUES (S.employee_id, S.salary*0.1);
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
Dude, I did what you said but give me an error that I can not find the answer.
is the following
but if I change here
should work
see if a light.
MERGE INTO sisesgoto.stc_agua_tratada1 D
USING (SELECT
cod_us,
cod_eta,
dt_agua_trat,
vol_agua_tratada,
qtd_filtros_servico,
nro_filtro_analisado,
qtd_filtros_lavado,
cons_agua_lavagem,
pe_cons_agua_lavagem,
dt_inclusao,
dt_alteracao,
usuario,
evento,
hrs_recalque_hhh,
hrs_recalque_mm,
carreira_md_filtros_lavado_hhh,
carreira_md_filtros_lavado_mm
FROM sisesgoto.stc_agua_tratada d
WHERE cod_us = 27) S
ON (s.cod_us=d.cod_us) /* erro acontece aqui */
WHEN MATCHED THEN UPDATE SET
d.cod_us = s.cod_us,
d.cod_eta = s.cod_eta,
d.dt_agua_trat = s.dt_agua_trat,
d.vol_agua_tratada = s.vol_agua_tratada,
d.qtd_filtros_servico = s.qtd_filtros_servico,
d.nro_filtro_analisado = s.nro_filtro_analisado,
d.qtd_filtros_lavado= s.qtd_filtros_lavado,
d.cons_agua_lavagem = s.cons_agua_lavagem,
d.pe_cons_agua_lavagem = s.pe_cons_agua_lavagem,
d.dt_inclusao = s.dt_inclusao,
d.dt_alteracao = s.dt_alteracao,
d.usuario = s.usuario,
d.evento = s.evento,
d.hrs_recalque_hhh = s.hrs_recalque_hhh,
d.hrs_recalque_mm = s.hrs_recalque_mm,
d.carreira_md_filtros_lavado_hhh = s.carreira_md_filtros_lavado_hhh,
d.carreira_md_filtros_lavado_mm = s.carreira_md_filtros_lavado_mm
WHEN NOT MATCHED THEN INSERT
(
d.cod_us,
d.cod_eta,
d.dt_agua_trat,
d.vol_agua_tratada,
d.qtd_filtros_servico,
d.nro_filtro_analisado,
d.qtd_filtros_lavado,
d.cons_agua_lavagem,
d.pe_cons_agua_lavagem,
d.dt_inclusao,
d.dt_alteracao,
d.usuario,
d.evento,
d.hrs_recalque_hhh,
d.hrs_recalque_mm,
d.carreira_md_filtros_lavado_hhh,
d.carreira_md_filtros_lavado_mm)
VALUES
(s.cod_us,
s.cod_eta,
s.dt_agua_trat,
s.vol_agua_tratada,
s.qtd_filtros_servico,
s.nro_filtro_analisado,
s.qtd_filtros_lavado,
s.cons_agua_lavagem,
s.pe_cons_agua_lavagem,
s.dt_inclusao,
s.dt_alteracao,
s.usuario,
s.evento,
s.hrs_recalque_hhh,
s.hrs_recalque_mm,
s.carreira_md_filtros_lavado_hhh,
s.carreira_md_filtros_lavado_mm
);
ON (s.cod_us=d.cod_us) /* erro acontece aqui */
com a linha como esta da erro de nome invalido de coluna.
ON (s.cod_us=27) /* isso funciona mas não me serve */
s.cod_us=d.cod_us
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother, good morning.
post the mistake here to analyze.
post the mistake here to analyze.
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
The error is this one.
Error at Command Line:2 Column:15
Error report:
SQL Error: ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
Sorry, I posted the error incorrect, disregard the above.
Error at Command Line:25 Column:15
Error report:
SQL Error: ORA-00904: nome inválido de coluna
00904. 00000 - "%s: invalid identifier"
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
Trevisolli,
face is the following, I was able to work, not as it should but
replaces the line where it should compare the number of US by these 99]
As I have 500 code of us, then I'll send all the changes. With the empty table it is easy and fast, by it just do the insert, but the update was time consuming. I'll review it.
Well here finished the development stage, now comes the difficult for me, I think.
I have two Oracle servers, one in IBM and another on Linux in distant places with differing TNS.
IBM
Linux
Question ??
How do I do the IBM tables merge to the tables on the serverLinux ??
The STC_AGUA_TRAATED table is in IBM and
the STC_AGUA_TRAATED table1 is on the serverLinux
How do I select the tables in due servers? ?
This here tried and did not work
obs. These machine names are examples (fictitious).
Here I want water !!! hehehehe
face is the following, I was able to work, not as it should but
replaces the line where it should compare the number of US by these
WHERE cod_us between 1 and 500)
ON(s.cod_us between 1 and 500)
As I have 500 code of us, then I'll send all the changes. With the empty table it is easy and fast, by it just do the insert, but the update was time consuming. I'll review it.
Well here finished the development stage, now comes the difficult for me, I think.
I have two Oracle servers, one in IBM and another on Linux in distant places with differing TNS.
IBM
IBM.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = IBM.oracle.CIA.CIA)(PORT = 1524))
(CONNECT_DATA = (SID = IBM) (SERVER=DEDICATED))
Linux
linux.cia2.cia2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = servidorlinux)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = linux)
)
)
How do I do the IBM tables merge to the tables on the serverLinux ??
The STC_AGUA_TRAATED table is in IBM and
the STC_AGUA_TRAATED table1 is on the serverLinux
How do I select the tables in due servers? ?
This here tried and did not work
ibm.stc_agua_tratada (IBM)
linux.stc_agua_tratada1(linux)
Here I want water !!! hehehehe
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Then Brother,
to perform this SELECT, on different bases, a database link) has to be created between the servers.
This should be analyzed with the Responsible DBA in the company, which should create this link to you.
Here in the forum, there are interesting examples of use and creation.
Look here by DBLink that will find interesting topics, such as [url=http://en.glufke.net/oracle/viewtopic.p ... ght=dblink]este
Any questions, send it there.
to perform this SELECT, on different bases, a database link) has to be created between the servers.
This should be analyzed with the Responsible DBA in the company, which should create this link to you.
Here in the forum, there are interesting examples of use and creation.
Look here by DBLink that will find interesting topics, such as [url=http://en.glufke.net/oracle/viewtopic.p ... ght=dblink]este
Any questions, send it there.
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
Trevisolli,
It's all right with Merge, beauty worked. Just a doubt as to dblink, I just need to create a dblink so for the target server or for the two machines ??
Oracle in IBM I have the tables I want to select, so I must create the dblink for the Linux machine and run the script in Oracle IBM or vice versa or cry in the Linux machine where are the tables destinations a dblink for oracle IBM and squeeze the script on the linux machine ??
It's all right with Merge, beauty worked. Just a doubt as to dblink, I just need to create a dblink so for the target server or for the two machines ??
Oracle in IBM I have the tables I want to select, so I must create the dblink for the Linux machine and run the script in Oracle IBM or vice versa or cry in the Linux machine where are the tables destinations a dblink for oracle IBM and squeeze the script on the linux machine ??
-
- Rank: Programador Júnior
- Posts: 17
- Joined: Tue, 09 Oct 2007 11:36 pm
- Location: Porto Alegre - RS
Trevisoli,
Thanks for the tips and I would finalize this topic. I already created the dblink and the merge is worked and scheduled.
ATT
Henrique
Thanks for the tips and I would finalize this topic. I already created the dblink and the merge is worked and scheduled.
ATT
Henrique
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother, it took me a while because I was in a project ...
It's good that it worked, if you can, detail the steps here, for those who need help.
Thank you very much,
It's good that it worked, if you can, detail the steps here, for those who need help.
Thank you very much,
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest