检查相关Oracle对象的状态,包含
检查Oracle控制文件状态,
检查Oracle在线日志状态,
检查Oracle表空间的状态,
检查Oracle所有数据文件状态,
检查Oracle所有表、索引、存储过程、触发器、包等对象的状态,
检查Oracle所有回滚段的状态,
总共六个部分。
1.检查Oracle控制文件状态
SQL> select name,status,IS_RECOVERY_DEST_FILE from v$controlfile;
NAME STATUS IS_
------------------------------------------------------- ------- ---
/u01/app/oracle/oradata/test/control01.ctl NO
/u01/app/oracle/flash_recovery_area/test/control02.ctl NO
STATUS 为空表示控制文件状态正常;
control01.ctl control02.ctl 两个控制文件互为镜像;
IS_RECOVERY_DEST_FILE VARCHAR2(3) Indicates whether the file was created in theflash recovery area (YES) or not (NO)
values代表是否在回收区;
2.检查Oracle在线日志状态
SQL> select group#,status,type,member,IS_RECOVERY_DEST_FILE from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ---------------------------------------- ---
3 ONLINE /u01/app/oracle/oradata/test/redo03.log NO
2 ONLINE /u01/app/oracle/oradata/test/redo02.log NO
1 ONLINE /u01/app/oracle/oradata/test/redo01.log NO
group# 日志组号 至少要有两个组
status 为空表示状态正常
type online 表示在线 offline 表示离线
member 日志文件的路径
查看日志文件的大小是另外一个视图 v$log
SQL> select group#,bytes/1024/1024 from v$log;
GROUP# BYTES/1024/1024
---------- ---------------
1 200
2 200
3 200
4 200
3.检查Oracle表空间的状态
SQL> select tablespace_name,block_size,max_size,status from dba_tablespaces;
TABLESPACE_NAME BLOCK_SIZE MAX_SIZE STATUS
------------------------------ ---------- ---------- ---------
SYSTEM 8192 2147483645 ONLINE
SYSAUX 8192 2147483645 ONLINE
UNDOTBS1 8192 2147483645 ONLINE
TEMP 8192 2147483645 ONLINE
USERS 8192 2147483645 ONLINE
HSCMP_TBL 8192 2147483645 ONLINE
HSCMP_IDX 8192 2147483645 ONLINE
HSCMP_TBL_LOG 8192 2147483645 ONLINE
HSCMP_TBL_STK 8192 2147483645 ONLINE
HSCMP_TBL_SAL 8192 2147483645 ONLINE
4.检查Oracle数据文件状态
SQL> select file#,name,status,bytes from v$datafile;
FILE# NAME STATUS BYTES
---------- --------------------------------------------- ------- ----------
1 /u01/app/oracle/oradata/test/system01.dbf SYSTEM 828375040
2 /u01/app/oracle/oradata/test/sysaux01.dbf ONLINE 671088640
3 /u01/app/oracle/oradata/test/undotbs01.dbf ONLINE 330301440
4 /u01/app/oracle/oradata/test/users01.dbf ONLINE 5242880
5 /u01/data/HSCMP_TBL.dbf ONLINE 104857600
6 /u01/data/HSCMP_IDX.dbf ONLINE 52428800
7 /u01/data/HSCMP_TBL_LOG.dbf ONLINE 104857600
8 /u01/data/HSCMP_TBL_STK.dbf ONLINE 104857600
9 /u01/data/HSCMP_TBL_SAL.dbf ONLINE 52428800
5.检查无效对象
SQL> select owner,object_name,object_type from dba_objects wherestatus='INVALID';
OWNER OBJECT_NAME OBJECT_TYPE
---------- ------------------------------ --------------------
HSCMP VORDDSTMLKBDORDERQRY VIEW
HSCMP SACP_GETDZDATA PROCEDURE
HSCMP SSAL_XSHZSALEBILLKCOPR PROCEDURE
HSCMP SSAL_XSHZMAIN PROCEDURE
HSCMP SSTK_ADDLSKCXS_ORA PROCEDURE
HSCMP SSTK_BUILDJHPSPC_ORA PROCEDURE
HSCMP SSTO_BUILDTSTOCW_ORA PROCEDURE
HSCMP SSTK_DECLSKCTH_ORA PROCEDURE
HSCMP SSTK_YWNEXT_THCG_ORA PROCEDURE
HSCMP SSTO_COMMIT_WLYK_ORA PROCEDURE
HSCMP SDST_BUILDKCYKBILL_BYPSDIF PROCEDURE
HSCMP SACP_GETKCDATA PROCEDURE
HSCMP SDST_PSDIFBILL_ACCOUNT PROCEDURE
HSCMP SPRC_PACKAGEBILLJZ PROCEDURE
HSCMP SPRC_REQUISITION_ACCOUNT PROCEDURE
HSCMP SRPTRPT10000000002 PROCEDURE
HSCMP PSSY_DB PACKAGE BODY
HSCMP PRF PACKAGE BODY
这些是imp时报错,有些对象没有导入成功,所以都不存在,不用再重新编译
这些都是无效的对象,需要重新编译这些对象。
手动编译无效对象
SQL> alrer package PSSY_DB compile body;
SQL> alrer procedure SRPTRPT10000000002 compile;
SQL> alrer view VORDDSTMLKBDORDERQRY compile;
执行脚本自动编译
[oracle@TEST ~]$ cd /u01/app/oracle/product/11.2.0.4/rdbms/admin/
[oracle@TEST admin]$ sqlplus / as sysdba
SQL> @utlprp.sql
6.检查Oracle回滚段的状态
SQL> select segment_name,owner,status,tablespace_name from dba_rollback_segs;
SEGMENT_NAME OWNER STATUS TABLESPACE_NAME
------------------------------ ---------- ----------------------------------------------
SYSTEM SYS ONLINE SYSTEM
_SYSSMU10_4131489474$ PUBLIC ONLINE UNDOTBS1
_SYSSMU9_1735643689$ PUBLIC ONLINE UNDOTBS1
_SYSSMU8_3901294357$ PUBLIC ONLINE UNDOTBS1
_SYSSMU7_3517345427$ PUBLIC ONLINE UNDOTBS1
_SYSSMU6_2897970769$ PUBLIC ONLINE UNDOTBS1
_SYSSMU5_538557934$ PUBLIC ONLINE UNDOTBS1
_SYSSMU4_1003442803$ PUBLIC ONLINE UNDOTBS1
_SYSSMU3_1204390606$ PUBLIC ONLINE UNDOTBS1
_SYSSMU2_967517682$ PUBLIC ONLINE UNDOTBS1
_SYSSMU1_592353410$ PUBLIC ONLINE UNDOTBS1