随笔分类 -  Database

摘要:报错: 置foreign_key_checks变量为0 set @@session.foreign_key_checks=0 select @@session.foreign_key_checks; 比对两张表 show full columns from dept_emp; show full c 阅读全文
posted @ 2020-11-21 14:14 ascertain 阅读(402) 评论(0) 推荐(0)
摘要:mysql中utf8和utf8mb4区别 MySQL在5.5.3之后增加了这个utf8mb4的编码,mb4就是most bytes 4的意思,专门用来兼容四字节的unicode。好在utf8mb4是utf8的超集,除了将编码改为utf8mb4外不需要做其他转换。当然,为了节省空间,一般情况下使用ut 阅读全文
posted @ 2020-11-09 19:10 ascertain 阅读(117) 评论(0) 推荐(0)
摘要:选用场景: 字段平均长度与极值相差小,选用char,反之,选用varchar 字段需要频繁更新,考虑char,char为定长,不容易产生碎片 字段存储信息很短,考虑char,varchar会占用额外空间保存长度信息 定长字段优选char 阅读全文
posted @ 2020-11-09 16:47 ascertain 阅读(89) 评论(0) 推荐(0)
摘要:comment查看comment show create table 'table_name'; show full columns from 'table_name'; 修改comment alter table 'table_name' modify column 'column_name' ' 阅读全文
posted @ 2020-11-09 09:34 ascertain 阅读(58) 评论(0) 推荐(0)
摘要:当前数据库: 内置函数database() select database(); show tables; status \s 当前用户: select user(); select current_user; 阅读全文
posted @ 2020-11-02 19:26 ascertain 阅读(1541) 评论(0) 推荐(0)
摘要:https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html default-storage-engin=INNODB 设定默认存储引擎 general-log=0 关闭general log skip-networking 阅读全文
posted @ 2020-10-14 20:03 ascertain 阅读(109) 评论(0) 推荐(0)
摘要:37-SQLServer的审核/审计功能介绍 一、总结 1、SQLServer2008开始支持审计功能,审计规范分为服务器级别和数据库级别两种; 2、无论是服务器级别的审计还是数据库级别的审计,第一步创建审计对象的方式一样,最后创建完都是在实例下的安全性查看; 3、创建审计对象的时候,不能在创建脚本 阅读全文
posted @ 2020-08-21 13:27 ascertain 阅读(1572) 评论(0) 推荐(0)
摘要:use master GO exec xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server\110\Tools\Setup','ProductCode' exec xp_regread 'HKEY_LOCAL 阅读全文
posted @ 2020-08-16 14:29 ascertain 阅读(348) 评论(0) 推荐(0)
摘要:select * from sysdatabases order by name 查询数据库中所有表 select * from sysobjects where xtype='U'; xtype='U' 表示所有用户表 select * from sysobjects where xtype='S 阅读全文
posted @ 2020-08-13 14:40 ascertain 阅读(363) 评论(0) 推荐(0)
摘要:前提条件:1: 创建与RDS实例同地域的OSS Bucket2: 数据库恢复模式为FULL3: RDS实例拥有足够的存储空间4: RDS实例中没有同名的目标数据库5: RDS实例已创建高权限账号上云阶段全量阶段 Step1. 00:00之前 完成准备工作,包括: 完成DBCC CheckDB检查。 阅读全文
posted @ 2020-08-04 18:28 ascertain 阅读(257) 评论(0) 推荐(0)
摘要:SELECT * FROM sys.all_objects 查询系统表的内容 USE cjml_basecenter; GO SELECT o.name, SUM(p.reserved_page_count) * 8 table_size_kb, SUM(p.reserved_page_count) 阅读全文
posted @ 2020-08-03 21:15 ascertain 阅读(555) 评论(0) 推荐(0)
摘要:直接在web中删除,要求输入手机验证码;采用以下方式可以直接删除数据库 EXEC sp_rds_drop_database 'cjml-auto' 直接利用rds的存储过程删除数据库,因为是高可用,后面有一个mirror,删除比较麻烦 阅读全文
posted @ 2020-08-03 21:11 ascertain 阅读(260) 评论(0) 推荐(0)
摘要:统计单个库所有表记录数(包含sys) SELECT SCHEMA_NAME(t.schema_id) AS [schema] ,t.name AS tableName ,i.rows AS [rowCount] FROM sys.tables AS t , sysindexes AS i WHERE 阅读全文
posted @ 2020-08-03 11:54 ascertain 阅读(677) 评论(0) 推荐(0)
摘要:查询每个库的数据文件大小和日志文件大小 with fs as ( select database_id, type, size -- * 8.0 / 1024 size from sys.master_files ) select name, --(select cast(round(sum(siz 阅读全文
posted @ 2020-08-03 10:49 ascertain 阅读(915) 评论(0) 推荐(0)
摘要:备份还原时,发现SQL server一个库一直处于还原状态,无法脱机,操作,解决办法 restore database DB_NAME with recovery 阅读全文
posted @ 2020-08-01 08:14 ascertain 阅读(355) 评论(0) 推荐(0)
摘要:--全量备份 exec master.dbo.fullbackup 'D:\DBBak\Bod\','Bod','bak' go exec master.dbo.fullbackup 'D:\DBBak\CJML_APP_IntelliP\','CJML_APP_IntelliP','bak' go 阅读全文
posted @ 2020-07-31 00:02 ascertain 阅读(281) 评论(0) 推荐(0)
摘要:预编译二进制包groupadd --gid 666 --system mysqluseradd --uid 666 --gid mysql --system mysqlln -sv mariadb-VERSION-OS mysqlchown --recursive --dereference -L 阅读全文
posted @ 2020-07-08 01:47 ascertain 阅读(298) 评论(0) 推荐(0)
摘要:修改global & session 变量 lock tables tbl_name [[as] alias] read | write 阅读全文
posted @ 2020-07-04 03:01 ascertain 阅读(152) 评论(0) 推荐(0)