配置SSH的對等性傳送ORACLE錯位的歸檔日誌檔案

hq181msn發表於2008-04-24

在所有節點配置SSH的對等性
在安裝Oracle Real Application clusters之前,必須先配置所有節點的SSH對等性。
因為在安裝過程種Oracle Universal Installer使用ssh和scp命令執行遠端命令
執行及copy的工作,還可以用來傳送錯位的歸檔日誌檔案。

[@more@]

下面是具體的步驟:
以下步驟在所有節點上執行

以oracle使用者登陸
# su – oracle

==========================================================

在兩個節點的oracle主目錄分別建立.ssh目錄,並賦予許可權。

==========================================================

# mkdir /opt/oracle/.ssh
# chmod 755 /opt/oracle/.ssh


在svr2節點上配置:
[oracle@svr2 .ssh]$ /usr/bin/ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/opt/oracle/.ssh/id_rsa):回車
Enter passphrase (empty for no passphrase):回車
Enter same passphrase again:回車
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
0f:bc:e2:f2:d2:ad:46:1b:c5:65:f7:9e:61:52:51:29
[oracle@svr2 .ssh]$ /usr/bin/ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/opt/oracle/.ssh/id_dsa): 回車
Enter passphrase (empty for no passphrase):回車
Enter same passphrase again:回車
Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.
The key fingerprint is:
8b:1a:87:f9:de:9f:90:77:db:46:47:bb:4b:40:cf:b8
[oracle@svr2 .ssh]$>/opt/oracle/.ssh/authorized_keys
[oracle@svr2 .ssh]$ touch /opt/oracle/.ssh/authorized_keys
[oracle@svr2 .ssh]$ ls -lt
總用量 20
-rw-r--r-- 1 oracle dba 0 4月 24 08:36 authorized_keys
-rw------- 1 oracle dba 668 4月 24 08:34 id_dsa
-rw-r--r-- 1 oracle dba 601 4月 24 08:34 id_dsa.pub
-rw------- 1 oracle dba 887 4月 24 08:33 id_rsa
-rw-r--r-- 1 oracle dba 221 4月 24 08:33 id_rsa.pub
drwxr-xr-x 2 oracle dba 4096 4月 15 18:07 bak

[oracle@svr2 .ssh]$ uname -n
svr2
[oracle@svr2 .ssh]$ ssh svr2 cat /opt/oracle/.ssh/id_dsa.pub>>/opt/oracle/.ssh/authorized_keys
[oracle@svr2 .ssh]$ ssh svr2 cat /opt/oracle/.ssh/id_rsa.pub>>/opt/oracle/.ssh/authorized_keys
[oracle@svr2 .ssh]$ ssh svr1 cat /opt/oracle/.ssh/id_dsa.pub>>/opt/oracle/.ssh/authorized_keys
[oracle@svr2 .ssh]$ ssh svr1 cat /opt/oracle/.ssh/id_rsa.pub>>/opt/oracle/.ssh/authorized_keys

==========================================================
Accept the default location for the key file.
Enter and confirm a pass phrase that is different from the oracle user’s password. phrase

密碼處直接回車即可
PS:如果提示是否連線選擇yes,密碼輸入oracle使用者的密碼
==========================================================

[oracle@svr2 .ssh]$ chmod 644 /opt/oracle/.ssh/authorized_keys

==========================================================
防止X11轉發造成的安裝失敗,建立~ /.ssh/config,並加入如下內容。
==========================================================
[oracle@svr2 .ssh]$ vi config
Host *
ForwardX11 no


==========================================================
測試svr2如下顯示正常
==========================================================

[root@svr2 root]# su - oracle
[oracle@svr2 oracle]$ exec /usr/bin/ssh-agent $SHELL
[oracle@svr2 oracle]$ ssh svr1 date
Thu Apr 24 08:47:15 CST 2008
[oracle@svr2 oracle]$ ssh svr2 date
Thu Apr 24 08:47:29 CST 2008

對另一節點svr1如上述步驟配置


==========================================================
利用SSH進行檔案傳遞
==========================================================

對錯位的歸檔日誌可以利用SCP來傳遞

crontab -l
0 10,16,22 * * * /sh/rcp.sh >>/sh/rcp_arch.log 2>&1|echo "`date`.../arch/ARC_0002* sent to svr2's archivelog ok..." >>/sh/rcp_arch.log

==========================================================
/sh/rcp.sh內容如下:
==========================================================
[oracle@svr1 sh]$ more rcp.sh
gdbase=/opt/oracle/arch
for bd in `if test -f /opt/oracle/arch/ARC_0001*;then ls /opt/oracle/arch/ARC_0001*;else echo;fi`;do
scp $bd svr2:/opt/oracle/arch/
if test $? -eq 0;then
rm $bd
fi
done

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/216109/viewspace-1002920/,如需轉載,請註明出處,否則將追究法律責任。

相關文章