从mysql迁移到sql server
Posted
技术标签:
【中文标题】从mysql迁移到sql server【英文标题】:Migration from mysql to sql server 【发布时间】:2014-05-24 12:28:27 【问题描述】:我正在努力将我的 mysql 服务器 (phpmyadmin) 迁移到 sql server 2012。我正在使用 SQl 迁移工具,但已经走到了这一步。当我选择我的数据库时:nih_bw 我无法访问“转换架构”。
当我双击数据库时,我得到:Target Metadata does not exist.
这是我的数据库 sql 文件:
-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 10, 2014 at 04:23 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `nih_bw`
--
CREATE DATABASE IF NOT EXISTS `nih_bw` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `nih_bw`;
-- --------------------------------------------------------
--
-- Table structure for table `change_log`
--
CREATE TABLE IF NOT EXISTS `change_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`routine_id` int(11) NOT NULL,
`title` varchar(25) NOT NULL,
`value_old` varchar(10) NOT NULL,
`value_new` varchar(10) DEFAULT NULL,
`action` varchar(10) NOT NULL,
`changed_at` date NOT NULL,
`date` date NOT NULL,
`time` time NOT NULL,
`changed_by` varchar(6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `change_log`
--
INSERT INTO `change_log` (`id`, `routine_id`, `title`, `value_old`, `value_new`, `action`, `changed_at`, `date`, `time`, `changed_by`) VALUES
(2, 250, 'T_Badende_per_time', '25', '35', 'Redigert', '2014-04-07', '2014-04-04', '15:41:20', 'TomCzi');
-- --------------------------------------------------------
--
-- Table structure for table `emps`
--
CREATE TABLE IF NOT EXISTS `emps` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(25) NOT NULL,
`first_name` varchar(15) NOT NULL,
`last_name` varchar(15) NOT NULL,
`email` varchar(25) NOT NULL,
`password` varchar(60) NOT NULL,
`user_type` char(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `emps`
--
INSERT INTO `emps` (`id`, `user_name`, `first_name`, `last_name`, `email`, `password`, `user_type`) VALUES
(1, 'BilAhm', 'Bilal', 'Ahmad', 'bilal.ahmad@gmail.com', '$2y$10$8/CSeWtfzkWIPE/B1F58D.2XiOPkm84RHk9WqjYTIY0Crn9qe1G.W', 'admin'),
(2, 'TomCzi', 'Tomas', 'Czipri', 'Noe@annet.com', '$2y$10$8CidOVjejN0Gn1vYdwSf.usSeP.dHeNKWKx1fC022qsnQ5Edh88uG', 'admin'),
(4, 'BenPau', 'Benedicte', 'Paulsen', 'b_p@something.net', '$2y$10$lQRDmqmNbmv3QGSg2onxOueMnMlNN00KSYK0Ggtjr3urzZFpE21iK', 'user');
-- --------------------------------------------------------
--
-- Table structure for table `measurements`
--
CREATE TABLE IF NOT EXISTS `measurements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ;
--
-- Dumping data for table `measurements`
--
INSERT INTO `measurements` (`id`, `title`) VALUES
(1, 'T_Badende_per_Time'),
(2, 'T_Temperatur'),
(3, 'T_Luft_Temperatur'),
(4, 'M_Fritt_Klor'),
(5, 'M_Bundet_Klor'),
(6, 'M_Total_Klor'),
(7, 'M_PH'),
(8, 'M_Auto_Klor'),
(9, 'M_Auto_PH'),
(10, 'M_Redox'),
(11, 'O_Vannbalanse'),
(12, 'O_Alakalitet'),
(13, 'O_Hardhet'),
(14, 'O_Natrium_Bk'),
(15, 'O_Kals_Klor'),
(16, 'O_Sjokklor'),
(17, 'O_Fellingsmiddel'),
(18, 'O_Sirkulasjonsmengde'),
(19, 'O_Filtertrykk'),
(20, 'O_Spyl_Av_Filter'),
(21, 'O_Vannforbruk'),
(22, 'O_Slamsuging'),
(23, 'O_Harsil'),
(24, 'O_Ren_Utj_Tank');
-- --------------------------------------------------------
--
-- Table structure for table `measure_routine`
--
CREATE TABLE IF NOT EXISTS `measure_routine` (
`routine_id` int(11) NOT NULL,
`measure_id` int(11) NOT NULL,
`pool_id` int(11) DEFAULT NULL,
PRIMARY KEY (`routine_id`,`measure_id`),
KEY `pool_id` (`pool_id`),
KEY `link3` (`measure_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `pools`
--
CREATE TABLE IF NOT EXISTS `pools` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=100 ;
--
-- Dumping data for table `pools`
--
INSERT INTO `pools` (`id`, `name`) VALUES
(1, 'Hovedbasseng'),
(2, 'Plaskebasseng'),
(99, 'Svommehall');
-- --------------------------------------------------------
--
-- Table structure for table `routines`
--
CREATE TABLE IF NOT EXISTS `routines` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`time` time NOT NULL,
`value` varchar(10) NOT NULL,
`emp_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `emp_id` (`emp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=561 ;
--
-- Dumping data for table `routines`
--
INSERT INTO `routines` (`id`, `date`, `time`, `value`, `emp_id`) VALUES
(554, '2014-04-10', '17:00:23', 'Utført', 1),
(555, '2014-04-10', '17:00:23', 'Utført', 1),
(556, '2014-04-10', '17:00:23', 'Utført', 1),
(557, '2014-04-10', '17:00:23', 'Utført', 1),
(558, '2014-04-10', '17:00:23', 'Utført', 1),
(559, '2014-04-10', '17:00:23', 'Utført', 1),
(560, '2014-04-10', '17:06:12', 'Utført', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tasks`
--
CREATE TABLE IF NOT EXISTS `tasks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=99 ;
--
-- Dumping data for table `tasks`
--
INSERT INTO `tasks` (`id`, `title`) VALUES
(40, 'D_Slamsuge_Pl_Bass'),
(41, 'D_Filter_Rens'),
(42, 'D_Bypass_Pl_Bass'),
(43, 'D_Vaske_Gulv_CM'),
(44, 'D_Garderobe_0730'),
(45, 'D_Garderobe_Dag'),
(46, 'D_Male_Temp_Just'),
(47, 'D_Vaske_Pl_Bass'),
(48, 'D_Vaske_H_Bass'),
(49, 'D_Renhold_Av_Wc'),
(50, 'D_Ettersyn_Utst_Skap'),
(51, 'D_Handicap_Heis'),
(52, 'D_Ettersyn_solarier'),
(53, 'D_Vannprove_0745'),
(54, 'D_Vannprover_1100'),
(55, 'D_Vannprover_1400'),
(56, 'D_Enkle_Vedliks_Oppg'),
(57, 'D_Sjekk_Skiftplan'),
(58, 'K_Oppdatere_Seg_IkkeUtf'),
(59, 'K_Vannprover_1700'),
(60, 'K_Vannprover_2000'),
(61, 'K_Vaske_Pl_Bass'),
(62, 'K_Vaske_H_Bass'),
(63, 'K_Sla_Av_Bypass'),
(64, 'K_Ettersyn_Materiell'),
(65, 'K_Ettersyn_Solarier'),
(66, 'K_Ettersyn_Sal_4'),
(67, 'K_Runde_Gard_Kveld'),
(68, 'K_Runde_Gard_For_Steng'),
(69, 'K_Enkle_Vedlik_Oppg'),
(70, 'K_Rullestolheis_lading'),
(71, 'K_Etterfylle_Skoposer'),
(72, 'K_Skap_Lases'),
(73, 'K_Sjekk_Skiftplan'),
(74, 'K_Rydd_Tribune'),
(75, 'K_Slamsug_H_Bass'),
(76, 'K_Stenge_Prosedyre'),
(77, 'K_Beskjed_H_Vakt'),
(79, 'C_Timeteller'),
(80, 'C_AllRent'),
(81, 'C_Grovrent_Ekstra'),
(82, 'C_Ren_Opplos_Tank'),
(83, 'C_Ren_Opps_Tank'),
(84, 'C_Ren_Flott_gitter'),
(85, 'C_Ren_Opplos_Filter'),
(86, 'C_Ren_Nal'),
(87, 'C_Kontr_Slang_Tank'),
(88, 'C_Kont_Ren_KostPad'),
(89, 'K_Forrige_Uke_Badende'),
(90, 'K_Sjekk_Flockmiddel_Kalsk'),
(91, 'K_Sjekk_Klorfat_Syrekanne'),
(92, 'K_Sjekk_Klorfat_Syrekanne'),
(93, 'K_Klorfat_Syrekanner'),
(94, 'K_Flockmiddel_Kalsklorid'),
(95, 'K_Sjekk_syreflow'),
(96, 'K_Kontroll_Wc'),
(97, 'K_Soppel_WC'),
(98, 'D_Vannmengde');
-- --------------------------------------------------------
--
-- Table structure for table `task_routine`
--
CREATE TABLE IF NOT EXISTS `task_routine` (
`routine_id` int(11) NOT NULL,
`task_id` int(11) NOT NULL,
PRIMARY KEY (`routine_id`,`task_id`),
KEY `link6` (`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `task_routine`
--
INSERT INTO `task_routine` (`routine_id`, `task_id`) VALUES
(554, 89),
(556, 93),
(555, 94),
(557, 95),
(558, 96),
(559, 97),
(560, 98);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `measure_routine`
--
ALTER TABLE `measure_routine`
ADD CONSTRAINT `link2` FOREIGN KEY (`routine_id`) REFERENCES `routines` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `link3` FOREIGN KEY (`measure_id`) REFERENCES `measurements` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `link99` FOREIGN KEY (`pool_id`) REFERENCES `pools` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `routines`
--
ALTER TABLE `routines`
ADD CONSTRAINT `link1` FOREIGN KEY (`emp_id`) REFERENCES `emps` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `task_routine`
--
ALTER TABLE `task_routine`
ADD CONSTRAINT `link5` FOREIGN KEY (`routine_id`) REFERENCES `routines` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `link6` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
【问题讨论】:
你试过sqlserver迁移助手吗?从 oracle 迁移对我来说效果很好 - sql server technet.microsoft.com/en-us/library/hh313129.aspx 【参考方案1】:http://www.mssqltips.com/sqlservertutorial/2205/mysql-to-sql-server-data-migration
这似乎是一个非常简单的迁移工具,带有屏幕截图和分步说明。 根据阅读有关您遇到的问题的信息,这似乎是一个很常见的问题。有时它甚至可以是您正在使用的字符集。
【讨论】:
以上是关于从mysql迁移到sql server的主要内容,如果未能解决你的问题,请参考以下文章