实用文档
FROM all_constraints
WHERE owner = '&OWNER' AND status = 'DISABLED’ AND constraint_type = 'P'
8. 重建索引,具体参数请根据实际情况进行修改
SELECT 'alter index ' || index_name || ' rebuild '
, 'tablespace INDEXES storage ( initial 256 K next 256 K ) ; ' FROM all_indexes
WHERE ( tablespace_name != 'INDEXES' OR next_extent != ( 256 * 1024 ) )
AND owner = '&OWNER'
9. 对比两个实例的不同
SELECT object_name, object_type FROM user_objects MINUS
SELECT object_name, object_type FROM user_objects@&my_db_link
10. 查看动态性能视图
Select * from V$FIXED_TABLE
11. 查看约束
select a.constraint_name, a.constraint_type,a.* from user_constraints a
where table_name='table_name';
select constraint_name, column_name from user_cons_columns
where table_name='table_name';
12. 查看索引
user_indexes包含索引的名字,user_ind_columns包含索引的列.
13. 查看数据库启动参数:show parameter para,v$parameter提供当前会话信息,
v$system_parameter提供当前系统信息。其中isses_modifiable,issys_modifiable表示是否允许动态修改。
14. 查看进程号:
标准文案
实用文档
select p.spid, s.username
from v$process p , v$session s where p.addr=s.paddr;
15. 查看数据文件:
select name, status from v$datafile;
select *
from dba_data_files;
16. 查看数据文件状态
select d.file# f#, d.name, d.status, h.status from v$datafile d, v$datafile_header h where d.file#=h.file#;
17. 查看控制文件
select name
from v$controlfile;
select type, record_size, records_total, records_used from v$controlfile_record_section where type=’DATAFILE’;
18. 查看是否归档模式:
archive log list
select name, log_mode from v$database;
select archiver from v$instance;
19. 查看日志组:
select groups, current_group#, sequence# from v$thread;
select group#, sequence#, bytes , members, status from v$log;
标准文案
实用文档
select *
from v$logfile;
其中status为空表示正常。
20. 查看large pool
select *
from v$sgastat
where pool=’large pool’;
21. 查看归档位置
show parameter archive
select destination, binding, target, status from v$archive_dest;
22. 查看归档进程
select *
from v$archive_processes;
23. 查看正在备份的数据文件
select *
from v$backup;
24. 查看需要恢复的文件
select *
from v$recover_file;
25. 查看所有归档日志文件
select *
from v$archived_log;
26. 查看恢复时要用到的日志文件
select *
from v$recovery_log;
标准文案
实用文档
27. 查看SGA的结构
Show sga;
select *
from v$sgastat;
28. 提取library cache的命中率
select gethitratio from v$librarycache where namespace=’…’;
29. 查看正在运行的SQL语句
select sql_text, users_executing, executions, loads from v$sqlarea;
select *
from v$sqltext
where sql_text=’select * from emp%’;
30. 查看library cache reload情况:
select sum(pins) “Executions”, sum(reloads) sum(reloads)/sum(pins) from v$librarycache;
31. 查看大匿名块
select sql_text from v$sqlarea where command_type=47
and length(sql_text)>500;
32. 查看当前会话的UGA区
select sum(value)||’bytes’ “Total session memory” from v$mystat, v$statname
where name=’session uga memory’
and v$mystat.statistic#=v$statname.statistic#;
33. 查看所有MTS用户的UGA区:
select sum(value)||’bytes’ “Total session memory”
标准文案
cache Misses”, “
相关推荐: