Oracle 数据库日常巡检
- 格式:docx
- 大小:57.33 KB
- 文档页数:14
oracle 日常维护工作内容(1). 每天对ORACLE数据库的运行状态,日志文件,备份情况,数据库的空间使用情况,系统资源的使用情况进行检查,发现并解决问题。
(2). 每周对数据库对象的空间扩展情况,数据的增长情况进行监控,对数据库做健康检查,对数据库对象的状态做检查。
====================每天工作====================1.(1).确认所有的INSTANCE状态正常.登陆到所有数据库或例程,检测ORACLE后台进程:$ps –-ef|grep ora(2). 检查文件系统的使用(剩余空间)。
如果文件系统的剩余空间小于20%,需删除不用的文件以释放空间。
对于业务交易生产系统和数据库日志归档目录,当空间不足,请急时清理.$df -h(3). 检查日志文件和trace文件记录alert和trace文件中的错误.连接到数据库服务器cd 到bdump目录,通常是$ORACLE_BASE/admin/<SID>/bdump‘tail’命令来查看alert_<SID>.log文件如果发现任何新的ORA- 错误,记录并解决(4). 检查数据文件的状态记录状态不是“online”的数据文件,并做恢复。
Select file_name from dba_data_files where status=’OFFLINE’(5). 检查表空间的使用情况SELECT SUM(bytes) / (1024 * 1024) AS free_space, tablespace_nameFROM dba_free_spaceGROUP BY tablespace_name;SELECT a.tablespace_name,a.bytes total,b.bytes used,c.bytes free,(b.bytes * 100) / a.bytes "% USED ",(c.bytes * 100) / a.bytes "% FREE "FROM sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free cWHERE a.tablespace_name = b.tablespace_nameAND a.tablespace_name = c.tablespace_name;(6). 检查剩余表空间SELECT tablespace_name, SUM (blocks) AS free_blk,TRUNC (SUM (BYTES) / (1024 * 1024)) AS free_m,MAX (BYTES) / (1024) AS big_chunk_k, COUNT (*) AS num_chunks FROM dba_free_spaceGROUP BY tablespace_name;(7). 检查数据库性能,记录数据库的cpu使用、IO、buffer命中率等等使用vmstat,iostat,glance,top等命令====================每周工作====================(1). 监控数据库对象的空间扩展情况根据本周每天的检查情况找到空间扩展很快的数据库对象,并采取相应的措施alter tablespace 表空间名add datafile '/u1/oradata/userdata_002.ora' size *m;(2). 检查无效的数据库对象SELECT owner, object_name, object_typeFROM dba_objectsWHERE status = 'invalid';(3). 检查不起作用的约束SELECT owner, constraint_name, table_name, constraint_type, statusFROM dba_constraintsWHERE status = 'DISABLED' AND constraint_type = 'P' ;(4). 检查无效的triggerSELECT owner, trigger_name, table_name, statusFROM dba_triggersWHERE status = 'DISABLED';====================每月的工作====================(1). 检查表空间碎片根据本月每周的检查分析数据库碎片情况,找到相应的解决方法(2). 寻找数据库性能调整的机会比较每天对数据库性能的监控报告,确定是否有必要对数据库性能进行调整(3). 数据库性能调整如有必要,进行性能调整(4). 提出下一步空间管理计划根据每周的监控,提出空间管理的改进方法============================================================================|| ★★★Oracle DBA 日常管理★★★||============================================================================目的:这篇文档有很详细的资料记录着对一个甚至更多的ORACLE 数据库每天的,每月的,每年的运行的状态的结果及检查的结果,在文档的附录中你将会看到所有检查,修改的SQL和PL/SQL 代码。
Oracle 数据库日常检查A.查看所有的实例及其后台进程是否正常确认所有的instanee 工作正常,登陆到所有的数据库或instanee 上,检测oracle后台进程$env | grep SIDORACLE_SID=UWNMS3B .检查文件系统的使用情况如果文件系统的剩余空间小于10 %,则需要删除不必要的文件以释放空间。
$df -hFilesystem size/dev/md/dsk/dO 20G /proc 0K mn ttab 0K fd 0K swap 85G dmpfs 85G dmpfs 85G swap 85G/dev/vx/dsk/data10dg/Ora_File_Vol01394G/dev/vx/dsk/data1dg/vola0131443G used avail capacity Moun ted on 17G 3.1G 85% /0K 0K 0% /proc0K 0K 0% /etc/ mn ttab 0K 0K 0% /dev/fd192K 85G 1% /var/r un 0K 85G 0% /dev/vx/dmp0K 85G 0% /dev/vx/rdmp 213M 85G 1% /tmp292G 98G 75% /data05156G 283G 36% /archivelogAIX:$df -g or df -kHP-UX$bdf or df -k or df -h注意:需要特别关注根目录,数据库软件和数据库备份所在目录的剩余空间情况!备注:数据库运行日志的及时清除1). 可清除bdump,cdump,udump 下的相关日志$ cd $ORACLE_BASE/admi n/db_ name/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_j 001_5369.trc-rwxrwxrwx 1 oracle dba 695 Jul 14 19:12 uwnm s1_lgwr_18100.trc -rwxrwxrwx 1 oracle dba2668 Jul 30 22:02 uwnms1」gwr_19661.trc -rwxrwxrwx 1 oracle dba 983 Jul 14 17:36 uwnm s1_lgwr_7816.trc -rwxrwxrwx 1 oracle dba 955 Jul 14 19:11 uwnm s1_lgwr_7883.trc -rwxrwxrwx 1 oracle dba 803 Jul 14 17:31 uwnm s1_p000_7714.trc -rwxrwxrwx 1 oracle dba 801 Jul 14 17:31 uwnm s1_p001_7716.trc$ cd ../cdump$ Is -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 uwnm s1_ora_14771.trc -rw-r— 1 oracle dba 4516169 Jul 25 14:12 uwnm s1_ora_18095.trc-rwxrwxrwx 1 oracle dba 644 Jul 14 19:12 uwnm s1_ora_18119.trc -rw-r— 1 oracle dba 505 Jul 30 15:11 uwnm s1_ora_18820.trc -rwxrwxrwx 1 oracle dba 774 Jul 15 10:23 uwnm s1_ora_19573.trc -rwxrwxrwx 1 oracle dba 587 Jul 15 10:23 uwnm s1_ora_19645.trc -rwxrwxrwx 1 oracle dba 644 Jul 15 10:23 uwnm s1_ora_19680.trc -rw-r— 1 oracle dba 720942 Jul 15 16:28 uwnm s1_ora_24759.trc -rw-r— 1 oracle dba 4951562 Jul 25 19:17 uwnm s1_ora_25934.trc-rw-r— 1 oracle dba 505 Jul 15 17:21 uwnm s1_ora_27326.trc -rw-r— 1 oracle dba 503 Jul 30 16:54 uwnm s1_ora_6612.trc-rwxrwxrwx 1 oracle dba 585 Jul 14 17:12 uwnm s1_ora_7523.trc -rwxrwxrwx 1 oracle dba 767 Jul 14 17:30 uwnm s1_ora_7566.trc2).可清除oracle 的监听日志$ cd $ORACLE_HOME/network/log$ ls -ltotal 533072-rwxrwxrwx 1 oracle dba 272507851 Jul 31 11:28 liste ner 」og -rw-r--r-- 1 oracle dba 257876 Jul 31 08:48 sql net.log$ cp /dev/ nu II liste ner 」ogC .查找警告日志文件1. 联接每一个操作管理系统2. 使用’TELNETS是可比较程序3. 对每一个管理实例,经常的执行 $ORACLE_BASE/<SID>/bdump 操作,并使其能回退到控制数据库的 SID 。
oracle日常巡检内容Oracle日常巡检内容1. 数据库配置检查•确认数据库参数设置是否合理•检查数据库和实例的名称及归属•检查数据库初始化参数是否按照最佳实践进行了配置2. 存储检查•检查表空间的使用情况,确保没有存储空间不足的情况出现•检查数据库文件的大小和增长情况,是否需要进行调整•检查redo日志文件的大小和数量,是否满足数据库的需求3. 逻辑结构检查•检查表、索引及其关联的约束是否正常•检查视图、存储过程、函数和触发器的状态和有效性•检查数据库对象的权限和所有权是否正确4. 数据完整性检查•检查数据表的行完整性,是否存在脏数据或冗余数据•检查约束的有效性和唯一性,是否存在违反约束的数据5. 性能检查•检查数据库的运行性能,包括CPU利用率、内存使用和磁盘I/O 等指标•检查SQL的执行计划,优化可能存在的性能瓶颈•检查数据库连接数和会话数,是否超过系统的承载能力6. 安全性检查•检查用户权限,确保每个用户的权限不超过其所需•检查密码策略和账号锁定设置,防范未授权访问和暴力破解•检查数据库日志和审计功能的开启情况,以跟踪和监控潜在的安全风险7. 备份和恢复检查•检查数据库的备份策略是否合理,并进行备份的可行性验证•检查恢复策略和操作步骤,确认数据库故障时的可靠性和可恢复性•检查归档日志的生成和转储情况,确保数据库的连续性和完整性8. 资源利用检查•检查数据库的资源利用情况,包括SGA和PGA的大小及利用率•检查数据文件、临时文件和日志文件的大小和利用率•检查并发和批处理作业,以保障系统资源的合理分配与利用以上是Oracle日常巡检的一些常见内容,通过对数据库配置、存储、逻辑结构、数据完整性、性能、安全性、备份恢复和资源利用等方面的检查,可以确保数据库的稳定性、安全性和可靠性。
巡检内容的具体细节可以根据实际需求进行适当调整和补充。
9. 日志监控•检查数据库日志文件的大小和增长情况,是否超过了预设阈值•检查日志文件的生成和转储是否正常,确保日志的连续性和完整性•监控错误日志和警告日志,及时发现并解决潜在的问题10. 定期维护•执行定期维护任务,例如统计表和索引的信息,更新数据库统计信息•定期收集和分析数据库性能指标,并作出相应的调整和优化•检查数据库软件及补丁的更新情况,确保数据库系统的安全和稳定11. 连接和会话管理•检查数据库连接数和会话数的变化趋势,确保系统的可用性和稳定性•监控长时间运行的会话和阻塞会话,及时解决可能的问题•检查连接和会话的权限和资源限制,防止滥用和资源浪费12. 监控和告警•设置数据库的监控和告警机制,及时发现和解决潜在的问题•监控数据库的系统资源利用率,预测和避免系统性能下降•监控数据库对象的变化和异常操作,保障数据的安全性和完整性13. 灾备和容灾•检查灾备和容灾系统的配置和状态,确保备份和恢复的可靠性•定期测试灾备和容灾方案的可行性,并进行必要的调整和优化•监控主备数据库之间的数据同步情况,保证数据的一致性和可用性14. 文档和记录•维护数据库巡检的文档和记录,包括巡检日期、巡检内容和发现的问题•归档和备份巡检记录,以便日后的审查和比对•根据巡检结果制定和执行相应的改进措施,持续优化数据库的运行和管理巡检内容的详细执行方法和频率将根据数据库的特定需求和环境进行调整和规划。
Oracle小型机日常巡检Oracle小型机日常巡检企业的业务数据库系统是IT运维的重中之重,为使数据库长期稳定的运行,需要相关人员对数据库进行每日巡检和记录,下面对数据库日常巡检工作做一个全面详细的计划:一、小型机日常巡检:1. 检查小型机硬件健康状态1.1 显示内核启用的是32位还是64位# bootinfo -K641.2 显示硬件32位还是64位:# bootinfo -y641.3 显示以KB为单位的实际内存:# bootinfo -r325058561.4 显示系统上的硬盘数量# lspvhdisk0 00c7c505bc0669c5 rootvg activehdisk1 00c7c50592cdd77a rootvg activehdisk2 00cb9934c0a92e73 datavg activehdisk3 00c7c505ce5e6688 datavg active1.5 查看硬盘hdisk1的详细信息:# lspv hdisk1PHYSICAL VOLUME: hdisk1 VOLUME GROUP: rootvgPV IDENTIFIER: 00c7c50592cdd77a VG IDENTIFIER 00c7c50500004c0000000129bc06773fPV STATE: activeSTALE PARTITIONS: 0 ALLOCATABLE: yesPP SIZE: 512 megabyte(s) LOGICAL VOLUMES: 14TOTAL PPs: 558 (285696 megabytes) VG DESCRIPTORS: 2FREE PPs: 224 (114688 megabytes) HOT SPARE: noUSED PPs: 334 (171008 megabytes) MAX REQUEST: 1 megabyteFREE DISTRIBUTION: 01..00..00..111..112USED DISTRIBUTION: 111..112..111..00..00MIRROR POOL: None# smitty fs# smitty lvm1.6 查看处理器数量:# lscfg | grep proc+ proc0 Processor+ proc2 Processor+ proc4 Processor+ proc6 Processor1.7 查看一个CPU的详细信息:# lsattr -El proc0frequency 4204000000 Processor Speed Falsesmt_enabled true Processor SMT enabled Falsesmt_threads 2 Processor SMT threads Falsestate enable Processor state Falsetype PowerPC_POWER6 Processor type False#1.8 查看系统硬件资源列表:#lscfg1.9 查看芯片类型:# uname -ppowerpc1.10 查看操作系统版本号:oslevel1.11 显示系统名称:# uname -sAIX1.12 显示节点名称:# uname -nDL-DB-021.13 显示uname的很多信息(系统名称、节点名称、版本、计算机ID):# uname -aAIX DL-DB-02 1 6 00C7C5054C001.14 显示系统型号:# uname -MIBM,8204-E8A1.15 显示操作系统版本:# uname -v61.16 显示运行系统的硬件的计算机ID编号:# uname-m00C7C5054C001.17 显示系统ID编号:# uname -uIBM,02067C5051.18 显示AIX的主要版本、次要版本和维护级:# oslevel -r6100-04# lslpp -h bos.rteFileset Level Action Status Date Time----------------------------------------------------------------------------Path: /usr/lib/objreposbos.rte6.1.4.0 COMMIT COMPLETE 07/10/10 19:07:31Path: /etc/objreposbos.rte6.1.4.0 COMMIT COMPLETE 07/10/10 19:07:31#1.19 查看磁盘使用情况(参数k表示以k为单位,m表示以M为单位):# df -kFilesystem 1024-blocks Free %Used Iused %Iused Mounted on/dev/hd4 5242880 5039512 4% 14271 2% //dev/hd2 11534336 5382688 54% 52471 5% /usr/dev/hd9var 5242880 4544720 14% 7487 1% /var/dev/hd3 10485760 10397956 1% 4002 1% /tmp/dev/fwdump 1048576 1046932 1% 13 1% /var/adm/ras/platform/dev/hd1 5242880 5241708 1% 8 1% /home/dev/hd11admin 524288 523848 1% 5 1% /admin/proc - - - - - /proc/dev/hd10opt 10485760 5696856 46% 10713 1% /opt/dev/livedump 524288 523880 1% 4 1% /var/adm/ras/livedump/dev/oradmpbak 10485760 4488028 58% 28042 3% /orainstbak1/dev/oraclebak 62914560 9605248 85% 33 1% /oradatabak1 /dev/oradata 367001600 321016968 13% 33 1% /oradata/dev/orainst 20971520 14943512 29% 28707 1% /orainst1.20 查看文件大小# du -s tmp166552 tmp2. 检查系统报错信息2.1 显示简短报错信息# errpt | moreTIMESTAMP: MMDDHHMMYY (月日时分年)T(类型): P 永久; T 临时; U 未知(永久性的错误应引起重视)C(分类): H 硬件; S 软件; O 用户; U未知2.2 列出所有硬件出错信息:# errpt -d H2.3 列出所有软件出错信息:# errpt -d S2.4 查看具体某个ID的报错信息:# errpt -aj D666A8C7 > aaa.txtD666A8C7是简短报错信息中的ID号。
Subject:How to Perform a Healthcheck on theDatabaseDoc ID: Note:122669.1 Type: BULLETIN Last Revision Date: 20-MAR-2008 Status: PUBLISHEDTable of Contents-----------------1. Introduction2. Parameter file3. Controlfiles4. Redolog files5. Archiving6. Datafiles6.1 Autoextend6.2 Location7. Tablespaces7.1 SYSTEM Tablespace7.2 SYSAUX Tablespace7.3 Locally vs Dictionary Managed Tablespaces7.4 Temporary Tablespace7.5 Tablespace Fragmentation8. Objects8.1 Number of Extents8.2 Next extent8.3 Indexes9. AUTO vs MANUAL undo9.1 AUTO Undo9.2 Manual undo10. Memory Management10.1 Pre-Oracle 9i10.2 Oracle 9i10.3 Oracle 10g10.4 Oracle 11g11. Logging & Tracing11.1 Alert File11.2 Max_dump_file_size11.3 User and core dump size parameters11.4 Audit files11.5 Sqlnet1. Introduction---------------This article explains how to perform a health check on the database. General guidelines are given on what areas to investigate to get a better overview onhow the database is working and evolving. These guidelines will reveal common issues regarding configuration as well as problems that may occur in the future.The areas investigated here are mostly based on scripts and are brought to you without any warranty, these scripts may need to be adapted for next database releases and features. This article will probably need to be extended to serve specific application needs/checks.Although some performance areas are discussed in this article, it is not the intention of this article to give a full detailed explanation of optimizing the database performance.General scripts that help track information on the database:=)> Note 250262.1 Health Check / Validation Engine Guide=)> Note 136697.1“hcheck8i.sql” script to check for known problems in Oracle8i, Oracle9i, and Oracle10g2. Parameter file-----------------The parameter file can exists in 2 forms. First of all we have the text-based version, commonly referred to as init.ora or pfile, and a binary-based file, commonly referred to as spfile. The pfile can be adjusted using a standard Operating System editor, while the spfile needs to be managed through the instance itself.It is important to realize that the spfile takes presedence above the pfile, meaning whenever there is an spfile available this will be automatically taken unless specified otherwise.NOTE: Getting an RDA report after making changes to the database configuration is also a recommendation. Keeping historical RDA reports will ensure you havean overview of the database configuration as the database evolves.Reference:Note 249664.1: Pfile vs SPfile3. Controlfiles---------------It is highly recommended to have at least two copies of the controlfile. This can be done by mirroring the controlfile, strongly recommended on different physicaldisks. If a controlfile is lost, due to a disk crash for example, then you canuse the mirrored file to startup the database. In this way fast and easy recovery from controlfile loss is obtained.connect as sysdbaSQL> select status, name from v$controlfile;STATUS NAME------- ---------------------------------/u01/oradata/L102/control01.ctl/u02/oradata/L102/control02.ctlThe location and the number of controlfiles can be controlled by the 'control_files' initialization parameter.4. Redolog files----------------The Oracle server maintains online redo log files to minimize loss of data in the database. Redo log files are used in a situation such as instance failure to recover commited data that has not yet been written to the data files. Mirroring theredo log files, strongly recommended on different physical disks, makes recovery more easy in case one of the redo log files is lost due to a disk crash, user delete, etc.connect as sysdbaSQL> select * from v$logfile;GROUP# STATUS TYPE MEMBER--------- ------- ------ -----------------------------------1 ONLINE /u01/oradata/L102/redo01_A.log1 ONLINE /u02/oradata/L102/redo01_B.log2 ONLINE /u01/oradata/L102/redo02_A.log2 ONLINE /u02/oradata/L102/redo02_B.log3 ONLINE /u01/oradata/L102/redo03_A.log3 ONLINE /u02/oradata/L102/redo03_B.logAt least two redo log groups are required, although it is advisable to have at least three redo log groups when archiving is enabled (see the following chapter). It is common, in environments where there are intensive log switches, to see the ARCHiver background process fall behind of the LGWR background process. In this case the LGWRprocess needs to wait for the ARCH process to complete archiving the redo log file.References :Note 102995.1 Maintenance of Online Redo Log Groups and Members5. Archiving------------Archiving provides the mechanism needed to backup the changes of the database.The archive files are essential in providing the necessary information to recover the database. It is advisable to run the database in archive log mode, although you may have reasons for not doing this, for example in case of a TEST environment where you accept to loose the changes made between the current time and the last backup.You may ignore this chapter when the database doesn't run in archive log mode.There are several ways of checking the archive configuration, below is one of them:connect as sysdbaSQL> archive log listDatabase log mode No Archive Mode --OR-- Archive ModeAutomatic archival Disabled --OR-- EnabledArchive destination <arch. dest.> --OR-- USE_DB_RECOVERY_FILE_DESTOldest online log sequence seq. noCurrent log sequence seq. noPre-10g, if the database is running in archive log mode but the automatic archiver process is disabled, then you were required to manually archive the redolog files. If this is not done in time then the database is frozen and any activity is prevented. Therefore you should enable automatic archiving when the database is running in archive log mode. This can be done by setting the 'log_archive_start' parameter to true in the parameter file.Starting from 10g, this parameter became obsolete and is no longer required to be set explicitly. It is important that there is enough free space on the dedicated disk(s) for the archive files, otherwise the ARCHiver process can't write and a crash is inevitable.References:Note 69739.1 How to Turn Archiving ON and OFFNote 122555.1 Determine how many disk space is needed for the archive files6. Datafiles------------6.1 Autoextend~~~~~~~~~~~~~~~The autoextend command option enables or disables the automatic extension ofdata files. If the given datafile is unable to allocate the space needed, itcan increase the size of the datafile to make space for objects to grow.A standard Oracle datafile can have, at most, 4194303 Oracle datablocks.So this also implies that the maximum size is dependant on the Oracle Block size used.DB_BLOCK_SIZE Max Mb value to use in any command~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~2048 8191 M4096 16383 M8192 32767 M16384 65535 Mstarting from Oracle 10g, we have a new functionality called BIGFILE, whichallows for bigger files to be created. Please also consider that every Operating System has its limits, therefore you should make sure that the maximum size ofa datafile cannot be extended past the Operating System allowed limit.To determine if a datafile and thus, a tablespace, has AUTOEXTEND capabilities:SQL> select file_id, tablespace_name, bytes, maxbytes, maxblocks, increment_by, file_namefrom dba_data_fileswhere autoextensible = 'YES';Reference:Note 112011.1: ALERT: RESIZE or AUTOEXTEND can "Over-size" Datafiles and Corrupt the DictionaryNote 262472.1: 10g BIGFILE Type Tablespaces Versus SMALLFILE Type6.2 Location~~~~~~~~~~~~~Verify the location of your datafiles. Overtime a database will grow and datafiles may be added to the database. Avoid placing datafiles on a 'wherever there is space' basis as this will complicate backup strategies and maintenance.Below is an example of bad usage:SQL> select * from v$dbfile;FILE# NAME--------- --------------------------------------------------1 D:\DATABASE\SYS1D806.DBF2 D:\DATABASE\D806\RBS1D806.DBF3 D:\DATABASE\D806\TMP1D806.DBF5 D:\DATABASE\D806\USR1D806.DBF6 D:\USR2D806.DBF7 F:\ORACLE\USR3D806.DBF7. Tablespaces--------------7.1 SYSTEM Tablespace~~~~~~~~~~~~~~~~~~~~~~User objects should not be created in the system tablespace. Doing so can lead to unnecessary fragmentation and preventing system tables of growing. The following queryreturns a list of objects that are created in the system tablespace but not owned by SYS or SYSTEM.SQL> select owner, segment_name, segment_typefrom dba_segmentswhere tablespace_name = 'SYSTEM'and owner not in ('SYS','SYSTEM');7.2 SYSAUX Tablespace (10g Release and above)~~~~~~~~~~~~~~~~~~~~~~The SYSAUX tablespace was automatically installed as an auxiliary tablespace to the SYSTEM tablespace when you created or upgraded the database. Some database components that formerly created and used separate tablespaces now occupy theSYSAUX tablespace.If the SYSAUX tablespace becomes unavailable, core database functionality will remain operational. The database features that use the SYSAUX tablespace could fail, or function with limited capability.The amount of data stored in this tablespace can be significant and may growover time to unmanageble sizes if not configured properly. There are a fewcomponents that need special attention.To check which components are occupying space:select space_usage_kbytes, occupant_name, occupant_descfrom v$sysaux_occupantsorder by 1 desc;Reference:Note 329984.1: Usage and Storage Management of SYSAUX tablespace occupants SM/AWR, SM/ADVISOR, SM/OPTSTAT and SM/OTHER7.3 Locally vs Dictionary Managed Tablespaces~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Locally Managed Tablespaces are available since Oracle 8i, however they becamethe default starting from Oracle 9i. Locally Managed Tablespaces, also referred to as LMT, have some advantage over Data Dictionary managed tablespaces.To verify which tablespace is Locally Managed or Dictionary Managed, you can run the following query:SQL> select tablespace_name, extent_managementfrom dba_tablespaces;Reference:Note 93771.1: Introduction to Locally-Managed TablespacesNote 105120.1: Advantages of Using Locally Managed vs Dictionary Managed Tablespaces7.4 Temporary Tablespace~~~~~~~~~~~~~~~~~~~~~~~~~o Locally Managed Tablespaces use tempfiles to serve the temporary tablespace, whereas Dictionary Managed Tablespaces use a tablespace of the type temporary. When you are running an older version (pre Oracle 9i), then it is important to check the type of tablespace used to store the temporary segments. By default, all tablespaces are created as PERMANENT, therefore you should make sure that the tablespace dedicated for temporary segments is of the type TEMPORARY.SQL> select tablespace_name, contentsfrom dba_tablespaces;TABLESPACE_NAME CONTENTS------------------------------ ---------SYSTEM PERMANENTUSER_DATA PERMANENTROLLBACK_DATA PERMANENTTEMPORARY_DATA TEMPORARYo Make sure that the users on the database are assigned a tablespace of thetype temporary. The following query lists all the users that have a permanent tablespace specified as their default temporary tablespace.SQL> select ername, t.tablespace_namefrom dba_users u, dba_tablespaces twhere u.temporary_tablespace = t.tablespace_nameand t.contents <> 'TEMPORARY';Note: User SYS and SYSTEM will show the SYSTEM tablespace as there defaulttemporary tablespace. This value can be altered as well to prevent fragmentation in the SYSTEM tablespace.SQL> alter user SYSTEM temporary tablespace TEMP;o The space allocated in the temporary tablespace is reused. This is done forperformance reasons to avoid the bottleneck of constant allocating and de-allocating of extents and segments. Therefore when looking at the free space in the temporary tablespace, this may appear as full all the time. The following are a few queries that can be used to list more meaningful information about the temporary segment usage:This will give the size of the temporary tablespace:SQL> select tablespace_name, sum(bytes)/1024/1024 mbfrom dba_temp_filesgroup by tablespace_name;This will give the "high water mark" of that temporary tablespace (= max used at one time):SQL> select tablespace_name, sum(bytes_cached)/1024/1024 mbfrom v$temp_extent_poolgroup by tablespace_name;This will give current usage:SQL> select ss.tablespace_name,sum((ed_blocks*ts.blocksize))/1024/1024 mb from gv$sort_segment ss, sys.ts$ tswhere ss.tablespace_name = group by ss.tablespace_name;7.5 Tablespace Fragmentation~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Heavly fragmented tablespaces can have an impact on the performance, especially when a lot of Full Table Scans are occurring on the system. Another disadvantage of fragmentation is that you can get out-of-space errors while the total sum of all free space is much more then you had requested.The only way to resolve fragmentation is drop and recreate the object. In most cases doing an export and import will solve the problem. If you need todefragment your system tablespace, you must rebuild the whole database sinceit is NOT possible to drop the system tablespace.References:Note 1020182.6 SCRIPT to detect tablespace fragmentationNote 1012431.6 Common causes of Fragmentation8. Objects----------8.1 Number of Extents~~~~~~~~~~~~~~~~~~~~~~While the performance hit on over extended objects is not significant, theaggregate effect on many over extended objects does impact performance. Thefollowing query will list all the objects that have allocated more extentsthan a specified minimum. Change the <--minext--> value by an actual number,in general objects allocating more then 100 a 200 extents can be recreatedwith larger extent sizes:SQL> select owner, segment_type, segment_name, tablespace_name,count(blocks), SUM(bytes/1024) "BYTES K", SUM(blocks)from dba_extentswhere owner NOT IN ('SYS','SYSTEM')group by owner, segment_type, segment_name, tablespace_namehaving count(*) > <--minext-->>order by segment_type, segment_name;8.2 Next extent~~~~~~~~~~~~~~~~It is important that segments can grow and therefore allocate their next extentwhen needed. If there is not enough free space in the tablespace then the nextextent can not be allocated and the object will fail to grow.The following query returns all the segments that are unable to allocate theirnext extent :SQL> select s.owner, s.segment_name, s.segment_type,s.tablespace_name, s.next_extentfrom dba_segments swhere s.next_extent > (select MAX(f.bytes)from dba_free_space fwhere f.tablespace_name = s.tablespace_name);Note that if there is a lot of fragmentation in the tablespace, then this querymay give you objects that still are able to grow. The above query is based onthe largest free chunk in the tablespace available. If there are a lot of'small' free chunks after each other, then Oracle will coalesce these to servethe extent allocation.Therefore it can be interesting to adapt the script in Note 1020182.6 'SCRIPTto detect tablespace fragmentation' to compare the next extent for each objectwith the 'contiguous' bytes (table space_temp) in the tablespace.8.3 Indexes~~~~~~~~~~~~An index needs to be maintained, every delete or insert on a table resultindirectly on a delete or insert on the underlying index. Over time an indexstructure can get fragmented and therefore the index should be rebuilt.9. AUTO vs MANUAL undo-----------------------Starting from Oracle 9i we introduced a new way of managing the before-images. Previously this was achieved through the RollBack Segments or also referred to as manual undo. Automatic undo is used when the UNDO_MANAGEMENT parameter is set to AUTO. When not set or set to MANUAL then we use the 'old' rollback segment mechanism. Although both versions are still available in current release, automatic undo is preferred.9.1 AUTO UNDO~~~~~~~~~~~~~~~There is little to no configuration involved to AUM (Automatic Undo Management). You basically define the amount of time the before image needs to be kept available.This is controlled through the parameter UNDO_RETENTION, defined in seconds. So a value of 900 indicates 15 minutes.It is important to realize that this value is not honored when we are under space pressure in the undo tablespace.Therefore the following formula can be used to calculate the optimal undo tablespace size:Note 262066.1: How To Size UNDO Tablespace For Automatic Undo ManagementStarting from Oracle 10g, you may choose to use the GUARANTEE option, to make sure the undo information does not get overwritten before the defined undo_retention time.Note 311615.1: Oracle 10G new feature - Automatic Undo Retention Tuning9.2 MANUAL UNDO~~~~~~~~~~~~~~~~~~o Damaged rollback segments will prevent the instance to open the database. Only if names of rollback segments are known, corrective action can be taken. Therefore specify all the rollback segments in the 'rollback_segments' parameter in theinit.orao Too small or not enough rollback segments can have serious impact on the behavior of your database. Therefore several issues must be taken into account. Thefollowing query will show you if there are not enough rollback segments onlineor if the rollback segments are too small.SQL> select d.segment_name, d.tablespace_name, s.waits, s.shrinks,s.wraps, s.statusfrom v$rollstat s, dba_rollback_segs dwhere n = d.segment_idorder by 1;SEGMENT_NAME TABLESPACE_NAME WAITS SHRINKS WRAPS STATUS---------------- ----------------------- --------- --------- --------- --------RB1 ROLLBACK_DATA 1 0 160 ONLINERB2 ROLLBACK_DATA 31 1 149 ONLINESYSTEM SYSTEM 0 0 0 ONLINEThe WAITS indicates which rollback segment headers had waits for them. Typically you would want to reduce such contention by adding rollback segments.If SHRINKS is non zero then the OPTIMAL parameter is set for that particularrollback segment, or a DBA explicitly issued a shrink on the rollback segment.The number of shrinks indicates the number of times a rollback segment shrinkedbecause a transaction has extended it beyond the OPTIMAL size. If this value is too high then the value of the OPTIMAL size should be increased as well as theoverall size of the rollback segment (the value of minextents can be increasedor the extent size itself, this depends mostly on the indications of the WRAPScolumn).The WRAPS column indicate the number of times the rollback segment wrapped toanother extent to serve the transaction. If this number is significant then you need to increase the extent size of the rollback segment.Reference:Note 62005.1 Creating, Optimizing, and Understanding Rollback Segments10. Memory Management---------------------This chapter is very version driven. Depending on which version you are running the option available will be different. Overtime Oracle has invested a great deal of time and effort in managing the memory more efficiently and transparently for the end-user.Therefore it is advisable to use the automation features as much as possible.10.1 Pre Oracle 9i~~~~~~~~~~~~~~~~~~~The different memory components (SGA & PGA) needed to be defined at the startup of thedatabase. These values were static. So if one of the memory components was too low thedatabase needed to be restarted to make the changes effective.How to determine the optimal or best value for the different memory components is not covered in this note, since this would lead us too far. However a parameter that was often misused in these versions is the sort_area_size.The 'sort_area_size' parameter in the init.ora defines the amount of memory that can beused for sorting. This value should be chosen carefully since this is part of the User Global Area (UGA) and therefore is allocated for each user individually.If there are a lot of concurrent users performing large sort operation on the databasethen the system can run out of memory.E.g.: You have a sort_area_size of 1Mb, with 200 concurrent users on the database. Although this memory is allocated dynamically, it can allocate up to 200Mband therefore can cause extensive swapping on the system.10.2 Oracle 9i~~~~~~~~~~~~~~~Starting from Oracle 9i we introduced the parametersworkarea_size_policy = [AUTO | MANUAL]pga_aggregate_target = <value>This allows you define 1 pool for the PGA memory, which will be shared across sessions. When you often receive ORA-4030 errors, then this can be an indication that this valueisspecified too low.10.3 Oracle 10g~~~~~~~~~~~~~~~~Automatic Shared Memory Management (ASMM) was introduced in 10g. The automatic shared memorymanagement feature is enabled by setting the SGA_TARGET parameter to a non-zero value.This feature has the advantage that you can share memory resources among the different components.Resources will be allocated and deallocated as needed by Oracle automatically.Automatic PGA Memory management is still available through the 'workarea_size_policy' and'pga_aggregate_target' parameters.10.4 Oracle 11g~~~~~~~~~~~~~~~~Automatic Memory Management (AMM) is being introduced in 11g. This enables automatic tuningof PGA and SGA with use of two new parameters named MEMORY_MAX_TARGET and MEMORY_TARGET.Reference:Note 443746.1: Automatic Memory Management(AMM) on 11g11. Logging & Tracing---------------------11.1 Alert File~~~~~~~~~~~~~~~~The alert log file of the database is written chronologically. Data is always appended and therefore this file can grow to an enormous size. It should becleared or truncated on a regular basis, as a large alert file occupiesunnecessary disk space and can slow down OS write performance to the file.SVRMGR> connect internal/<password>SVRMGR> show parameter background_dump_destNAME TYPE VALUE------------------------------ ------- ----------------------------------background_dump_dest string D:\Oradata\Admin\PROD\Trace\BDumpNote: starting from Oracle 11g, this location is controlled by the 'diagnostic_dest' parameter11.2 Max_dump_file_size~~~~~~~~~~~~~~~~~~~~~~~~Oracle Server processes generate trace files for certain errors or conflicts.These trace files are of use for further analyzing the probleThe init.oraparameter 'max_dump_file_size' limits the size of these trace files. The value of this parameter should be specified in Operating System blocks.Make sure the disk space can handle the maximum size specified, if not thenthis value should be changed.SVRMGR> connect internal/<password>SVRMGR> show parameter max_dump_file_sizeNAME TYPE VALUE----------------------------------- ------- ---------------------max_dump_file_size integer 1024011.3 User and core dump size parameters~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The parameters 'user_dump_size' and 'core_dump_size' can contain a lot of trace information.It is important to clear this directory at regular times as this can take up a significantamount of space.Note: starting from Oracle 11g, this location is controlled by the 'diagnostic_dest' parameter11.4 Audit files~~~~~~~~~~~~~~~~~By default, every connection as SYS or SYSDBA is logged in an operating system file. The location is controlled through the parameter 'audit_file_dest'. If this parameter isnot set then the location defaults to $ORACLE_HOME/rdbms/audit.Overtime this directory may contain a lot of auditing information and can take up a significant amount of space.11.5 Sqlnet~~~~~~~~~~~~By default sqlnet tracing is disabled while logging for sqlnet connections andthe listener is enabled. These log files are written chronologically and data is always appended. This causes some log files to grow to enormous sizes. Theselarge log files should be cleared or truncated on a regular basis.Activate tracing in case there is a problem that needs to be analyzed. Unnecessary tracing will slow down the system and occupy free disk space. Therefore youshould disable sqlnet and listener tracing when it is not required.To find the location of the logfiles or to activate tracing see:Note 219968.1: SQL*Net, Net8, Oracle Net Services - Tracing and Logging at a Glance <<E--End--。
ORACLE数据库常规巡检报告单(例⼦)ORACLE数据库常规巡检报告单⽬录ORACLE数据库常规巡检报告单 (1)⼀、概述 (3)⼆、使⽤的相关软件简要说明 (3)三、主机及操作系统常规配置检查 (3)1、系统设置检查 (3)2、I/O 设备信息 (3)3、⽹络配置信息 (4)四、ORACLE 数据库常规检查 (5)1、ORACLE 常规检查 (5)2、基本参数配置 (5)3、ORACLE ⽤户配置⽂件 (6)五、数据库关键性能检查及分析 (6)1、数据库性能检查 (6)2、数据库响应时间分析 (6)六、备份恢复策略检查和维护 (7)1、RMAN 配置情况 (7)2、备份策略描述 (7)3、备份策略实施 (7)4、备份检查和每⽇备份脚本⽇志检查 (8)5、对当前策略的总结 (8)七、关键性SQL 语句定位及分析 (8)⼋、近期警告⽇志及相关分析 (8)1、orcl_ora_8727.trc (8)2、orcl_ora_8727.trc (9)九、⼩结 (9)⼀、概述按照维护计划和为了系统的稳定运⾏,需要定期对系统进⾏⼀次巡检,时间周期为每星期⼀次。
⽬的在于诊断当前环境是否存在安全隐患,系统运⾏是否存在明显的系统瓶颈,定位重要的SQL 语句并进⾏性能分析,分析当前备份策略,分析警告⽇志信息并提供解决⽅案。
⼆、使⽤的相关软件简要说明1.使⽤RDA 对整个系统进⾏检查,并且⽣成报告2.使⽤AWR 对数据库进⾏检查,并且⽣成报告。
3.使⽤RMAN 对数据库进⾏备份,并且使⽤RMAN 相关的功能进⾏备份检查。
相关详细后页提供三、主机及操作系统常规配置检查1、系统设置检查主机和版本号Linux localhost 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST 2006 x86_64主机名localhost.localdomain操作系统平台64-bit Red Hat Linux操作系统版本 2.6.92、I/O 设备信息3、⽹络配置信息四、ORACLE 数据库常规检查1、ORACLE 常规检查Database OverviewDB Name ORCLGlobal Name /doc/e298af7e4693daef5ef73dba.html Host Name localhost Instance Name orclInstance Start Time 18-Nov-2008 14:14:01Restricted Mode NOArchive Log ModeARCHIVELOG3、ORACLE ⽤户配置⽂件# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then. ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHunset USERNAME#for oracleexport ORACLE_SID=orclexport ORACLE_BASE=/oracleexport ORACLE_HOME=/oracle/10gexport PATH=$ORACLE_HOME/bin:$PATHexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBK五、数据库关键性能检查及分析1、数据库性能检查2、数据库响应时间分析响应时间是⾮常重要的数据库性能指标从以上信息可以看出,RMAN 备份占⽤的⼤量的时间,六、备份恢复策略检查和维护1、RMAN 配置情况RMAN configuration parameters are:CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;CONFIGURE BACKUP OPTIMIZATION ON;CONFIGURE DEFAULT DEVICE TYPE TO DISK;CONFIGURE CONTROLFILE AUTOBACKUP ON;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'orclcongrol_%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # defaultCONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL 1 DEVICE TYPE DISK MAXPIECESIZE 100 M MAXOPENFILES 8 RATE 40 M; CONFIGURE CHANNEL 2 DEVICE TYPE DISK MAXPIECESIZE 100 M MAXOPENFILES 8 RATE 40 M; CONFIGURE MAXSETSIZE TO UNLIMITED; # defaultCONFIGURE ENCRYPTION FOR DATABASE OFF; # defaultCONFIGURE ENCRYPTION ALGORITHM 'AES128'; # defaultCONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # defaultCONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/10g/dbs/snapcf_orcl.f'; # default2、备份策略描述选⽤RMAN 多级备份策略,以每个星期作为⼀个周期星期1 数据库全备0 级星期2 增量备份 1 级星期3 增量备份 1 级星期4 累积增量备份1c 级星期5 数据库全备0 级星期6 增量备份 1 级星期天增量备份 1 级基于以上策略,任何时间点的数据恢复只需要做最多1 次0 级恢复和2 次1 级恢复.加上当⽇的归档⽇志可以实现快速的完全恢复3、备份策略实施Cat /etc/crontabSHELL=/bin/bashPATH=/sbin:/bin:/usr/sbin:/usr/binMAILTO=rootHOME=/# run-parts01 * * * * root run-parts /etc/cron.hourly02 4 * * * root run-parts /etc/cron.daily22 4 * * 0 root run-parts /etc/cron.weekly42 4 1 * * root run-parts /etc/cron.monthly00 4 * * 1 oracle /oracle/scripts/rman/backupweek1.cmd &00 4 * * 2 oracle /oracle/scripts/rman/backupweek2.cmd &00 4 * * 3 oracle /oracle/scripts/rman/backupweek3.cmd & 00 4 * * 4 oracle/oracle/scripts/rman/backupweek4.cmd &00 4 * * 5 oracle /oracle/scripts/rman/backupweek5.cmd &00 4 * * 6 oracle /oracle/scripts/rman/backupweek6.cmd &00 4 * * 7 oracle /oracle/scripts/rman/backupweek7.cmd &4、备份检查和每⽇备份脚本⽇志检查使⽤crosscheck backupset 检查。
Oracle 数据库日常巡检指令Oracle数据库的日常巡检内容包括:Oracle数据库基本状况检查;Oracle相关资源的使用情况检查;Oracle数据库性能检查;数据库服务器cpu、mem和I/O 性能检查;数据库服务器安全性及其他事项检查等五大检查项目。
1、数据库基本状况检查(1)、数据库实例状况检查说明:其中“STATUS”表示Oracle当前的实例状态,必须为“OPEN”;“DATABASE_STATUS”表示Oracle当前数据库的状态,必须为“ACTIVE”。
(2)、数据库表空间状态检查说明:输出结果中STATUS应该都为“ONLINE”。
(3)、数据库数据文件检查1 select tablespace_name,status from dba_tablespaces;说明:输出结果中“STATUS”应该都为“AVAILABLE”。
(4)、数据库在线日志检查1 select group#,status,type,member from v$logfile;说明:输出结果应该有3条或3条以上记录,“STATUS”应该为非“INVALID”,非“DELETED”。
“STATUS”的值为空表示正常。
(5)、数据库回滚段检查1 select segment_name,status from dba_rollback_segs;说明:输出结果中所有回滚段的“STATUS”应该为“ONLINE”。
2、数据库相关资源使用情况检查(1)、检查Oracle初始化文件中相关参数值1 select resource_name,max_utilization,initial_allocation, limit_value from v$resource_limit;说明:若字段值【LIMIT_VALU】-【MAX_UTILIZATION】<=5,则表明与RESOURCE_NAME相关的Oracle初始化参数需要调整。
Oracle数据库日常检查A.查看所有的实例及其后台进程是否正常确认所有的instance工作正常,登陆到所有的数据库或instance上,检测oracle后台进程$env|grep SIDORACLE_SID=UWNMS3B.检查文件系统的使用情况如果文件系统的剩余空间小于10%,则需要删除不必要的文件以释放空间。
$df-hFilesystem size used avail capacity Mounted on/dev/md/dsk/d020G17G 3.1G85%//proc0K0K0K0%/procmnttab0K0K0K0%/etc/mnttabfd0K0K0K0%/dev/fdswap85G192K85G1%/var/rundmpfs85G0K85G0%/dev/vx/dmpdmpfs85G0K85G0%/dev/vx/rdmpswap85G213M85G1%/tmp/dev/vx/dsk/data10dg/Ora_File_Vol01394G292G98G75%/data05/dev/vx/dsk/data1dg/vola0131443G156G283G36%/archivelogAIX:$df–g or df–kHP-UX$bdf or df–k or df-h注意:需要特别关注根目录,数据库软件和数据库备份所在目录的剩余空间情况!备注:数据库运行日志的及时清除1).可清除bdump,cdump,udump下的相关日志$cd$ORACLE_BASE/admin/db_name/bdump$ls-ltotal174-rwxrwxrwx1oracle dba59047Jul3022:02alert_UWNMS1.log-rwxrwxrwx1oracle dba1000Jul1422:00uwnms1_j000_18128.trc -rw-r-----1oracle dba1000Jul2222:00uwnms1_j001_5369.trc -rwxrwxrwx1oracle dba695Jul1419:12uwnms1_lgwr_18100.trc -rwxrwxrwx1oracle dba2668Jul3022:02uwnms1_lgwr_19661.trc -rwxrwxrwx1oracle dba983Jul1417:36uwnms1_lgwr_7816.trc -rwxrwxrwx1oracle dba955Jul1419:11uwnms1_lgwr_7883.trc -rwxrwxrwx1oracle dba803Jul1417:31uwnms1_p000_7714.trc -rwxrwxrwx1oracle dba801Jul1417:31uwnms1_p001_7716.trc $cd../cdump$ls-ltotal4drwxr-x---2oracle dba512Jul2514:12core_18095drwxr-x---2oracle dba512Jul2519:17core_25934$cd../udump$ls-ltotal20042-rw-r-----1oracle dba505Jul1616:33uwnms1_ora_14771.trc-rw-r-----1oracle dba4516169Jul2514:12uwnms1_ora_18095.trc -rwxrwxrwx1oracle dba644Jul1419:12uwnms1_ora_18119.trc -rw-r-----1oracle dba505Jul3015:11uwnms1_ora_18820.trc-rwxrwxrwx1oracle dba774Jul1510:23uwnms1_ora_19573.trc -rwxrwxrwx1oracle dba587Jul1510:23uwnms1_ora_19645.trc -rwxrwxrwx1oracle dba644Jul1510:23uwnms1_ora_19680.trc -rw-r-----1oracle dba720942Jul1516:28uwnms1_ora_24759.trc-rw-r-----1oracle dba4951562Jul2519:17uwnms1_ora_25934.trc -rw-r-----1oracle dba505Jul1517:21uwnms1_ora_27326.trc-rw-r-----1oracle dba503Jul3016:54uwnms1_ora_6612.trc-rwxrwxrwx1oracle dba585Jul1417:12uwnms1_ora_7523.trc-rwxrwxrwx1oracle dba767Jul1417:30uwnms1_ora_7566.trc 2).可清除oracle的监听日志$cd$ORACLE_HOME/network/log$ls-ltotal533072-rwxrwxrwx1oracle dba272507851Jul3111:28listener.log-rw-r--r--1oracle dba257876Jul3108:48sqlnet.log$cp/dev/null listener.logC.查找警告日志文件1.联接每一个操作管理系统2.使用‘TELNET’或是可比较程序3.对每一个管理实例,经常的执行$ORACLE_BASE/<SID>/bdump操作,并使其能回退到控制数据库的SID。
数据库日常巡检内容
数据库是企业重要的信息基础设施之一,对数据库进行日常巡检是确保数据库运行稳定、安全可靠的重要手段。
数据库日常巡检内容主要包括以下几个方面:
1. 数据库性能监控,通过监控数据库的性能指标,如CPU利用率、内存利用率、磁盘空间利用率、网络流量等,及时发现数据库性能异常,及时进行优化调整,确保数据库的高效稳定运行。
2. 数据库备份与恢复检查,定期检查数据库备份的完整性和可用性,确保数据库备份的及时性和准确性,以便在数据库发生故障时能够及时恢复数据。
3. 数据库安全审计,对数据库的安全审计日志进行定期分析和检查,发现异常操作和安全威胁,及时采取相应的安全措施,保障数据库的安全可靠。
4. 数据库空间管理,定期检查数据库的存储空间使用情况,及时清理无用数据和日志,释放存储空间,避免数据库空间不足导致数据库运行异常。
5. 数据库版本和补丁管理,定期检查数据库的版本和补丁情况,及时进行数据库版本升级和补丁安装,确保数据库的安全性和稳定性。
综上所述,数据库日常巡检内容涵盖了数据库性能监控、备份
与恢复检查、安全审计、空间管理、版本和补丁管理等多个方面,
通过对这些内容的定期检查和维护,能够确保数据库的稳定可靠运行,保障企业信息系统的正常运转。
数据库例行巡检流程
1.Oracle数据库的例行巡检流程通常包括以下几个步骤:
2.操作系统的CPU空闲率:检查操作系统的CPU空闲率以确保系统资源充足。
3.检查磁盘空间是否不足:确认数据存储设备的可用空间是否足够。
4.检查操作系统错误日志:查看是否有操作系统相关的错误记录。
5.检测数据库是否启动且侦听正常:验证数据库实例和服务器的监听器已经正确启动并正在运行。
6.检查和启动实例(服务器端):确保数据库实例已经被正确配置并且可以开始服务。
7.检测和启动侦听(服务器端):同样地,需要确认数据库的侦听器已经启动并能正常工作。
8.检查状态为非“online”的数据文件:确保所有数据文件都处于在线状态。
9.数据缓冲区命中率:评估数据缓冲区的性能,确保查询响应时间良好。
10.数据字典缓冲区命中率:类似地,检查数据字典缓冲区的性能。
11.LIBRARYCACHE命中率:检查库缓存的性能。
12.检测使用率超过80%的表空间:识别那些可能因为频繁读写
而变得过热的表空间。
13.检查作业是否正常:确认所有的后台处理任务都在正常运行。
14.了解数据库备份情况:最后,确保有适当的数据库备份策略,以便在出现问题时能够快速恢复。
ORACLE巡检报告一、引言本次巡检报告是针对目标系统中的ORACLE数据库进行的,旨在评估数据库的整体性能、安全性以及运行状态,并提供相应的优化建议和改进措施。
二、巡检目的1.评估数据库的性能状况,识别存在的性能瓶颈和潜在问题。
2.检查数据库的安全性,发现可能存在的安全隐患和漏洞。
3.检查数据库的运行状态,确认数据库的稳定性和可用性。
4.提供相应的优化建议和改进措施,帮助提升数据库的性能和安全性。
三、巡检内容1.性能评估通过对数据库的性能指标进行测试和分析,评估数据库的性能状况。
主要包括以下内容:-响应时间:检查数据库的响应时间是否满足业务需求,识别响应时间过长的问题。
-请求量:评估数据库的吞吐量和并发处理能力,查看数据库是否存在请求量过大的问题。
-查询优化:检查数据库的查询计划,分析查询语句的性能瓶颈,提出优化建议。
2.安全评估对数据库的安全性进行全面的评估,发现可能存在的安全隐患和漏洞。
主要包括以下内容:-访问控制:检查数据库的用户权限设置,确认是否存在权限过大或权限缺失的情况。
-弱口令检测:扫描数据库的用户口令,发现可能存在的弱口令,提出修改口令的建议。
-审计日志:检查数据库的审计日志设置,确认是否存在未启用审计或日志记录不完整的情况。
3.运行状态检查对数据库的运行状态进行全面检查,确认数据库的稳定性和可用性。
主要包括以下内容:-内存使用情况:检查数据库的内存使用情况,确认是否存在内存泄漏或内存不足的情况。
-磁盘空间:评估数据库的磁盘空间使用情况,预测磁盘空间是否足够,提出磁盘空间扩容的建议。
-日志管理:检查数据库的日志管理情况,确认是否存在日志文件过大或日志文件切换不及时的情况。
四、巡检结果1.性能评估结果数据库的响应时间整体符合业务需求,但存在部分查询语句性能较差的情况,建议对这些查询进行优化。
数据库的请求量较大,建议增加服务器资源以提升并发处理能力。
2.安全评估结果数据库的访问控制较为合理,但存在少数用户权限过大的情况,建议限制部分用户的权限。
oracle 数据库巡检语句进行Oracle数据库巡检时,可以使用一系列SQL语句来检查数据库的健康状况、性能和安全性。
以下是一些常用的Oracle数据库巡检语句:1. 检查数据库实例的运行情况:SELECT instance_name, host_name, version,startup_time, status FROM v$instance;2. 检查数据库的空间使用情况:SELECT tablespace_name, sum(bytes)/1024/1024 AS "Total Size (MB)",。
sum(bytes blocks8192)/1024/1024 AS "Used Size (MB)",。
sum(blocks8192)/1024/1024 AS "Free Size (MB)"FROM dba_free_space.GROUP BY tablespace_name;3. 检查数据库的性能指标:SELECT FROM v$sysstat WHERE name LIKE 'parse count%';SELECT FROM v$sysstat WHERE name LIKE 'execute count%';SELECT FROM v$sysstat WHERE name LIKE 'user commits';4. 检查数据库的会话和进程信息:SELECT username, osuser, machine, program FROM v$session;SELECT spid, osuser, username, program FROMv$process;5. 检查数据库的表空间和数据文件信息:SELECT tablespace_name, file_name, bytes/1024/1024 AS "File Size (MB)",。
Oracle数据库巡检方案
Oracle数据库巡检维护方案
一、巡检维护的目的
为了保障数据库正常运行,保证数据的安全性、完整性和可用性,需进行数据库巡检维护。
二、巡检维护的分类
数据库巡检维护包含的内容很多,如果每天都将这些项目进行一遍,在时间上是不允许的,可能还会影响到数据库使用效率,因此,通常会将这些巡检维护内容分门别类地按不同的时间频率进行。
数据库巡检维护按时间频率可分为日巡检、周巡检、月巡检、半年度巡检四类。
日巡检维护指每日按计划进行的巡检维护活动,以检查数据库运行状态、数据库备份状态和告警错误为主要内容,同时还必须检查使用数据库的应用软件是否因数据库运行原因产生使用错误或不畅。
周巡检维护指按一周为周期,在每周指定日按计划进行的巡检维护活动,它的工作内容是在日巡检维护工作内容的基础上添加数据库对象检查、安全性检查等内容组成。
月巡检维护指按一月为周期,在每月指定日按计划进行的巡检维护活动,它的工作内容是在周巡检维护工作内容的基础上添加系统参数配置检查、硬件与系统平台运行状态检查等内容组成。
半年度巡检维护指按半年为周期,在指定日按计划进行的巡检维护活动,它的工作内容是在月巡检维护工作内容的基础上添加数据库性能诊断检查组成。
如果能够提供模拟环境或生产环境在特定条件下允许停机,还应该进行备份有效性测试。
由于巡检维护工作任务的涵盖性,进行半年度巡检维护日可不执行所在月的月巡检维护、所在周的周巡检维护和日巡检维护,以此类推。
三、巡检维护工作内容和周期。
Oracle日常巡检内容1. 概述Oracle数据库是一款功能强大的关系型数据库管理系统,用于存储和管理大量的数据。
为了保证Oracle数据库的正常运行,必须进行日常巡检工作,及时发现并解决潜在的问题,确保数据库的稳定性和性能。
本文将介绍Oracle日常巡检的内容,包括数据库基本信息、存储空间、性能优化、安全性、备份与恢复等方面。
2. 数据库基本信息在进行日常巡检时,首先需要了解数据库的基本信息,以便更好地管理和维护数据库。
以下是需要关注的内容:•数据库名称、版本和补丁级别•数据库的物理和逻辑结构•数据库的字符集和语言设置•数据库的运行状态和连接数•数据库的启动参数和配置文件3. 存储空间数据库的存储空间是关键的资源,需要定期检查和管理。
以下是存储空间的巡检内容:•数据文件和表空间的大小和增长趋势•磁盘空间的使用情况和剩余容量•数据文件的布局和分布情况•表空间的使用率和碎片情况•确保数据文件和表空间的备份和恢复策略4. 性能优化数据库的性能是用户体验的重要因素,需要进行定期的性能优化工作。
以下是性能优化的巡检内容:•数据库的响应时间和吞吐量•SQL语句的执行计划和性能指标•索引的使用情况和效率•内存和缓冲区的配置和利用率•确保数据库的统计信息是最新的5. 安全性数据库的安全性是非常重要的,需要进行巡检和加固。
以下是安全性的巡检内容:•用户和角色的权限和访问控制•数据库的审计和日志记录设置•数据库的加密和身份验证策略•数据库的防火墙和网络安全设置•确保数据库的补丁和安全更新是最新的6. 备份与恢复数据库的备份和恢复是数据库管理的核心任务之一,需要定期进行巡检和测试。
以下是备份与恢复的巡检内容:•数据库备份的策略和计划•数据库备份的完整性和可用性•数据库恢复的速度和可靠性•确保备份文件的存储和保护措施•确保备份和恢复的文档和操作步骤是最新的7. 总结Oracle数据库的日常巡检是保证数据库稳定性和性能的重要工作。
Oracle 数据库日常巡检阅读目录∙ 1. 检查数据库基本状况∙ 2. 检查Oracle相关资源的使用情况∙ 3. 检查Oracle数据库备份结果∙ 4. 检查Oracle数据库性能∙ 5. 检查数据库cpu、I/O、内存性能∙ 6. 检查数据库安全性∙7. 其他检查1. 检查数据库基本状况包含:检查Oracle实例状态,检查Oracle服务进程,检查Oracle监听进程,共三个部分。
1.1. 检查Oracle实例状态select instance_name,host_name,startup_time,status,database_status from v$instance;其中“STATUS”表示Oracle当前的实例状态,必须为“OPEN”;“DATABASE_STATUS”表示Oracle当前数据库的状态,必须为“ACTIVE”。
1.2. 检查Oracle在线日志状态select group#,status,type,member from v$logfile;输出结果应该有3条以上(包含3条)记录,“STATUS”应该为非“INVALID”,非“DELETED”。
注:“STATUS”显示为空表示正常。
1.3. 检查Oracle表空间的状态select tablespace_name,status from dba_tablespaces;输出结果中STATUS应该都为ONLINE。
1.4. 检查Oracle所有数据文件状态select name,status from v$datafile;输出结果中“STATUS”应该都为“ONLINE”。
或者:select file_name,status from dba_data_files;输出结果中“STATUS”应该都为“AVAILABLE”。
1.5. 检查无效对象select owner,object_name,object_type from dba_objects where status!='VALID'and owner!='SYS'and owner!='SYSTEM';如果有记录返回,则说明存在无效对象。
若这些对象与应用相关,那么需要重新编译生成这个对象,或者:SELECT owner, object_name, object_type FROM dba_objects WHERE status='INVALID';1.6. 检查所有回滚段状态select segment_name,status from dba_rollback_segs;输出结果中所有回滚段的“STATUS”应该为“ONLINE”。
2. 检查Oracle相关资源的使用情况包含:a.检查Oracle初始化文件中相关的参数值b.检查数据库连接情况,检查系统磁盘空间c.检查Oracle各个表空间使用情况,检查一些扩展异常的对象,d.检查system表空间内的内容,检查对象的下一扩展与表空间的最大扩展值,总共七个部分。
2.1. 检查Oracle初始化文件中相关参数值select resource_name,max_utilization,initial_allocation,limit_valuefrom v$resource_limit;若LIMIT_VALU-MAX_UTILIZATION<=5,则表明与RESOURCE_NAME相关的Oracle初始化参数需要调整。
可以通过修改Oracle初始化参数文件$ORACLE_BASE/admin/CKDB/pfile/initORCL.ora来修改。
2.2. 检查数据库连接情况查看当前会话连接数,是否属于正常范围。
select count(*) from v$session;select sid,serial#,username,program,machine,status from v$session;其中:SID 会话(session)的ID号;SERIAL# 会话的序列号,和SID一起用来唯一标识一个会话;USERNAME 建立该会话的用户名;PROGRAM 这个会话是用什么工具连接到数据库的;STATUS 当前这个会话的状态,ACTIVE表示会话正在执行某些任务,INACTIVE表示当前会话没有执行任何操作;如果建立了过多的连接,会消耗数据库的资源,同时,对一些“挂死”的连接可能需要手工进行清理。
如果DBA要手工断开某个会话,则执行:(一般不建议使用这种方式去杀掉数据库的连接,这样有时候session不会断开。
容易引起死连接。
建议通过sid查到操作系统的spid,使用ps –ef|grep spidno的方式确认spid不是ORACLE的后台进程。
使用操作系统的kill -9命令杀掉连接)alter system kill session 'SID,SERIAL#';注意:上例中SID为1到10(USERNAME列为空)的会话,是Oracle的后台进程,不要对这些会话进行任何操作。
2.3. 检查系统磁盘空间如果文件系统的剩余空间过小或增长较快,需对其进行确认并删除不用的文件以释放空间。
[oracle@AS14 ~]$ df -hFilesystem Size Used Avail Use% Mounted on/dev/sda5 9.7G 3.9G 5.4G 42% //dev/sda1 479M 16M 438M 4% /boot/dev/sda2 49G 19G 28G 41% /datanone 1014M 0 1014M 0% /dev/shm2.4. 检查表空间使用情况select f.tablespace_name,a.total,f.free,round((f.free / a.total) *100) "% Free"from (select tablespace_name, sum(bytes / (1024*1024)) totalfrom dba_data_filesgroup by tablespace_name) a,(select tablespace_name, round(sum(bytes / (1024*1024))) freefrom dba_free_spacegroup by tablespace_name) fWHERE a.tablespace_name = f.tablespace_name(+)order by "% Free";如果空闲率%Free小于10%以上(包含10%),则注意要增加数据文件来扩展表空间而不要是用数据文件的自动扩展功能。
请不要对表空间增加过多的数据文件,增加数据文件的原则是每个数据文件大小为2G或者4G,自动扩展的最大限制在8G。
2.5. 检查一些扩展异常的对象select Segment_Name,Segment_Type,TableSpace_Name,(Extents / Max_extents) *100PercentFrom sys.DBA_SegmentsWhere Max_Extents !=0and (Extents / Max_extents) *100>=95order By Percent;如果有记录返回,则这些对象的扩展已经快达到它定义时的最大扩展值。
对于这些对象要修改它的存储结构参数。
2.6. 检查system表空间内的内容select distinct (owner)from dba_tableswhere tablespace_name ='SYSTEM'and owner !='SYS'and owner !='SYSTEM'unionselect distinct (owner)from dba_indexeswhere tablespace_name ='SYSTEM'and owner !='SYS'and owner !='SYSTEM';如果记录返回,则表明system表空间内存在一些非system和sys用户的对象。
应该进一步检查这些对象是否与我们应用相关。
如果相关请把这些对象移到非System表空间,同时应该检查这些对象属主的缺省表空间值。
2.7. 检查对象的下一扩展与表空间的最大扩展值select a.table_name, a.next_extent, a.tablespace_namefrom all_tables a,(select tablespace_name, max(bytes) as big_chunkfrom dba_free_spacegroup by tablespace_name) fwhere f.tablespace_name = a.tablespace_nameand a.next_extent > f.big_chunkunionselect a.index_name, a.next_extent, a.tablespace_namefrom all_indexes a,(select tablespace_name, max(bytes) as big_chunkfrom dba_free_spacegroup by tablespace_name) fwhere f.tablespace_name = a.tablespace_nameand a.next_extent > f.big_chunk;如果有记录返回,则表明这些对象的下一个扩展大于该对象所属表空间的最大扩展值,需调整相应表空间的存储参数。
3. 检查Oracle数据库备份结果包含:a.检查数据库备份日志信息;b.检查backup卷中文件产生的时间;c.检查oracle用户的email3.1. 检查数据库备份日志信息假设:备份的临时目录为/backup/hotbakup,我们需要检查2009年7月22日的备份结果,则用下面的命令来检查:cat /backup/hotbackup/hotbackup-09-7-22.log|grep –i error备份脚本的日志文件为hotbackup-月份-日期-年份.log,在备份的临时目录下面。
如果文件中存在“ERROR:”,则表明备份没有成功,存在问题需要检查。
3.2. 检查backup卷中文件产生的时间#ls –lt /backup/hotbackupbackup卷是备份的临时目录,查看输出结果中文件的日期,都应当是在当天凌晨由热备份脚本产生的。