修改ORACLE7數(shù)據(jù)庫(kù)maxdatafiles參數(shù)的方法
2024-08-29 13:38:40
供稿:網(wǎng)友
在安裝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ù)超過(guò)了最大值”的錯(cuò)誤,以至后邊的數(shù)據(jù)無(wú)法存入。
數(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ù)超過(guò)了最大值”的問(wèn)題時(shí),可通過(guò)修改maxdatafiles參數(shù)來(lái)解決,下面就介紹一下具體的修改方法:
1.實(shí)驗(yàn)環(huán)境
ALPHA8200服務(wù)器,操作系統(tǒng)Digial UNIX V3.2C,Oracle7.2數(shù)據(jù)庫(kù)。
2.預(yù)備工作
啟動(dòng)ORACLE數(shù)據(jù)庫(kù),進(jìn)行下列操作:
$sqldba mode=line(回車(chē))
SQLDBA>connect internal(回車(chē))
SQLDBA>alter database backup controlfile to trace;( 回車(chē))
SQLDBA>show parameter user_dump_dest(回車(chē))
可以看到trace文件“ora_3044.trc”在/volora/oracle/rdbms/log目錄下。
將trace文件/volora/oracle/rdbms/log/ora_3044.trc拷貝成 df ileadd.sql。
用vi編輯dfileadd.sql文件,修改maxdatafiles參數(shù)(由原來(lái)的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文件中橫線上沒(méi)用的斜體部分行刪掉,存盤(pán)。
最后關(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ù)的過(guò)程
3.1刪除/volora/oracle/dbs目錄下面所有的控制文件(共3個(gè)):
$rm*.ctl(回車(chē))
3.2重新生成數(shù)據(jù)庫(kù)(生成新的控制文件、數(shù)據(jù)文件等)
$sqldba mode=line(回車(chē))
SQLDBA>connect internal(回車(chē))
運(yùn)行dfileadd.sql:
SQLDBA>@dfileadd.sql(回車(chē))
ORACLE instance started.
Statement processed.
Media recovery complete.
Statement processed.
SQLDBA>alter database open noresetlogs;(回車(chē))
至此,數(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))打開(kāi)任務(wù)列表從中選擇切換,筆者在使用中總感到不如在Windows 95下那樣方便。本文提供一個(gè)用VB 3.0專(zhuān)業(yè)版在Windows 3.2中文版下編寫(xiě)的程序,可實(shí)現(xiàn)將任務(wù)列表一直顯示在屏幕上,隨時(shí)可用鼠標(biāo)雙擊任務(wù)列表中的程序名字切換,類(lèi)似與Windows 95下的任務(wù)欄,使用很方便。
實(shí)現(xiàn)方法:在窗體中加入一列表框,將檢測(cè)到的所有已打開(kāi)的應(yīng)用程序加入其中,用戶就可以雙擊應(yīng)用程序名字來(lái)切換了。這里還有一個(gè)將其常居頂端的問(wèn)題,這方面的實(shí)現(xiàn)方法在許多報(bào)刊雜志上都可以看到,本文不再敘述,本文只給出其余功能的實(shí)現(xiàn)程序。
本程序在開(kāi)始運(yùn)行時(shí)檢測(cè)已運(yùn)行的應(yīng)用程序并將它們加入到任務(wù)列表框中,當(dāng)此后再有新的應(yīng)用程序打開(kāi)時(shí),需要將其添加到列表框中,所以設(shè)計(jì)了一個(gè)刷新按鈕,假如有新的應(yīng)用程序打開(kāi),可點(diǎn)一下它。 另外類(lèi)似與Windows 本身的任務(wù)列表功能,加入了一個(gè)切換按鈕,當(dāng)用戶在任務(wù)列表中單擊選擇任務(wù)后,單擊切換按鈕也可切換,此外還有一個(gè)退出按鈕用來(lái)關(guān)閉任務(wù)列表。
程序如下:
在窗體中加入如下對(duì)象并設(shè)置屬性:
按鈕1 Caption="刷新" name=cmdrefresh
按鈕2 Caption="切換" name=cmdswitch
按鈕3 Caption="退出" name=cmdexit
列表框list name=lstApp
將窗體外形拉成長(zhǎng)條狀,安排好對(duì)象位置,以便減少屏幕占用空間,將其邊框?qū)傩愿臑楣潭ㄟ吙颍淮饝?yīng)改變大小。
在總體聲明部分寫(xiě)如下代碼:
'聲明用到的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ù)要寫(xiě)在一行中
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 right">(出處:清風(fēng)軟件下載學(xué)院)