Linux oracle cool back scritp
oracle 冷备份是一致性备份,备份的内容有数据文件,redo文件,temp文件,控制文件等,
SQLBLANKLINES ON 是预防脚本中有空格,sqlplus误认为是结束,报
SP2-0734: unknown command beginning "where t.bg..." - rest of line ignored.
错误.
set feedback off heading off verify off trimspool off SQLBLANKLINES ON
set pagesize 0 linesize 200
define dir=‘/u01/backup‘
define script=‘/tmp/coolbak.sql‘
spool &script
select ‘! cp ‘ || name || ‘ &dir ‘ from v$datafile order by 1;
select ‘! cp ‘ || member || ‘ &dir ‘ from v$logfile order by 1;
select ‘! cp ‘ || name || ‘ &dir ‘ from v$controlfile order by 1;
select ‘! cp ‘ || name || ‘ &dir ‘ from v$tempfile order by 1;
create pfile = ’&dir/initDBID.ora’ from spfile;
ho cp /u01/app/oracle/product/11.2.0/db_1/dbs/orapwDBID ‘ &dir ‘
spool off
shutdown immediate
@&script
startup
本文出自 “Permanent” 博客,谢绝转载!