oracle数据库删除备份,oracle数据库的备份与恢复

1:今天我在oracle10g上面做了一个冷备份,首先:coldBack.sql

Remark Set SQl*Plus variables to manipulate output

set feedback off heading off verify off trimspool off

set pagesize 0 linesize 200

Remark Set SQL*Plus user variables used in this script

define dir='E:\database\H\R'

define copyDate='D:\backup_commands.sql'

prompt *** Spooling to &copyDate

Remark Create a command file with file backup commands

spool &copyDate

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;

Remark Shutdown the database cleanly

shutdown immediate;

Remark Run the copy file commands from the operating system

@&copyDate

Remark Start the database again

startup;

在数据库关闭状态下,把你的数据文件删除,删除以后用startup mount;来启动数据库,把你备份数据文件拷贝到你删除数据文件的地方,这时我们用下面的命令来查看数据库的SID是否一致:

alter session set NLS_DATE_FORMAT='HH24:MI:SS';

select file#,status,checkpoint_change#,checkpoint_time,last_change#,last_time from v$datafile;

select group#,sequence#,status,first_change#,first_time from v$log order by first_change#;

如果得到的SID是一致的哪么我们就可以用这个命令来打开数据库了:

alter database open;如果在打开的过程中出现了这样的错误:

ORA-01113: 文件 5 需要介质恢复

ORA-01110: 数据文件 5: 'D:\ORACLE\PRODUCT\10.2.0\DBFILES\DSBI\DS.ORA'

哪么我们可以用下面的命令来运行:

set autorecovery on;

recover datafile 5;这个5就是3中提到的数据文件 5;

这时再用:alter database open;就可以打开数据库了。

接下来我会完成oracle10g数据库的各种备份.......

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值