关闭

查看当前用户下所有的表中每个表的条目数

570人阅读 评论(0) 收藏 举报
分类:


SQL> create user cs identified by cs;

User created.

SQL> grant connect,resource,create view to cs;

Grant succeeded.

SQL> create table cs.cs as select * from scott.emp;

Table created.

SQL> conn cs/cs
Connected.

SQL> select table_name ,num_rows from user_tables;

TABLE_NAME                       NUM_ROWS
------------------------------ ----------
CS


SQL> select * from cs;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

14 rows selected.


SQL> conn / as sysdba
Connected.
SQL> exec dbms_stats.gather_schema_stats(ownname=>'CS',estimate_percent=>10,degree=>8,cascade=>true,granularity=>'ALL');

PL/SQL procedure successfully completed.

SQL> conn cs/cs;
Connected.
SQL> select table_name ,num_rows from user_tables;

TABLE_NAME                       NUM_ROWS
------------------------------ ----------
CS                                     14


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:42819次
    • 积分:1308
    • 等级:
    • 排名:千里之外
    • 原创:75篇
    • 转载:37篇
    • 译文:8篇
    • 评论:3条
    文章分类
    最新评论