1、查询空闲数据库缺省表空间类型(BIGFILE, SMALLFILE)
SELECT * FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME='DEFAULT_TBS_TYPE';
(ALTER DATABASE SET DEFAULT BIGFILE TABLESPACE; ALTER DATABASE SET DEFAULT SMALLFILE TABLESPACE;)
2、查看各表空间的管理状态
SELECT TABLESPACE_NAME, EXTENT_MANAGEMENT, SEGMENT_SPACE_MANAGEMENT FROM DBA_TABLESPACES;
3、查看数据字典的各表名称
SELECT TABLE_NAME FROM DICT;
SELECT TABLE_NAME FROM DICT WHERE TABLE_NAME LIKE 'DBA%';
SELECT TABLE_NAME FROM DICT WHERE TABLE_NAME LIKE 'USER%';
SELECT TABLE_NAME FROM DICT WHERE TABLE_NAME LIKE 'ALL%';
4、统计信息表(在运行ANALYZE后,会更新这些信息)
DBA_TABLES
DBA_TAB_COLUMNS
DBA_CLUSTERS
DBA_INDEXES
INDEX_STATS
INDEX_HISTOGRAM
DBA_TAB_HISTOGRAMS
5、查看系统统计信息
SELECT NAME, CLASS, VALUE FROM V$SYSSTAT;
6、查看并行查询信息
SELECT * FROM V$PX_PROCESS_SYSSTAT;
7、查看当前活动进程信息
SELECT ADDR, PID, SPID, USERNAME, LATCHWAIT, PGA_USED_MEM, PGA_MAX_MEM FROM V$PROCESS;
8、查看争用统计信息
SELECT CLASS, COUNT, TIME FROM V$WAITSTAT;
9、查看特定事件的总等待事件
SELECT EVENT, TOTAL_WAITS, TIME_WAITED, EVENT_ID, WAIT_CLASS_ID, WAIT_CLASS FROM V$SYSTEM_EVENT;
10、缓冲池统计信息
SELECT ID, NAME, BLOCK_SIZE, SUM_WRITE, DB_BLOCK_CHANGE, PHYSICAL_READS, PHYSICAL_WRITES FROM V$BUFFER_POOL_STATISTICS;
11、查看高速缓冲中的(Library Cache)SQL信息
SELECT OWNER, NAME, LOADS, EXECUTIONS, LOCKS FROM V$DB_OBJECT_CACHE;
12、查看数据字典的各行命中率
SELECT CACHE#, TYPE, COUNT, USAGE, GETS, SCANS, FLUSHES FROM V$ROWCACHE;
13、查看实例基本信息统计
SELECT NAME, CLASS, VALUE, STAT_ID FROM V$SYSSTAT;
14、查看各数据文件读写统计信息
SELECT FILE#, PHYRDS, PHYWRTS, PHYBLKRD, PHYBLKWRT, READTIM, WRITETIM FROM V$FILESTAT;
15、查看临时表空间文件读写统计信息
SELECT FILE#, PHYRDS, PHYWRTS, PHYBLKRD, PHYBLKWRT, READTIM, WRITETIM FROM V$TEMPSTAT;
16、查看闩锁
SELECT ADDR, LEVEL#, NAME, HASH, WAIT_TIME FROM V$LATCH;
17、查看联机回退段的统计
SELECT LATCH, EXTENTS, WRITES, GETS, WAITS, HWMSIZE, SHRINKS, WRAPS, EXTENDS, STATUS FROM V$ROLLSTAT;
18、等待事件统计信息
SELECT CLASS, COUNT, TIME FROM V$WAITSTAT;
19、查看锁信息
SELECT ADDR, KADDR, SID, TYPE, REQUEST, CTIME, BLOCK FROM V$LOCK;
20、查看打开的游标
SELECT SADDR, SID, USER_NAME, ADDRESS, HASH_VALUE, SQL_TEXT FROM V$OPEN_CURSOR;
21、查看临时段及创建这些段的会话的大小磁盘排序进程信息
SELECT USERNAME, USER, SESSION_ADDR, SQLADDR, SQLHASH, TABLESPACE, CONTENTS, BLOCKS FROM V$SORT_USAGE;
22、用户会话统计
SELECT SID, STATISTIC#, VALUE FROM V$SESSTAT;
23、查看会话等待事件的信息(从启动开始到目前)
SELECT SID, EVENT, TOTAL_WAITS, TIME_WAITED, EVENT_ID, WAIT_CLASS FROM V$SESSION_EVENT;
24、查看会话正在等待的事件
SELECT SID, SEQ#, EVENT, P1TEXT, P1, P2TEXT, P2, P3TEXT, P3, WAIT_CLASS, STATE FROM V$SESSION_WAIT;
25、查看并行执行的会话信息
SELECT SADDR ,SID, DEGREE, VALUE FROM V$PX_SESSTAT;
26、查看需要恢复的文件
SELECT * FROM V$RECOVER_FILE;