Use SSH to implement Oracle Database Backup File Automatically Storage

xiaoxiao2021-03-06  36

First set the automatic backup script in the Oracle Database Server (211.96.97.52)

-bash-2.05b $ more /opt/oracle/product/movedata/movedata1.shracle_home=/opt/oracle/product/9.0.2export Oracle_Home. /opt/oracle/product/.bash_profileexport date = $ (DATE % Y% M% D) #date variable assignment represents the current date /opt/oracle/product/9.0.2/bin/exp goldring / 123456 @ SZDB file = / data / oracledb_backup / goldring.dmp log = / data / oracledb_backup / loggoldring. dmp consistent = yes / opt / oracle / product / 9.0.2 / bin / exp jltgame / 123456 @ szdb file = / data / OracleDB_Backup / jltgame $ DATE.dmp log = / data / OracleDB_Backup / logjltgame $ DATE.dmp consistent = yes /opt/oracle/product/9.0.2/bin/exp userid = oraclebackup / "abcd456 & * (" @ szdb owner = moonprincess file = / data / OracleDB_Backup / moonprincess.dmp log = / data / OracleDB_Backup / logmoonprincess.dmp consistent = YES # ftp -n 10.0.0.0.3

Add /Opt/oracle/product/movedata/movedata1.sh Add to Time Task Automatically Perform -bash-2.05B $ crontab -L # do not edit this file - Edit the master and reinstall. # (/Tmp/crontab.2257 installed on Wed Feb 2 13:40:43 2005) # (Cron Version - $ ID: crontab.c, v 2.13 1994/01/17 03:20:37 Vixie Exp $) 0 2 * * * Sh / OPT / Oracle / Product / MoveData / MoveData1.sh0 6 * * * RM -F /OPT/Oracle/Product/9.0.2/oradata/szdb/archive/**

The following remote copy scripts are then written on the remote backup storage server (61.144.222.111): (because the backup of my remote Oracle database is placed on 211.96.97.46, the IP in the script is not 211.96.97.52 of the Oracle database server) [log @ GameServer log] $ more /HOME/LOG/52.sh Export Date = $ (DATE % Y% M% D) # Note: This Date variable assignment format to match the DATE variable assignment format of the remote Oracle database, SCP log @ 211.96.97.46:/data/oracledb_backup/jltgame 2BACKUPSCP log@211.96.97.46: /data/oracledb_backup/logjltgame?date.dmp / backup / 52Backup

Add 52.SH to the timed task Automatically perform [LOG @ Gameserver 37Backup] $ crontab -l30 3 * * * /Home/log/52.sh This time because /Home/log/52.sh Script script does not set the input password, So there is also a key to establishing RSA in 61.144.222.111 to generate log users RSA key pairs.

[log @ Gameserver Log] # ssh-keygen -t rsa generating public / private rsa key pair.enter file in which to save the key (/LOG/.SSH/ID_RSA): EMPTY for no passphrase: ENTER SAME Passphrase Again: Your Identification Has Been Saved In /Log/.ssh/id_rsa.your public key Has been saved in /log/.ssh/id_rsa.pub.the key fingerprint IS: 0A: BE: F4: C6: 55: 50 : D2: 7A: E7: E7: BA: 66: CD: D7: 2F: 26 log @ Gameserver

In the process of generating prompts the key to save the location, go directly to the bus, accept the default value. Then prompt to enter a password different from your Password, go directly to the bus, let it be empty. Of course, you can also enter one. (I am more lazy, I don't want to enter a password every time.) This, the key pair is finished. The public key is stored in ~ / .ssh / id_rsa.pub private key saved in ~ / .ssh / id_rsa then change the .ssh directory permission, use the command "CHMOD 755 ~ / .SSH" [log @ Gameserver Log] $ ChMOD 0755 ~ / .SH / After copying the public key in the key to 211.96.97.46 log users, and saved as ~ / .ssh / authorized_keys

[log @ Gameserver log] # SCP /HOME/LOG/.ssh/id_rsa.pub 211.96.97.46:/HOME/LOG/.ssh/authorized_keys

At this time, call /Home/log/52.sh, then tested the following.

Note 1: After establishing this key, remotely log in remotely on 61.144.222.111, no need to enter the account password, this is very dangerous, so carefully

Note 2: The permissions of the ID_RSA file must be 0700, otherwise the key pair does not take effect, resulting in a password to establish a connection [log @ Waplb .ssh] $ PWD / home / log / .ssh [log @ Waplb .ssh] $ LLTOTAL 12-RWX ------ 1 LOG LOG 883 February 2 17:16 ID_RSA-RWXR-XR-X 1 LOG LOG 219 February 2 17:16 ID_RSA.PUB-RWXR-XR-X 1 log log 445 February 2 16:45 KNOWN_HOSTS Reference: http://www.chinaunix.net/jh/4/343905.html http://www-900.ibm.com/developerWorks/cn/linux/l-backup/index .shtml http://www-900.ibm.com/developerWorks/cn/linux/security/openssh/part1/index.shtml#10

转载请注明原文地址:https://www.9cbs.com/read-61176.html

New Post(0)