oracle健康巡檢筆記

xunmingxxx發表於2011-10-08

檢查範圍:

(主機配置,記憶體引數,系統配置,硬碟利用率和可用空間,CPU利用率,當前作業系統補丁情況,oracle配置,配置檔案的內容和位置,目錄結構,資料檔案和位置,表空間,Invalid資料庫物件,資料庫執行日誌檔案,網路資訊和NET 8TCP/IP配置,network吞吐量,NET8資訊,資料庫備份和恢復概況,備份策略,恢復策略)

利用SQL命令檢查資料庫配置,開啟SQL*PLUS來檢查。

ORACLE 工具STATSPACK進行資料庫效能資料的收集。(這裡非分析)

檢視SERVER NAME:

[root@oracle11g ~]# hostname

oracle11g

檢視OS version

[root@oracle11g ~]# lsb_release -a

LSB Version: :core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch

Distributor ID: CentOS

Description: CentOS release 4.8 (Final)

Release: 4.8

Codename: Final

檢視CPU

[root@oracle11g ~]# more /proc/cpuinfo

processor : 0

vendor_id : GenuineIntel

cpu family : 6

model : 23

model name : Pentium(R) Dual-Core CPU T450

0 @ 2.30GHz

stepping : 8

cpu MHz : 2296.821

cache size : 1024 KB

fdiv_bug : no

hlt_bug : no

f00f_bug : no

coma_bug : no

fpu : yes

fpu_exception : yes

cpuid level : 13

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8

apic sep mtrr pge mca cmov pat pse36 clflush dts acpi

mmx fxsr sse sse2 ss nx constant_tsc pni ds_cpl

bogomips : 4593.99

檢視記憶體:

[root@oracle11g ~]# top | grep Mem

Mem: 1018280k total, 203460k used, 81

Mem: 1018280k total, 203460k used, 81

Mem: 1018280k total, 203460k used, 81

檢視Product name

[root@oracle11g ~]# dmidecode | grep Product

Product Name: VMware Virtual Platform

Product Name: 440BX Desktop Reference Platform

檢視記憶體引數:

[root@oracle11g ~]# more /etc/sysctl.conf

檢視ORACLE使用者限制:

[oracle@oracle11g ~]$ ulimit -a

core file size (blocks, -c) 0

data seg size (kbytes, -d) unlimited

file size (blocks, -f) unlimited

pending signals (-i) 1024

max locked memory (kbytes, -l) 32

max memory size (kbytes, -m) unlimited

open files (-n) 65536

pipe size (512 bytes, -p) 8

POSIX message queues (bytes, -q) 819200

stack size (kbytes, -s) 10240

cpu time (seconds, -t) unlimited

max user processes (-u) 16384

virtual memory (kbytes, -v) unlimited

file locks (-x) unlimited

檢視硬碟的情況:

[root@oracle11g ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/hda1 14444992 13452000 259228 99% /

none 509140 0 509140 0% /dev/shm

檢視資料庫的版本:

[oracle@oracle11g ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sat Oct 1 06:48:47 2011

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to an idle instance.

檢視當前版本:

SQL> select * from v$option;

PARAMETER VALUE

---------------------------------------------------------------- ----------------------------------------------------------------

Partitioning TRUE

Objects TRUE

Real Application Clusters FALSE

Advanced replication TRUE

Bit-mapped indexes TRUE

Connection multiplexing TRUE

Connection pooling TRUE

Database queuing TRUE

Incremental backup and recovery TRUE

Instead-of triggers TRUE

Parallel backup and recovery TRUE

Parallel execution TRUE

Parallel load TRUE

Point-in-time tablespace recovery TRUE

Fine-grained access control TRUE

Proxy authentication/authorization TRUE

Change Data Capture TRUE

Plan Stability TRUE

Online Index Build TRUE

Coalesce Index TRUE

Managed Standby TRUE

Materialized view rewrite TRUE

Materialized view warehouse refresh TRUE

Database resource manager TRUE

Spatial TRUE

Export transportable tablespaces TRUE

Transparent Application Failover TRUE

Fast-Start Fault Recovery TRUE

Sample Scan TRUE

Duplexed backups TRUE

Java TRUE

OLAP Window Functions TRUE

Block Media Recovery TRUE

Fine-grained Auditing TRUE

Application Role TRUE

Enterprise User Security TRUE

Oracle Data Guard TRUE

Oracle Label Security FALSE

OLAP TRUE

Table compression TRUE

Join index TRUE

Trial Recovery TRUE

Data Mining TRUE

Online Redefinition TRUE

Streams Capture TRUE

File Mapping TRUE

Block Change Tracking TRUE

Flashback Table TRUE

Flashback Database TRUE

Transparent Data Encryption TRUE

Backup Encryption TRUE

Unused Block Compression TRUE

Oracle Database Vault FALSE

Result Cache TRUE

SQL Plan Management TRUE

SecureFiles Deduplication TRUE

SecureFiles Encryption TRUE

SecureFiles Compression TRUE

Real Application Testing TRUE

Flashback Data Archive TRUE

DICOM TRUE

61 rows selected.

檢視被使用的產品選項:

SQL> select COMP_ID,COMP_NAME,VERSION,STATUS FROM dba_registry;

COMP_ID COMP_NAME VERSION STATUS

---------- ------------------------------ ------------------------------ --------------------------------------------

OWB OWB 11.1.0.6.0 VALID

APEX Oracle Application Express 3.0.1.00.08 VALID

EM Oracle Enterprise Manager 11.1.0.6.0 VALID

WK Oracle Ultra Search 11.1.0.6.0 VALID

AMD OLAP Catalog 11.1.0.6.0 VALID

SDO Spatial 11.1.0.6.0 VALID

ORDIM Oracle Multimedia 11.1.0.6.0 VALID

XDB Oracle XML Database 11.1.0.6.0 VALID

CONTEXT Oracle Text 11.1.0.6.0 VALID

EXF Oracle Expression Filter 11.1.0.6.0 VALID

RUL Oracle Rules Manager 11.1.0.6.0 VALID

OWM Oracle Workspace Manager 11.1.0.6.0 VALID

CATALOG Oracle Database Catalog Views 11.1.0.6.0 VALID

CATPROC Oracle Database Packages and T 11.1.0.6.0 VALID

ypes

JAVAVM JServer JAVA Virtual Machine 11.1.0.6.0 VALID

XML Oracle XDK 11.1.0.6.0 VALID

CATJAVA Oracle Database Java Packages 11.1.0.6.0 VALID

APS OLAP Analytic Workspace 11.1.0.6.0 VALID

XOQ Oracle OLAP API 11.1.0.6.0 VALID

19 rows selected.

檢視資料庫引數檔案:

SQL> show parameter spfile;

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile string /u01/oracle/dbs/spfilewilson.ora

檢視資料庫的非預設引數:

SQL> select name,value from v$parameter where isdefault='false';

no rows selected

執行日誌和跟蹤檔案:

Oracle資料庫程式生成跟蹤檔案來記錄錯誤或者衝突,這些跟蹤檔案可以用來進一步分析問題。定期檢查alert.log檔案,以便及早發現問題。

檢視資料庫的歸檔模式:

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 30

Next log sequence to archive 32

Current log sequence 32

檢視資料檔案的個數以及總的大小:

SQL> select count(*),sum(bytes)/1024/1024/1024 from v$datafile;

COUNT(*) SUM(BYTES)/1024/1024/1024

---------- -------------------------

8 2.78387451

dba_segments 這個中可以檢視哪些物件放在哪個表空間裡。

建議使用LOCAL方式管理表空間,表空間不存在碎片問題。

建議刪除不使用物件,避免在系統壓力較大時,手工或自動編譯無效物件,否則可能造成資料庫鎖死。

檢視BLEVEL>4的索引,如果有,則要重建索引:

SQL> select * from dba_indexes where blevel>4;

no rows selected

檢視系統哪些角色被授予了DBA的超級許可權:

SQL> select grantee,granted_role from dba_role_privs where granted_role='DBA';

GRANTEE

------------------------------

GRANTED_ROLE

------------------------------

SYS

DBA

SYSMAN

DBA

SYSTEM

DBA

被授予DBA許可權可以隨時的開啟和關閉資料庫等一些DBA的系統重要操作。

檢視監聽器listener.ora的配置:

[oracle@oracle11g admin]$ pwd

/u01/oracle/network/admin

[oracle@oracle11g admin]$ more listener.ora

# listener.ora Network Configuration File: /u01/oracle/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = oracle11g)(PORT = 1521))

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

)

)

檢視tnsnames.ora的配置:

[oracle@oracle11g admin]$ more tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/oracle/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

WILSON =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = oracle11g)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = wilson)

)

)

[@more@]

然後對於資料庫效能:10g需檢視AWR報告。AWR報告需要加深學習。9i檢視statpack報告。

資料庫的備份和恢復:

建議:

根據不同的資料庫失敗情況制定相應的恢復策略。

資料庫全庫恢復。

表空間恢復。

資料檔案恢復。

資料表恢復。

根據制定的恢復策略進行恢復測試。

Redo log檔案:

對於恢復操作,最為關鍵的是online redo log。一般由2個或以上預先分配的儲存資料庫變化檔案組成。每個資料庫的例程都有相關的online redo log

每個資料庫至少有兩個redo log組,每組至少有一個日誌檔案。Oracle有多重online redo log檔案,LGWR同時將相同的redo log資訊寫入不同的REDO LOG檔案中,從而減少單個檔案丟失的損失。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24829399/viewspace-1055495/,如需轉載,請註明出處,否則將追究法律責任。

相關文章