MySQL Forums :: MySQL for Visual Studio :: Backup base de datos Event


Advanced Search

Backup base de datos Event
Posted by: Fabian Segovia ()
Date: October 14, 2016 07:11AM

Hola a Todos estoy tratando de crear un evento que respalde la base de datos, de hecho lo he creado, no tiene errores sin embargo no da resultados, este es el codigo:


DELIMITER $$

CREATE DEFINER=`paccds`@`%` EVENT `respaldoinfo` ON SCHEDULE EVERY 1 DAY STARTS '2016-10-14 08:13:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE done INT DEFAULT 0;
DECLARE ruta VARCHAR(250);
DECLARE nombretabla VARCHAR(250);
DECLARE cursor1 CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_schema='empresax' AND TABLE_TYPE ='BASE TABLE';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cursor1;
read_loop: LOOP
FETCH cursor1 INTO nombretabla;

IF done THEN
LEAVE read_loop;
END IF;


SET @ruta = CONCAT('c:/conta/respaldos/',nombretabla,'.bkp');


SET @cadenaSql = CONCAT("SELECT * FROM ", nombretabla, " INTO OUTFILE ", @ruta, " FIELDS TERMINATED BY '|' ENCLOSED BY ';' LINES TERMINATED BY '\r\n'");
PREPARE s1 FROM @cadenaSql;
EXECUTE s1;
DEALLOCATE PREPARE s1;

END LOOP;
CLOSE cursor1;

END$$

DELIMITER ;

Options: ReplyQuote


Subject Views Written By Posted
Backup base de datos Event 395 Fabian Segovia 10/14/2016 07:11AM
Re: Backup base de datos Event 207 Javier TreviƱo 10/20/2016 02:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.