查看当前用户的缺省表空间 SQL>select username,default_tablespace from user_users; 查看当前用户的角色 SQL>select * from user_role_privs; 查看当前用户的系统权限和表级权限 SQL>select * from user_sys_privs; SQL>select * from user_tab_privs; 查看用户下所有的表 SQL>select * from user_tables;
1.查看表所占空间 SELECT TABLESPACE_NAME,TO_CHAR(SUM(BYTES)/(1024*1024),'999G999D999') CNT_MB FROM DBA_EXTENTS WHERE OWNER='&OWNER' AND SEGMENT_NAME='&TABLE_NAME' AND SEGMENT_TYPE LIKE 'TABLE%' GROUP BY TABLESPACE_NAME;
查询用户创建的表 select * from user_tab_comments; -- 查询本用户的表,视图等. select * from user_col_comments; -- 查询本用户的表的列名和注释. 查询所有表大小 select Segment_Name, Sum(bytes) / 1024 / 1024 / 1024 "size(DB)" From User_Extents Group By Segment_Name order by "size(DB)&
注意如果是从旧的数据库复制,一定要保证字符集使用一模一样的,不然会有很多问题(比如汉字在UTF8占3个字符,在GBK占2个字符,所以设置的列宽度要比原来的大才行,不然就会报值太大的错误) select * from v$nls_parameters where parameter='NLS_CHARACTERSET';
查询某个表所占用的磁盘空间大小: SELECT CONCAT(ROUND(SUM(data_length/1024/1024),2),'MB') AS data_length_MB, CONCAT(ROUND(SUM(index_length/1024/1024),2),'MB') AS index_length_MB FROM `information_schema`.tables WHERE table_schema='db_name' AND table_name = 'table_nam
oracle查看表名 select table_name from user_tables; select table_name from dba_tables; select * from all_all_tables oracle查看数据库名 select * from v$database; mysql查看表名: show tables: mysql查看数据库名: show databases;