導航:首頁 > 文件類型 > linux怎麼退出vip文件

linux怎麼退出vip文件

發布時間:2024-03-30 22:04:07

linux操作系統文件訪問許可權詳解

一直以root登陸使用linux的人來說很少有許可權被拒這種概念,但某些時候又深受許可權拒絕困擾。
知道為什麼很多程序中需要使用getuid(),setuid()?為什麼以普通許可權登陸的用戶不能進入/root,為什麼在/目錄下執行ls -l後可以顯示root的信息,但ls /root -al卻是許可權不夠?為什麼有些文件夾可以繼續創建文件,但就是不能ls?等等,相信看了此文就能明白。
主要是學習筆記,不足之處請指正。
CentOS 5.4 [testc@xxx opt]$ uname -a Linux xxx 2.6.18-164.el5xen #1 SMP Thu Sep 3 04:47:32 EDT 2009 i686 i686 i386 GNU/Linux
一、口令文件1,格式存儲文件/etc/passwd,格式如下:root:x:0:0:root:/root:/bin/bash aaa:x:501:501:bj, bj, 8111111,136000111:/home/aaa:/bin/bash用戶名:加密密碼:用戶ID:組ID:注釋:工作目錄:shell:
默認情況是第一行的格式;注釋欄位可以自行修改,用逗號隔開,如第二行格式,這主要是給finger命令使用時可解析。
可以vi /etc/passwd修改,但為了保證其格式的正確性,請用vipw命令編譯此文件。
sh-3.2# finger aaa Login: aaa Name: bj Directory: /home/aaa Shell: /bin/bash Office: bj, 8111111 Home Phone: 136000111 Never logged in. No mail. No Plan.
2,編程實例
/*getpwnam_pwuid.c*/ #include #include #include
int main(void)
{ //struct passwd *pwd = getpwnam("aaa");struct passwd *pwd = getpwuid(501);if(pwd == NULL)
{ printf("err.\n");return 1;}
printf("name:%s\n", pwd->pw_name);printf("passwd:%s\n", pwd->pw_passwd);printf("description:%s\n", pwd->pw_gecos);printf("uid:%d\n", pwd->pw_uid);printf("gid:%d\n", pwd->pw_gid);printf("dir:%s\n", pwd->pw_dir);printf("shell:%s\n", pwd->pw_shell);
return 0;}
sh-3.2# gcc getpwnam_pwuid.c -o app sh-3.2# ./app name:aaa passwd:x description:bj, bj, 8111111,136000111 uid:501 gid:501 dir:/home/aaa shell:/bin/bash
二、組文件1,格式存儲文件/etc/group,格式如下root:x:0:root bin:x:1:root,bin,daemon aaa:x:501:組名:加密密碼:組ID:指向的各用戶名
2,改變文件uid和gid.
sh-3.2# pwd /root/study sh-3.2# ls -al -rw-r——r—— 1 root root 397 10-11 03:23 test.c
chgrp 改變所屬組ID,當然只有root許可權才可以修改。
sh-3.2# chgrp aaa test.c sh-3.2# ls -al -rw-r——r—— 1 root aaa 397 10-11 03:23 test.c
這個aaa就是新組名,其在/etc/group中,可以通過adser aaa自行添加sh-3.2# cat /etc/group root:x:0:root bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon.
gdm:x:42:sabayon:x:86:plmtest:x:500:aaa:x:501:
chown 改變用戶ID或組ID sh-3.2# chown aaa:aaa test.c sh-3.2# ls -al -rw-r——r—— 1 aaa aaa 397 10-11 03:23 test.c
3,編程實例
/*getgrnam.c*/ #include #include
int main(int argc, char *argv[])
{ if(argv[1] == NULL)
{ printf("input error.\n");return 1;}
struct group *gp = getgrnam(argv[1]);if(gp == NULL)
{ printf("err.\n");return 1;}
printf("name:%s\n", gp->gr_name);printf("psswd:%s\n", gp->gr_passwd);printf("gid:%d\n", gp->gr_gid);
int i;for(i = 0; gp->gr_mem[i] != NULL; i++)
{ printf("group name:%s\n", gp->gr_mem[i]);}
return 0;}
sh-3.2# gcc getgrnam.c -o app sh-3.2# ./app bin name:bin psswd:x gid:1 group name:root group name:bin group name:daemon 4,文件許可權不細講了sh-3.2# ls -al總計 483984 drwxr-x—— 13 root root 4096 02-22 00:01 . drwxr-xr-x 32 root root 4096 02-21 21:15 ……
-rw-r——r—— 1 root root 464023491 10-25 22:33 3.3.005-080425.tgz -rw—— 1 root root 9346 02-21 23:16 .bash_history -rw-r——r—— 1 root root 24 2007-01-06 .bash_logout -rw-r——r—— 1 root root 191 2007-01-06 .bash_profile -rw-r——r—— 1 root root 176 2007-01-06 .bashrc drwxrwxrwx 10 1000 users 4096 08-23 20:16 cflow-1.3 -rw-r——r—— 1 root root 759691 08-23 20:13 cflow.tar.gz -rw-r——r—— 1 root root 100 2007-01-06 .cshrc -rwxr-xr-x 1 root root 582 11-11 21:48 delete_M.sh -rw-r——r—— 1 root root 2518 11-11 20:25 .dir_colors
主要是最左邊一列:drwxr-x——10個字元,最左邊是文件類型,-默認為普通文件;d:目錄文件;l符號鏈接……
後面9個,3個一組共三組,分別表示所屬用戶uid的許可權;所屬組或者附屬組gid的許可權;其它許可權。
三個字元分別是讀、寫、執行許可權讀4,寫2, 執行1
所以chmod 777 test.c,提升到讀、寫、執行許可權。
5,組許可權操作實例此節演示相同組的成員之間共享資源,即不同uid但相同gid的用戶共享同一組的資源。
為了方便起見,我同時開了兩個終端。
"sh-3.2#"以root許可權登陸的shell /bin/sh "[testa@xxx root]"以testa用戶登陸的shell
註:下文提到的「用戶」是指/etc/passwd里定義的通過終端登陸的用戶(此文即以下增加的三個賬號名)。
sh-3.2# useradd testa sh-3.2# useradd testb sh-3.2# useradd testc
sh-3.2# tail -f /etc/passwd -n 4 sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin testa:x:500:500::/home/testa:/bin/bash testb:x:501:501::/home/testb:/bin/bash testc:x:502:502::/home/testc:/bin/bash
再開一個終端登陸testa,之前那個終端保持。
sh-3.2# su testa [testa@xxx root]$ id uid=500(testa) gid=500(testa) groups=500(testa)
[testa@xxx home]$ ls -al總計 28 drwxr-xr-x 5 root root 4096 02-21 22:52 . drwxr-xr-x 32 root root 4096 02-21 21:15 ……
drwx—— 3 testa testa 4096 02-21 22:56 testa drwx—— 3 testb testb 4096 02-21 22:48 testb drwx—— 3 testc testc 4096 02-21 22:52 testc
[testa@xxx home]$ cd testb bash: cd: testb: 許可權不夠
通過root修改testb目錄許可權為770,即當前uid或者gid相同的用戶均有讀寫執行許可權。
sh-3.2# cd /home/ sh-3.2# chmod 770 testb
[testa@xxx home]$ ls -al總計 28 drwxr-xr-x 5 root root 4096 02-21 22:52 . drwxr-xr-x 32 root root 4096 02-21 21:15 ……
drwx—— 3 testa testa 4096 02-21 22:56 testa drwxrwx—— 3 testb testb 4096 02-21 22:48 testb (here modify)
drwx—— 3 testc testc 4096 02-21 22:52 testc
[testa@xxx home]$ cd testb bash: cd: testb: 許可權不夠[testa@xxx root]$ id uid=500(testa) gid=500(testa) groups=500(testa)
此時雖然開放了testb的所屬組許可權,但用戶testa的gid=500(testa) groups=500(testa),它還不屬於testb組。
下面修改testa的gid為testb(或者增加其附屬組groups值為testb)
sh-3.2# usermod -G testb testa (增加用戶testa的附屬組testb)
sh-3.2# id testa uid=500(testa) gid=500(testa) groups=500(testa),501(testb)
此時testa終端需要重新登下,使剛才更改生效[testa@xxx root]$ exit exit [root@xxx ~]# su testa [testa@xxx root]$ id uid=500(testa) gid=500(testa) groups=500(testa),501(testb)
[testa@xxx root]$ cd /home/ [testa@xxx home]$ ls -al總計 28 drwxr-xr-x 5 root root 4096 02-21 22:52 . drwxr-xr-x 32 root root 4096 02-21 21:15 ……
drwx—— 3 testa testa 4096 02-21 22:56 testa drwxrwx—— 3 testb testb 4096 02-21 22:48 testb drwx—— 3 testc testc 4096 02-21 22:52 testc [testa@xxx home]$ cd testb [testa@xxx testb]$ pwd /home/testb
以上是增加了用戶testa的附屬組testb,使其對於屬於testb組的資源有了訪問許可權。
下面再使用newgrp切換用戶testa的gid.
[testa@xxx testb]$ id uid=500(testa) gid=500(testa) groups=500(testa),501(testb)
[testa@xxx testb]$ newgrp testb [testa@xxx testb]$ id uid=500(testa) gid=501(testb) groups=500(testa),501(testb)
此時testa用戶的gid已改為501(testb)。
組之前的關系在文件/etc/group sh-3.2# tail -f /etc/group -n 4 sabayon:x:86:testa:x:500:testb:x:501:testa (最後一列:組內用戶列表。即組testb里包含testa,testa屬於testb組,大概就這意思吧……)
testc:x:502:
雖然知道控制組關系的文件,但不能直接修改些文件,否則執行newgrp時會出現"抱歉"錯誤提示。
當然root用戶許可權是無限制的,它訪問文件時不需要進行許可權檢查。
三、相關系統調用getuid();getgid();int setuid(uid_t uid);int setgid(gid_t gid);
只有超級用戶或者需要設置的uid和當前用戶的uid一致才可以設置,否則返回-1,置errno = EPERM, errno可以通過strerror()翻譯。
其它:[testa@xxx home]$ su testa [testa@xxx home]$ sudo touch aa
testa is not in the sudoers file. This incident will be reported.
以root許可權vim /etc/sudoers增加testa ALL=(ALL) ALL
參考:APUE2E,1.8, 4.4, 8.11

⑵ 鉶氭嫙鏈洪棶棰(鎵鐢ㄧ増鏈琖Mvare 5.51)

1.瀹夎卾mware server杞浠
浠www.vmware.com涓嬭澆vmware server 1.0 for linux杞浠,瀹夎呰繃紼嬪緢綆鍗,鍩烘湰涓婃槸涓璺疎nter.鍙鏄闇瑕乻n,鍦ㄨ繖閲屾彁渚涘嚑涓浣跨敤
928WH-Y65AW-21394-4C70J,92EY4-Y4NAT-23L07-4U7CH,9AWPN-Y400W-2179N-4K5HM
瀹夎卾mware server console,浠ヤ究榪滅▼綆$悊vmware server
2.瀹夎呰櫄鎷熸湇鍔″櫒鎿嶄綔緋葷粺
鎴戠敤鐨勬槸OS鏄疪edhat AS4,kernel 2.6.9-22,鉶氭嫙鍑轟袱鍧楃綉鍗,寮濮嬪畨瑁呮搷浣滅郴緇,涓繪満鍚嶅彨ha1pub,eth0:10.1.250.17,eth1:192.168.100.100.鍏蜂綋榪囩▼鐪佺暐.瀹夎呯粨鏉熷悗,浣跨敤ntsysv鍛戒護,鍏抽棴鎺変竴浜涗笉甯鎬嬌鐢ㄧ殑榪涚▼,鍙鐣欎笅涓涓嬩竴浜涢渶瑕佺殑,濡俿sh,ftp絳夌瓑.鐒跺悗鍏蟲満!
鐒跺悗cp ha1pub鐨勬墍鏈夐厤緗鏂囦歡鍒頒竴涓鏂扮殑鐩褰,鍦ㄨ櫄鎷熸満console閲岄潰鎵撳紑,灝變細鍑虹幇涓涓鏂扮殑緋葷粺,浣嗘槸鐢變簬閲岄潰鐨剗p淇℃伅鍜岀涓鍙版満鍣ㄧ殑閲嶅,榪涘叆緋葷粺鍚庝慨鏀逛竴涓
緙栬緫/etc/sysconfig/network鏂囦歡,灝唄a1pub淇鏀逛負ha2pub,鐒跺悗淇鏀筰p,eth0:10.1.250.18,eth1:192.168.100.200.
娉ㄦ剰,redhat緋葷粺閲岄潰,ip鐨勯厤緗鏂囦歡ifcfg-eth鏂囦歡閲岄潰,鏈夊彲鑳藉寘鍚玬ac鍦板潃鐨勪俊鎮,闇瑕佸垹闄ゆ帀,鍚﹀垯浼歮ac鍦板潃閲嶅嶇殑閿欒.ha2pub涔熷叧鏈
3.璁劇疆鍏變韓瀛樺偍
鐢變簬瀹夎匯AC闇瑕佸叡浜瀛樺偍,鎵浠ュ繀欏諱負涓ゅ彴鏈哄櫒璁劇疆鍏變韓瀛樺偍,鎴戜嬌鐢╲mware-vdiskmanager鍛戒護鍒涘緩涓浜涜櫄鎷熺‖鐩
________________________________________________________________________
vmware-vdiskmanager -c -s 1Gb -a lsilogic -t 2 "/vmware/share/ocfs.vmdk" |鐢ㄤ簬Oracle闆嗙兢娉ㄥ唽琛ㄦ枃浠跺拰CRS琛ㄥ喅紓佺洏
________________________________________________________________________
vmware-vdiskmanager -c -s 2Gb -a lsilogic -t 2 "/vmware/share/asm1.vmdk" |鐢ㄤ簬Oracle鐨勬暟鎹鏂囦歡
________________________________________________________________________
vmware-vdiskmanager -c -s 2Gb -a lsilogic -t 2 "/vmware/share/asm2.vmdk" |鐢ㄤ簬Oracle鐨勬暟鎹鏂囦歡
________________________________________________________________________
vmware-vdiskmanager -c -s 2Gb -a lsilogic -t 2 "/vmware/share/asm3.vmdk" |鐢ㄤ簬Oracle鐨勬暟鎹鏂囦歡
________________________________________________________________________
vmware-vdiskmanager -c -s 2Gb -a lsilogic -t 2 "/vmware/share/asm4.vmdk" |鐢ㄤ簬Oracle鐨勯棯鍥炴仮澶嶅尯
____________________________________________________________________

鐒跺悗鍒嗗埆鍦ㄤ袱涓鉶氭嫙鏈嶅姟鍣ㄧ殑鐨勯厤緗鏂囦歡,ha1.vmx鍜宧a2vmx鏂囦歡閲岄潰娣誨姞濡備笅淇℃伅
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "virtual"

scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.filename = "/vmware/share/ocfs.vmdk"
scsi1:1.deviceType = "disk"

scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.filename = "/vmware/share/asm1.vmdk"
scsi1:2.deviceType = "disk"

scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.filename = "/vmware/share/asm2.vmdk"
scsi1:3.deviceType = "disk"

scsi1:4.present = "TRUE"
scsi1:4.mode = "independent-persistent"
scsi1:4.filename = "/vmware/share/asm3.vmdk"
scsi1:4.deviceType = "disk"

scsi1:5.present = "TRUE"
scsi1:5.mode = "independent-persistent"
scsi1:5.filename = "/vmware/share/asm4.vmdk"
scsi1:5.deviceType = "disk"

disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
淇濆瓨鍚,鎵撳紑vmware console灝卞彲浠ョ湅鍒版坊鍔犵殑紜鐩,鍚鍔╤a1pub鍜宧a2pub!闅忎究榪涘叆涓鍙扮郴緇,鐢╢disk鏍煎紡鍖栬繖浜涙柊娣誨姞鐨勭‖鐩.
fdisk -l鍙浠ョ湅鍒板備笅
__________________________________________________________________
Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 275 2104515 82 Linux swap
/dev/sda3 276 1958 13518697+ 83 Linux

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 83 Linux

Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 261 2096451 83 Linux

Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 261 2096451 83 Linux

Disk /dev/sde: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sde1 1 261 2096451 83 Linux

Disk /dev/sdf: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdf1 1 261 2096451 83 Linux
____________________________________________________________________

淇鏀/etc/hosts鏂囦歡,濡備笅鎵紺
127.0.0.1 localhost(榪欓噷蹇呴』榪欐牱淇鏀,鍚﹀垯RAC鑺傜偣鍚嶅嚭鐜板湪鍥為佸湴鍧涓錛屽畨瑁匯AC鏈熼棿鍙鑳戒細鎶ラ敊)
10.1.250.17 ha1pub
10.1.250.18 ha2pub

192.168.100.100 ha1prv
192.168.100.200 ha2prv

10.1.250.19 ha1vip
10.1.250.20 ha2vip

4.璋冩暣緗戠粶璁劇疆,璁劇疆鍏變韓鍐呭瓨鍜屼俊鍙峰弬鏁
鍒嗗埆鍦╤a1pub鍜宧a2pub涓,緙栬緫/etc/sysctl.conf鏂囦歡,娣誨姞濡備笅淇℃伅,榪欎簺淇℃伅鍙浠ユ牴鎹鑷宸辯殑鏈哄櫒瀹為檯鎯呭喌鏉ヨ皟鏁
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144

kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

5. 閰嶇疆 hangcheck-timer 鍐呮牳妯″潡
璇ユā鍧楁槸鐢ㄦ潵鐩戞帶闆嗙兢鐨勭姸鎬佹儏鍐,linux as4涓宸茬粡瀹夎呬簡姝ゆā鍧,浣跨敤涓嬮潰鐨勫懡浠ょ『璁
find /lib/moles -name "hangcheck-timer.o" 鐪嬬湅鏈夋病鏈,濡傛灉鏈,閰嶇疆騫跺姞杞借ユā鍧
#echo "/sbin/modprobe hangcheck-timer" >> /etc/rc.local
#modprobe hangcheck-timer
#grep Hangcheck /var/log/messages | tail -2
Jul 31 15:01:49 ha2pub kernel: Hangcheck: starting hangcheck timer 0.5.0 (tick is 30 seconds, margin is 180 seconds).
濡傛灉鐪嬪埌涓婇潰鐨勪俊鎮,璇存槑妯″潡鐨勮劇疆宸ヤ綔姝g『
6. 鍦ㄤ袱涓鑺傜偣涓婂壋寤簅racle鐢ㄦ埛鍜岀洰褰
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
浠oracle鐢ㄦ埛鐧婚檰,鍒嗗埆寤虹珛涓や釜鐩褰
mkdir /home/oracle/app 鐢ㄤ簬瀹夎卭racle 鏁版嵁搴
mkdir /home/oracle/orcl 鐢ㄤ簬Oracle 闆嗙兢鏂囦歡緋葷粺 (OCFS) 鐨勬寕杞界偣

淇鏀篔racle鐢ㄦ埛鐨.bash_profile鏂囦歡濡備笅鎵紺
__________________________________________________________________
export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/proct/10.2.0/db_1
export ORA_CRS_HOME=/home/oracle/app/oracle/proct/10.2.0/crs/
export ORACLE_SID=orcl1

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
________________________________________________________________________
娉ㄦ剰,鍦ㄧ浜屼釜鑺傜偣涓,淇鏀筍ID=orcl2

7.寤虹珛鑺傜偣涔嬮棿鐨勪簰淇
鎴戦噰鐢ㄧ殑鏄痵sh,鍏蜂綋榪囩▼鏈夊緢澶氭枃妗h存槑,榪欓噷鐪佺暐.鍒嗗埆瑕佸緩絝媟oot鐢ㄦ埛,oracle鐢ㄦ埛鐨勪簰淇.
鐒跺悗鍦ㄥ垎鍒浠root鐢ㄦ埛,oracle鍦ㄤ袱涓鑺傜偣涓婃墽琛屽備笅鍛戒護
ssh localhost
ssh ha1pub
ssh ha2pub
ssh ha1prv
ssh ha2prv
8.瀹夎呴厤緗畂cfs2
浠http://oss.oracle.com/projects/ocfs2/涓嬭澆涓庤嚜宸辨搷浣滅郴緇熺増鏈鐩哥﹀悎鐨刼cfs,ocfs console
姣斿傛垜鐨勫唴鏍告槸2.6.9-22.EL,浜庢槸鎴戜笅杞界殑灝辨槸ocfs2-2.6.9-22.EL-1.2.2-1.i686.rpm,榪欑偣闈炲父閲嶈
瀹夎呭緢綆鍗,鎶婅ヤ笅杞界殑鍖呴兘涓嬭澆浜唕pm瀹夎呭氨ok浜
8.1 ocfs2鐨勯厤緗
鍏堜嬌鐢ㄤ笅闈㈠懡浠ょ佺敤SElinux
#system-config-securitylevel &
鐒跺悗鍦ㄩ泦緹や腑鐨勬瘡涓鑺傜偣涓婄敓鎴愬拰閰嶇疆 /etc/ocfs2/cluster.conf
鍙浠ヤ嬌鐢╫cfs2console鍛戒護璋冨嚭鍥懼艦鐣岄潰,灝唄a1pub鍜宧a2pub涓や釜鑺傜偣閮藉姞鍏,鐐瑰嚮apply,鐒跺悗閫鍑.
鍦/etc/ocfs2/鐩褰曚笅闈㈠皢鏈塩luster.conf鏂囦歡,鍐呭瑰簲璇ュ備笅
______________________________________________________
node:
ip_port = 7777
ip_address = 10.1.250.17
number = 0
name = ha1pub
cluster = ocfs2

node:
ip_port = 7777
ip_address = 10.1.250.18
number = 1
name = ha2pub
cluster = ocfs2

cluster:
node_count = 2
name = ocfs2
________________________________________________________
鎺ョ潃緙栬緫 /etc/init.d/o2cb, 鍒犻櫎寮濮嬪甫 #鐨勯厤緗琛
鐒跺悗 /etc/init.d/o2cb offline ocfs2
/etc/init.d/o2cb unload ocfs2
/etc/init.d/o2cb configure ocfs2 杈撳叆y灝眔k浜
8.2 鍒涘緩ocfs2鏂囦歡緋葷粺
mkfs.ocfs2 -b 4k -C 32k -L oradatafiles /dev/sdb1
鐒跺悗鎸傝澆ocfs2鏂囦歡緋葷粺
mount -t ocfs2 -o datavolume /dev/sdb1 /home/oracle/orcl
淇鏀/etc/fstab,娣誨姞
/dev/sdb1 /home/oracle/orcl ocfs2 _netdev,datavolume 0 0
8.3 璋僌2CB鐨勫績璺抽榾鍊
淇鏀規枃浠/etc/sysconfig/o2cb灝哋2CB_HEARTBEAT_THRESHOLD 璁劇疆涓 301
淇鏀規枃浠 /etc/sysconfig/o2cb 鍚庯紝闇瑕佹洿鏀 o2cb 閰嶇疆銆傚悓鏍鳳紝搴斿湪闆嗙兢鐨勬墍鏈夎妭鐐逛笂鎵ц屼互涓嬫搷浣溿
# umount /home/oracle/orcl/
# /etc/init.d/o2cb unload
# /etc/init.d/o2cb configure
reboot涓や釜鑺傜偣
9. 瀹夎,閰嶇疆鑷鍔ㄥ瓨鍌ㄧ$悊ASM2.0
鍙浠ヤ粠http://www.oracle.com/technology ... x/asmlib/rhel4.html榪欓噷涓嬭澆鐩稿叧rpm鍖
rpm瀹夎呰繃紼嬬渷鐣
鎵ц/etc/init.d/oracleasm configure
榛樿ょ敤鎴瘋緭鍏oracle,榛樿ょ粍杈撳叆dba,鍏朵粬閮統,y灝卞彲浠ヤ簡
9.1鍒涘緩ASM紓佺洏
鍦ㄤ竴涓鑺傜偣涓婃墽琛
/etc/init.d/oracleasm createdisk VOL1 /dev/sdc1
/etc/init.d/oracleasm createdisk VOL2 /dev/sdd1
/etc/init.d/oracleasm createdisk VOL3 /dev/sde1
/etc/init.d/oracleasm createdisk VOL4 /dev/sdf1
鍒涘緩濂藉悗,鎵ц/etc/init.d/oracleasm listdisks鍙浠ョ湅鍒
VOL1
VOL2
VOL3
VOL4
鐒跺悗鍦ㄥ彟澶栦竴涓鑺傜偣涓婃墽琛
/etc/init.d/oracleasm scandisks
瀹屾垚鍚庢墽琛
/etc/init.d/oracleasm listdisks搴旇ュ彲浠ョ湅鍒板拰鐨勪竴涓鑺傜偣鐩稿悓鐨勫唴瀹
10. 瀹夎匫racle 10G cluster杞浠
浠巓racle緗戠珯涓嬭澆10201_clusterware_linux32
浠oracle鐢ㄦ埛鐧誨綍,unset鎺変竴浜涚幆澧冨彉閲,濡備笅
$ unset ORA_CRS_HOME
$ unset ORACLE_HOME
$ unset ORA_NLS10
$ unset TNS_ADMIN

寮濮嬪畨瑁卌luster杞浠
./runInstaller -ignoreSysPrereqs
*紜璁ゅ畨瑁呯洰褰曟槸/home/oracle/app/oracle/proct/10.2.0/crs/
*濡傛灉鎰挎剰鍙浠ュ皢clustername鐢眂rs淇鏀規垚鍏朵粬鐨勫悕縐
*娣誨姞涓や釜鑺傜偣,濡備笅鎵紺
____________________________________________________________________
Public Node Name Private Node Name Virtual Node Name
ha1pub ha1prv ha1vip
ha2pub ha2prv ha2vip
____________________________________________________________________
*瑕佷慨鏀逛竴涓媏th0鐨勭被鍨,浠栭粯璁ょ殑鏄痯rivate,淇鏀逛負public
*鎸囧畾OCR鍜宮irror鐨勮礬寰
Specify OCR Location: /home/oracle/orcl/OCRFile
Specify OCR Mirror Location:/home/oracle/orcl/OCRFile_mirror
*鎸囧畾Voting紓佺洏璺寰
Voting Disk Location: /home/oracle/orcl/CSSFile
Additional Voting Disk 1 Location:/home/oracle/orcl/CSSFile_mirror1
Additional Voting Disk 2 Location:/home/oracle/orcl/CSSFile_mirror2
*瀹夎呭揩緇撴潫鏃.浼氳佹眰浠root鎵ц宱rainsRoot.sh鍜宺oot.sh鑴氭湰,浠root鐢ㄦ埛鎵撳紑涓涓鏂扮殑緇堢,涓涓涓涓鑺傜偣欏哄簭鎵ц,鍗冧竾涓嶈佹姠鏃墮棿涓璧鋒墽琛
*鎵ц屾渶鍚庝竴涓猺oot.sh鐨勬椂鍊,鍙鑳戒細鎶""eth0" is not public.Public interfaces should be used to configure virtual IPs."榪欐牱鐨勯敊璇.榪欐椂鍊欓渶瑕佷互root鐢ㄦ埛鍘繪墽琛$ORA_CRS_HOME/bin/vipca,閫夋嫨涓や釜鑺傜偣,閰嶇疆涓涓嬭櫄鎷焛p鐨勪俊鎮.
鑷蟲,clusterware瀹夎呭氨ok浜,媯鏌ヤ竴涓嬮泦緹よ妭鐐
$ORA_CRS_HOME/bin/olsnodes -n
ha1pub 1
ha2pub 2

11. 瀹夎匫racle 10g杞浠
浠巓racle緗戠珯涓嬭澆10201_database_linux32
unset鎺変竴浜涚幆澧冨彉閲
$ unset ORA_CRS_HOME
$ unset ORACLE_HOME
$ unset ORA_NLS10
$ unset TNS_ADMIN
Oracle鐨勫畨瑁呯渷鐣,鏃㈢劧鏁㈢帺RAC,鑲瀹氫互鍓嶄篃瀹夎呰繃oracle,鍙鏄鏈変簺鍦版柟闇瑕佹敞鎰
*鑺傜偣鐨勯夋嫨涓,涓瀹氳侀変笂鎵鏈夌殑鑺傜偣
*閫夋嫨 "Install database software only",鍏堜笉瑕佸緩instance,絳夋暟鎹搴撳畨瑁呭畬姣曞悗鏃跺檇bca鍒涘緩
*瀹夎呭畬鎴愬悗,闇瑕佹墽琛宺oot.sh鑴氭湰,涓嶈佺潃鎬,涓涓鑺傜偣涓涓鑺傜偣鎵ц
12. 寤虹珛TNS渚﹀惉
浠oracle鐢ㄦ埛鎵ц
$ netca &
*閫夋嫨鎵鏈夎妭鐐
*閫夋嫨Listener configuration
*鍏朵粬鐨勯兘閫夋嫨榛樿ゅ嵆鍙
緇撴潫鍚庡彲浠ラ獙璇佷竴涓嬩睛鍚鏄鍚﹀凡緇忓湪鎵鏈夎妭鐐逛笂榪愯
ps -ef|grep LISTEN
搴旇ュ彲浠ョ湅鍒
/home/oracle/app/oracle/proct/10.2.0/db_1/bin/tnslsnr LISTENER_HA1PUB -inherit
鍙﹀栦竴涓鑺傜偣搴旇ユ槸
/home/oracle/app/oracle/proct/10.2.0/db_1/bin/tnslsnr LISTENER_HA2PUB -inherit
13. 鍒涘緩鏁版嵁搴撳疄渚
浠oracle鐢ㄦ埛鍦ㄤ換涓鑺傜偣鎵ц
dbca &
*閫夋嫨 Create a Database
*閫夋嫨鎵鏈夎妭鐐
*閫夋嫨Custom Database
*鍏ㄥ矓鏁版嵁搴撳悕杈撳叆orcl,SID涔熸槸orcl
*閫夋嫨浣跨敤鐩稿悓鐨勫瘑鐮佸規墍鏈夌敤鎴
*瀛樺偍閫夐」閫夋嫨 use ASM
*淇鏀光淐reate server parameter file (SPFILE)鈥濅負 /home/oracle/orcl/dbs/spfile+ASM.ora銆傛墍鏈夊叾浠栭夐」鍙浠ヤ繚鐣欏叾榛樿ゅ箋
*鍦ˋSM Disk Groups閰嶇疆鐣岄潰,閫夋嫨Create New,浼氭樉紺轟箣鍓嶉氳繃ASMlib鍒涘緩鐨4涓鍗稸OL1鍒癡OL4
閫夋嫨鍓嶄笁涓,VOL1,VOL2,VOL3,Disk group name杈撳叆DATA,Rendancy,閫夋嫨Normal,鍗曞嚮ok,瀹屾垚鍚庡啀嬈″崟鍑籆reate New.閫夋嫨鏈鍚庝竴涓猇OL4,Disk group name杈撳叆FLASH_RECOVERY_AREA, Rendancy閫夋嫨External,鍗曞嚮ok,瀹屾垚ASM鐨勭佺洏緇勫壋寤.
*Database File Locations 閫夋嫨DATA
*Recovery Configuration 閫夋嫨FLASH_RECOVERY_AREA
*Database Content鐢變簬鏄嫻嬭瘯,鍙浠ュ彇娑堟帀鎵鏈夐夐」
*Service name 鍙浠ヨ緭鍏orcltest,TAF Policy閫夋嫨Basic
*Database Storage 鏍規嵁鑷宸辯郴緇熺殑紜浠舵潯浠跺彲浠ユ洿鏀逛竴浜涘弬鏁.
瀹屾垚dbca,Oracle RAC灝卞彲浠ユ墍宸茬粡瀹屽叏瀹夎呮垚鍔熶簡!

14. RAC鐨勫惎鍔ㄥ拰鍏抽棴
濡傛灉閮介伒寰浜嗕笂闈㈢殑瀹夎呮ラ,閭d箞姣忔¤妭鐐歸噸鏂板惎鍔ㄧ殑鏃跺,鎵鏈夋湇鍔¢兘浼氳嚜鍔ㄥ惎鍔,濡傛灉闇瑕佸叧闂鎴栬呭惎鍔ㄦ煇涓鑺傜偣,濡備笅鎵紺
*鍋滄RAC
1.emctl stop dbconsole
2.srvctl stop instance -d orcl -i orcl1
3.srvctl stop asm -n ha1pub
4.srvctl stop nodeapps -n ha1pub
*鍚鍔≧AC
鍜屼笂闈㈢殑姝ラゆeソ鐩稿弽鍗
1.srvctl start nodeapps -n ha1pub
2.srvctl start asm -n ha1pub
3.srvctl start instance -d orcl -i orcl1
4.srvctl start dbconsole

15. RAC鐨勯獙璇佸拰嫻嬭瘯
鏈夊緢澶氭枃妗e啓鐨勯兘寰堣︾粏,鏈鏂囧氨涓嶈禈榪頒簡

16. 鍙傝冩枃妗
鍦 Linux 鍜 FireWire 涓婃瀯寤烘偍鑷宸辯殑 Oracle RAC 10g 絎 2 鐗堥泦緹
浣滆咃細Jeffrey Hunter
http://www.oracle.com/technology ... unter_rac10gr2.html

閱讀全文

與linux怎麼退出vip文件相關的資料

熱點內容
怎麼樣讓自己的網站不被別人看到 瀏覽:711
編程擴展效果如何 瀏覽:335
榮耀暢玩手環同步qq 瀏覽:475
怎麼向sql中添加資料庫 瀏覽:596
錄歌失敗重啟app什麼意思 瀏覽:522
壓縮文件包怎麼在微信發送 瀏覽:432
mysql資料庫怎麼插入時間值 瀏覽:191
微信視頻不能轉發朋友圈 瀏覽:596
影視後期的app有哪些 瀏覽:956
電子保單數據出錯什麼意思 瀏覽:368
如何以文件下載音樂 瀏覽:438
計算機網路章節練習 瀏覽:999
單片機的外部中斷程序 瀏覽:48
表格批量更名找不到指定文件 瀏覽:869
js的elseif 瀏覽:584
3dmaxvray視頻教程 瀏覽:905
imgtool工具中文版 瀏覽:539
java幫助文件在哪裡 瀏覽:965
win10切換輸入語言 瀏覽:696
haier電視網路用不了怎麼辦 瀏覽:361

友情鏈接