上周去处理生产部门的一个问题,数据库运行在归档模式下,但现在维护还没移交到信息单位,导致归档文件占用大量磁盘空间,数据库挂起。把归档文件移走就OK了。针对目前情况,管理上的问题我是无能为力,只好做了个冷备脚本,让操作人员定期冷备,再清理归档文件。
connect sys/@ as sysdba
Rem 冷备份脚本
Rem 信息中心 2005
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
define dir='S:\cold_bat'
define cmdfile='S:\cold_bat\cold_backup_command.sql'
prompt *** spooling to &cmdfile
spool &cmdfile
select 'host copy ' || name || ' &dir' from v$datafile order by 1;
select 'host copy ' || member || ' &dir' from v$logfile order by 1;
select 'host copy ' || name || ' &dir' from v$controlfile order by 1;
select 'host copy ' || name || ' &dir' from v$tempfile order by 1;
spool off;
shutdown immediate;
@&cmdfile
startup;
set feedback on heading on verify on trimspool on pagesize 14
exit