ddl

Free/OSS Data model diagram generator from DDL

末鹿安然 提交于 2019-12-23 01:33:05
问题 I am looking for some free/oss to reverse engineer from DDL a data model diagram. My database is Oracle if that matters. Do any exist? 回答1: http://schemaspy.sourceforge.net/ 回答2: SQL Power architect has a GPL version (though it looks like they are releasing an 'Enterprise' edition soon) There is also FabForce's DBDesigner, though it is more geared to MySQL (but has some Oracle capability) 回答3: You could also look at sql-developer and data-modeler from Oracle. both are free http://www.oracle

Using Visio to generate MySQL DDL

时光怂恿深爱的人放手 提交于 2019-12-22 11:25:57
问题 I have a database model diagram created in MS Visio which I would like to export to DDL file to create a MySQL database. I've already installed the MySQL ODBC driver, which I can successfully use to generate DDL file, but I have some problems anyway. Visio puts quotation marks around the table names which are also reserved words (like user). This is not OK, since MySQL uses backticks (`) and not quotation marks (") for this purpose. MySQL ODBC driver also changes the BLOB data type to

Delete tables from database Oracle 10g

孤人 提交于 2019-12-22 09:40:03
问题 I have deleted some tables from an Oracle 10g database using the drop command. When I list the tables using select * from cat; I get the following : Are the tables deleted or not? Why do I have these BIN$... things? How can I remove them or the tables once and for all? Thanks! 回答1: They are entries in the Recycle Bin, created by the deletion of a table. They can be purged if required. http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables011.htm 回答2: The tables prefixed with BIN$ are

How to create a Postgres table with unique combined primary key?

只愿长相守 提交于 2019-12-22 08:32:51
问题 I have two tables named players & matches in a Postgres DB as follows: CREATE TABLE players ( name text NOT NULL, id serial PRIMARY KEY ); CREATE TABLE matches ( winner int REFERENCES players (id), loser int REFERENCES players (id), -- to prevent rematch btw players CONSTRAINT unique_matches PRIMARY KEY (winner, loser) ); How can I ensure that only a unique combination of either (winner, loser) or (loser, winner) is used for matches primary key so that the matches table won't allow the

SQL DDL和DML的定义和区别

大兔子大兔子 提交于 2019-12-22 02:40:42
DML(Data Manipulation Language)数据操纵语言: 适用范围:对数据库中的数据进行一些简单的基本操作,如insert,delete,update,select等. DDL(Data Definition Language)数据定义语言: 适用范围:对数据库中的某些对象(例如,database,table)进行管理,如Create,Alter和Drop. 区别: 1.DML操作是可以手动控制事务的开启、提交和回滚的。 2.DDL操作是隐性提交的,不能rollback! 来源: CSDN 作者: Kevinxue025 链接: https://blog.csdn.net/Kevinxue025/article/details/103647942

How to alter “REFERENCES” in PostgreSQL?

烂漫一生 提交于 2019-12-21 07:12:10
问题 How can I alter the reference to a table in PostgreSQL when the table name has been changed? Say I have: CREATE TABLE example1 ( id serial NOT NULL PRIMARY KEY, name varchar(100) ); CREATE TABLE example2 ( id serial NOT NULL PRIMARY KEY, example1fk integer REFERENCES example1 (id) DEFERRABLE INITIALLY DEFERRED ); Later I do: ALTER TABLE example1 RENAME TO example3; How to change the definition of the foreign key constraint? example1fk integer REFERENCES example1 (id) DEFERRABLE INITIALLY

直击备份恢复的痛点:基于 TiDB Binlog 的快速时间点恢复

时间秒杀一切 提交于 2019-12-20 10:40:24
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 作者介绍:吕磊,Better 队成员、美团点评高级 DBA,Better 队参加了 TiDB Hackathon 2019,其项目「基于 TiDB Binlog 的 Fast-PITR」获得了最佳贡献奖。 维护过数据库的同学应该都能体会,数据备份对于数据库来说可以说至关重要,尤其是关键业务。TiDB 原生的备份恢复方案已经在多家客户得到稳定运行的验证,但是对于业务量巨大的系统存在如下几个痛点: 集群中数据量很大的情况下,很难频繁做全量备份。 传统 TiDB Binlog 原样吐出 binlog 增量备份会消耗大量的磁盘空间,并且重放大量 binlog 需要较长时间。 binlog 本身是有向前依赖关系的,任何一个时间点的 binlog 丢失,都会导致后面的数据无法自动恢复。 调大 TiDB gc_life_time 保存更多版本的快照数据,一方面保存时间不能无限长,另一方面过多的版本会影响性能且占用集群空间。 <center>图 1 原生 binlog 备份恢复</center> 我们在线上使用 TiDB 已经超过 2 年,从 1.0 RC 版本到 1.0 正式版、2.0、2.1 以及现在的 3.0,我们能感受到 TiDB 的飞速进步和性能提升,但备份恢复的这些痛点,是我们 TiDB

How to generate DDL for all tables in a database in MySQL

为君一笑 提交于 2019-12-20 08:39:31
问题 How to generate the DDL for all tables in a database of MySQL at once. I know that the following query will output the DDL for a table. But I want DDL of all tables at once because I am having hundreds of tables in my database. show create table <database name>.<table name>; For example: show create table projectdb.customer_details; The above query will result in DDL of customer_details table. I am using MySQL with MySQL workbench on Windows OS. 回答1: You can do it using the mysqldump command

Unit testing DDL statements that need to be in a transaction

℡╲_俬逩灬. 提交于 2019-12-20 05:52:48
问题 I am working on an application that uses Oracle's built in authentication mechanisms to manage user accounts and passwords. The application also uses row level security. Basically every user that registers through the application gets an Oracle username and password instead of the typical entry in a "USERS" table. The users also receive labels on certain tables. This type of functionality requires that the execution of DML and DDL statements be combined in many instances, but this poses a

Oracle什么时候需要Commit

若如初见. 提交于 2019-12-20 04:43:27
写完DML语句(update, insert, delete)后,需要手动COMMIT,如果没有COMMIT,更新的内容会被保存到内存中,而不是提交到数据库中,将不会被其他Session(对话)看见。其他对话看到的是更新前的数据。当用户退出对话时,Oracle才会自动Commit。 而DDL语句(create, alter, drop, truncate),自带COMMIT,所以不需要写COMMIT。因此,DDL操作不能被回滚。 执行完DML语句,如果再执行DDL语句,也会自动COMMIT未被COMMIT的数据。还有其他的SQL命令也有同样的效果:audit, noaudio, comment, grant, revoke, connect, disconnect, exit,quit. 如果打开自动提交,DML操作后也不需要手动提交。 SET AUTOCOMMIT ON 来源: https://www.cnblogs.com/yidan621/p/5226865.html