oracle技术之oracle一致性备份(冷备份)
2013-05-20 16:28
302 查看
1、编写生成备份脚本的脚本
#cold backcup
remark set sql*plus variable to manipulate output //注释
set feedback off heading off verify off trimspool off echo off time off
set pagesize 0 linesize 200
remark set sql*plus user variable used in this script //注释
define bakdir='/disk1/backup/anny/cold_bak' //备份文件的存放位置
define bakscp='/disk1/backup/anny/cold_bak/cold_cmd.sql' //执行备份的脚本,自动生成
prompt *** Spooling to &bakscp //输出提示语
remark create a command file with file backup commands
spool &bakscp
select 'host cp '|| name ||' &bakdir ' from v$datafile order by 1;
select 'host cp '|| name ||' &bakdir ' from v$controlfile order by 1;
spool off;
remark shutdown the database cleanly
shutdown immediate; ——冷备份需要关库执行
remark run the copy file commands form the operating system
@&bakscp
remark start the database again
startup;
2、执行该脚本生成了一个脚本cold_cmd.sql,并执行该脚本进行冷备份
SQL> conn /as sysdba
Connected.
SQL> @/export/home/oracle/sqlplus/anny_cold_bak
SP2-0734: unknown command beginning "cold backc..." - rest of line ignored.
*** Spooling to /disk1/backup/anny/cold_bak/cold_cmd.sql ——一下是脚本内容
host cp /u01/app/oracle/oradata/anny/index01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx02.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx03.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx04.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/sysaux01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/system01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/text01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/undotbs01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/user01.dbf /disk1/backup/anny/cold_bak
host cp /disk1/oradata/anny/control02.ctl /disk1/backup/anny/cold_bak
host cp /disk2/oradata/anny/control03.ctl /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/control01.ctl /disk1/backup/anny/cold_bak
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1279964 bytes
Variable Size 58722340 bytes
Database Buffers 251658240 bytes
Redo Buffers 2912256 bytes
Database mounted.
Database opened.
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html
#cold backcup
remark set sql*plus variable to manipulate output //注释
set feedback off heading off verify off trimspool off echo off time off
set pagesize 0 linesize 200
remark set sql*plus user variable used in this script //注释
define bakdir='/disk1/backup/anny/cold_bak' //备份文件的存放位置
define bakscp='/disk1/backup/anny/cold_bak/cold_cmd.sql' //执行备份的脚本,自动生成
prompt *** Spooling to &bakscp //输出提示语
remark create a command file with file backup commands
spool &bakscp
select 'host cp '|| name ||' &bakdir ' from v$datafile order by 1;
select 'host cp '|| name ||' &bakdir ' from v$controlfile order by 1;
spool off;
remark shutdown the database cleanly
shutdown immediate; ——冷备份需要关库执行
remark run the copy file commands form the operating system
@&bakscp
remark start the database again
startup;
2、执行该脚本生成了一个脚本cold_cmd.sql,并执行该脚本进行冷备份
SQL> conn /as sysdba
Connected.
SQL> @/export/home/oracle/sqlplus/anny_cold_bak
SP2-0734: unknown command beginning "cold backc..." - rest of line ignored.
*** Spooling to /disk1/backup/anny/cold_bak/cold_cmd.sql ——一下是脚本内容
host cp /u01/app/oracle/oradata/anny/index01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx02.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx03.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/lx04.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/sysaux01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/system01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/text01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/undotbs01.dbf /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/user01.dbf /disk1/backup/anny/cold_bak
host cp /disk1/oradata/anny/control02.ctl /disk1/backup/anny/cold_bak
host cp /disk2/oradata/anny/control03.ctl /disk1/backup/anny/cold_bak
host cp /u01/app/oracle/oradata/anny/control01.ctl /disk1/backup/anny/cold_bak
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1279964 bytes
Variable Size 58722340 bytes
Database Buffers 251658240 bytes
Redo Buffers 2912256 bytes
Database mounted.
Database opened.
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html
相关文章推荐
- Oracle 数据库的备份与恢复,热备份和冷备份
- oracle技术之一次RMAN备份报错的诊断过程(三)
- Oracle技术之逻辑备份的案例应用
- 深入oracle 12c数据库备份与恢复(优化RMAN性能、Oracle flashback技术)
- oracle技术之一次RMAN备份报错的诊断过程(四)
- 探索ORACLE之RMAN_04非一致性备份
- 深入oracle 12c数据库备份与恢复(优化RMAN性能、Oracle flashback技术)
- oracle技术之浅述当前模式读与一致性读
- Oracle技术之调整RMAN备份与恢复操作的性能(一)
- Oracle10g数据库备份与恢复总结6--Oracle备份与恢复之数据库闪回技术
- oracle技术之一次RMAN备份报错的诊断过程(五)
- oracle 学习 热备份 冷备份
- 神华包神铁路Oracle goldengate备份容灾软件等技术服务招标
- Oracle技术之调整RMAN备份与恢复操作的性能(二)
- ORACLE 数据库备份技术
- 机房搬迁项目中oracle一致性备份步骤(一切为了恢复)
- ORACLE 数据库备份技术
- [置顶] [实验-视频过程]简单有用的备份-oracle 物理冷备份操作
- oracle技术之Rman备份恢复命令
- 探索ORACLE之RMAN_03一致性备份