Teach you to complete Oracle automated physical backup with Linux

Source: Internet
Author: User
Tags character set oracle database backup

The goal of this article is to complete the process of automated Oracle database backups by executing a shell script, and to generate its compressed files in the current directory. The following steps are implemented:

1. Log on to the Linux system as an Oracle user.

2. Create a Database.srcipt file to generate some parameter information for the backup database and save it in the file database.parm.

This information is important for future recovery of the database, so in the process of physical backup, you need to save this information, you can also write some other important information in this script.

$vi Database.srcipt

Spool Database.parm

--This is the list of system parameters for the current backup database

SELECT * from V$parameter;

--This is the character set part parameter of the current backup database

SELECT * from props$;

--This is the current backup database data file storage location and name

SELECT * from V$datafile;

--This is the current backup database control file storage location and name

SELECT * from V$controlfile;

--This is the current backup database log file storage location and name

SELECT * from V$logfile;

--You can add some other important information here

--start to generate backup shell files, refer to backup.sh

Spool off

Spool backup.sh

Select ' CP ' | | name | | ' backup/' from V$datafile;

Select ' CP ' | | name | | ' backup/' from V$controlfile;

Select ' CP ' | | Member | | ' backup/' from V$logfile;

Spool off

Shutdown immediate

Exit

!

3. Modify the backup.sh file that was generated in the previous step and execute it to complete the operating system backup of the database file. For clarity, name this script file alterbackup.sh.

$vi alterbackup.sh

echo "This script completes the process of copying database data files, control files, log files to the current directory"

Cat Backup.sh|grep ' CP/' >c.sh

#该语句把backup. All statements in sh that start with "CP/" are extracted to generate a new file c.sh

RM backup.sh

MV C.sh backup.sh

chmod +x backup.sh

. backup.sh

#注意: Point number "." There is a space between the backup.sh and the

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.