Informix命令之一-oninit
Usage: oninit { -[ipsy] } -i Initialize disk space and shared memory, leave in on-line mode. -p Do not reclaim temporary tables. -s Initialize shared memory, leave in quiescent mode. -y Respond yes to all prompts
以上是在線幫助,用法如下: 1)$>oninit -i 這個命令將初始化磁盤空間,是很危險的參數(shù),在你使用數(shù)據(jù)庫的過程中,只能在剛安裝完做一次,否則。。。 2)$>oninit -p 數(shù)據(jù)庫不正常宕掉時,數(shù)據(jù)庫中會留有臨時表,這些表會占據(jù)一定的磁盤空間,一般我們重起數(shù)據(jù)庫時,數(shù)據(jù)庫會自動刪除臨時表,但我們也可以使用該命令保留這些臨時表。 3)$>oninit -s 將數(shù)據(jù)庫服務(wù)器啟動到單用戶模式,就同操作系統(tǒng)的單用戶一樣,這時你可以做一些維護(hù)工作,而不受其它想連上數(shù)據(jù)庫的用戶干擾。 4) $>oninit 正常啟動數(shù)據(jù)庫。 5)$>oninit -v 正常啟動數(shù)據(jù)庫,并且顯示啟動的過程信息。
Informix命令之二--dbexport
Usage: dbexport <database> [-X] [-c] [-q] [-d] [-ss] [{ -o <dir> | -t <tapedev> -b <blksz> -s <tapesz> [-f <sql-command-file>] }] NOTE: arguments to dbexport are order independent. 參數(shù)詳解: -X 如果某個字符串字段中包含二進(jìn)制數(shù)據(jù),加上該參數(shù)后,dbexport將重新組織這些數(shù)據(jù)。 -c 除非很嚴(yán)重的錯誤dbexport才中斷,這些錯誤如下: 不能打開你指定的磁帶設(shè)備; 不能寫磁帶設(shè)備或文件; 不正確的命令行參數(shù); 不能打開數(shù)據(jù)庫或沒有連接數(shù)據(jù)庫的權(quán)限; -q 不用將導(dǎo)出過程輸出到屏幕上 -d 讓dbexport只導(dǎo)出BLOB字段的描述符,而不導(dǎo)出BLOB數(shù)據(jù) -ss 能夠生成更詳細(xì)的信息,比如: 初始和附加extent的尺寸; 表的分片信息; 對表的鎖的模式(行鎖或頁鎖); 表所在的dbspace或BLOB數(shù)據(jù)所在的space; -o <dir> 可以將數(shù)據(jù)庫導(dǎo)入到你指定的目錄下 -t <tapedev> -b <blksz> -s <tapesz> 將數(shù)據(jù)導(dǎo)入到磁帶 -f <sql-command-file> dbexport在導(dǎo)出數(shù)據(jù)的同時會產(chǎn)生一個DDL的文件,你可以指定一個絕對路徑的文件
例: 1) 將數(shù)據(jù)庫stores導(dǎo)出到當(dāng)前目錄下 $>dbexport stores 2) 將數(shù)據(jù)庫stores導(dǎo)出到當(dāng)前目錄下,不將過程輸出到屏幕,并且忽略小錯 $>dbexport stores -q -c 3) 將數(shù)據(jù)庫stores導(dǎo)出到指定目錄下 $>dbexport stores -q -c -o /tmp 4)將數(shù)據(jù)庫stores導(dǎo)出到磁帶上 $>dbexport stores -t /dev/tape -b 2048 -s 2000000 -f /tmp 5)將數(shù)據(jù)庫stores導(dǎo)出前目錄下,并且加上額外的信息 $>dbexport stores -ss
Informix命令之三--ontape
ontape usage: { -a | -c | -l | -p | -r [-D DBspace_list] | -s [-L archive_level] [-A database_list] [-B database_list] [-N database_list] [-U database_list] } -a Automatic backup of logical logs -c Continuous backup of logical logs -l Logical restore -p Physical restore for HDR -r Full restore DBspaces/BLOBspaces as listed -s Archive full system -A set the following database(s) to ansi logging -B set the following database(s) to buffered logging -N set the following database(s) to no logging -U set the following database(s) to unbuffered logging
與該工具有關(guān)的幾個參數(shù),在$ONCONFIG文件中:
。。。 # System Archive Tape Device
TAPEDEV /dev/tapedev # Tape device path TAPEBLK 16 # Tape block size (Kbytes) TAPESIZE 10240 # Maximum amount of data to put on tape (Kbytes)
# Log Archive Tape Device
LTAPEDEV /dev/tapedev # Log tape device path LTAPEBLK 16 # Log tape block size (Kbytes) LTAPESIZE 10240 # Max amount of data to put on log tape (Kbytes) 。。。
其中LTAPEDEV為備份邏輯日志的磁帶設(shè)備,TAPEDEV為零級備份的設(shè)備。它們也可以指向同一個設(shè)備名。
例: 1)零級(一級或二級)備份 $>ontape -s $>ontape -s -L 0 $>ontape -s -L 1 $>ontape -s -L 2
2)邏輯日志備份 $>ontape -a
3)連續(xù)邏輯日志備份(日志文件滿一個備份一個,你可以插盤磁帶到磁帶機(jī)上,讓IDS自動備份) $>ontape -c
4)備份恢復(fù)(對應(yīng)零級備份或一級備份或二級備份) $>ontape -r
5)備份恢復(fù)幾個DBSPACE(一定要存在邏輯日志備份,否則物理恢復(fù)完后,還是不能用) $>ontape -r -D dbs1 dbs2 。。。
6)配置HDR時使用的物理恢復(fù) $>ontape -p
7)修改數(shù)據(jù)庫日志模式 $>ontape -s -B db_name 修改為buffer_log $>ontape -s -U db_name 修改為unbuffer_log $>ontape -s -N db_name 修改為無日志模式 $>ontape -s -A db_name 修改為ansi logging模式,從這個模式無法改到其它模式,因此一般不要用該項。
另外,我們改完日志后需要做一個零級備份,這時我們可以將TAPEDEV設(shè)置為/dev/null ,然后再接著做,就可以了,但作完后一定要將該參數(shù)改回來,注意修改LTAPEDEV和TAPEDEV都不用重新啟動數(shù)據(jù)庫,改完存盤就能用了。
如果我們不想要邏輯日志備份,我們可以將LTAPEDEV設(shè)為/dev/null ,那么邏輯日志會滿一個自動備份一個,不用我們?nèi)ス芾砹恕?nbsp; | | |