?
このドキュメントでは、 php中國(guó)語(yǔ)ネットマニュアル リリース
修改ORACLE7數(shù)據(jù)庫(kù)maxdatafiles參數(shù)的方法
2000/04/13?
|
? |
在安裝ORACLE7時(shí),一般對(duì)maxdatafiles(數(shù)據(jù)文件的最大個(gè)數(shù))參數(shù)值不加修改或未意識(shí)到對(duì)
其修改,而使用其默認(rèn)值(往往比需要值要?。?。但隨著數(shù)據(jù)量的增多,需要不斷地往表空間內(nèi)增加數(shù)據(jù)文件,但是maxd
atafiles的值限定了數(shù)據(jù)文件的最大個(gè)數(shù),數(shù)據(jù)文件個(gè)數(shù)增加到最大值后,若再繼續(xù)追加,就會(huì)導(dǎo)致“數(shù)據(jù)文件個(gè)數(shù)
超過了最大值”的錯(cuò)誤,以至后邊的數(shù)據(jù)無法存入。 數(shù)據(jù)文件的最大個(gè)數(shù)因操作系統(tǒng)的不同而不同,但是,現(xiàn)在運(yùn)行著的ORACLE7數(shù)據(jù)庫(kù)中,數(shù)據(jù)文件的最大個(gè)數(shù)
可以達(dá)到1000個(gè)以上,即maxdatafiles的參數(shù)值可設(shè)為1000或更大,遠(yuǎn)遠(yuǎn)大于其安裝時(shí)的默認(rèn)值(本系
統(tǒng)安裝時(shí)的默認(rèn)值為30),如果遇到了“數(shù)據(jù)文件個(gè)數(shù)超過了最大值”的問題時(shí),可通過修改maxdatafiles參
數(shù)來解決,下面就介紹一下具體的修改方法: 1.實(shí)驗(yàn)環(huán)境 ALPHA8200服務(wù)器,操作系統(tǒng)Digial UNIX V3.2C,Oracle7.2數(shù)據(jù)庫(kù)。 2.準(zhǔn)備工作 啟動(dòng)ORACLE數(shù)據(jù)庫(kù),進(jìn)行下列操作: $sqldba mode=line(回車) SQLDBA>connect internal(回車) SQLDBA>alter database backup controlfile to trace;(
回車) SQLDBA>show parameter user_dump_dest(回車) 可以看到trace文件“ora_3044.trc”在/volora/oracle/rdbms/log目
錄下。 將trace文件/volora/oracle/rdbms/log/ora_3044.trc拷貝成 df
ileadd.sql。 用vi編輯dfileadd.sql文件,修改maxdatafiles參數(shù)(由原來的30改為300)。 Dfileadd.sql文件如下: Dump file/volora/oracle/rdbms/log/ora_3044.trc Oracle7 Server Release7.2.2.3.0 with the64-bit opti
on- Production Release With the distributed and parallel query options PL/SQL Release2.2.2.3.0- Production ORACLE_HOME=/volora/oracle ORACLE_SID= ora72 Oracle process number:8 Unix process id:3044 System name: OSF1 Node name: slserver.sl.cnpc.co.cn Release: V3.2 Version:148 Machine: alpha Wed Apr2315:54:281997 Wed Apr2315:54:281997 *** SESSION ID:(9.1455)1997.04.23.15.54.28.359 # The following commands will create a new control
file and use it # to open the database. # No data other than log history will be lost. Addi
tional logs may # be required for media recovery of offline data fi
les. Use this # only if the current version of all online logs ar
e available. STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE"ORA72" NORESETLOG
S NOARCHIVELOG MAXLOGFILES32 MAXLOGMEMBERS2 MAXDATAFILES300 MAXINSTANCES8 MAXLOGHISTORY800 LOGFILE GROUP1'/volora/oracle/dbs/log1ora72.dbf' SIZE500K, GROUP2'/volora/oracle/dbs/log2ora72.dbf' SIZE500K, GROUP3'/volora/oracle/dbs/log3ora72.dbf' SIZE500K DATAFILE '/volora/oracle/dbs/systora72.dbf', '/volora/oracle/dbs/rbsora72.dbf', '/volora/oracle/dbs/tempora72.dbf', '/volora/oracle/dbs/toolora72.dbf', '/volora/oracle/dbs/usrora72.dbf', '/volora/oracle/dbs/jhc.dbf', '/volora/oracle/dbs/useradd.dbf' ; # Recovery is required if any of the datafiles are
restored backups, # or if the last shutdown was not normal or immedia
te. RECOVER DATABASE # Database can now be opened normally. ALTER DATABASE OPEN; 將以上dfileadd.sql文件中橫線上沒用的斜體部分行刪掉,存盤。 最后關(guān)閉數(shù)據(jù)庫(kù),并做好數(shù)據(jù)庫(kù)的備份,包括數(shù)據(jù)和控制文件的備份,起碼要用export將數(shù)據(jù)全部卸出。有條
件的話,盡量做全備份,預(yù)防在數(shù)據(jù)庫(kù)重建失敗后癱瘓,因?yàn)橄乱徊焦ぷ鳡砍兜綄?duì)數(shù)據(jù)庫(kù)的破壞和重新生成工作。 3.修改maxdatafiles參數(shù)的過程 3.1刪除/volora/oracle/dbs目錄下面所有的控制文件(共3個(gè)): $rm*.ctl(回車) 3.2重新生成數(shù)據(jù)庫(kù)(生成新的控制文件、數(shù)據(jù)文件等) $sqldba mode=line(回車) SQLDBA>connect internal(回車) 運(yùn)行dfileadd.sql: SQLDBA>@dfileadd.sql(回車) ORACLE instance started. Statement processed. Media recovery complete. Statement processed. SQLDBA>alter database open noresetlogs;(回車) 至此,數(shù)據(jù)庫(kù)的刷新工作已完成,可以投入正常運(yùn)行了,目前運(yùn)行著的ORACLE7數(shù)據(jù)庫(kù),數(shù)據(jù)文件最多可建立
到300個(gè)。 在Windows 95下有一個(gè)任務(wù)欄可隨時(shí)用鼠標(biāo)單擊任務(wù)欄上的應(yīng)用程序圖標(biāo)切換到相應(yīng)的程序,在Wind
ows 3.X下要切換應(yīng)用程序使用的方法有兩種,一種是用ALT+TAB切換,另一種是用CTRL+ESC(或在桌
面的空白處雙擊鼠標(biāo))打開任務(wù)列表從中選擇切換,筆者在使用中總感到不如在Windows 95下那樣方便。本文提供
一個(gè)用VB 3.0專業(yè)版在Windows 3.2中文版下編寫的程序,可實(shí)現(xiàn)將任務(wù)列表一直顯示在屏幕上,隨時(shí)可用
鼠標(biāo)雙擊任務(wù)列表中的程序名字切換,類似與Windows 95下的任務(wù)欄,使用很方便。 實(shí)現(xiàn)方法:在窗體中加入一列表框,將檢測(cè)到的所有已打開的應(yīng)用程序加入其中,用戶就可以雙擊應(yīng)用程序名字來切
換了。這里還有一個(gè)將其常居頂端的問題,這方面的實(shí)現(xiàn)方法在許多報(bào)刊雜志上都可以看到,本文不再敘述,本文只給出其余
功能的實(shí)現(xiàn)程序。 本程序在開始運(yùn)行時(shí)檢測(cè)已運(yùn)行的應(yīng)用程序并將它們加入到任務(wù)列表框中,當(dāng)此后再有新的應(yīng)用程序打開時(shí),需要將
其添加到列表框中,所以設(shè)計(jì)了一個(gè)刷新按鈕,如果有新的應(yīng)用程序打開,可點(diǎn)一下它。 另外類似與Windows 本身
的任務(wù)列表功能,加入了一個(gè)切換按鈕,當(dāng)用戶在任務(wù)列表中單擊選擇任務(wù)后,單擊切換按鈕也可切換,此外還有一個(gè)退出按
鈕用來關(guān)閉任務(wù)列表。 程序如下: 在窗體中加入如下對(duì)象并設(shè)置屬性: 按鈕1 Caption="刷新" name=cmdrefresh 按鈕2 Caption="切換" name=cmdswitch 按鈕3 Caption="退出" name=cmdexit 列表框list name=lstApp 將窗體形狀拉成長(zhǎng)條狀,安排好對(duì)象位置,以便減少屏幕占用空間,將其邊框?qū)傩愿臑楣潭ㄟ吙?,不允許改變大小。
在總體聲明部分寫如下代碼: '聲明用到的API函數(shù)和常量 Option Explicit Declare Function ShowWindow Lib"User"(ByVal hWnd As
Integer, ByVal flgs As Integer) As Integer Declare Function GetWindow Lib"User"(ByVal hWnd As
Integer, ByVal wCmd As Integer) As Integer Declare Function GetWindowWord Lib"User"(ByVal hWnd
As Integer, ByVal wIndx As Integer) As Integer Declare Function GetWindowLong Lib"User"(ByVal hWnd
As Integer, ByVal wIndx As Integer) As Long Declare Function GetWindowText Lib"User"(ByVal hWnd
As Integer, ByVal lpSting As String, ByVal nMaxCount As
Integer) As Integer Declare Function GetWindowTextLength Lib"User"(ByVa
l hWnd As Integer) As Integer Declare Function SetWindowPos Lib"User"(ByVal hWnd
As Integer, ByVal insaft As Integer, ByVal x%, ByVal y%
, ByVal cx%, ByVal cy%, ByVal flgs As Integer) As Integ
er '注:上面的API函數(shù)要寫在一行中 Const WS_MINIMIZE=&H20000000 Const HWND_TOP=0 Const SWP_NOSIZE=&H1 Const SWP_NOMOVE=&H2 Const SWP_SHOWWINDOW=&H40 Const GW_HWNDFIRST=0 Const GW_HWNDNEXT=2 Const GWL_STYLE=(-16) Const SW_RESTORE=9 Const WS_VISIBLE=&H10000000 Const WS_BORDER=&H800000 Const WS_CLIPSIBLINGS=&H4000000 Const WS_THICKFRAME=&H40000 Const WS_GROUP=&H20000 Const WS_TABSTOP=&H10000 Dim IsTask As Long '尋找已打開的應(yīng)用程序函數(shù) Sub FindAllApps() Dim hwCurr As Long Dim intLen As Long Dim strTitle As String lstApp.Clear hwCurr= GetWindow(Me.hWnd, GW_HWNDFIRST) Do While hwCurr If hwCurr Me.hWnd And TaskWindow(hwCurr) Then intLen= GetWindowTextLength(hwCurr)+1 strTitle= Space$(intLen) intLen= GetWindowText(hwCurr, strTitle, intLen) If intLen>0 Then lstApp.AddItem strTitle lstApp.ItemData(lstApp.NewIndex)= hwCurr End If End If hwCurr= GetWindow(hwCurr, GW_HWNDNEXT) Loop End Sub Function TaskWindow(hwCurr As Long) As Long Dim lngStyle As Long lngStyle= GetWindowLong(hwCurr, GWL_STYLE) If(lngStyle And IsTask)= IsTask Then TaskWindow= Tr
ue End Function 雙擊“退出”按鈕,寫如下代碼: Sub Cmdexit_Click() Unload Me End Sub 雙擊“刷新”按鈕,寫如下代碼: Sub Cmdrefresh_Click() FindAllApps'刷新任務(wù)列表 End Sub 雙擊“切換”按鈕,寫如下代碼: Sub Cmdswitch_Click() Dim hWnd As Long Dim x As Long Dim lngWW As Long If lstApp.ListIndex
hWnd= lstApp.ItemData(lstApp.ListIndex) lngWW= GetWindowLong(hWnd, GWL_STYLE) If lngWW And WS_MINIMIZE Then x= ShowWindow(hWnd, SW_RESTORE) End If x= SetWindowPos(hWnd, HWND_TOP,0,0,0,0, SWP_NOMOVE
Or SWP_NOSIZE Or SWP_SHOWWINDOW) End Sub 雙擊窗體,寫如下代碼: Sub Form_Load() IsTask= WS_VISIBLE Or WS_BORDER FindAllApps End Sub 窗體更新時(shí)刷新任務(wù)列表: Sub Form_Paint() FindAllApps End Sub雙擊列表框?qū)懭缦麓a: Sub lstApp_DblClick() Switch.Value= True End Sub
|