Database(Mysql)发版控制二
author:skate
time:2014/08/18
Database(Mysql)发版控制
The Liquibase Tool related Database
一.Installation & Configration
二.Advanced Usage of the Liquibase
三.Frequently Questions
二.Advanced Usage of the Liquibase
1.实际场景模拟
实际需求:须要把不同环境的不同分支的数据库变更合并,并按需求应用或回滚到不同的DB环境中。实现对DB发版的管理
DB的环境:dev,qa,sandbox,prod
规划DB发版文件夹。如:
database
Release-2014-05
db.Changelog-master.xml
000_CreateTable.sql
001_Init.sql
....
032_Update.sql
Release-2014-06
db.Changelog-master.xml
000_CreateTable.sql
001_Init.sql
....
192_Update.sql
Release-2014-07
db.Changelog-master.xml
000_CreateTable.sql
001_Init.sql
....
132_Update.sql
db.Changelog-master.xml是数据库变更的主文件,其包含每个数据库的changeset文件,这样能够控制每个changeset的运行顺序和大小,例如以下是一个样例:
# more db.Changelog-master.xml
<?xml version="1.0" encoding="UTF-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<preConditions>
<dbms type="oracle"/>
</preConditions>
<include file="database/Release-2014-05/000_CreateTable.sql"/>
<!-- include file="database/Release-2014-05/001_Init.sql"/ -->
<!-- include file="database/Release-2014-05/032_Update.sql"/ -->
</databaseChangeLog>
# more 000_CreateTable.sql
--liquibase formatted sql
--changeset skate:Release-2014-05_000_CreateTable.sql context:test
CREATE TABLE table3 (
id int(11) NOT NULL,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=Innodb;
ALTER TABLE table3 CHANGE id id INT( 11 ) AUTO_INCREMENT;
ALTER TABLE table3 CHANGE name firstname VARCHAR( 255 );
INSERT INTO table3 (id, firstname) VALUES (NULL, 'name1'),(NULL, 'name2'), (NULL, 'name3');
--rollback drop table table3;
或者用xml文件
# more 000_CreateTable.xml
<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet author="Skate" id="Release-2014-05_000_CreateTable.sql context:test ">
<createTable tableName="testtab">
<column autoIncrement="true" name="id" type="INT(10)">
<constraints primaryKey="true"/>
</column>
<column name="firstname" type="VARCHAR(50)"/>
<column name="lastname" type="VARCHAR(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="VARCHAR(2)"/>
</createTable>
</changeSet>
</databaseChangeLog>
每一个developer能够通过自己本机的liquibase把数据库的changset同步到dev环境
首先检查changelog是否有错误
[root@skatedb55 liquibase30]# sh liquibase --contexts=dev --defaultSchemaName=test5 --logLevel=debug --changeLogFile=/tmp/db.Changelog-master.xml --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8"
--username=skate --password=skate validate
Liquibase Home: /mysql/software/liquibase30
DEBUG 8/19/14 2:45 PM:liquibase: Connected to skate@127.0.0.1@jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8
DEBUG 8/19/14 2:45 PM:liquibase: Setting auto commit to false from true
INFO 8/19/14 2:46 PM:liquibase: Reading from test5.DATABASECHANGELOG
DEBUG 8/19/14 2:46 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE,DESCRIPTION,COMMENTS FROM test5.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 8/19/14 2:46 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for inputStream as 00ba919fb68564b7f5f8dab227e4f6a8
DEBUG 8/19/14 2:46 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for 7:00ba919fb68564b7f5f8dab227e4f6a8: as 283384b19a5c2734d153462833903290
No validation errors found
Liquibase 'validate' Successful
[root@skatedb55 liquibase30]#
为本次更新创建tag(方便以后按须要回滚) useUnicode=true&characterEncoding=UTF-8"> useUnicode=true&characterEncoding=UTF-8 useUnicode=true&characterEncoding=UTF-8"> useUnicode=true&characterEncoding=UTF-8
[root@skatedb55 liquibase30]# sh liquibase --contexts=dev --defaultSchemaName=test5 --logLevel=debug --changeLogFile=/tmp/db.Changelog-master.xml --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8"
--username=skate --password=skate tag Release-2014-05_000_CreateTable
Liquibase Home: /mysql/software/liquibase30
DEBUG 8/19/14 2:54 PM:liquibase: Connected to
skate@127.0.0.1@jdbc:mysql://localhost/test2?
DEBUG 8/19/14 2:54 PM:liquibase: Setting auto commit to false from true
DEBUG 8/19/14 2:54 PM:liquibase: Executing QUERY database command: select count(*) from test5.DATABASECHANGELOGLOCK
DEBUG 8/19/14 2:54 PM:liquibase: Executing QUERY database command: SELECT LOCKED FROM test5.DATABASECHANGELOGLOCK WHERE ID=1
DEBUG 8/19/14 2:54 PM:liquibase: Lock Database
DEBUG 8/19/14 2:54 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = 'skatedb55 (fe80:0:0:0:218:51ff:fe85:562a%3)', LOCKGRANTED = '2014-08-19 14:54:02.036' WHERE ID = 1 AND LOCKED = 0
INFO 8/19/14 2:54 PM:liquibase: Successfully acquired change log lock
DEBUG 8/19/14 2:54 PM:liquibase: Executing QUERY database command: SELECT MD5SUM FROM test5.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
DEBUG 8/19/14 2:54 PM:liquibase: Executing QUERY database command: SELECT COUNT(*) FROM test5.DATABASECHANGELOG
DEBUG 8/19/14 2:54 PM:liquibase: Executing EXECUTE database command: UPDATE test5.DATABASECHANGELOG SET TAG = 'Release-2014-05_000_CreateTable' WHERE DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM (SELECT DATEEXECUTED FROM test5.DATABASECHANGELOG) AS X)
INFO 8/19/14 2:54 PM:liquibase: Reading from test5.DATABASECHANGELOG
DEBUG 8/19/14 2:54 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE,DESCRIPTION,COMMENTS FROM test5.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 8/19/14 2:54 PM:liquibase: Release Database Lock
DEBUG 8/19/14 2:54 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 8/19/14 2:54 PM:liquibase: Successfully released change log lock
Successfully tagged
skate@127.0.0.1@jdbc:mysql://localhost/test2?
Liquibase 'tag' Successful
You have new mail in /var/spool/mail/root
[root@skatedb55 liquibase30]#
运行数据库变更到dev数据库
[root@skatedb55 liquibase30]# sh liquibase --contexts=test --defaultSchemaName=test5 --logLevel=debug --changeLogFile=/tmp/db.Changelog-master.xml --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8"
--username=skate --password=skate update
Liquibase Home: /mysql/software/liquibase30
DEBUG 8/19/14 2:39 PM:liquibase: Connected to skate@127.0.0.1@jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8
DEBUG 8/19/14 2:39 PM:liquibase: Setting auto commit to false from true
DEBUG 8/19/14 2:39 PM:liquibase: Executing QUERY database command: select count(*) from test5.DATABASECHANGELOGLOCK
DEBUG 8/19/14 2:39 PM:liquibase: Executing QUERY database command: SELECT LOCKED FROM test5.DATABASECHANGELOGLOCK WHERE ID=1
DEBUG 8/19/14 2:39 PM:liquibase: Lock Database
DEBUG 8/19/14 2:39 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = 'skatedb55 (fe80:0:0:0:218:51ff:fe85:562a%3)', LOCKGRANTED = '2014-08-19 14:39:26.745' WHERE ID = 1 AND LOCKED = 0
INFO 8/19/14 2:39 PM:liquibase: Successfully acquired change log lock
DEBUG 8/19/14 2:39 PM:liquibase: Executing QUERY database command: SELECT MD5SUM FROM test5.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
INFO 8/19/14 2:39 PM:liquibase: Reading from test5.DATABASECHANGELOG
DEBUG 8/19/14 2:39 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE,DESCRIPTION,COMMENTS FROM test5.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
INFO 8/19/14 2:39 PM:liquibase: Reading from test5.DATABASECHANGELOG
DEBUG 8/19/14 2:39 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE,DESCRIPTION,COMMENTS FROM test5.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 8/19/14 2:39 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for inputStream as 00ba919fb68564b7f5f8dab227e4f6a8
DEBUG 8/19/14 2:39 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for 7:00ba919fb68564b7f5f8dab227e4f6a8: as 283384b19a5c2734d153462833903290
DEBUG 8/19/14 2:39 PM:liquibase: Release Database Lock
DEBUG 8/19/14 2:39 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 8/19/14 2:39 PM:liquibase: Successfully released change log lock
Liquibase Update Successful
You have new mail in /var/spool/mail/root
2.Liquibase的一些高级使用方法
按指定tag rollback
[root@skatedb55 liquibase30]# sh liquibase --contexts=dev --defaultSchemaName=test5 --logLevel=debug --changeLogFile=/tmp/db.Changelog-master.xml --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test2?
useUnicode=true&characterEncoding=UTF-8"
--username=skate --password=skate rollback Release-2014-05_000_CreateTable
Liquibase Home: /mysql/software/liquibase30
DEBUG 8/19/14 3:06 PM:liquibase: Connected to skate@127.0.0.1@jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8
DEBUG 8/19/14 3:06 PM:liquibase: Setting auto commit to false from true
DEBUG 8/19/14 3:06 PM:liquibase: Executing QUERY database command: select count(*) from test5.DATABASECHANGELOGLOCK
DEBUG 8/19/14 3:06 PM:liquibase: Executing QUERY database command: SELECT LOCKED FROM test5.DATABASECHANGELOGLOCK WHERE ID=1
DEBUG 8/19/14 3:06 PM:liquibase: Lock Database
DEBUG 8/19/14 3:06 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = 'skatedb55 (fe80:0:0:0:218:51ff:fe85:562a%3)', LOCKGRANTED = '2014-08-19 15:06:55.866' WHERE ID = 1 AND LOCKED = 0
INFO 8/19/14 3:06 PM:liquibase: Successfully acquired change log lock
DEBUG 8/19/14 3:07 PM:liquibase: Executing QUERY database command: SELECT MD5SUM FROM test5.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
INFO 8/19/14 3:07 PM:liquibase: Reading from test5.DATABASECHANGELOG
DEBUG 8/19/14 3:07 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE,DESCRIPTION,COMMENTS FROM test5.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 8/19/14 3:07 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for inputStream as 00ba919fb68564b7f5f8dab227e4f6a8
DEBUG 8/19/14 3:07 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for 7:00ba919fb68564b7f5f8dab227e4f6a8: as 283384b19a5c2734d153462833903290
DEBUG 8/19/14 3:07 PM:liquibase: Release Database Lock
DEBUG 8/19/14 3:07 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 8/19/14 3:07 PM:liquibase: Successfully released change log lock
Liquibase Rollback Successful
You have new mail in /var/spool/mail/root
按给定时间rollback
[root@skatedb55 liquibase30]# sh liquibase --contexts=dev --defaultSchemaName=test5 --logLevel=debug --changeLogFile=/tmp/db.Changelog-master.xml --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test2?useUnicode=true&characterEncoding=UTF-8"
--username=skate --password=skate rollbackToDate 2014-08-19 14:01:28
Liquibase Home: /mysql/software/liquibase30
DEBUG 8/19/14 3:14 PM:liquibase: Connected to skate@127.0.0.1@jdbc:mysql://localhost/test2?
useUnicode=true&characterEncoding=UTF-8
DEBUG 8/19/14 3:14 PM:liquibase: Setting auto commit to false from true
DEBUG 8/19/14 3:14 PM:liquibase: Executing QUERY database command: select count(*) from test5.DATABASECHANGELOGLOCK
DEBUG 8/19/14 3:14 PM:liquibase: Executing QUERY database command: SELECT LOCKED FROM test5.DATABASECHANGELOGLOCK WHERE ID=1
DEBUG 8/19/14 3:14 PM:liquibase: Lock Database
DEBUG 8/19/14 3:14 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = 'skatedb55 (fe80:0:0:0:218:51ff:fe85:562a%3)', LOCKGRANTED = '2014-08-19 15:14:46.132' WHERE ID = 1 AND LOCKED = 0
INFO 8/19/14 3:14 PM:liquibase: Successfully acquired change log lock
DEBUG 8/19/14 3:14 PM:liquibase: Executing QUERY database command: SELECT MD5SUM FROM test5.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
INFO 8/19/14 3:14 PM:liquibase: Reading from test5.DATABASECHANGELOG
DEBUG 8/19/14 3:14 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE,DESCRIPTION,COMMENTS FROM test5.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for inputStream as 00ba919fb68564b7f5f8dab227e4f6a8
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/db.Changelog-master.xml: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for 7:00ba919fb68564b7f5f8dab227e4f6a8: as 283384b19a5c2734d153462833903290
INFO 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Rolling Back Changeset:/tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Rolling Back ChangeSet: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Executing EXECUTE database command: drop table table3
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: ChangeSet /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate has been successfully rolled
back.
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Executing EXECUTE database command: DELETE FROM test5.DATABASECHANGELOG WHERE ID='Release-2014-05_000_CreateTable.sql' AND AUTHOR='skate'
AND FILENAME='/tmp/database/Release-2014-05/000_CreateTable.sql'
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for inputStream as 00ba919fb68564b7f5f8dab227e4f6a8
DEBUG 8/19/14 3:14 PM:liquibase: /tmp/database/Release-2014-05/000_CreateTable.sql::Release-2014-05_000_CreateTable.sql::skate: Computed checksum for 7:00ba919fb68564b7f5f8dab227e4f6a8: as 283384b19a5c2734d153462833903290
DEBUG 8/19/14 3:14 PM:liquibase: Release Database Lock
DEBUG 8/19/14 3:14 PM:liquibase: Executing UPDATE database command: UPDATE test5.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 8/19/14 3:14 PM:liquibase: Successfully released change log lock
Liquibase Rollback Successful
You have new mail in /var/spool/mail/root
[root@skatedb55 liquibase30]#
生成当前数据库状态的文档
[root@skatedb55 liquibase30]# sh liquibase --driver=com.mysql.jdbc.Driver --changeLogFile=/tmp/mysql_liquibase_changelog.xml --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test5?useUnicode=true&characterEncoding=UTF-8"
--username=skate --password=skate dbDoc /tmp/dbdoc/
Liquibase Home: /mysql/software/liquibase30
Liquibase 'dbDoc' Successful
You have new mail in /var/spool/mail/root
产生数据库的changelog
sh liquibase --driver=com.mysql.jdbc.Driver --changeLogFile=/tmp/mysql_liquibase_changelog.xml --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test5?
useUnicode=true&characterEncoding=UTF-8" --username=skate --password=skate
generateChangeLog
对照两个数据库
[root@skatedb55 liquibase30]# sh liquibase --logLevel=debug --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://10.10.0.117/test1?useUnicode=true&characterEncoding=UTF-8" --username=test
--password=test@df diff --referenceUrl="jdbc:mysql://10.20.0.55/test5?useUnicode=true&characterEncoding=UTF-8" --referenceUsername=skate --referencePassword=skate
Liquibase Home: /mysql/software/liquibase30
DEBUG 8/21/14 9:24 AM:liquibase: Connected to test@10.20.0.55@jdbc:mysql://10.10.0.117/test1?useUnicode=true&characterEncoding=UTF-8
DEBUG 8/21/14 9:24 AM:liquibase: Setting auto commit to false from true
DEBUG 8/21/14 9:24 AM:liquibase: Connected to skate@10.20.0.55@jdbc:mysql://10.20.0.55/test5?useUnicode=true&characterEncoding=UTF-8
DEBUG 8/21/14 9:24 AM:liquibase: Setting auto commit to false from true
Diff Results:
Reference Database: skate@10.20.0.55 @ jdbc:mysql://10.20.0.55/test5?useUnicode=true&characterEncoding=UTF-8 (Default Schema: test5)
Comparison Database: test@10.20.0.55 @ jdbc:mysql://10.10.0.117/test1?useUnicode=true&characterEncoding=UTF-8 (Default Schema: test1)
Product Name: EQUAL
Product Version: EQUAL
Missing Catalog(s):
test5
Unexpected Catalog(s):
test1
Changed Catalog(s): NONE
Missing Column(s):
t2.a
t2.b
Unexpected Column(s): NONE
Changed Column(s): NONE
Missing Foreign Key(s): NONE
Unexpected Foreign Key(s): NONE
Changed Foreign Key(s): NONE
Missing Index(s): NONE
Unexpected Index(s): NONE
Changed Index(s): NONE
Missing Primary Key(s): NONE
Unexpected Primary Key(s): NONE
Changed Primary Key(s): NONE
Missing Schema(s): NONE
Unexpected Schema(s): NONE
Changed Schema(s): NONE
Missing Sequence(s): NONE
Unexpected Sequence(s): NONE
Changed Sequence(s): NONE
Missing Table(s):
t2
Unexpected Table(s): NONE
Changed Table(s): NONE
Missing Unique Constraint(s): NONE
Unexpected Unique Constraint(s): NONE
Changed Unique Constraint(s): NONE
Missing View(s): NONE
Unexpected View(s): NONE
Changed View(s): NONE
Liquibase 'diff' Successful
You have new mail in /var/spool/mail/root
[root@skatedb55 liquibase30]#
列出当前数据库的lock
[root@skatedb55 liquibase30]# sh liquibase --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test5?
useUnicode=true&characterEncoding=UTF-8" --username=skate --password=skate listLocks useUnicode=true&characterEncoding=UTF-8">
Liquibase Home: /mysql/software/liquibase30
Database change log locks for
skate@127.0.0.1@jdbc:mysql://localhost/test5?useUnicode=true&characterEncoding=UTF-8
- No locks
Liquibase 'listLocks' Successful
You have new mail in /var/spool/mail/root
[root@skatedb55 liquibase30]#
Release当前数据库的全部的lock
[root@skatedb55 liquibase30]# sh liquibase --driver=com.mysql.jdbc.Driver --classpath=/usr/share/java/mysql-connector-java-5.1.17.jar --url="jdbc:mysql://localhost/test5?
useUnicode=true&characterEncoding=UTF-8" --username=skate --password=skate releaseLocks
Liquibase Home: /mysql/software/liquibase30
Successfully released all database change log locks for skate@127.0.0.1@jdbc:mysql://localhost/test5?
useUnicode=true&characterEncoding=UTF-8
Liquibase 'releaseLocks' Successful
[root@skatedb55 liquibase30]#
--------end---------
Database(Mysql)发版控制二的更多相关文章
- MySQL简版(二)
第一章 表的约束 1.1 概念 对表中的数据进行限定,保证数据的正确性.有效性和完整性. 1.2 分类 主键约束:primary key. 非空约束:not null. 唯一约束:unique. 外键 ...
- Windows 8.1下 MySQL绿色版安装配置与使用
原文:Windows 8.1下 MySQL绿色版安装配置与使用 Mysql-5.6.17-winx64操作步骤: 一.安装MySQL数据库 1.下载. 下载地址:http://downloads.my ...
- Windows下MySQL绿色版安装配置与使用
Mysql-5.7.11-winx64操作步骤: 一.安装MySQL数据库 1.下载. 下载地址: http://downloads.mysql.com/archives/get/file/mysql ...
- 彻底解决mysql中文乱码的办法,修改mysql解压缩版(免安装版或zip版)字符编码
MySQL会出现中文乱码的原因不外乎下列几点:1.server本身设定问题,例如server字符编码还停留在latin12.table的语系设定问题(包含character与collation)3.客 ...
- MySql绿色版配置及使用详解
原文:MySql绿色版配置及使用详解 最近在做项目开发时用到了MySql数据库,在看了一些有关MySql的文章后,很快就上手使用了.在使用的过程中还是出现了一些问题,因为使用的是绿色免安装版的MySq ...
- mysql绿色版配置
MySQL 绿色版安装配置教程 一.下载,这里使用绿色免安装版 1.网上搜索mysql绿色免安装版下载即可.提供官网地址 http://dev.mysql.com/downloads/mysql--- ...
- c++ primer plus 第6版 部分二 5- 8章
---恢复内容开始--- c++ primer plus 第6版 部分二 5- 章 第五章 计算机除了存储外 还可以对数据进行分析.合并.重组.抽取.修改.推断.合成.以及其他操作 1.for ...
- mysql绿色版下载及应用
一.mysql绿色版下载 第一歩:打开下载网址:https://www.oracle.com 点击Menu-->Database and Technologies-->Databases- ...
- 阿里云移动研发平台 EMAS 助力银行业打造测试中台,提升发版效能
随着移动互联网的发展,手机银行凭借低成本.操作简单.不受时间空间约束等优势,正逐步替代传统的网银交易方式.越来越多的银行开始了“业务移动化”转型之路,“手机APP”已经成为企业价值传递和关系维护的关键 ...
随机推荐
- VHDL testbench 例子,包含向文件中写数据
LIBRARY ieee; USE ieee.std_logic_1164.ALL; use std.textio.all; use ieee.std_logic_textio.all; EN ...
- CSS自学笔记(5):CSS的样式
CSS中拥有各种各样的样式表,而基本的样式有背景,文本,字体,链接,列表,表格,轮廓. 一.CSS-背景 CSS中允许用纯色背景,也允许用图片来创建复杂的个性背景. p {background-col ...
- 获取IP地址(简单实现)
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket ...
- Asp.net MVC学习--默认程序结构、工作流程
二.MVC 默认程序结构 MVC新建好之后,会对应的出现几个包,分别是:Controller.Model.View --即MVC 其中的默认的Default.aspx文件可以方便url重写,如果不设置 ...
- 十度好友问题(DFS经典应用)
问题: 在社交网络里(比如 LinkedIn),如果A和B是好友,B和C是好友,但是A和C不是好友,那么C是A的二度好友,给定一个社交网络的关系图,如何找到某一个人的所有十度好友.
- 运行预构建 Linux 映像的 Windows Azure 虚拟机中的交换空间 – 第 1 部分
本文章由 Azure CAT 团队的 Piyush Ranjan (MSFT) 撰写. 随着基础结构服务(虚拟机和虚拟网络)近期在 Windows Azure 上正式发布,越来越多的企业工作负荷正在向 ...
- zyUpload界面绝佳、体验超棒的HTML5上传插件
一.为毛线开发它 经过了两个星期做出了两个基于HTML5的多文件上传插件,之前在做网站的时候用到文件上传这一个功能,但是大多说都是基于Flash的,正好最近HTML5很火,而且渐渐壮大起来,感觉搞前端 ...
- Minimum Inversion Number(归并排序)
Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- poj 1149 PIGS(最大流经典构图)
题目描述:迈克在一个养猪场工作,养猪场里有M 个猪圈,每个猪圈都上了锁.由于迈克没有钥匙,所以他不能打开任何一个猪圈.要买猪的顾客一个接一个来到养猪场,每个顾客有一些猪圈的钥匙,而且他们要买一定数量的 ...
- Android 教你打造炫酷的ViewPagerIndicator 不仅仅是高仿MIUI
1.概述 哈,今天给大家带来一个ViewPagerIndicator的制作,相信大家在做tabIndicator的时候,大多数人都用过 TabPageIndicator,并且很多知名APP都使用过这个 ...