Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to back up Oracle database regularly in different places

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to regularly back up Oracle database". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to back up Oracle database regularly".

1) set deferred_segment_creation parameters

The following setting allocates segment space whether the table is empty or not.

Su-oraclesqlplus / as sysdbaSQL > show parameter deferred_segment_creation

Note: the default value of this parameter is TRUE, and when changed to FALSE, segment is assigned to both empty and non-empty tables.

SQL > alter system set deferred_segment_creation=false

Note: this value setting has no effect on previously imported empty tables, still can not be exported, can only have an effect on later new tables.

Restart the database service

2) configure ssh trust

Configure ssh trust, and the scp command in the backup script can transfer files to the slave server (192.168.1.21) without a password

Execute on the primary server:

Ssh-keygen-t rsa / / you can enter cd / root/.ssh/scp id_rsa.pub root@192.168.1.21:/root/.ssh/ all the time.

Execute on the slave server:

Cd / root/.ssh/mv id_rsa.pub authorized_keys

In this way, scp can copy files to the slave server without password on the master server.

3) automatic backup script

First create a backup file storage directory on the slave server

Mkdir-p / home/backup/oracledata/chmod 777 / home/backup/oracledata/

Scripting on the primary server

Vim / home/backup/oracledata/oraclebk.sh

# / usr/bin# path name, specify the backup path FILEPATH=/home/backup/oracledata # define the backup database file name FILENAME= `date + "% Y%m%d_%H%M" `# switch to the specified path and create a folder cd $FILEPATHmkdir $FILENAMEchmod 775$ FILENAME # oracle variable to set export USER=oracle;export ORACLE_SID=ecology;export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1;export PATH=$ORACLE_HOME/bin:$PATH # Export database exp ecology/ecology file= "$FILENAME/$FILENAME" .DMP log= "$FILENAME/$FILENAME" .log owner=ecology # package tar-zcvf $FILENAME.tar.gz $FILENAMErm-rf $FILENAMEscp $FILENAME.tar.gz root@192.168.1.21:$FILEPATH/find. /-mtime + 15-name\ * .gz | xargs rm-fexitEOF

4) add scheduled tasks

Crontab-e00 03 * sh / home/backup/oracledata/oraclebk.sh

5) restart crond service

Systemctl restart crond.service

Thank you for your reading, the above is the content of "how to regularly back up the Oracle database". After the study of this article, I believe you have a deeper understanding of the problem of how to back up the Oracle database on a regular basis, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report