已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Oracle数据库日常管理_项目现场篇修改:2010/2/8A. 查看所有的实例及其后台进程是否正常确认所有的instance工作正常,登陆到所有的数据库或instance上,检测oracle后台进程GDDB4-/export/home/oracle env | grep SIDORACLE_SID=UWNMS3GDDB4-/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_UWNMS3B检查文件系统的使用情况如果文件系统的剩余空间小于10,则需要删除不必要的文件以释放空间。GDDB4-/export/home/oracle df -hFilesystem size used avail capacity Mounted on/dev/md/dsk/d0 20G 17G 3.1G 85% /proc 0K 0K 0K 0% /procmnttab 0K 0K 0K 0% /etc/mnttabfd 0K 0K 0K 0% /dev/fdswap 85G 192K 85G 1% /var/rundmpfs 85G 0K 85G 0% /dev/vx/dmpdmpfs 85G 0K 85G 0% /dev/vx/rdmpswap 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 -ltotal 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 -ltotal 4drwxr-x- 2 oracle dba 512 Jul 25 14:12 core_18095drwxr-x- 2 oracle dba 512 Jul 25 19:17 core_25934$ cd ./udump$ ls -ltotal 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 644 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_19645.trc-rwxrwxrwx 1 oracle dba 644 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.trc2). 可清除oracle的监听日志$ cd $ORACLE_HOME/network/log$ ls -ltotal 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.logC查找警告日志文件1. 联接每一个操作管理系统2. 使用TELNET或是可比较程序3. 对每一个管理实例,经常的执行$ORACLE_BASE/bdump 操作,并使其能回退到控制数据库的SID。4. 在提示下,使用UNIX 中的TAIL命令查看alert_.log,或是用其他方式检查文件中最近时期的警告日志5. 如果发现任何ORA_ERRORS (ORA-XXX) 的错误,将它记录并且仔细的研究它们,或反馈给DB组如何确定警告日志文件的路径? 通过参看起始参数文件 init.ora,而起始参数文件一般存储在$ORACLE_HOME/dbs下$ 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/udumpD检查数据库备份是否成功对RMAN备份方式:检查第三方备份工具的备份日志以确定备份是否成功如果具备恢复目录的,可直接登陆到rman环境下,发命令list backup查看具体备份集合的情况; GDDB4-/ rman target=sys/xxxuwnms3 catalog=rman/rmanuwnms3Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jul 31 11:39:37 2008Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: UWNMS3 (DBID=2229785441)connected to recovery catalog databaseRMAN 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 offUwnms2: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 200SQL set pagesize 200SQL Select file_name from dba_data_files where status=OFFLINE;no rows selectedG检查数据库会话分数据库用户统计数据库会话的情况: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 = $sidselect 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的idleIostat:关注磁盘IO的繁忙程度(%b)Top: 关注消耗cpu多的相关进程Oracle 10g EM监控:I. 数据库的正常启动与关闭- 关闭步骤:1停止监听GDDB4-/export/home/oracle lsnrctl stop2停止实例使用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 2008Copyright (c) 1982, 2006, Oracle. All Rights Reserved.SQL conn sys/xxxxxx as sysdbaConnected.SQL shutdown immediate3. 检查实例相关进程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 2008Copyright (c) 1982, 2006, Oracle. All Rights Reserved.SQL conn sys/xxxxxx as sysdbaConnected.SQL startup2启动监听GDDB4-/export/home/oracle lsnrctl start3. 检查实例相关进程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_UWNM
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 施工协议解除协议书
- T∕DEFA 003-2025 黑木耳菌渣栽培元蘑技术规程
- 文物租借保护协议书
- 书印刷设计合同范本
- 敬老院劳务合同范本
- 木门及家具合同范本
- 文制作服务合同范本
- 书店合伙协议书模板
- 职场知识考试题及答案(时间管理)
- 2026-2031年中国牛奶市场现状调研及投资发展战略研究报告
- 合同签订培训课件
- 诊疗技术规范与医疗操作规程
- 小学班主任经验交流课件
- 人教版七年级上册历史全册思维导图
- 宫颈癌术后护理
- 西师版五年级上册(全册)数学【知识点详细梳理】
- 自然地理与资源环境专业生涯发展展示
- 福建省泉州市四校2024-2025学年高二上学期11月期中联考物理试卷(含答案)
- 重度贫血病例讨论
- 高考英语读后续写专题 02 话题分类+公益组织、公益活动(人与社会)
- 《失智老年人照护》课件-项目四:失智老年人康复照护
评论
0/150
提交评论