1. 将oracle 安装文件 tar个 包
这一步主要使数据库到 nomount 状态,口令文件,spfile.ora 等
2. restore controlfile from '/u01/oracle/cf_c-2783238366-20070716-00';
3. rman target /
rman>startup mount;
4. restore database;
5. 恢复数据库
recover database
6. 以 resetlogs 打开数据库 。
rman > alter database open resetlogs;[@more@]
这个是全库备份的备份集
$ ls -lt
total 137292080
-rw-r----- 1 oracle dba 7634944 Jul 16 09:47 cf_c-2783238366-20070716-00
-rw-r--r-- 1 oracle dba 34591170560 Jul 13 18:59 fcard_20070713_5uimmd2t_1_1.bak
-rwxrwxr-x 1 oracle dba 35648847872 Jul 13 18:09 fcard_20070713_5timmd2t_1_1.bak
-rwxrwxr-x 1 oracle dba 7634944 Jul 13 17:18 cf_c-2783238366-20070713-00
-rwxrwxr-x 1 oracle dba 3881984 Jul 13 17:18 arc_20070713_5vimme27_1_1.bak
这个数据rman 的配置
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/oracle/rman/cf_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/export/home/oracle/product/10.2.0/dbs/snapcf_fcard.f'; # default
1. 将oracle 安装文件 tar个 包
这一步主要使数据库到 nomount 状态,口令文件,spfile.ora 等
2. restore controlfile from '/u01/oracle/cf_c-2783238366-20070716-00';
这一步主要是恢复数据文件 ,使数据库到达 mount 状态
3. rman target /
rman>startup mount;
4. restore database;
$ more rmanhf.sh
#!/bin/sh
. /export/home/oracle/.profile
echo "-----------------------------start-----------------------------";
date
$ORACLE_HOME/bin/rman
run
{
restore database;
}
quit;
EOF
echo "------------------------------end------------------------------";date
$
监视 rman
SELECT sid, serial#, context, sofar, totalwork,
round(sofar/totalwork*100,2) "% Complete"
FROM V$SESSION_LONGOPS
WHERE opname LIKE 'RMAN:%'
AND opname NOT LIKE 'RMAN: aggregate%'
AND totalwork != 0
SQL> /
SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete
---------- ---------- ---------- ---------- ---------- ----------
155 1 1 3048629 5346304 57.02
156 14 1 3245506 5492736 59.09
把全库备份以来的所有的归档日志都 copy 到这个机器上的相关目录下
5. 恢复数据库
rman>recover database
6. 以 resetlogs 打开数据库 。
rman > alter database open resetlogs;
到这里 , 克隆一个完整的数据库已经完成
===============================================
restore database tag=tag_number;
restore controlfile from ' snap' --------- 用这个也做个。