修改:2010/2/8
A. 查看所有的实例及其后台进程是否正常
确认所有的instance工作正常,登陆到所有的数据库或instance上,检测oracle后台进程
GDDB4-/export/home/oracle> env | grep SID ORACLE_SID=UWNMS3
GDDB4-/export/home/oracle> ps -ef|grep UWNMS3 | grep -v grep | grep ora oracle 25119 1 0 Jun 24 ? 0:04 ora_dbw4_UWNMS3 oracle 25110 1 0 Jun 24 ? 3:20 ora_dbw1_UWNMS3 oracle 25146 1 0 Jun 24 ? 0:00 ora_reco_UWNMS3 oracle 25125 1 0 Jun 24 ? 0:09 ora_dbw5_UWNMS3 oracle 25142 1 0 Jun 24 ? 5:41 ora_smon_UWNMS3 oracle 25155 1 0 Jun 24 ? 1:17 ora_mmon_UWNMS3 oracle 25152 1 0 Jun 24 ? 101:32 ora_cjq0_UWNMS3 oracle 25102 1 0 Jun 24 ? 0:02 ora_mman_UWNMS3 oracle 25108 1 0 Jun 24 ? 7:37 ora_dbw0_UWNMS3 oracle 25478 1 0 Jun 24 ? 0:45 ora_arc1_UWNMS3 oracle 25470 1 0 Jun 24 ? 0:47 ora_arc0_UWNMS3 oracle 25159 1 0 Jun 24 ? 84:02 ora_mmnl_UWNMS3 oracle 25094 1 0 Jun 24 ? 17:30 ora_pmon_UWNMS3 oracle 25117 1 0 Jun 24 ? 0:41 ora_dbw3_UWNMS3 oracle 25131 1 0 Jun 24 ? 13:12 ora_lgwr_UWNMS3 oracle 20175 1 0 18:27:25 ? 0:00 ora_j000_UWNMS3 oracle 25100 1 0 Jun 24 ? 1:10 ora_psp0_UWNMS3 oracle 25113 1 0 Jun 24 ? 0:14 ora_dbw2_UWNMS3 oracle 25135 1 0 Jun 24 ? 23:50 ora_ckpt_UWNMS3
B.检查文件系统的使用情况
如果文件系统的剩余空间小于10%,则需要删除不必要的文件以释放空间。
GDDB4-/export/home/oracle> df -h
Filesystem size used avail capacity Mounted on /dev/md/dsk/d0 20G 17G 3.1G 85% / /proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab fd 0K 0K 0K 0% /dev/fd swap 85G 192K 85G 1% /var/run
dmpfs 85G 0K 85G 0% /dev/vx/dmp dmpfs 85G 0K 85G 0% /dev/vx/rdmp swap 85G 213M 85G 1% /tmp /dev/vx/dsk/data10dg/Ora_File_Vol01
394G 292G 98G 75% /data05 /dev/vx/dsk/data1dg/vola0131
443G 156G 283G 36% /archivelog
注意:需要特别关注根目录,数据库软件和数据库备份所在目录的剩余空间情况!
备注:数据库运行日志的及时清除
1). 可清除bdump,cdump,udump下的相关日志
$ cd bdump $ ls -l total 174
-rwxrwxrwx 1 oracle dba 59047 Jul 30 22:02 alert_UWNMS1.log
-rwxrwxrwx 1 oracle dba 1000 Jul 14 22:00 uwnms1_j000_18128.trc -rw-r----- 1 oracle dba 1000 Jul 22 22:00 uwnms1_j001_5369.trc -rwxrwxrwx 1 oracle dba 695 Jul 14 19:12 uwnms1_lgwr_18100.trc -rwxrwxrwx 1 oracle dba 2668 Jul 30 22:02 uwnms1_lgwr_19661.trc -rwxrwxrwx 1 oracle dba 983 Jul 14 17:36 uwnms1_lgwr_7816.trc -rwxrwxrwx 1 oracle dba 955 Jul 14 19:11 uwnms1_lgwr_7883.trc -rwxrwxrwx 1 oracle dba 803 Jul 14 17:31 uwnms1_p000_7714.trc -rwxrwxrwx 1 oracle dba 801 Jul 14 17:31 uwnms1_p001_7716.trc
$ cp /dev/null alert_UWNMS1.log $ rm *.trc
$ cd ../cdump $ ls -l total 4
drwxr-x--- 2 oracle dba 512 Jul 25 14:12 core_18095 drwxr-x--- 2 oracle dba 512 Jul 25 19:17 core_25934
$ cd ../udump $ ls -l
total 20042
-rw-r----- 1 oracle dba 505 Jul 16 16:33 uwnms1_ora_14771.trc -rw-r----- 1 oracle dba 4516169 Jul 25 14:12 uwnms1_ora_18095.trc -rwxrwxrwx 1 oracle dba 4 Jul 14 19:12 uwnms1_ora_18119.trc -rw-r----- 1 oracle dba 505 Jul 30 15:11 uwnms1_ora_18820.trc -rwxrwxrwx 1 oracle dba 774 Jul 15 10:23 uwnms1_ora_19573.trc -rwxrwxrwx 1 oracle dba 587 Jul 15 10:23 uwnms1_ora_195.trc
-rwxrwxrwx 1 oracle dba 4 Jul 15 10:23 uwnms1_ora_19680.trc -rw-r----- 1 oracle dba 720942 Jul 15 16:28 uwnms1_ora_24759.trc -rw-r----- 1 oracle dba 4951562 Jul 25 19:17 uwnms1_ora_25934.trc -rw-r----- 1 oracle dba 505 Jul 15 17:21 uwnms1_ora_27326.trc -rw-r----- 1 oracle dba 503 Jul 30 16:54 uwnms1_ora_6612.trc -rwxrwxrwx 1 oracle dba 585 Jul 14 17:12 uwnms1_ora_7523.trc -rwxrwxrwx 1 oracle dba 767 Jul 14 17:30 uwnms1_ora_7566.trc
2). 可清除oracle的监听日志
$ cd $ORACLE_HOME/network/log $ ls -l
total 533072
-rwxrwxrwx 1 oracle dba 272507851 Jul 31 11:28 listener.log -rw-r--r-- 1 oracle dba 257876 Jul 31 08:48 sqlnet.log $ cp /dev/null listener.log
C.查找警告日志文件
1. 联接每一个操作管理系统
2. 使用„TELNET‟或是可比较程序
3. 对每一个管理实例,经常的执行$ORACLE_BASE/ 4. 在提示下,使用UNIX 中的„TAIL‟命令查看alert_ 5. 如果发现任何ORA_ERRORS (ORA-XXX) 的错误,将它记录并且仔细的研究它们,或反馈给DB组 如何确定警告日志文件的路径? 通过参看起始参数文件 init $ cd $ORACLE_HOME/dbs $ cat initUWNMS1.ora *.background_dump_dest='/opt/oracle/product/10g/admin/UWNMS1/bdump' *.core_dump_dest='/opt/oracle/product/10g/admin/UWNMS1/cdump' *.user_dump_dest='/opt/oracle/product/10g/admin/UWNMS1/udump' D.检查数据库备份是否成功 ※对RMAN备份方式: 检查第三方备份工具的备份日志以确定备份是否成功 如果具备恢复目录的,可直接登陆到rman环境下,发命令list backup查看具体备份集合的情况; GDDB4-/> rman target=sys/xxx@uwnms3 catalog=rman/rman@uwnms3 Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jul 31 11:39:37 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: UWNMS3 (DBID=2229785441) connected to recovery catalog database RMAN> list backup; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 422624 Incr 0 12.59M DISK 00:00:07 2008-07-28 03:15:21 BP Key: 422631 Status: AVAILABLE Compressed: YES Tag: BK0 Piece Name: /export/home/oracle/rman3/bk0_UWNMS3_20080728_2393 List of Datafiles in backup set 422624 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 2 0 Incr 35321096 2008-07-28 03:15:14 /archivelog/oradata/UWNMS3/undo01.dbf 5 0 Incr 35321096 2008-07-28 03:15:14 /archivelog/oradata/UWNMS3/system2.dbf ※对EXPORT,EXPDP逻辑备份方式: 检查exp,expdp日志文件以确定备份是否成功 ※对其他备份方式: 检查相应的日志文件 E.检查表空间的使用情况 1. 检查在表空间中有没有剩余空间。 对每一个实例来说,检查在表空间中是否存在有剩余空间来满足当天的预期的需要。当数据库中已有的数据是稳定的,数据日增长的平均数也是可以计算出来,最小的剩余空间至少要能满足每天数据的增长。 脚本: select t.tablespace_name, total, free, round(100*(1-(free/total)),3)||'%' as已使用的空间 比例 from (select tablespace_name, sum(bytes)/1024/1024 total from dba_data_files group by tablespace_name) t,(select tablespace_name, sum(bytes)/1024/1024 free from dba_free_space group by tablespace_name) f where t.tablespace_name=f.tablespace_name(+) and t.tablespace_name not in ('DRSYS','ORDIM','SPATIAL','USERS','TOOLS','XDB') order by round(100*(1-(free/total)),3) desc; 2. 识别出表空间下一些过分的对象空间增长 查看数据库中超出资源或是增长速度过大的段,具体分析看是否需要调整。 select owner,segment_name,partition_name,bytes/1024/1024 from dba_segments where tablespace_name = 'NRMTBS' order by bytes desc 根据实际情况,先清除临时无用的数据库对象;或回收部分频繁dml操作的库表空间 Oracle 10g下的一些处理: -- 库表: alter table prdb.MLOG$_FACT_AGG2BSC_BASE_PI move 注意:move后建立于数据库对象上的索引会失效,记住一定要重新编译!! /* -- 以下脚本用于检查失效的索引 select * from dba_indexes where status not in ('VALID','N/A') SELECT index_name,PARTITION_NAME,TABLESPACE_NAME FROM USER_IND_PARTITIONS WHERE status = 'UNUSABLE' ORDER BY PARTITION_NAME; */ -- 索引: alter index NPMDB.UQ_TPA_SAE_SUM rebuild tablespace idxdbs online nologging parallel 4 ; alter index NPMDB.UQ_TPA_SAE_SUM noparallel; 3. 表空间管理 -- 创建表空间 CREATE tablespace apmdbs1 datafile '/dev/vx/rdsk/data1dg/vola0101' size 4095M extent management local segment space management auto; 注: 添加裸设备上的数据文件请注意路径 /dev/rdsk/c0t0d0s0 裸设备 /dev/dsk/c0t0d0s0 块设备 它们链接的是同一块物理设备,具体区别是在访问方式上。 裸设备是假设硬盘上没有文件系统时的访问方式。裸设备是按顺序访问,块设备是按文件系统和i节点“随机”访问。二者的使用场合也不同。在做newfs之前,因为没有文件系统,只能访问裸设备;做了newfs,进行挂接时,因为需要访问磁盘上的文件系统,所以只能用块设备 -- 增加数据文件,扩充表空间 ALTER TABLESPACE PRTBS19 ADD DATAFILE '/dev/vx/rdsk/data2dg/volb0082' SIZE 4095M AUTOEXTEND OFF; ASM下: Uwnms1: alter tablespace NRMTBS add datafile '+DISKGROUP1' size 8192M autoextend off Uwnms2: alter tablespace PRTBS add datafile '+DISKGROUP2' size 8192M autoextend off -- 增加临时文件,扩充临时表空间 ALTER tablespace TEMP ADD tempfile '/dev/vx/rdsk/data2dg/temp02' size 4095M reuse; -- 数据文件收缩,针对文件系统上的数据文件 alter database datafile '$HOME/DATA/DISK5/data02.dbf' resize 1500k; ASM下: Select file_name,tablespace_name,bytes/1024/1024||'M','alter database datafile '''||file_name||''' resize 22528M;' from dba_data_files where tablespace_name = 'IDXDBS' alter database datafile '+DISKGROUP2/uwnms2/datafile/npmdbs.532.694287447' resize 15360M; F.检查数据文件的状态 检查数据文件的状态记录状态不是“online”的数据文件,并及时联系DB组跟进。 SQL> set linesize 200 SQL> set pagesize 200 SQL> Select file_name from dba_data_files where status='OFFLINE'; no rows selected G.检查数据库会话 分数据库用户统计数据库会话的情况: select schemaname,count(1) from v$session group by schemaname 分数据库用户,模块统计数据库会话的情况: select schemaname,program,count(1) from v$session where schemaname <> 'SYS' group by schemaname,program 杀掉异常的会话或会话对应的进程:(以具有DBA权限的用户来清除会话) select sid,serial# from v$session where sid = $sid select spid from v$process where addr in ( select paddr from v$session where sid = $sid ) alter system kill session „ 如果执行上述命令后,仍然没有能及时释放会话,可直接杀掉会话对应的服务器进程 kill -9 H.检查数据库主机的性能情况 检查数据库所在主机的性能,记录数据库的cpu使用、IO、buffer命中率等等,使用vmstat,iostat,top等命令 Vmstat: 关注cpu的idle Iostat:关注磁盘IO的繁忙程度(%b) Top: 关注消耗cpu多的相关进程 Oracle 10g EM监控: I. 数据库的正常启动与关闭 -- 关闭步骤: 1.停止监听 GDDB4-/export/home/oracle> lsnrctl stop 2.停止实例 使用sql*plus工具,以具有DBA权限的数据库用户登陆到具体实例上操作 GDDB4-/export/home/oracle> setenv ORACLE_SID UWNMS3 GDDB4-/export/home/oracle> sqlplus /nolog SQL*Plus: Release 10.2.0.3.0 - Production on Thu Jul 31 15:06:23 2008 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. SQL> conn sys/xxxxxx as sysdba Connected. SQL> shutdown immediate 3. 检查实例相关进程 GDDB4-/export/home/oracle> ps -ef|grep UWNMS3 oracle 25119 1 0 Jun 24 ? 0:04 ora_dbw4_UWNMS3 oracle 25110 1 0 Jun 24 ? 3:23 ora_dbw1_UWNMS3 oracle 25146 1 0 Jun 24 ? 0:00 ora_reco_UWNMS3 oracle 25125 1 0 Jun 24 ? 0:09 ora_dbw5_UWNMS3 oracle 25142 1 0 Jun 24 ? 5:49 ora_smon_UWNMS3 oracle 25155 1 0 Jun 24 ? 1:19 ora_mmon_UWNMS3 oracle 25152 1 0 Jun 24 ? 103:58 ora_cjq0_UWNMS3 oracle 25102 1 0 Jun 24 ? 0:02 ora_mman_UWNMS3 oracle 25108 1 0 Jun 24 ? 7:49 ora_dbw0_UWNMS3 oracle 25478 1 0 Jun 24 ? 0:46 ora_arc1_UWNMS3 oracle 25470 1 0 Jun 24 ? 0:49 ora_arc0_UWNMS3 oracle 7770 1 0 15:06:42 ? 0:00 ora_j000_UWNMS3 oracle 25159 1 0 Jun 24 ? 86:03 ora_mmnl_UWNMS3 oracle 25094 1 0 Jun 24 ? 17:55 ora_pmon_UWNMS3 oracle 25117 1 0 Jun 24 ? 0:42 ora_dbw3_UWNMS3 oracle 25131 1 0 Jun 24 ? 13:32 ora_lgwr_UWNMS3 oracle 25100 1 0 Jun 24 ? 1:11 ora_psp0_UWNMS3 oracle 25113 1 0 Jun 24 ? 0:15 ora_dbw2_UWNMS3 oracle 25135 1 0 Jun 24 ? 24:23 ora_ckpt_UWNMS3 oracle 18673 1 0 Jun 11 ? 47:45 oracleUWNMS3 (LOCAL=NO) oracle 14299 1 0 15:00:06 ? 0:00 oracleUWNMS3 (LOCAL=NO) oracle 28391 1 0 11:23:55 ? 0:12 oracleUWNMS3 (LOCAL=NO) oracle 10004 1 1 15:08:02 ? 0:17 oracleUWNMS3 (LOCAL=NO) 紧急情况下,可手工直接杀掉带LOCAL标识的进程,加快数据库的关闭操作;但oracle的相关后台进程请不要随便KILL掉。 -- 启动步骤: 1.启动实例 使用sql*plus工具,以具有DBA权限的数据库用户登陆到具体实例上操作 GDDB4-/export/home/oracle> setenv ORACLE_SID UWNMS3 GDDB4-/export/home/oracle> sqlplus /nolog SQL*Plus: Release 10.2.0.3.0 - Production on Thu Jul 31 15:06:23 2008 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. SQL> conn sys/xxxxxx as sysdba Connected. SQL> startup 2.启动监听 GDDB4-/export/home/oracle> lsnrctl start 3. 检查实例相关进程 GDDB4-/export/home/oracle> ps -ef|grep UWNMS3 oracle 25119 1 0 Jun 24 ? 0:04 ora_dbw4_UWNMS3 oracle 25110 1 0 Jun 24 ? 3:23 ora_dbw1_UWNMS3 oracle 25146 1 0 Jun 24 ? 0:00 ora_reco_UWNMS3 oracle 25125 1 0 Jun 24 ? 0:09 ora_dbw5_UWNMS3 oracle 25142 1 0 Jun 24 ? 5:49 ora_smon_UWNMS3 oracle 25155 1 0 Jun 24 ? 1:19 ora_mmon_UWNMS3 oracle 25152 1 0 Jun 24 ? 103:58 ora_cjq0_UWNMS3 oracle 25102 1 0 Jun 24 ? 0:02 ora_mman_UWNMS3 oracle 25108 1 0 Jun 24 ? 7:49 ora_dbw0_UWNMS3 oracle 25478 1 0 Jun 24 ? 0:46 ora_arc1_UWNMS3 oracle 25470 1 0 Jun 24 ? 0:49 ora_arc0_UWNMS3 oracle 7770 1 0 15:06:42 ? 0:00 ora_j000_UWNMS3 oracle 25159 1 0 Jun 24 ? 86:03 ora_mmnl_UWNMS3 oracle 25094 1 0 Jun 24 ? 17:55 ora_pmon_UWNMS3 oracle 25117 1 0 Jun 24 ? 0:42 ora_dbw3_UWNMS3 oracle 25131 1 0 Jun 24 ? 13:32 ora_lgwr_UWNMS3 oracle 25100 1 0 Jun 24 ? 1:11 ora_psp0_UWNMS3 oracle 25113 1 0 Jun 24 ? 0:15 ora_dbw2_UWNMS3 oracle 25135 1 0 Jun 24 ? 24:23 ora_ckpt_UWNMS3 J. 多使用已有网络资料 多使用网络搜索,查询oracle日常问题的解决方式 如果有可能的话,要广泛的阅读,包括DBA手册,itpub数据库论坛。 * 基础重于一切。 * 思考才能提高。 * 严谨是一种必备的素质。 * 实践出真知,不要以为然,亲自动手。 * 工欲善其事必先利其器,选择熟悉好适合自己的工具。(TOAD, PL/SQL Developer, Oracle EM, SQL*PLUS) 延伸阅读: 1.eBOOK Oracle 9i Database Concepts (基础) Oracle 9i Database Administrator’s Guide (管理) 其它: Oracle 9i 初学者指南,Expert One-On-One Oracle, Oracle 9i:The Complete Reference Oracle Performance Tuning 101 (性能优化) Oracle 8i 备份与恢复手册 (备份与恢复) 2.WEB SITE www.itpub.net www.asktom.oracle.com
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- axer.cn 版权所有 湘ICP备2023022495号-12
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务