Full-Library hot backup of shell scripts

Source: Internet
Author: User

#!/bin/bashbackup_dir=/oracle/backuplog_file= $ORACLE _base/admin/$ORACLE _sid/hold_backup_$oracle_sid.logecho   "Backuping cold backup"  > $log _filedata>> $log _filesqlplus -s /  As sysdba <<eof >> $log _filealter database backup controlfile to   ' $backup _dir/backup_controlfile.ctl '; set pagesize 0 linesize 1000 feedback  off heading offcolumn tablespace_name noprincolumn sortorder noprincolumn  textout format a120spool hold_backup_$oracle_sid.sqlselect tablespace_name, ' 1 '   SortOrder, ' alter tablespace  ' | | tablespace_name| | '  begin backup ; ' &NBSP;TEXTOUTFROM&NBSP;DBA_DATA_FILESUNIONSELECT&NBSP;TABLESPACE_NAME&NBSP, ' 2 '  sortorder, ' HOST&NBSP;CP ' | | file_name| | '   ' | | '   $backup _dir '  textoutfrom dba_data_filesunionselect tablespace_name, ' 3 '  sortorder, ' Alter tablespace  ' | |  tablespace_name | | '  end backup ; '  textoutfrom dba_data_filesorder by tablespace_name,sortorder,textout;select  ' alter  system archive log current; '  from dual;spool off; @hold_backup_ $ORACLE _sid.sqlexiteofrm -f hold_backup_$oracle_ sid.sqlecho  "hot backup finished." >> $log _file



PS: Cold backup with all libraries

Full-Library hot backup of shell scripts

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.