select COLUMN_NAME,DATA_TYPE,DATA_PRECISION,DATA_SCALE,NULLABLE
from user_tab_columns
where table_name ='YourTableName'
TBP_PM_EQUIP_CALL_STATUS
select table_name,comments from
all_tab_comments where table_name = 'TBP_PM_EQUIP_CALL_STATUS'
select * from
all_col_comments where table_name = 'TBC_RM_MAIN_TOOL_ACT'
获取表名:
Oracle的user_talbes用于记录了用户表信息。
select TABLE_NAME from all_tables where table_name = 'TBC_RM_MAIN_TOOL_ACT'
select A.table_name,B.comments from all_tables A, all_tab_comments B where A.TABLE_NAME = B.TABLE_NAME and length(b.comments) > 3
select TABLE_NAME from all_tables
select count(*) from all_tables
获取某个表的字段:
USER_TAB_COLS中记录了用户表的列信息。下面是别人写的:
SELECT USER_TAB_COLS.TABLE_NAME as 表名,USER_TAB_COLS.COLUMN_NAME as 列名 , USER_TAB_COLS.DATA_TYPE as 数据类型, USER_TAB_COLS.DATA_LENGTH as 长度, USER_TAB_COLS.NULLABLE as 是否为空,USER_TAB_COLS.COLUMN_ID as 列序号,user_col_comments.comments as 备注 FROM USER_TAB_COLS inner join user_col_comments on user_col_comments.TABLE_NAME=USER_TAB_COLS.TABLE_NAME and user_col_comments.COLUMN_NAME=USER_TAB_COLS.COLUMN_NAME
如何从Oracle、中取得表的注释
user_tab_comments;表注释
user_col_comments;表字段注释
以上两个只能获取自己用户的表的注释信息,如果要访问自己能够访问的其他用户的表,则需要使用:
all_tab_comments;表注释
all_col_comments;表字段注释
当然,如果有DBA权限,则可以使用
dba_tab_comments;表注释
dba_col_comments;表字段注释
dba*和all*最好指定owner条件。user*没有该字段
user_tab_comments;表注释
user_col_comments;表字段注释
以上两个只能获取自己用户的表的注释信息,如果要访问自己能够访问的其他用户的表,则需要使用:
all_tab_comments;表注释
all_col_comments;表字段注释
当然,如果有DBA权限,则可以使用
dba_tab_comments;表注释
dba_col_comments;表字段注释
dba*和all*最好指定owner条件。user*没有该字段
pool guowang.log
----set pagesize 9999
----set linesize 9999
----set long 99999
set echo off
set feedback off
alter session set NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";
prompt '********************数据库部署方式********************'
select name,value from v$parameter where name='cluster_database';
prompt '********************数据库软件个数及名称********************'
prompt '********************部署的数据库类型及版本********************'
select * from v$version;
prompt '********************数据库实例个数及名称********************'
select instance_number,instance_name from v$instance;
prompt '********************数据库用户名称********************'
select username from dba_users;
prompt '********************表空间名称及大小(G)********************'
SELECT UPPER (f.tablespace_name) "TABLESPACE_NAME",
d.tot_grootte_mb "TOTAL_SIZE(M)",
TO_CHAR (ROUND ( (d.tot_grootte_mb - f.total_bytes)
/ d.tot_grootte_mb
* 100,
2
),
'990.99'
)||'%' "PER_USERD",d.tot_grootte_mb - f.total_bytes "USERD(M)",f.total_bytes "FREE(M)"
FROM (SELECT tablespace_name,
ROUND (SUM (BYTES) / (1024 * 1024), 2) total_bytes
FROM SYS.dba_free_space
GROUP BY tablespace_name) f,
(SELECT dd.tablespace_name,
ROUND (SUM (dd.BYTES) / (1024 * 1024), 2) tot_grootte_mb
FROM SYS.dba_data_files dd
GROUP BY dd.tablespace_name) d
WHERE d.tablespace_name = f.tablespace_name
ORDER BY 3 DESC;
prompt '********************数据库文件存放路径********************'
select name from v$datafile;
prompt '********************业务数据存放位置********************'
prompt '********************业务数据存储机制********************'
prompt '********************业务系统现有数据量(G)********************'
select owner,SUM(BYTES/1024/1024) from dba_segments group by owner;
prompt '********************数据库最大连接用户数********************'
select value from v$parameter where name='processes';
prompt '********************数据库数据的处理类型********************'
prompt '********************数据库操作高峰时段********************'
prompt '********************数据库字符集********************'
select * from nls_database_parameters
prompt '********************内存分配量(SGA)(M)********************'
select name,VALUE/1024/1024 from v$parameter where name in('sga_max_size','sga_target');
prompt '********************listerner端口********************'
host lsnrctl stat
prompt '********************归档日志日增长数********************'
select trunc(first_time) "DATE",thread#,count(1) "ARCH_PER_DAY",round(count(1) / 24) "ARCH_PER_HR"
from v$log_history
group by trunc(first_time), thread#
order by 1,3 desc;
----------------------------
select to_char(first_time, 'yyyy-mm-dd hh24') "DATE",
thread#,
count(1) "ARCH_HR"
from v$log_history
where trunc(first_time) in
(select d_time
from (select max(count(1)) m_arch
from v$log_history
group by trunc(first_time)) a,
(select trunc(first_time) d_time, count(1) d_arch
from v$log_history
group by trunc(first_time)) b
where a.m_arch = b.d_arch)
group by to_char(first_time, 'yyyy-mm-dd hh24'), thread#
order by thread#,3 desc;
prompt '********************归档日志大小(MB)********************'
select bytes/1024/1024 from v$log;
prompt '********************归档日志总增长量
日增长量计算:
(每天生成的生产日志个数*大小)********************'