declare v_tName varchar(50); v_sqlanalyze varchar(500); v_num number; v_sql varchar(500); cursor c1 is select table_name from user_tables; begin open c1; loop fetch c1 into v_tName; if c1%found then v_sqlanalyze :='analyze table '||v_tName||' es…
统计MySQL中某个数据库中有多少张表 SELECT count(*) TABLES, table_schema FROM information_schema.TABLES where table_schema = '数据库名称' GROUP BY table_schema; 统计MySQL中某个数据库中表记录数 use information_schema; select table_name,table_rows from tables where TABLE_SCHE…
无意间看到一篇文章,觉得对于ORACLE的新手很实用,特转载,原文出处这里 说明:在创建数据库时输入的密码,是修改系统默认的密码,以system和sysman等系统默认身份登录时要输入的密码就是修改后的密码(创建数据库时输入的密码)如果要创建新的用户就必须以system或者sysman(这二者的权限最大)的身份登录后才可创建创建用户格式:create user 用户名 identified by 密码(例如:create user cht identified by cht;)创建完成后,必须分…
在使用navicat进行数据库管理的时候,在查看表对象的时候会发现,每次刷新,数据表的记录数不断变化,尤其是大表. 对于100万的数据经常会显示九十几万,当然通过count(*)出来的数据是正确的. 非常疑惑,查了一下资料,原来和存储引擎有关.官方说明: The number of rows. Some storage engines, such as MyISAM, store the exact count. For other storage engines, such as InnoDB…
-- 所有表的记录数 SELECT a.name, b.rowsFROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.idWHERE (a.type = 'u') AND (b.indid IN (0, 1))ORDER BY b.rows DESC -- 查找所有表的记录数以及空间占用情况 selectobject_name(id) tablename,8*reserved/1024 reserved,rtrim(8*dpage…