手工冷备份

1、冷备一定先正常关库。

cp就可以。

查看控制文件:

SQL> select name from v$controlfile order by 1;

NAME
--------------------------------------------
/u01/app/oracle/oradata/PROD/disk1/control01.ctl
/u01/app/oracle/oradata/PROD/disk2/control01.ctl
/u01/app/oracle/oradata/PROD/disk3/control01.ctl

查看数据文件:

SQL> select file#,name from v$datafile order by 1;

     FILE# NAME
---------- --------------------------------------------------
         1 /u01/app/oracle/oradata/PROD/disk3/system01.dbf
         2 /u01/app/oracle/oradata/PROD/goldengate01.dbf
         3 /u01/app/oracle/oradata/PROD/disk4/sysaux01.dbf
         4 /u01/app/oracle/oradata/PROD/tools01.dbf
         5 /u01/app/oracle/oradata/PROD/exec.dbf
         6 /u01/app/oracle/oradata/PROD/disk3/gguser.dbf
         7 /u01/app/oracle/oradata/PROD/qianyi.dbf
         8 /u01/app/oracle/oradata/PROD/disk3/undotbs02.dbf

 

2、手工冷备份脚本 

1)准备工作,创建目录

[oracle@gc1 ~]$ mkdir prod_bak                      --创建目录

[oracle@gc1 ~]$ cd prod_bak

[oracle@gc1 prod_bak]$ pwd                               --查看路径

/home/oracle/prod_bak

[oracle@gc1 prod_bak]$ mkdir cold_bak hot_bak

[oracle@gc1 prod_bak]$ ls

cold_bak  hot_bak

(2)编写脚本

[oracle@gc1 prod_bak]$ vi cold_bak.sql                              --注意空格cp 的格式

set echo off trimspool off heading off feedback off verify off time off

set pagesize 0 linesize 200

define bakdir='/home/oracle/prod_bak/cold_bak'

define bakscp='/home/oracle/prod_bak/cold_cmd.sql'

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

shutdown immediate

@&bakscp

startup

 

(3)跑脚本

SQL> @/home/oracle/prod_bak/cold_bak

 

注:手工备份就是物理cp所以备份的数据文件和原文件是一样大的

你可能感兴趣的:(冷备份,手工备份)