国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > Oracle > 正文

ORACLE數(shù)據(jù)庫管理員的職責(轉)

2024-08-29 13:30:01
字體:
來源:轉載
供稿:網友

應按如下方式對oracle數(shù)據(jù)庫系統(tǒng)做定期監(jiān)控:

?

(1). 每天對oracle數(shù)據(jù)庫的運行狀態(tài),日志文件,備份情況,數(shù)據(jù)庫的空間使用情況,系統(tǒng)資源的使用情況進行檢查,發(fā)現(xiàn)并解決問題。

(2). 每周對數(shù)據(jù)庫對象的空間擴展情況,數(shù)據(jù)的增長情況進行監(jiān)控,對數(shù)據(jù)庫做健康檢查,對數(shù)據(jù)庫對象的狀態(tài)做檢查。

(3). 每月對表和索引等進行analyze,檢查表空間碎片,尋找數(shù)據(jù)庫性能調整的機會,進行數(shù)據(jù)庫性能調整,提出下一步空間管理計劃,對oracle數(shù)據(jù)庫狀態(tài)進行一次全面檢查。

每天的工作:

(1).確認所有的instance狀態(tài)正常。

登陸到所有數(shù)據(jù)庫或例程,檢測oracle后臺進程:

$ps –ef|grep ora

(2). 檢查文件系統(tǒng)的使用(剩余空間)。如果文件系統(tǒng)的剩余空間小于20%,需刪除不用的文件以釋放空間:

$df –k

(3). 檢查日志文件和trace文件記錄alert和trace文件中的錯誤。

連接到每個需管理的系統(tǒng):

使用'telnet'

對每個數(shù)據(jù)庫,cd到bdump目錄,通常是$oracle_base/bdump

使用 unix 'tail'命令來查看alert_.log文件,如果發(fā)現(xiàn)任何新的ora-錯誤,記錄并解決。

(4). 檢查數(shù)據(jù)庫當日備份的有效性。

對rman備份方式:

檢查第三方備份工具的備份日志以確定備份是否成功。

對export備份方式:

檢查exp日志文件以確定備份是否成功

對其他備份方式:

檢查相應的日志文件

(5). 檢查數(shù)據(jù)文件的狀態(tài)記錄狀態(tài)不是“online”的數(shù)據(jù)文件,并做恢復:

select file_name from dba_data_files where status='offline';

(6). 檢查表空間的使用情況:

select tablespace_name,max_m,count_blocks free_blk_cnt,sum_free_m,to_char(100*sum_free_m/sum_m, '99.99') || '%' as pct_free from (select tablespace_name,sum(bytes)/1024/1024 as sum_m from dba_data_files group by tablespace_name),(select tablespace_name as fs_ts_name, max(bytes)/1024/1024 as max_m,count(blocks) as count_blocks,sum(bytes/1024/1024) as sum_free_m from dba_free_space group by tablespace_name) where tablespace_name=fs_ts_name;

(7). 檢查剩余表空間:

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_space group by tablespace_name;

(8). 監(jiān)控數(shù)據(jù)庫性能:

運行bstat/estat生成系統(tǒng)報告,或者使用statspack收集統(tǒng)計數(shù)據(jù);

(9). 檢查數(shù)據(jù)庫性能,記錄數(shù)據(jù)庫的cpu使用、io、buffer命中率等等;

使用vmstat,iostat,glance,top等命令。

(10). 日常出現(xiàn)問題的處理。

每周的工作:

(1). 監(jiān)控數(shù)據(jù)庫對象的空間擴展情況:

根據(jù)本周每天的檢查情況找到空間擴展很快的數(shù)據(jù)庫對象,并采取相應的措施

-- 刪除歷史數(shù)據(jù)

--- 擴表空間

alter tablespace add datafile‘xxxx.dbf’ size 10m;

--- 調整數(shù)據(jù)對象的存儲參數(shù)

next extent

pct_increase

(2). 監(jiān)控數(shù)據(jù)量的增長情況

根據(jù)本周每天的檢查情況找到記錄數(shù)量增長很快的數(shù)據(jù)庫對象,并采取相應的措施

-- 刪除歷史數(shù)據(jù)

--- 擴表空間

alter tablespace add datafile ‘xxx.dbf’ size 100m;?

(3). 系統(tǒng)健康檢查

檢查以下內容:

init.ora

controlfile

redo log file

archiving

sort area size

tablespace(system,temporary,tablespace fragment)

datafiles(autoextend,location)

object(number of extent,next extent,index)

rollback segment

logging &tracing(alert.log,max_dump_file_size,sqlnet)

(4). 檢查無效的數(shù)據(jù)庫對象:

select owner, object_name, object_type from dba_objects where status='invalid';

(5). 檢查不起作用的約束

select owner, constraint_name, table_name,constraint_type,status from dba_constraints

where status = 'disabled’ and constraint_type = 'p';

(6). 檢查無效的trigger

select owner,trigger_name,table_name,status from dba_triggers where status ='disabled’;

每月的工作

(1). analyze tables/indexes/cluster

analyze table estimate statistics sample 50 percent;

(2). 檢查表空間碎片

根據(jù)本月每周的檢查分析數(shù)據(jù)庫碎片情況,找到相應的解決方法。

(3). 尋找數(shù)據(jù)庫性能調整的機會

比較每天對數(shù)據(jù)庫性能的監(jiān)控報告,確定是否有必要對數(shù)據(jù)庫性能進行調整

(4). 數(shù)據(jù)庫性能調整

如有必要,進行性能調整

(5). 提出下一步空間管理計劃

根據(jù)每周的監(jiān)控,提出空間管理的改進方法

oracle dba 日常管理

目的:這篇文檔有很詳細的資料記錄著對一個甚至更多的oracle 數(shù)據(jù)庫每天的,每月的,每年的運行的狀態(tài)的結果及檢查的結果,在文檔的附錄中你將會看到所有檢查,修改的sql和pl/sql 代碼。

目錄

1.日常維護程序

a. 檢查已起的所有實例

b. 查找一些新的警告日志

c. 檢查dbsnmp 是否在運行

d. 檢查數(shù)據(jù)庫備份是否正確

e. 檢查備份到磁帶中的文件是否正確

f. 檢查數(shù)據(jù)庫的性能是否正常合理,是否有足夠的空間和資源

g. 將文檔日志復制到備份的數(shù)據(jù)庫中

h. 要常看dba 用戶手冊

2.晚間維護程序

a.收集volumetric 的數(shù)據(jù)

3.每周維護工作

a. 查找那些破壞規(guī)則的object

b. 查找是否有違反安全策略的問題

c. 查看錯誤地方的sql*net 日志

d. 將所有的警告日志存檔

e. 經常訪問供應商的主頁

4.月維護程序

a. 查看對數(shù)據(jù)庫會產生危害的增長速度

b. 回顧以前數(shù)據(jù)庫優(yōu)化性能的調整

c. 查看i/o 的屏頸問題

d. 回顧fragmentation

e. 將來的執(zhí)行計劃

f. 查看調整點和維護

5.附錄

a. 月維護過程

b. 晚間維護過程

c. 周維護過程

?



一.日維護過程


a.查看所有的實例是否已起

確定數(shù)據(jù)庫是可用的,把每個實例寫入日志并且運行日報告或是運行測試

文件。當然有一些操作我們是希望它能自動運行的。

可選擇執(zhí)行:用oracle 管理器中的‘probe’事件來查看

b.查找新的警告日志文件

1. 聯(lián)接每一個操作管理系統(tǒng)

2. 使用‘telnet’或是可比較程序

3. 對每一個管理實例,經常的執(zhí)行$oracle_base//bdump 操

作,并使其能回退到控制數(shù)據(jù)庫的sid。

4. 在提示下,使用unix 中的‘tail’命令查看alert_.log,或是用其他方式檢查文件中最近時期的警告日志。

5. 如果以前出現(xiàn)過的一些ora_errors 又出現(xiàn),將它記錄到數(shù)據(jù)庫恢復日志中并且仔細的研究它們,這個數(shù)據(jù)庫恢復日志在〈file〉中。

c.查看dbsnmp 的運行情況

檢查每個被管理機器的‘dbsnmp’進程并將它們記錄到日志中。

在unix 中,在命令行中,鍵入ps –ef | grep dbsnmp,將回看到2個dbsnmp 進程在運行。如果沒有,重啟dbsnmp。

d.查數(shù)據(jù)庫備份是否成功

e.檢查備份的磁帶文檔是否成功

f.檢查對合理的性能來說是否有足夠的資源

1. 檢查在表空間中有沒有剩余空間。

對每一個實例來說,檢查在表空間中是否存在有剩余空間來滿足當天

的預期的需要。當數(shù)據(jù)庫中已有的數(shù)據(jù)是穩(wěn)定的,數(shù)據(jù)日增長的平均

數(shù)也是可以計算出來,最小的剩余空間至少要能滿足每天數(shù)據(jù)的增 長。

a) 運行‘free.sql’來檢查表空間的剩余空間。

b) 運行‘space.sql’來檢查表空間中的剩余空間百分率

2. 檢查回滾段

回滾段的狀態(tài)一般是在線的,除了一些為復雜工作準備的專用 段,它一般狀態(tài)是離線的。

a) 每個數(shù)據(jù)庫都有一個回滾段名字的列表。

b) 你可以用v$rollstat 來查詢在線或是離線的回滾段的現(xiàn)在狀 態(tài).

c) 對于所有回滾段的存儲參數(shù)及名字,可用

dba_rollback_segs 來查詢。但是它不如v$rollstat 準確。

3. 識別出一些過分的增長

查看數(shù)據(jù)庫中超出資源或是增長速度過大的段,這些段的存儲參 數(shù)需要調整。

a) 收集日數(shù)據(jù)大小的信息, 可以用'analyze5pct.sql'。如果你收集的是每晚的信息,則可跳過這一步。

b) 檢查當前的范圍,可用‘nr.extents.sql’。

c) 查詢當前表的大小信息。

d) 查詢當前索引大小的信息。

e) 查詢增長趨勢。

4. 確定空間的范圍。

如果范圍空間對象的next_extent 比表空間所能提供的最大范圍還要大,那么這將影響數(shù)據(jù)庫的運行。如果我們找到了這個目標,可以用‘alter tablespace coalesce’調查它的位置,或加另外的數(shù)據(jù)文件。

a)運行‘spacebound.sql’。如果都是正常的,將不返回任何行。

5. 回顧cpu,內存,網絡,硬件資源論點的過程

a)檢查cpu的利用情況,進到x:.htm =>system

metrics=>cpu 利用頁,cpu 的最大限度為400,當cpu 的占用保持

在350 以上有一段時間的話,我們就需要查看及研究出現(xiàn)的問題。

g.將存檔日志復制到備用數(shù)據(jù)庫中

如果有一個備用數(shù)據(jù)庫,將適當?shù)拇鏅n日志復制到備用數(shù)據(jù)庫的期望

位置,備用數(shù)據(jù)庫中保存最近期的數(shù)據(jù)。

h. 經常查閱dba 用戶手冊

如果有可能的話,要廣泛的閱讀,包括dba 手冊,行業(yè)雜志,新聞 組或是郵件列表。

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

二.晚間維護過程

大部分的數(shù)據(jù)庫產品將受益于每晚確定的檢查進程的運行。

a. 收集volumetric 數(shù)據(jù)

1. 分析計劃和收集數(shù)據(jù)

更準確的分析計算并保存結果。

a) 如果你現(xiàn)在沒有作這些的話,用‘mk volfact.sql’來創(chuàng)建測定體積的 表。

b) 收集晚間數(shù)據(jù)大小的信息,用‘analyze comp.sql’。

c) 收集統(tǒng)計結果,用‘pop vol.sql’。

d) 在空閑的時候檢查數(shù)據(jù),可能的話,每周或每個月進行。

我是用ms excel 和odbc 的聯(lián)接來檢查數(shù)據(jù)和圖表的增長

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

三.每周維護過程

a. 查找被破壞的目標

1. 對于每個給定表空間的對象來說,next_extent 的大小是相同的,如12/14/98,缺省的next_extent 的datahi 為1g,datalo 為500mb, indexes 為256mb。

a) 檢查next_extent 的設置,可用‘nextext。sql’。

b) 檢查已有的extents,可用‘existext。sql’。

2. 所有的表都應該有唯一的主鍵

a) 查看那些表沒有主鍵,可用‘no_pk.sql’。

b) 查找那些主鍵是沒有發(fā)揮作用的,可用'dis_pk.sql'。

c) 所有作索引的主鍵都要是唯一的,可用'nonupk.sql'來檢 查。

3. 所有的索引都要放到索引表空間中。運行‘mkrebuild_idx。sql’

4. 不同的環(huán)境之間的計劃應該是同樣的,特別是測試環(huán)境和成品環(huán)境之間的計劃應該相同。

a) 檢查不同的2 個運行環(huán)境中的數(shù)據(jù)類型是否一致,可用'datatype.sql'。

b) 在2 個不同的實例中尋找對象的不同點,可用'obj_coord.sql'。

c) 更好的做法是,使用一種工具,象尋求軟件的計劃管理器那樣的工具。

b. 查看是否有危害到安全策略的問題。

c. 查看報錯的sql*net 日志。

1. 客戶端的日志。

2. 服務器端的日志。

d..將所有的警告日志存檔

e..供應商的主頁

1. oracle 供應商

http://www.oracle.com

http://technet.oracle.com

http://www.oracle.com/support

http://www.oramag.com

2. quest software

http://www.quests.com

3. sun microsystems

http://www.sun.com

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

四.月維護過程

a.查看對數(shù)據(jù)庫會產生危害的增長速度

1. 從以前的記錄或報告中回顧段增長的變化以此來確定段增長帶來危害

b. 回顧以前數(shù)據(jù)庫優(yōu)化性能的調整

1. 回顧一般oracle 數(shù)據(jù)庫的調整點,比較以前的報告來確定有害的發(fā)展趨勢。

c. 查看i/o 的屏頸問題

1. 查看前期數(shù)據(jù)庫文件的活動性,比較以前的輸出來判斷有可能導致屏頸問題的趨勢。

d. 回顧fragmentation

e. 計劃數(shù)據(jù)庫將來的性能

1. 比較oracle 和操作系統(tǒng)的cpu,內存,網絡,及硬盤的利用率以此

來確定在近期將會有的一些資源爭奪的趨勢

2. 當系統(tǒng)將超出范圍時要把性能趨勢當作服務水平的協(xié)議來看

f. 完成調整和維護工作

1.使修改滿足避免系統(tǒng)資源的爭奪的需要,這里面包括增加新資源或使預期的停工。

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

五.附錄

a. 日常程序

-- free.sql

--to verify free space in tablespaces

--minimum amount of free space

--document your thresholds:

-- = m

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_space group by tablespace_name;

1. space.sql

-- space.sql

-- to check free, pct_free, and allocated space within a tablespace

-- 11/24/98

select tablespace_name, largest_free_chunk

, nr_free_chunks, sum_alloc_blocks, sum_free_blocks

, to_char(100*sum_free_blocks/sum_alloc_blocks, '09.99') || '%'

as pct_free

from ( select tablespace_name , sum(blocks) as sum_alloc_blocks

from dba_data_files group by tablespace_name )

, ( select tablespace_name as fs_ts_name

, max(blocks) as largest_free_chunk

, count(blocks) as nr_free_chunks

, sum(blocks) as sum_free_blocks from dba_free_space

group by tablespace_name ) where tablespace_name = fs_ts_name

2. analyze5pct.sql

-- analyze5pct.sql

-- to analyze tables and indexes quickly, using a 5% sample size

-- (do not use this script if you are performing the overnight

-- collection of volumetric data)

-- 11/30/98

begin

dbms_utility.analyze_schema ( '&owner', 'estimate', null, 5 ) ;

end ;

/

3. nr_extents.sql

-- nr_extents.sql

-- to find out any object reaching

-- extents, and manually upgrade it to allow unlimited

-- max_extents (thus only objects we *expect* to be big

-- are allowed to become big)

-- 11/30/98

select e.owner, e.segment_type , e.segment_name , count(*) as nr_extents ,

s.max_extents

, to_char ( sum ( e.bytes ) / ( 1024 * 1024 ) , '999,999.90') as mb

from dba_extents e , dba_segments s

where e.segment_name = s.segment_name

group by e.owner, e.segment_type , e.segment_name , s.max_extents

having count(*) > &threshold

or ( ( s.max_extents - count(*) )

order by count(*) desc

4. spacebound.sql

-- spacebound.sql

-- to identify space-bound objects. if all is well, no rows are returned.

-- if any space-bound objects are found, look at value of next extent

-- size to figure out what happened.

-- then use coalesce (alter tablespace coalesce .

-- lastly, add another datafile to the tablespace if needed.

-- 11/30/98

select a.table_name, a.next_extent, a.tablespace_name

from all_tables a,

( select tablespace_name, max(bytes) as big_chunk

from dba_free_space

group by tablespace_name ) f

where f.tablespace_name = a.tablespace_name

and a.next_extent > f.big_chunk

b. 每晚處理程序

1. mk_volfact.sql

-- mk_volfact.sql (only run this once to set it up; do not run it nightly!)

-- -- table utl_vol_facts

create table utl_vol_facts (

table_name varchar2(30),

num_rows number,

meas_dt date )

tablespace platab

storage (

initial 128k

next 128k

pctincrease 0

minextents 1

maxextents unlimited

)

/

-- public synonym

create public synonym utl_vol_facts for &owner..utl_vol_facts

/

-- grants for utl_vol_facts

grant select on utl_vol_facts to public

/

2. analyze_comp.sql

--

-- analyze_comp.sql

--

begin

sys.dbms_utility.analyze_schema ( '&owner','compute');

end ;

/

3. pop_vol.sql

--

-- pop_vol.sql

--

insert into utl_vol_facts

select table_name

, nvl ( num_rows, 0) as num_rows

, trunc ( last_analyzed ) as meas_dt

from all_tables -- or just user_tables

where owner in ('&owner') -- or a comma-separated list of owners

/

commit

/

 

c. 每周處理程序

1. nextext.sql

--

-- nextext.sql

--

-- to find tables that don't match the tablespace default for next extent.

-- the implicit rule here is that every table in a given tablespace should

-- use the exact same value for next, which should also be the tablespace's

-- default value for next.

--

-- this tells us what the setting for next is for these objects today.

--

-- 11/30/98

select segment_name, segment_type, ds.next_extent as actual_next

, dt.tablespace_name, dt.next_extent as default_next

from dba_tablespaces dt, dba_segments ds

where dt.tablespace_name = ds.tablespace_name

and dt.next_extent !=ds.next_extent

and ds.owner = upper ( '&owner' )

order by tablespace_name, segment_type, segment_name

2. existext.sql

--

-- existext.sql

--

-- to check existing extents

--

-- this tells us how many of each object's extents differ in size from

-- the tablespace's default size. if this report shows a lot of different

-- sized extents, your free space is likely to become fragmented. if so,

-- this tablespace is a candidate for reorganizing.

--

-- 12/15/98

select segment_name, segment_type

, count(*) as nr_exts

, sum ( decode ( dx.bytes,dt.next_extent,0,1) ) as nr_illsized_exts

, dt.tablespace_name, dt.next_extent as dflt_ext_size

from dba_tablespaces dt, dba_extents dx

where dt.tablespace_name = dx.tablespace_name

and dx.owner = '&owner'

group by segment_name, segment_type, dt.tablespace_name, dt.next_extent

3. no_pk.sql

--

-- no_pk.sql

--

-- to find tables without pk constraint

--

-- 11/2/98

select table_name

from all_tables

where owner = '&owner'

minus

select table_name

from all_constraints

where owner = '&&owner'

and constraint_type = 'p'

4. dispk.sql

--

-- dispk.sql

--

-- to find out which primary keys are disabled

--

-- 11/30/98

select owner, constraint_name, table_name, status

from all_constraints

where owner = '&owner' and status = 'disabled’ and constraint_type = 'p'

5. nonupk.sql

--

-- nonupk.sql

--

-- to find tables with nonunique pk indexes. requires that pk names

-- follow a naming convention. an alternative query follows that

-- does not have this requirement, but runs more slowly.

--

-- 11/2/98

select index_name, table_name, uniqueness

from all_indexes

where index_name like '&pkname%'

and owner = '&owner' and uniqueness = 'nonunique'

select c.constraint_name, i.tablespace_name, i.uniqueness

from all_constraints c , all_indexes i

where c.owner = upper ( '&owner' ) and i.uniqueness = 'nonunique'

and c.constraint_type = 'p' and i.index_name = c.constraint_name

6. mkrebuild_idx.sql

--

-- mkrebuild_idx.sql

--

-- rebuild indexes to have correct storage parameters

--

-- 11/2/98

select 'alter index ' || index_name || ' rebuild '

, 'tablespace indexes storage '

|| ' ( initial 256 k next 256 k pctincrease 0 ) ; '

from all_indexes

where ( tablespace_name != 'indexes'

or next_extent != ( 256 * 1024 )

)

and owner = '&owner'

/

7. datatype.sql

--

-- datatype.sql

--

-- to check datatype consistency between two environments

--

-- 11/30/98

select

table_name,

column_name,

data_type,

data_length,

data_precision,

data_scale,

nullable

from all_tab_columns -- first environment

where owner = '&owner'

minus

select

table_name,

column_name,

data_type,

data_length,

data_precision,

data_scale,

nullable

from [email protected]&my_db_link -- second environment

where owner = '&owner2'

order by table_name, column_name

8. obj_coord.sql

--

-- obj_coord.sql

--

-- to find out any difference in objects between two instances

--

-- 12/08/98

select object_name, object_type

from user_objects

minus

select object_name, object_type

from [email protected]&my_db_link;

?
菜鳥學堂:
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 镇江市| 仪征市| 东丽区| 乐清市| 彭水| 呼伦贝尔市| 西青区| 全州县| 平潭县| 盐亭县| 利辛县| 维西| 汝城县| 中卫市| 抚松县| 望谟县| 科尔| 化隆| 永州市| 泊头市| 北川| 青神县| 巩留县| 白河县| 信阳市| 淮北市| 弥渡县| 天台县| 吐鲁番市| 天门市| 广河县| 修水县| 景德镇市| 平潭县| 辽宁省| 长子县| 察哈| 扎鲁特旗| 澳门| 屏边| 襄城县|